-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update wdio deps linting of code * feat: Simplify setup for new examples * fix: fix config * feat: create separate configs - cleanup code a bit * chore: some fixes - remove wdio - fix window size - update readme with EU DC
- Loading branch information
1 parent
ad67820
commit 9a50cbc
Showing
8 changed files
with
185 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Options } from '@wdio/types'; | ||
import { config as sauceSharedConfig } from './wdio.saucelabs.shared.conf.ts'; | ||
|
||
const buildName = `Sauce Demo Test - ${new Date().getTime()}`; | ||
|
||
export const config: Options.Testrunner = { | ||
...sauceSharedConfig, | ||
// | ||
// ============ | ||
// Capabilities | ||
// ============ | ||
capabilities: [ | ||
{ | ||
browserName: 'chrome', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 11', | ||
'sauce:options': { | ||
screenResolution: '2560x1600', | ||
build: buildName, | ||
}, | ||
}, | ||
{ | ||
browserName: 'firefox', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 11', | ||
'sauce:options': { | ||
screenResolution: '2560x1600', | ||
build: buildName, | ||
}, | ||
}, | ||
{ | ||
browserName: 'microsoftedge', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 11', | ||
'sauce:options': { | ||
screenResolution: '2560x1600', | ||
build: buildName, | ||
}, | ||
}, | ||
{ | ||
browserName: 'safari', | ||
browserVersion: 'latest', | ||
platformName: 'macOS 13', | ||
'sauce:options': { | ||
screenResolution: '2048x1536', | ||
build: buildName, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import type { Options } from '@wdio/types'; | ||
import { browser } from '@wdio/globals'; | ||
import { SauceVisualService } from '@saucelabs/wdio-sauce-visual-service'; | ||
import { config as sharedConfig } from './wdio.shared.conf.ts'; | ||
import { getSauceCredentials } from '../helpers.ts'; | ||
|
||
// | ||
// Get the Sauce Labs credentials | ||
const { sauceUsername, sauceAccessKey } = await getSauceCredentials(); | ||
|
||
export const config: Options.Testrunner = { | ||
...sharedConfig, | ||
// | ||
// ================= | ||
// Service Providers | ||
// ================= | ||
user: sauceUsername, | ||
key: sauceAccessKey, | ||
region: (process.env.REGION || 'us') as Options.SauceRegions, | ||
// | ||
// ============ | ||
// Capabilities | ||
// ============ | ||
// Are not configured here, they can be found in: | ||
// - wdio.saucelabs.desktop.conf.ts | ||
// | ||
// ======== | ||
// Services | ||
// ======== | ||
services: (sharedConfig.services || []).concat([ | ||
// | ||
// This service is needed for WDIO to make sure it can connect to Sauce Labs to: | ||
// - automatically update the names | ||
// - automatically update the status (passed/failed) | ||
// - automatically send the stacktrace in case of a failure | ||
// | ||
'sauce', | ||
// | ||
// This service is needed for the Sauce Visual service to work | ||
// | ||
[ | ||
SauceVisualService, | ||
// The options for the Sauce Visual service | ||
{ | ||
buildName: 'Sauce Demo Test', | ||
branch: 'main', | ||
project: 'WDIO examples', | ||
}, | ||
], | ||
]), | ||
// ===== | ||
// Hooks | ||
// ===== | ||
before: async (_capabilities, _specs) => { | ||
// Set all browsers to the "same" viewport | ||
// @ts-ignore | ||
await browser.setWindowSize(1920, 1080); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'dotenv/config'; | ||
import updateDotenv from 'update-dotenv'; | ||
import readline from 'readline-sync'; | ||
|
||
/** | ||
* Get the Sauce Labs credentials from the environment variables, if not available, | ||
* ask the user to provide them and store them in a .env file. | ||
*/ | ||
export async function getSauceCredentials(): Promise<{ | ||
sauceUsername: string; | ||
sauceAccessKey: string; | ||
}> { | ||
let sauceUsername = process.env.SAUCE_USERNAME; | ||
let sauceAccessKey = process.env.SAUCE_ACCESS_KEY; | ||
|
||
if (!sauceUsername) { | ||
sauceUsername = await readline.question( | ||
'What is your Sauce Labs username? ' | ||
); | ||
await updateDotenv({ | ||
SAUCE_USERNAME: sauceUsername, | ||
}); | ||
console.log('Sauce Labs username is saved in the .env file.'); | ||
} | ||
|
||
if (!sauceAccessKey) { | ||
sauceAccessKey = await readline.question( | ||
'What is your Sauce Labs API key?? ', | ||
{ | ||
hideEchoBack: true, | ||
} | ||
); | ||
await updateDotenv({ | ||
SAUCE_ACCESS_KEY: sauceAccessKey, | ||
}); | ||
console.log('Sauce Labs API key is saved in the .env file.'); | ||
} | ||
|
||
return { sauceUsername, sauceAccessKey }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters