Skip to content

Commit

Permalink
Merge branch 'unified-desktop-gui' into tgriesser/unify/ui-data-push
Browse files Browse the repository at this point in the history
* unified-desktop-gui: (40 commits)
  feat: index.html configurability and storybook support (#18242)
  fix: remove .json check from require_async, prevent child_process spawn (#18416)
  percy snapshot the tooltip visually, prevent it from being hidden
  fix: failing tests from #18372 (#18414)
  fix: `everyNthFrame` should only be applied for Chrome 89+ (#18392)
  feat(app): render spec list, command log, iframe (#18372)
  fix: drag and drop to be correct directory (#18400)
  refactor: Add GitDataSource, FileDataSource, toast for errors (#18385)
  docs: General updates to contributing guide (#18283)
  Add shorter --ct alias for --component
  Add --e2e and --component CLI options
  chore: Update Chrome (beta) to 95.0.4638.40 (#18389)
  chore: use circleci timings split for e2e tests (#18367)
  fix: fixed title (#18370)
  chore(deps): update dependency electron to v14 🌟 (#18384)
  chore(server): share client route (#18215)
  fix: Prevent Cypress from crashing when argument parsing "spec: {}" (#18312)
  chore: update husky dev dependency to v7 (#18345)
  feat: add defineConfig function to help type config (#18302)
  chore: Update Chrome (stable) to 94.0.4606.71 (#18324)
  ...
  • Loading branch information
tgriesser committed Oct 8, 2021
2 parents eaa6f93 + 0fede06 commit 3bbd333
Show file tree
Hide file tree
Showing 279 changed files with 13,440 additions and 748 deletions.
120 changes: 63 additions & 57 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"chrome:beta": "95.0.4638.32",
"chrome:beta": "95.0.4638.40",
"chrome:stable": "94.0.4606.71"
}
27 changes: 22 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,16 @@ commands:
description: ct or e2e
type: enum
enum: ['ct', 'e2e']
debug:
description: debug option
type: string
default: ''
steps:
- restore_cached_workspace
- run:
command: |
DEBUG=<<parameters.debug>> \
CYPRESS_INTERNAL_FORCE_BROWSER_RELAUNCH='true' \
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$TEST_LAUNCHPAD_RECORD_KEY \
yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --record --parallel --group <<parameters.package>>-<<parameters.type>>
Expand Down Expand Up @@ -454,7 +460,20 @@ commands:
steps:
- restore_cached_workspace
- run:
command: yarn workspace @packages/server test ./test/e2e/$(( $CIRCLE_NODE_INDEX ))_*spec* --browser <<parameters.browser>>
command: |
ALL_SPECS=`circleci tests glob "/root/cypress/packages/server/test/e2e/*spec*"`
SPECS=
for file in $ALL_SPECS; do
# filter out non_root tests, they have their own stage
if [[ "$file" == *"non_root"* ]]; then
echo "Skipping $file"
continue
fi
SPECS="$SPECS $file"
done
SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings`
echo SPECS=$SPECS
yarn workspace @packages/server test $SPECS --browser <<parameters.browser>>
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
Expand Down Expand Up @@ -1032,9 +1051,6 @@ jobs:
- run: yarn test
# run type checking for each individual package
- run: yarn lerna run types
# check for compile errors with the releaserc scripts
- run: yarn test-npm-package-release-script

- verify-mocha-results:
expectedResultCount: 9
- store_test_results:
Expand Down Expand Up @@ -1184,12 +1200,13 @@ jobs:

run-launchpad-component-tests-chrome:
<<: *defaults
parallelism: 3
parallelism: 7
steps:
- run-new-ui-tests:
browser: chrome
package: launchpad
type: ct
# debug: cypress:*,engine:socket

run-launchpad-integration-tests-chrome:
<<: *defaults
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ yarn test-watch --scope cypress
yarn test-debug --scope cypress
```

### Updating snaphots
### Updating snapshots

Prepend `SNAPSHOT_UPDATE=1` to any test command. See [`snap-shot-it` instructions](https://github.com/bahmutov/snap-shot-it#advanced-use) for more info.

Expand Down
4 changes: 4 additions & 0 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ exports['shows help for open --foo 1'] = `
-c, --config <config> sets configuration values. separate multiple
values with a comma. overrides any value in
cypress.json.
--ct, --component runs component tests
-C, --config-file <config-file> path to JSON file where configuration values
are set. defaults to "cypress.json". pass
"false" to disable.
-d, --detached [bool] runs Cypress application in detached mode
--e2e runs end to end tests
-e, --env <env> sets environment variables. separate
multiple values with a comma. overrides any
value in cypress.json or cypress.env.json
Expand Down Expand Up @@ -64,8 +66,10 @@ exports['shows help for run --foo 1'] = `
Options:
-b, --browser <browser-name-or-path> runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.
--ci-build-id <id> the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers
--ct, --component runs component tests
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.
-C, --config-file <config-file> path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.
--e2e runs end to end tests
-e, --env <env> sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json
--group <name> a named group for recorded runs in the Cypress Dashboard
-k, --key <record-key> your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.
Expand Down
6 changes: 6 additions & 0 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ const descriptions = {
cachePath: 'print the path to the binary cache',
cacheSize: 'Used with the list command to show the sizes of the cached folders',
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
component: 'runs component tests',
config: 'sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.',
configFile: 'path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.',
detached: 'runs Cypress application in detached mode',
dev: 'runs cypress in development and bypasses binary check',
e2e: 'runs end to end tests',
env: 'sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json',
exit: 'keep the browser open after tests finish',
forceInstall: 'force install the Cypress binary',
Expand Down Expand Up @@ -248,8 +250,10 @@ const addCypressRunCommand = (program) => {
.description('Runs Cypress tests from the CLI without the GUI')
.option('-b, --browser <browser-name-or-path>', text('browserRunMode'))
.option('--ci-build-id <id>', text('ciBuildId'))
.option('--ct, --component', text('component'))
.option('-c, --config <config>', text('config'))
.option('-C, --config-file <config-file>', text('configFile'))
.option('--e2e', text('e2e'))
.option('-e, --env <env>', text('env'))
.option('--group <name>', text('group'))
.option('-k, --key <record-key>', text('key'))
Expand Down Expand Up @@ -386,8 +390,10 @@ module.exports = {
.description('Opens Cypress in the interactive GUI.')
.option('-b, --browser <browser-path>', text('browserOpenMode'))
.option('-c, --config <config>', text('config'))
.option('--ct, --component', text('component'))
.option('-C, --config-file <config-file>', text('configFile'))
.option('-d, --detached [bool]', text('detached'), coerceFalse)
.option('--e2e', text('e2e'))
.option('-e, --env <env>', text('env'))
.option('--global', text('global'))
.option('-p, --port <port>', text('port'))
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/exec/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
args.push('--project', options.project)
}

args.push(...processTestingType(options.testingType))
args.push(...processTestingType(options))

debug('opening from options %j', options)
debug('command line arguments %j', args)
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/exec/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const processRunOptions = (options = {}) => {
args.push('--tag', options.tag)
}

args.push(...processTestingType(options.testingType))
args.push(...processTestingType(options))

return args
}
Expand Down
16 changes: 8 additions & 8 deletions cli/lib/exec/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ const throwInvalidOptionError = (details) => {
* @param {string} testingType The type of tests being executed
* @returns {string[]} The array of new exec arguments
*/
const processTestingType = (testingType) => {
if (testingType) {
if (testingType === 'e2e') {
return ['--testing-type', 'e2e']
}
const processTestingType = (options) => {
if (options.testingType === 'component' || options.component || options.ct) {
return ['--testing-type', 'component']
}

if (testingType === 'component') {
return ['--testing-type', 'component']
}
if (options.testingType === 'e2e' || options.e2e) {
return ['--testing-type', 'e2e']
}

if (options.testingType) {
return throwInvalidOptionError(errors.invalidTestingType)
}

Expand Down
3 changes: 3 additions & 0 deletions cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,15 @@ const parseOpts = (opts) => {
'cacheClear',
'cachePrune',
'ciBuildId',
'ct',
'component',
'config',
'configFile',
'cypressVersion',
'destination',
'detached',
'dev',
'e2e',
'exit',
'env',
'force',
Expand Down
14 changes: 14 additions & 0 deletions cli/test/lib/exec/run_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ describe('exec run', function () {
})
})

it('spawns with --testing-type e2e when given --e2e', function () {
return run.start({ e2e: true })
.then(() => {
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--testing-type', 'e2e'])
})
})

it('spawns with --testing-type component when given --ct', function () {
return run.start({ ct: true })
.then(() => {
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--testing-type', 'component'])
})
})

it('spawns with --tag value', function () {
return run.start({ tag: 'nightly' })
.then(() => {
Expand Down
8 changes: 5 additions & 3 deletions npm/react/examples/react-scripts-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
"start": "react-scripts start",
"test": "node ../../../../scripts/cypress run-ct"
},
"dependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3"
},
"devDependencies": {
"@cypress/react": "file:../../dist",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"mocha-junit-reporter": "^2.0.0",
"mocha-multi-reporters": "^1.5.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"typescript": "^4.2.3"
}
}
Loading

0 comments on commit 3bbd333

Please sign in to comment.