diff --git a/bamboo-integration/config-parallel.js b/bamboo-integration/config-parallel.js new file mode 100644 index 0000000..7d5d728 --- /dev/null +++ b/bamboo-integration/config-parallel.js @@ -0,0 +1,15 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + reporters: [ + 'dot', + ['junit', { + outputDir: './testresults/', + outputFileFormat: function (options) { + return `results-${options.cid}.xml`; + } + }] + ], + // ... +}) \ No newline at end of file diff --git a/bamboo-integration/config.js b/bamboo-integration/config.js new file mode 100644 index 0000000..e95d314 --- /dev/null +++ b/bamboo-integration/config.js @@ -0,0 +1,12 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + reporters: [ + 'dot', + ['junit', { + outputDir: './testresults/' + }] + ], + // ... +}) \ No newline at end of file diff --git a/browser/mobile-flags.js b/browser/mobile-flags.js new file mode 100644 index 0000000..ec1673d --- /dev/null +++ b/browser/mobile-flags.js @@ -0,0 +1,13 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: { + platformName: 'iOS', + app: 'net.company.SafariLauncher', + udid: '123123123123abc', + deviceName: 'iPhone', + // ... + } + // ... +}) \ No newline at end of file diff --git a/browserstack/config.js b/browserstack/config.js new file mode 100644 index 0000000..e2598b4 --- /dev/null +++ b/browserstack/config.js @@ -0,0 +1,29 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + //... + user: '' || process.env.BROWSERSTACK_USERNAME, + key: '' || process.env.BROWSERSTACK_ACCESS_KEY, + commonCapabilities: { + 'bstack:options': { + projectName: "Your static project name goes here", + buildName: "Your static build/job name goes here" + } + }, + services: [ + ['browserstack', { + accessibility: true, + // Optional configuration options + accessibilityOptions: { + 'wcagVersion': 'wcag21a', + 'includeIssueType': { + 'bestPractice': false, + 'needsReview': true + }, + 'includeTagsInTestingScope': ['Specify tags of test cases to be included'], + 'excludeTagsInTestingScope': ['Specify tags of test cases to be excluded'] + }, + }] + ], + //... +}); \ No newline at end of file diff --git a/capabilities/config.js b/capabilities/config.js new file mode 100644 index 0000000..f9c22ec --- /dev/null +++ b/capabilities/config.js @@ -0,0 +1,11 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: [{ + browserName: 'chrome', + 'custom:caps': { + // custom configurations + } + }] +}) \ No newline at end of file diff --git a/cloud-services/config-env-variables.js b/cloud-services/config-env-variables.js new file mode 100644 index 0000000..7c0e54f --- /dev/null +++ b/cloud-services/config-env-variables.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... +}) + +if (process.env.CI) { + config.user = process.env.SAUCE_USERNAME + config.key = process.env.SAUCE_ACCESS_KEY +} \ No newline at end of file diff --git a/cloud-services/config-perfecto.js b/cloud-services/config-perfecto.js new file mode 100644 index 0000000..944781c --- /dev/null +++ b/cloud-services/config-perfecto.js @@ -0,0 +1,13 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + hostname: "your_cloud_name.perfectomobile.com", + path: "/nexperience/perfectomobile/wd/hub", + port: 443, + protocol: "https", + // ... + capabilities: [{ + // ... + securityToken: "your security token" + }], +}) \ No newline at end of file diff --git a/component-testing/config-selenium-grid.js b/component-testing/config-selenium-grid.js new file mode 100644 index 0000000..c49aaac --- /dev/null +++ b/component-testing/config-selenium-grid.js @@ -0,0 +1,8 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + runner: ['browser', { + // network IP of the machine that runs the WebdriverIO process + host: 'http://172.168.0.2' + }] +}) \ No newline at end of file diff --git a/component-testing/config.js b/component-testing/config.js new file mode 100644 index 0000000..991fd6f --- /dev/null +++ b/component-testing/config.js @@ -0,0 +1,11 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + mochaOpts: { + ui: 'tdd', + // provide a setup script to run in the browser + require: './__fixtures__/setup.js' + }, + // ... +}) \ No newline at end of file diff --git a/configuration-file/config.js b/configuration-file/config.js new file mode 100644 index 0000000..9357eb0 --- /dev/null +++ b/configuration-file/config.js @@ -0,0 +1,30 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + runner: 'local', + specs: [ + 'test/spec/**', + ['group/spec/**'] + ], + maxInstances: 10, + capabilities: [ + { + browserName: 'chrome', + }, + { + browserName: 'firefox', + } + ], + logLevel: 'info', + outputDir: './logs', + baseUrl: 'http://localhost:8080', + waitforTimeout: 30000, + framework: 'mocha', + reporters: [ + 'dot', + 'allure' + ], + mochaOpts: { + ui: 'bdd' + }, +}) \ No newline at end of file diff --git a/configuration/config-headers.js b/configuration/config-headers.js new file mode 100644 index 0000000..604b381 --- /dev/null +++ b/configuration/config-headers.js @@ -0,0 +1,19 @@ +import { Buffer } from 'buffer'; +import { defineConfig } from '@wdio/config' + +// Read the username and password from environment variables +const username = process.env.SELENIUM_GRID_USERNAME; +const password = process.env.SELENIUM_GRID_PASSWORD; + +// Combine the username and password with a colon separator +const credentials = `${username}:${password}`; +// Encode the credentials using Base64 +const encodedCredentials = Buffer.from(credentials).toString('base64'); + +export const config = defineConfig({ + // ... + headers: { + Authorization: `Basic ${encodedCredentials}` + } + // ... +}) \ No newline at end of file diff --git a/configuration/config-resolve-snapshot-path.js b/configuration/config-resolve-snapshot-path.js new file mode 100644 index 0000000..5fd453a --- /dev/null +++ b/configuration/config-resolve-snapshot-path.js @@ -0,0 +1,5 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + resolveSnapshotPath: (testPath, snapExtension) => testPath + snapExtension, +}) \ No newline at end of file diff --git a/custom-reporter/config-npm.js b/custom-reporter/config-npm.js new file mode 100644 index 0000000..558baf2 --- /dev/null +++ b/custom-reporter/config-npm.js @@ -0,0 +1,7 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + reporter: ['custom'], + // ... +}) \ No newline at end of file diff --git a/custom-reporter/config.js b/custom-reporter/config.js new file mode 100644 index 0000000..34fc1e7 --- /dev/null +++ b/custom-reporter/config.js @@ -0,0 +1,21 @@ +import { defineConfig } from '@wdio/config' +import CustomReporter from './reporter/my.custom.reporter' + +export const config = defineConfig({ + // ... + reporters: [ + /** + * use imported reporter class + */ + [CustomReporter, { + someOption: 'foobar' + }], + /** + * use absolute path to reporter + */ + ['/path/to/reporter.js', { + someOption: 'foobar' + }] + ], + // ... +}) \ No newline at end of file diff --git a/custom-service/config-npm.js b/custom-service/config-npm.js new file mode 100644 index 0000000..08df2d5 --- /dev/null +++ b/custom-service/config-npm.js @@ -0,0 +1,7 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + services: ['custom'], + // ... +}) \ No newline at end of file diff --git a/custom-service/config.js b/custom-service/config.js new file mode 100644 index 0000000..2b61d4e --- /dev/null +++ b/custom-service/config.js @@ -0,0 +1,21 @@ +import { defineConfig } from '@wdio/config' +import CustomService from './service/my.custom.service' + +export const config = defineConfig({ + // ... + services: [ + /** + * use imported service class + */ + [CustomService, { + someOption: true + }], + /** + * use absolute path to service + */ + ['/path/to/service.js', { + someOption: true + }] + ], + // ... +}) \ No newline at end of file diff --git a/debugging/config-dynamic.js b/debugging/config-dynamic.js new file mode 100644 index 0000000..fd0f220 --- /dev/null +++ b/debugging/config-dynamic.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +const debug = process.env.DEBUG +const defaultCapabilities = ... +const defaultTimeoutInterval = ... +const defaultSpecs = ... + +export const config = defineConfig({ + // ... + maxInstances: debug ? 1 : 100, + capabilities: debug ? [{ browserName: 'chrome' }] : defaultCapabilities, + execArgv: debug ? ['--inspect'] : [], + jasmineOpts: { + defaultTimeoutInterval: debug ? (24 * 60 * 60 * 1000) : defaultTimeoutInterval + } + // ... +}) \ No newline at end of file diff --git a/debugging/config.js b/debugging/config.js new file mode 100644 index 0000000..02186ee --- /dev/null +++ b/debugging/config.js @@ -0,0 +1,13 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + maxInstances: 1, + specs: [ + '**/myspec.spec.js' + ], + capabilities: [{ + browserName: 'firefox' + }], + // ... +}) \ No newline at end of file diff --git a/docker/config.js b/docker/config.js new file mode 100644 index 0000000..3e83b11 --- /dev/null +++ b/docker/config.js @@ -0,0 +1,19 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: [{ + maxInstances: 1, + browserName: 'chrome', + 'goog:chromeOptions': { + args: [ + '--no-sandbox', + '--disable-infobars', + '--headless', + '--disable-gpu', + '--window-size=1440,735' + ], + } + }], + // ... +}) \ No newline at end of file diff --git a/electron/config.js b/electron/config.js new file mode 100644 index 0000000..cb80c8f --- /dev/null +++ b/electron/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + services: [['electron', { + appEntryPoint: './path/to/bundled/electron/main.bundle.js', + appArgs: [/** ... */], + }]] +}) \ No newline at end of file diff --git a/frameworks/publish-report.js b/frameworks/publish-report.js new file mode 100644 index 0000000..ac9e70b --- /dev/null +++ b/frameworks/publish-report.js @@ -0,0 +1,17 @@ +import { v4 as uuidv4 } from 'uuid' +import { defineConfig } from '@wdio/config' +import { publishCucumberReport } from '@wdio/cucumber-framework'; + +export const config = defineConfig({ + // ... Other Configuration Options + cucumberOpts: { + // ... Cucumber Options Configuration + format: [ + ['message', `./reports/${uuidv4()}.ndjson`], + ['json', './reports/test-report.json'] + ] + }, + async onComplete() { + await publishCucumberReport('./reports'); + } +}) \ No newline at end of file diff --git a/frameworks/serenity.js b/frameworks/serenity.js new file mode 100644 index 0000000..e69de29 diff --git a/getting-started/ocr.js b/getting-started/ocr.js new file mode 100644 index 0000000..f8cc1c8 --- /dev/null +++ b/getting-started/ocr.js @@ -0,0 +1,16 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + //... + services: [ + // your other services + [ + "ocr", + { + contrast: 0.25, + imagesFolder: ".tmp/", + language: "eng", + }, + ], + ], +}); \ No newline at end of file diff --git a/getting-started/run-in-script.js b/getting-started/run-in-script.js index 5f5a00c..3ddaf73 100644 --- a/getting-started/run-in-script.js +++ b/getting-started/run-in-script.js @@ -1,7 +1,8 @@ import fs from 'node:fs' import { remote } from 'webdriverio' +import { defineConfig } from '@wdio/config' -const browser = await remote({ +const config = defineConfig({ capabilities: { browserName: 'chrome', 'goog:chromeOptions': { @@ -9,6 +10,7 @@ const browser = await remote({ } } }) +const browser = await remote(config) await browser.url('https://webdriver.io') const apiLink = await browser.$('=API') diff --git a/multiremote/config-cloud-service.js b/multiremote/config-cloud-service.js new file mode 100644 index 0000000..d0eca46 --- /dev/null +++ b/multiremote/config-cloud-service.js @@ -0,0 +1,26 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + user: process.env.BROWSERSTACK_USERNAME, + key: process.env.BROWSERSTACK_ACCESS_KEY, + capabilities: { + myChromeBrowser: { + capabilities: { + browserName: 'chrome' + } + }, + myBrowserStackFirefoxBrowser: { + capabilities: { + browserName: 'firefox', + 'bstack:options': { + // ... + } + } + } + }, + services: [ + ['browserstack', 'selenium-standalone'] + ], + // ... +}) \ No newline at end of file diff --git a/multiremote/config-parallel.js b/multiremote/config-parallel.js new file mode 100644 index 0000000..3cdd4cf --- /dev/null +++ b/multiremote/config-parallel.js @@ -0,0 +1,29 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: [{ + myChromeBrowser0: { + capabilities: { + browserName: 'chrome' + } + }, + myFirefoxBrowser0: { + capabilities: { + browserName: 'firefox' + } + } + }, { + myChromeBrowser1: { + capabilities: { + browserName: 'chrome' + } + }, + myFirefoxBrowser1: { + capabilities: { + browserName: 'firefox' + } + } + }] + // ... +}) \ No newline at end of file diff --git a/multiremote/config.js b/multiremote/config.js new file mode 100644 index 0000000..68cbecd --- /dev/null +++ b/multiremote/config.js @@ -0,0 +1,18 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: { + myChromeBrowser: { + capabilities: { + browserName: 'chrome' + } + }, + myFirefoxBrowser: { + capabilities: { + browserName: 'firefox' + } + } + } + // ... +}) \ No newline at end of file diff --git a/multiremote/extend-typescript-types.js b/multiremote/extend-typescript-types.js new file mode 100644 index 0000000..39e631f --- /dev/null +++ b/multiremote/extend-typescript-types.js @@ -0,0 +1,14 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: { + myAppiumDriver: { + // ... + }, + myChromeDriver: { + // ... + } + } + // ... +}) \ No newline at end of file diff --git a/organizing-test-suites/config.js b/organizing-test-suites/config.js new file mode 100644 index 0000000..aa50b84 --- /dev/null +++ b/organizing-test-suites/config.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + // set maxInstance for all browser + maxInstances: 10, + // ... + capabilities: [{ + browserName: 'firefox' + }, { + // maxInstances can get overwritten per capability. So if you have an in-house WebDriver + // grid with only 5 firefox instance available you can make sure that not more than + // 5 instance gets started at a time. + browserName: 'chrome' + }], + // ... +}) \ No newline at end of file diff --git a/organizing-test-suites/further-grouping.js b/organizing-test-suites/further-grouping.js new file mode 100644 index 0000000..cb237ee --- /dev/null +++ b/organizing-test-suites/further-grouping.js @@ -0,0 +1,23 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + "specs": [ + "tests/general/**/*.js" + ], + "capabilities": [ + { + platformName: "Android", + specs: ["tests/android/**/*.js"], + //... + }, + { + platformName: "iOS", + specs: ["tests/ios/**/*.js"], + //... + }, + { + platformName: "Chrome", + //config level specs will be used + } + ] +}) \ No newline at end of file diff --git a/organizing-test-suites/grouping-test-specs-in-suites.js b/organizing-test-suites/grouping-test-specs-in-suites.js new file mode 100644 index 0000000..1bc54d9 --- /dev/null +++ b/organizing-test-suites/grouping-test-specs-in-suites.js @@ -0,0 +1,18 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // define all tests + specs: ['./test/specs/**/*.spec.js'], + // ... + // define specific suites + suites: { + login: [ + './test/specs/login.success.spec.js', + './test/specs/login.failure.spec.js' + ], + otherFeature: [ + // ... + ] + }, + // ... +}) \ No newline at end of file diff --git a/parameterize/config.js b/parameterize/config.js new file mode 100644 index 0000000..fa8706c --- /dev/null +++ b/parameterize/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + baseURL: process.env.STAGING === '1' + ? 'http://staging.example.test/' + : 'http://example.test/', + // ... +}) \ No newline at end of file diff --git a/preact/config.js b/preact/config.js new file mode 100644 index 0000000..d5462e0 --- /dev/null +++ b/preact/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'preact' + }], + // ... +}) \ No newline at end of file diff --git a/proxy/proxy-between-browser-and-internet.js b/proxy/proxy-between-browser-and-internet.js new file mode 100644 index 0000000..3fe100b --- /dev/null +++ b/proxy/proxy-between-browser-and-internet.js @@ -0,0 +1,18 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: [{ + browserName: 'chrome', + // ... + proxy: { + proxyType: "manual", + httpProxy: "corporate.proxy:8080", + socksUsername: "codeceptjs", + socksPassword: "secret", + noProxy: "127.0.0.1,localhost" + }, + // ... + }], + // ... +}) \ No newline at end of file diff --git a/proxy/proxy-between-driver-and-test.js b/proxy/proxy-between-driver-and-test.js new file mode 100644 index 0000000..35550b3 --- /dev/null +++ b/proxy/proxy-between-driver-and-test.js @@ -0,0 +1,9 @@ +import { setGlobalDispatcher, ProxyAgent } from 'undici'; +import { defineConfig } from '@wdio/config' + +const dispatcher = new ProxyAgent({ uri: new URL(process.env.https_proxy).toString() }); +setGlobalDispatcher(dispatcher); + +export const config = defineConfig({ + // ... +}) \ No newline at end of file diff --git a/react/config.js b/react/config.js new file mode 100644 index 0000000..b00776b --- /dev/null +++ b/react/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'react' + }], + // ... +}) \ No newline at end of file diff --git a/repl/config-multiremote.js b/repl/config-multiremote.js new file mode 100644 index 0000000..4792704 --- /dev/null +++ b/repl/config-multiremote.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: { + myChromeBrowser: { + capabilities: { + browserName: 'chrome' + } + }, + myFirefoxBrowser: { + capabilities: { + browserName: 'firefox' + } + } + } +}) \ No newline at end of file diff --git a/repl/config.js b/repl/config.js new file mode 100644 index 0000000..3d7fccd --- /dev/null +++ b/repl/config.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities:[{ + browserName: 'chrome', // options: `chrome`, `edge`, `firefox`, `safari`, `chromium` + browserVersion: '27.0', // browser version + platformName: 'Windows 10' // OS platform + }] +}) \ No newline at end of file diff --git a/retry/config-retry-per-specfile.js b/retry/config-retry-per-specfile.js new file mode 100644 index 0000000..594c0f9 --- /dev/null +++ b/retry/config-retry-per-specfile.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + /** + * The number of times to retry the entire specfile when it fails as a whole + */ + specFileRetries: 1, + /** + * Delay in seconds between the spec file retry attempts + */ + specFileRetriesDelay: 0, + /** + * Retried specfiles are inserted at the beginning of the queue and retried immediately + */ + specFileRetriesDeferred: false +}) \ No newline at end of file diff --git a/selenium-grid/file-downloads.js b/selenium-grid/file-downloads.js new file mode 100644 index 0000000..df2f658 --- /dev/null +++ b/selenium-grid/file-downloads.js @@ -0,0 +1,12 @@ +export const config = defineConfig({ + // ... + protocol: 'https', + hostname: 'yourseleniumgridhost.yourdomain.com', + port: 443, + path: '/wd/hub', + capabilities: [{ + browserName: 'chrome', + 'se:downloadsEnabled': true + }], + //... +}) \ No newline at end of file diff --git a/selenium-grid/local-grid.js b/selenium-grid/local-grid.js new file mode 100644 index 0000000..f85d27b --- /dev/null +++ b/selenium-grid/local-grid.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + protocol: 'http', + hostname: 'localhost', + port: 4444, + path: '/wd/hub', + // ... +}) \ No newline at end of file diff --git a/selenium-grid/remote-grid.js b/selenium-grid/remote-grid.js new file mode 100644 index 0000000..87af854 --- /dev/null +++ b/selenium-grid/remote-grid.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + protocol: 'https', + hostname: 'yourseleniumgridhost.yourdomain.com', + port: 443, + path: '/wd/hub', + // ... +}) \ No newline at end of file diff --git a/service-options/config.js b/service-options/config.js new file mode 100644 index 0000000..6036a21 --- /dev/null +++ b/service-options/config.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + // ===== + // Setup + // ===== + services: [ + [ + "visual", + { + // The options + }, + ], + ], + // ... +}); \ No newline at end of file diff --git a/solid/config.js b/solid/config.js new file mode 100644 index 0000000..25ac134 --- /dev/null +++ b/solid/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'solid' + }], + // ... +}) \ No newline at end of file diff --git a/stencil/config.js b/stencil/config.js new file mode 100644 index 0000000..847b38a --- /dev/null +++ b/stencil/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'stencil' + }], + // ... +}) \ No newline at end of file diff --git a/svelte/config.js b/svelte/config.js new file mode 100644 index 0000000..f7be35b --- /dev/null +++ b/svelte/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'svelte' + }], + // ... +}) \ No newline at end of file diff --git a/test-output/enable-layout-testing.js b/test-output/enable-layout-testing.js new file mode 100644 index 0000000..fc1c566 --- /dev/null +++ b/test-output/enable-layout-testing.js @@ -0,0 +1,17 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + // ===== + // Setup + // ===== + services: [ + [ + 'visual', + { + enableLayoutTesting: true + } + ] + ] + // ... +}) \ No newline at end of file diff --git a/timeouts/cucumber.js b/timeouts/cucumber.js new file mode 100644 index 0000000..a32475a --- /dev/null +++ b/timeouts/cucumber.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + framework: 'cucumber', + cucumberOpts: { + timeout: 20000 + }, + // ... +}) \ No newline at end of file diff --git a/timeouts/jasmine.js b/timeouts/jasmine.js new file mode 100644 index 0000000..a8fd6ff --- /dev/null +++ b/timeouts/jasmine.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + framework: 'jasmine', + jasmineOpts: { + defaultTimeoutInterval: 20000 + }, + // ... +}) \ No newline at end of file diff --git a/timeouts/mocha.js b/timeouts/mocha.js new file mode 100644 index 0000000..e91f9c5 --- /dev/null +++ b/timeouts/mocha.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + framework: 'mocha', + mochaOpts: { + timeout: 20000 + }, + // ... +}) \ No newline at end of file diff --git a/timeouts/waitforTimeout.js b/timeouts/waitforTimeout.js new file mode 100644 index 0000000..09ea2e3 --- /dev/null +++ b/timeouts/waitforTimeout.js @@ -0,0 +1,7 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + waitforTimeout: 5000, + // ... +}) \ No newline at end of file diff --git a/typescript/type-definitions.js b/typescript/type-definitions.js new file mode 100644 index 0000000..02e228f --- /dev/null +++ b/typescript/type-definitions.js @@ -0,0 +1,14 @@ +import { defineConfig } from '@wdio/config' + +const remoteConfig = defineConfig({ + hostname: 'http://localhost', + port: '4444', // Error: Type 'string' is not assignable to type 'number'.ts(2322) + capabilities: { + browserName: 'chrome' + } +}) + +export const config = defineConfig({ + ...remoteConfig + // Other configs options +}) \ No newline at end of file diff --git a/visual-reporter/config.js b/visual-reporter/config.js new file mode 100644 index 0000000..566c533 --- /dev/null +++ b/visual-reporter/config.js @@ -0,0 +1,13 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + services: [ + [ + "visual", + { + createJsonReportFiles: true, // Generates the output.json file + }, + ], + ], +}); \ No newline at end of file diff --git a/visual-testing/capabilities.js b/visual-testing/capabilities.js new file mode 100644 index 0000000..482e767 --- /dev/null +++ b/visual-testing/capabilities.js @@ -0,0 +1,34 @@ +import path from "node:path"; +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + capabilities: [ + { + browserName: 'chrome', + 'wdio-ics:options': { + logName: 'chrome-mac-15', // Custom log name for Chrome + }, + }, + { + browserName: 'firefox', + 'wdio-ics:options': { + logName: 'firefox-mac-15', // Custom log name for Firefox + }, + } + ], + services: [ + [ + "visual", + { + // Some options, see the docs for more + baselineFolder: path.join(process.cwd(), "tests", "baseline"), + screenshotPath: path.join(process.cwd(), "tmp"), + // The format below will use the `logName` from capabilities + formatImageName: "{tag}-{logName}-{width}x{height}", + // ... more options + }, + ], + ], + // ... +}); \ No newline at end of file diff --git a/visual-testing/config.js b/visual-testing/config.js new file mode 100644 index 0000000..0be6688 --- /dev/null +++ b/visual-testing/config.js @@ -0,0 +1,21 @@ +import path from "node:path"; + +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + services: [ + [ + "visual", + { + // Some options, see the docs for more + baselineFolder: path.join(process.cwd(), "tests", "baseline"), + formatImageName: "{tag}-{logName}-{width}x{height}", + screenshotPath: path.join(process.cwd(), "tmp"), + savePerInstance: true, + // ... more options + }, + ], + ], + // ... +}); \ No newline at end of file diff --git a/visual-testing/multiremote.js b/visual-testing/multiremote.js new file mode 100644 index 0000000..cf04ce9 --- /dev/null +++ b/visual-testing/multiremote.js @@ -0,0 +1,30 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + capabilities: { + chromeBrowserOne: { + capabilities: { + browserName: "chrome", + "goog:chromeOptions": { + args: ["disable-infobars"], + }, + // THIS!!! + "wdio-ics:options": { + logName: "chrome-latest-one", + }, + }, + }, + chromeBrowserTwo: { + capabilities: { + browserName: "chrome", + "goog:chromeOptions": { + args: ["disable-infobars"], + }, + // THIS!!! + "wdio-ics:options": { + logName: "chrome-latest-two", + }, + }, + }, + }, +}); \ No newline at end of file diff --git a/visual-testing/type-safety.ts b/visual-testing/type-safety.ts new file mode 100644 index 0000000..6986359 --- /dev/null +++ b/visual-testing/type-safety.ts @@ -0,0 +1,18 @@ +import { join } from 'node:path'; +import type { VisualServiceOptions } from '@wdio/visual-service'; + +export const config = defineConfig({ + // ... + services: [ + [ + "visual", + { + // Service options + baselineFolder: join(process.cwd(), './__snapshots__/'), + formatImageName: '{tag}-{logName}-{width}x{height}', + screenshotPath: join(process.cwd(), '.tmp/'), + } satisfies VisualServiceOptions, // Ensures type safety + ], + ], + // ... +}); \ No newline at end of file diff --git a/vs-code-extension/chrome.js b/vs-code-extension/chrome.js new file mode 100644 index 0000000..13da323 --- /dev/null +++ b/vs-code-extension/chrome.js @@ -0,0 +1,14 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + outputDir: 'trace', + // ... + capabilities: [{ + browserName: 'chrome', + 'wdio:vscodeOptions': { + extensionPath: __dirname + } + }], + services: ['vscode'], + // ... +}); \ No newline at end of file diff --git a/vs-code-extension/electron.js b/vs-code-extension/electron.js new file mode 100644 index 0000000..fc4f77e --- /dev/null +++ b/vs-code-extension/electron.js @@ -0,0 +1,23 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + outputDir: 'trace', + // ... + capabilities: [{ + browserName: 'vscode', + browserVersion: '1.71.0', // "insiders" or "stable" for latest VSCode version + 'wdio:vscodeOptions': { + extensionPath: __dirname, + userSettings: { + "editor.fontSize": 14 + } + } + }], + services: ['vscode'], + /** + * optionally you can define the path WebdriverIO stores all + * VSCode and Chromedriver binaries, e.g.: + * services: [['vscode', { cachePath: __dirname }]] + */ + // ... +}); \ No newline at end of file diff --git a/vue/config.js b/vue/config.js new file mode 100644 index 0000000..b781e38 --- /dev/null +++ b/vue/config.js @@ -0,0 +1,9 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + runner: ['browser', { + preset: 'vue' + }], + // ... +}) \ No newline at end of file diff --git a/watch-files/config.js b/watch-files/config.js new file mode 100644 index 0000000..c530f1c --- /dev/null +++ b/watch-files/config.js @@ -0,0 +1,10 @@ +import { defineConfig } from '@wdio/config' + +export const config = defineConfig({ + // ... + filesToWatch: [ + // watch for all JS files in my app + './src/app/**/*.js' + ], + // ... +}) \ No newline at end of file diff --git a/web-extension/chrome.js b/web-extension/chrome.js new file mode 100644 index 0000000..b0e8bd5 --- /dev/null +++ b/web-extension/chrome.js @@ -0,0 +1,17 @@ +import path from 'node:path' +import url from 'node:url' +import { defineConfig } from '@wdio/config' + +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + +export const config = defineConfig({ + // ... + capabilities: [{ + browserName, + 'goog:chromeOptions': { + // given your wdio.conf.js is in the root directory and your compiled + // web extension files are located in the `./dist` folder + args: [`--load-extension=${path.join(__dirname, '..', '..', 'dist')}`] + } + }] +} \ No newline at end of file diff --git a/web-extension/crx.js b/web-extension/crx.js new file mode 100644 index 0000000..1e7d12d --- /dev/null +++ b/web-extension/crx.js @@ -0,0 +1,17 @@ +import path from 'node:path' +import url from 'node:url' +import { defineConfig } from '@wdio/config' + +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) +const extPath = path.join(__dirname, `web-extension-chrome.crx`) +const chromeExtension = (await fs.readFile(extPath)).toString('base64') + +export const config = defineConfig({ + // ... + capabilities: [{ + browserName, + 'goog:chromeOptions': { + extensions: [chromeExtension] + } + }] +} \ No newline at end of file diff --git a/web-extension/firefox.js b/web-extension/firefox.js new file mode 100644 index 0000000..c2a7d4f --- /dev/null +++ b/web-extension/firefox.js @@ -0,0 +1,17 @@ +import path from 'node:path' +import url from 'node:url' +import { defineConfig } from '@wdio/config' + +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) +const extensionPath = path.resolve(__dirname, `web-extension.xpi`) + +export const config = defineConfig({ + // ... + before: async (capabilities) => { + const browserName = (capabilities as WebdriverIO.Capabilities).browserName + if (browserName === 'firefox') { + const extension = await fs.readFile(extensionPath) + await browser.installAddOn(extension.toString('base64'), true) + } + } +} \ No newline at end of file diff --git a/web-extension/popup-modal.js b/web-extension/popup-modal.js new file mode 100644 index 0000000..11cb532 --- /dev/null +++ b/web-extension/popup-modal.js @@ -0,0 +1,11 @@ +import { browser } from '@wdio/globals' +import { defineConfig } from '@wdio/config' + +import { openExtensionPopup } from './support/customCommands' + +export const config = defineConfig({ + // ... + before: () => { + browser.addCommand('openExtensionPopup', openExtensionPopup) + } +}) \ No newline at end of file