Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add browserstack test environments #100

Merged
merged 9 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ cache: npm

script:
- npm run build:libs
- if [ "$TRAVIS_TAG" == "" ]; then npm run test; fi
- if [ "$TRAVIS_TAG" == "" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then npm run test; fi
- if [ "$TRAVIS_TAG" == "" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then npm run test:pr; fi
- if [ "$TRAVIS_TAG" == "" ]; then npm run lint; fi
- if [ "$TRAVIS_TAG" == "" ]; then npm run sonar; fi
- npm run build:angular-showcase
Expand Down
63 changes: 40 additions & 23 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,17 @@
]
},
"configurations": {
"pr": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless,FirefoxHeadless",
"sourceMap": false,
"preserveSymlinks": false
},
"ci": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless",
"browsers": "ChromeHeadless,FirefoxHeadless,BsChrome,BsFirefox",
"sourceMap": false,
"preserveSymlinks": false
}
Expand Down Expand Up @@ -181,21 +188,19 @@
}
},
"configurations": {
"ci": {
"pr": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless",
"browsers": "ChromeHeadless,FirefoxHeadless",
"sourceMap": false,
"progress": false
},
"local": {
"codeCoverage": true
},
"datepicker": {
"main": "projects/sbb-esta/angular-public/src/lib/datepicker/test.ts"
},
"toggle": {
"main": "projects/sbb-esta/angular-public/src/lib/datepicker/test.ts"
"ci": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless,FirefoxHeadless,BsChrome,BsFirefox",
"sourceMap": false,
"progress": false
}
}
},
Expand Down Expand Up @@ -244,15 +249,19 @@
}
},
"configurations": {
"ci": {
"pr": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless",
"browsers": "ChromeHeadless,FirefoxHeadless",
"sourceMap": false,
"progress": false
},
"local": {
"codeCoverage": true
"ci": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless,FirefoxHeadless,BsChrome,BsFirefox",
"sourceMap": false,
"progress": false
}
}
},
Expand Down Expand Up @@ -296,15 +305,19 @@
"karmaConfig": "projects/sbb-esta/angular-icons/karma.conf.js"
},
"configurations": {
"ci": {
"pr": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless",
"browsers": "ChromeHeadless,FirefoxHeadless",
"sourceMap": false,
"progress": false
},
"local": {
"codeCoverage": true
"ci": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless,FirefoxHeadless,BsChrome,BsFirefox",
"sourceMap": false,
"progress": false
}
}
},
Expand Down Expand Up @@ -349,15 +362,19 @@
"karmaConfig": "projects/sbb-esta/angular-keycloak/karma.conf.js"
},
"configurations": {
"ci": {
"pr": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless",
"browsers": "ChromeHeadless,FirefoxHeadless",
"sourceMap": false,
"progress": false
},
"local": {
"codeCoverage": true
"ci": {
"watch": false,
"codeCoverage": true,
"browsers": "ChromeHeadless,FirefoxHeadless,BsChrome,BsFirefox",
"sourceMap": false,
"progress": false
}
}
},
Expand Down
14 changes: 14 additions & 0 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"BsChrome": {
"base": "BrowserStack",
"os": "Windows",
"os_version": "10",
"browser": "Chrome"
},
"BsFirefox": {
"base": "BrowserStack",
"os": "Windows",
"os_version": "10",
"browser": "Firefox"
}
}
33 changes: 12 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@
"build:angular-showcase:ng": "ng build angular-showcase --prod",
"build:angular-showcase:license": "copyfiles LICENSE ./dist/angular-showcase/",
"build:angular-showcase:packagejson": "cd projects/angular-showcase && copyfiles package.json ../../dist/angular-showcase",
"test": "run-s test:angular-public",
"test": "run-s test:angular-business test:angular-public test:angular-keycloak",
"test:angular-business": "ng test @sbb-esta/angular-business -c ci",
"test:angular-public": "ng test @sbb-esta/angular-public -c ci",
"test:angular-keycloak": "ng test @sbb-esta/angular-keycloak -c ci",
"test:angular-showcase": "ng test angular-showcase -c ci",
"test:pr": "run-s test:pr:angular-business test:pr:angular-public test:pr:angular-keycloak",
"test:pr:angular-business": "ng test @sbb-esta/angular-business -c pr",
"test:pr:angular-public": "ng test @sbb-esta/angular-public -c pr",
"test:pr:angular-keycloak": "ng test @sbb-esta/angular-keycloak -c pr",
"test:pr:angular-showcase": "ng test angular-showcase -c pr",
"sonar": "node ./scripts/sonar.js",
"changelog": "standard-version --tag-prefix=\"\"",
"publish:staging": "node ./scripts/publish.js",
Expand Down Expand Up @@ -134,7 +139,7 @@
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"karma-parallel": "^0.3.1",
"karma-sonarqube-reporter": "^1.2.3",
"karma-sonarqube-reporter": "^1.2.4",
"karma-sourcemap-loader": "^0.3.7",
"lint-staged": "^8.2.1",
"lodash": "^4.17.11",
Expand Down
20 changes: 5 additions & 15 deletions projects/sbb-esta/angular-business/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,7 @@ module.exports = function(config) {
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
BsChrome: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'Chrome'
},
BsFirefox: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'Firefox'
}
},
customLaunchers: require('../../../browsers.json'),
singleRun: false,
// Try Websocket for a faster transmission first. Fallback to polling if necessary.
transports: ['websocket', 'polling'],
Expand All @@ -67,6 +54,10 @@ module.exports = function(config) {
});

if (process.env.TRAVIS) {
config.reporters = config.reporters
.filter(r => r !== 'progress' && r !== 'kjhtml')
.concat('dots');

// This defines how often a given browser should be launched in the same Travis
// container. This is helpful if we want to shard tests across the same browser.
const parallelBrowserInstances = Number(process.env.KARMA_PARALLEL_BROWSERS) || 1;
Expand All @@ -83,7 +74,6 @@ module.exports = function(config) {
}

if (process.env.BROWSERSTACK_USERNAME && process.env.BROWSERSTACK_ACCESS_KEY) {
config.browsers.push('BsCrhome', 'BsFirefox');
config.browserDisconnectTimeout = 180000;
config.browserDisconnectTolerance = 3;
config.captureTimeout = 180000;
Expand Down
Loading