- run: pnpm run -r build
- run: pnpm run -r build:dts
- run: pnpm run -r test:dts
- # TODO: add when doable
- # - run: pnpm run -r test:e2e:ci
+ - run: pnpm run -r test:e2e:ci
- uses: codecov/codecov-action@v2
+++ /dev/null
-require('dotenv').config()
-const Nightwatch = require('nightwatch')
-const browserstack = require('browserstack-local')
-const path = require('path')
-
-const { BROWSERSTACK_ACCESS_KEY } = process.env
-if (!BROWSERSTACK_ACCESS_KEY) {
- throw new Error(
- `
-(ONLY FOR MAINTAINERS)
-BROWSERSTACK_ACCESS_KEY is not set. Did you create the .env file?
-`
- )
-}
-
-try {
- require.main.filename = path.resolve(
- __dirname,
- '../../../node_modules/.bin/nightwatch'
- )
-
- // Code to start browserstack local before start of test
- console.log('Connecting local')
-
- const bs_local = new browserstack.Local()
- Nightwatch.bs_local = bs_local
-
- bs_local.start(
- { key: process.env.BROWSERSTACK_ACCESS_KEY },
- function (error) {
- if (error) throw error
-
- console.log('Connected. Now testing...')
- Nightwatch.cli(function (argv) {
- Nightwatch.CliRunner(argv)
- .setup()
- .runTests()
- .catch(err => {
- throw err
- })
- .finally(() => {
- // Code to stop browserstack local after end of single test
- bs_local.stop(function () {})
- })
- })
- }
- )
-} catch (ex) {
- console.log('There was an error while starting the test runner:\n\n')
- process.stderr.write(ex.stack + '\n')
- process.exit(2)
-}
--- /dev/null
+require('dotenv').config()
+const Nightwatch = require('nightwatch')
+const browserstack = require('browserstack-local')
+const path = require('path')
+
+const { BROWSERSTACK_ACCESS_KEY } = process.env
+if (!BROWSERSTACK_ACCESS_KEY) {
+ throw new Error(
+ `
+(ONLY FOR MAINTAINERS)
+BROWSERSTACK_ACCESS_KEY is not set. Did you create the .env file?
+`
+ )
+}
+
+const args = process.argv.slice(2)
+
+// allow running browserstack local
+// note this works because nighwatch doesn't use this option
+const isLocal = args.indexOf('--local') > -1
+
+try {
+ require.main.filename = path.resolve(
+ __dirname,
+ '../../../node_modules/.bin/nightwatch'
+ )
+
+ // Code to start browserstack local before start of test
+ console.log('Connecting local')
+
+ /** @type {import('browserstack-local').Local} */
+ let bs_local
+ if (isLocal) {
+ bs_local = new browserstack.Local()
+ Nightwatch.bs_local = bs_local
+
+ bs_local.start(
+ { key: process.env.BROWSERSTACK_ACCESS_KEY },
+ async error => {
+ if (error) throw error
+
+ console.log('Connected. Now testing...')
+ await runNighwatchCli().finally(() => {
+ // Code to stop browserstack local after end of single test
+ bs_local.stop(() => {})
+ })
+ }
+ )
+ } else {
+ runNighwatchCli()
+ }
+} catch (ex) {
+ console.log('There was an error while starting the test runner:\n\n')
+ process.stderr.write(ex.stack + '\n')
+ process.exit(2)
+}
+
+function runNighwatchCli() {
+ return new Promise((resolve, reject) => {
+ Nightwatch.cli(argv => {
+ Nightwatch.CliRunner(argv).setup().runTests().then(resolve).catch(reject)
+ })
+ })
+}
.click('li:nth-child(3) a')
.assert.urlEquals(baseURL + '/documents/%E2%82%ACuro')
- .assert.containsText('#fullPath', '/documents/%E2%82%ACuro')
- .assert.containsText('#path', '/documents/%E2%82%ACuro')
- .assert.containsText('#p-id', '"€uro"')
+ .assert.textContains('#fullPath', '/documents/%E2%82%ACuro')
+ .assert.textContains('#path', '/documents/%E2%82%ACuro')
+ .assert.textContains('#p-id', '"€uro"')
// full encoding test
.click('li:nth-child(8) a')
browser
.url(baseURL + '/documents/%E2%82%ACuro')
.waitForElementPresent('#app > *', TIMEOUT)
- // .assert.containsText('#fullPath', '/documents/%E2%82%ACuro')
- // .assert.containsText('#path', '/documents/%E2%82%ACuro')
- .assert.containsText('#p-id', '"€uro"')
+ // .assert.textContains('#fullPath', '/documents/%E2%82%ACuro')
+ // .assert.textContains('#path', '/documents/%E2%82%ACuro')
+ .assert.textContains('#p-id', '"€uro"')
// TODO: invalid in safari, tests on those where this is valid
// .url(baseURL + '/unicode/€uro')
// .waitForElementPresent('#app > *', TIMEOUT)
// navigation to unencoded value
// depending on the browser the value will be encoded or not
- // .assert.containsText('#params', JSON.stringify({ id: '€uro' }, null, 2))
+ // .assert.textContains('#params', JSON.stringify({ id: '€uro' }, null, 2))
.end()
},
browserName: 'chrome',
'goog:chromeOptions': {
w3c: true,
- args: ['window-size=1280,800', 'headless'],
},
},
webdriver: {
start_process: true,
server_path: '',
- cli_args: [
- // --verbose
- ],
},
},
'chrome-headless': {
extends: 'default',
+ desiredCapabilities: {
+ browserName: 'chrome',
+ 'goog:chromeOptions': {
+ w3c: true,
+ args: ['window-size=1280,800', 'headless'],
+ },
+ },
},
edge: {
},
},
- 'browserstack.chrome': {
- extends: 'browserstack',
- desiredCapabilities: {
- browserName: 'chrome',
- chromeOptions: {
- w3c: true,
- },
- },
- },
-
- 'browserstack.firefox': {
- extends: 'browserstack',
- desiredCapabilities: {
- browserName: 'firefox',
- },
- },
-
- 'browserstack.safari': {
- extends: 'browserstack',
- desiredCapabilities: {
- browserName: 'safari',
- },
- },
-
'browserstack.local_chrome': {
extends: 'browserstack.local',
desiredCapabilities: {
"test:unit": "jest --coverage",
"test": "pnpm run test:types && pnpm run test:unit && pnpm run build && pnpm run build:dts && pnpm run test:e2e",
"test:e2e": "pnpm run test:e2e:headless && pnpm run test:e2e:native",
- "test:e2e:headless": "node e2e/runner.js -e chrome-headless --skiptags no-headless",
- "test:e2e:native": "node e2e/runner.js -e chrome --tag no-headless",
- "test:e2e:ci": "node e2e/runner.js -e firefox --retries 2",
- "test:e2e:bs": "node e2e/local.runner.js -e edge_pre_chrome,android44 --tag browserstack"
+ "test:e2e:headless": "nightwatch --skiptags no-headless",
+ "test:e2e:native": "nightwatch --env chrome",
+ "test:e2e:ci": "nightwatch --env chrome --retries 2",
+ "test:e2e:bs": "node e2e/runner.js -e edge_pre_chrome,android44 --tag browserstack"
},
"gitHooks": {
"pre-commit": "lint-staged",