Skip to content

Commit

Permalink
Browser testing via saucelabs on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tompahoward committed Oct 29, 2020
1 parent 276f224 commit b24f02c
Show file tree
Hide file tree
Showing 16 changed files with 810 additions and 76 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
- run: npm run lint
- run: npm run build
- run: npm run cover
env:
SAUCE_LABS_KEY: ${{secrets.SAUCE_LABS_KEY}}
SAUCE_LABS_USERNAME: ${{secrets.SAUCE_LABS_USERNAME}}

# removed artifact upload because the server is flakey
# - name: Archive code coverage results
# uses: actions/upload-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exclude:
- 'scripts/**/*.js'
- 'coverage/**/*.js'
- 'src/test/clients/waychaser-via-webdriver-firefox.js'
- 'src/test/clients/waychaser-via-webdriver-saucy.js'
check-coverage: false

reporter:
Expand Down
17 changes: 17 additions & 0 deletions .nycrc-browser-api-chrome-saucy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends: '@istanbuljs/nyc-config-babel'
all: true
skip-full: false
exclude:
- 'lib/**/*.js'
- 'dist/**/*.js'
- 'scripts/**/*.js'
- 'coverage/**/*.js'
- 'src/test/clients/waychaser-via-webdriver-firefox.js'
- 'src/test/clients/waychaser-via-webdriver-chrome.js'
- 'src/test/clients/waychaser-via-webdriver-local.js'
check-coverage: false

reporter:
- text-summary
- lcov
- text
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exclude:
- 'scripts/**/*.js'
- 'coverage/**/*.js'
- 'src/test/clients/waychaser-via-webdriver-chrome.js'
- 'src/test/clients/waychaser-via-webdriver-saucy.js'
check-coverage: false

reporter:
Expand Down
17 changes: 17 additions & 0 deletions .nycrc-browser-api-firefox-saucy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends: '@istanbuljs/nyc-config-babel'
all: true
skip-full: false
exclude:
- 'lib/**/*.js'
- 'dist/**/*.js'
- 'scripts/**/*.js'
- 'coverage/**/*.js'
- 'src/test/clients/waychaser-via-webdriver-firefox.js'
- 'src/test/clients/waychaser-via-webdriver-chrome.js'
- 'src/test/clients/waychaser-via-webdriver-local.js'
check-coverage: false

reporter:
- text-summary
- lcov
- text
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ library.load(“https://api-addressr.mountain-pass.com.au”)

- [x] CI/CD pipeline
- [x] dependabot
- [ ] Firefox/Safari/IE testing
- [x] Firefox testing
- [ ] matrix testing for firefox
- [ ] Safari/IE testing
- [ ] badges
- [ ] Code coverage and code quality reporting
- [ ] lots more 😂

Expand Down
25 changes: 21 additions & 4 deletions cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getFeatureGlob(RERUN, profile) {
: `src/test/**/*.feature --tags 'not(@not-${profile})'`;
}

function generateConfig(profile) {
function generateConfig(profile, client, browser, platform) {
const resultsDirectory = `${outputDirectory}/${profile}`;
fs.mkdirSync(resultsDirectory, { recursive: true });

Expand All @@ -33,11 +33,28 @@ function generateConfig(profile) {
FORMAT_OPTIONS
)}' ${MODULES} --require ${REQUIRE_GLOB} ${NO_STRICT} --format rerun:${RERUN} --format json:${resultsDirectory}/results.cucumber -f node_modules/cucumber-junit-formatter:${resultsDirectory}/results.xml ${FAIL_FAST}`;

return `${BASE_CONFIG} --world-parameters '${JSON.stringify({ profile })}'`;
return `${BASE_CONFIG} --world-parameters '${JSON.stringify({
profile,
client: client || profile,
browser,
platform,
})}'`;
}

module.exports = {
'node-api': generateConfig('node-api'),
'browser-api-chrome': generateConfig('browser-api-chrome'),
'browser-api-firefox': generateConfig('browser-api-firefox'),
'browser-api-chrome-local': generateConfig('browser-api-chrome-local'),
'browser-api-chrome-saucy': generateConfig(
'browser-api-chrome-saucy',
'browser-api-saucy',
'chrome',
'Windows 10'
),
'browser-api-firefox-local': generateConfig('browser-api-firefox-local'),
'browser-api-firefox-saucy': generateConfig(
'browser-api-firefox-saucy',
'browser-api-saucy',
'firefox',
'Windows 10'
),
};
Loading

0 comments on commit b24f02c

Please sign in to comment.