Skip to content

Commit

Permalink
feat: component testing (#14479)
Browse files Browse the repository at this point in the history
Co-authored-by: Jessica Sachs <jess@jessicasachs.io>
Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com>
Co-authored-by: ElevateBart <ledouxb@gmail.com>
Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
  • Loading branch information
8 people committed Feb 4, 2021
1 parent 0abb5ef commit af26fbe
Show file tree
Hide file tree
Showing 394 changed files with 49,242 additions and 9,603 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Expand Up @@ -7,8 +7,11 @@
"plugin:@cypress/dev/tests"
],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-useless-constructor": "off",
"prefer-spread": "off",
"prefer-rest-params": "off"
"prefer-rest-params": "off",
"no-useless-constructor": "off"
},
"settings": {
"react": {
Expand Down
8 changes: 7 additions & 1 deletion .vscode/settings.json
@@ -1,6 +1,12 @@
{
"eslint.alwaysShowStatus": true,
"eslint.validate": ["json"],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json"
],
"eslint.enable": true,
// this project does not use Prettier
// thus set all settings to disable accidentally running Prettier
Expand Down
39 changes: 39 additions & 0 deletions .vscode/tasks.json
@@ -0,0 +1,39 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "rename yarn workspace packages",
"type": "shell",
"command": "node ./scripts/rename-workspace-packages --file ${file}",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
},
{
"label": "decaffeinate-bulk file",
"type": "shell",
"command": "yarn decaffeinate-bulk convert --file ${file}",
"problemMatcher": []
},
{
"label": "decaffeinate-bulk multiple files",
"type": "shell",
"command": "yarn decaffeinate-bulk convert --file ${file} ${file}",
"problemMatcher": []
},
{
"label": "decaffeinate-bulk dir",
"type": "shell",
"command": "yarn decaffeinate-bulk --dir ${fileDirname} convert",
"problemMatcher": []
}
]
}
35 changes: 33 additions & 2 deletions .vscode/terminals.json
Expand Up @@ -2,19 +2,43 @@
"autorun": false,
"terminals": [
{
"name": "cypress open",
"name": "yarn",
"focus": true,
"onlySingle": true,
"execute": true,
"cwd": "[cwd]",
"command": "yarn"
},
{
"name": "cypress open (E2E)",
"focus": true,
"onlySingle": true,
"execute": true,
"command": "yarn cypress:open"
},
{
"name": "cypress run",
"name": "cypress run (E2E)",
"focus": true,
"onlySingle": true,
"execute": false,
"command": "yarn cypress:run --project ../project"
},
{
"name": "cypress open (CT)",
"focus": true,
"onlySingle": true,
"execute": true,
"cwd": "[cwd]/packages/server-ct",
"command": "yarn cypress:open"
},
{
"name": "packages/server test-e2e",
"focus": true,
"onlySingle": true,
"execute": false,
"cwd": "[cwd]/packages/server",
"command": "yarn test-e2e [fileBasename]"
},
{
"name": "packages/server test-watch",
"focus": true,
Expand All @@ -38,6 +62,13 @@
"cwd": "[cwd]/packages/runner",
"command": "yarn watch"
},
{
"name": "packages/runner-ct watch",
"focus": true,
"onlySingle": true,
"cwd": "[cwd]/packages/runner-ct",
"command": "yarn watch"
},
{
"name": "packages/driver cypress open",
"focus": true,
Expand Down
59 changes: 58 additions & 1 deletion circle.yml
Expand Up @@ -8,6 +8,9 @@ macBuildFilters: &macBuildFilters
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- include-electron-node-version
- sem-next-ver

defaults: &defaults
Expand Down Expand Up @@ -35,6 +38,8 @@ testBinaryFirefox: &testBinaryFirefox
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-npm-package
Expand Down Expand Up @@ -642,6 +647,20 @@ jobs:
path: /tmp/cypress
- store-npm-logs

server-ct-unit-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
- check-conditional-ci
- run: yarn test-unit --scope @packages/server-ct
- verify-mocha-results:
expectedResultCount: 1
- store_test_results:
path: /tmp/cypress
- store-npm-logs

server-integration-tests:
<<: *defaults
parallelism: 1
Expand Down Expand Up @@ -893,6 +912,16 @@ jobs:
working_directory: npm/webpack-preprocessor/examples/react-app
- store-npm-logs

npm-webpack-dev-server:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- check-conditional-ci
- run:
name: Run tests
command: yarn workspace @cypress/webpack-dev-server test

npm-webpack-batteries-included-preprocessor:
<<: *defaults
steps:
Expand All @@ -914,7 +943,8 @@ jobs:
command: yarn workspace @cypress/vue build
- run:
name: Run tests
command: yarn workspace @cypress/vue test
command: yarn test
working_directory: npm/vue
- store-npm-logs

npm-react:
Expand Down Expand Up @@ -1711,6 +1741,9 @@ linux-workflow: &linux-workflow
requires:
- build

- npm-webpack-dev-server:
requires:
- build
- npm-webpack-preprocessor:
requires:
- build
Expand Down Expand Up @@ -1808,6 +1841,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build
Expand All @@ -1826,6 +1861,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build
Expand All @@ -1838,6 +1875,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-npm-package
Expand All @@ -1850,6 +1889,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-binary
Expand Down Expand Up @@ -1907,6 +1948,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- upload-npm-package
Expand All @@ -1917,6 +1960,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- upload-npm-package
Expand All @@ -1926,6 +1971,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-npm-package
Expand All @@ -1936,6 +1983,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-npm-package
Expand All @@ -1962,6 +2011,8 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- build-npm-package
Expand Down Expand Up @@ -2056,6 +2107,8 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- Mac NPM package
Expand All @@ -2069,6 +2122,8 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- Mac NPM package upload
Expand All @@ -2082,6 +2137,8 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- v6.0-release
- feat/component-testing
- sem-next-ver
requires:
- Mac NPM package upload
Expand Down
1 change: 1 addition & 0 deletions cli/__snapshots__/cli_spec.js
Expand Up @@ -35,6 +35,7 @@ exports['shows help for open --foo 1'] = `
-P, --project <project-path> path to the project
--dev runs cypress in development and bypasses
binary check
-ct, --component-testing Cypress Component Testing mode (alpha)
-h, --help display help for command
-------
stderr:
Expand Down
2 changes: 2 additions & 0 deletions cli/lib/cli.js
Expand Up @@ -401,6 +401,7 @@ module.exports = {
.option('--global', text('global'))
.option('-p, --port <port>', text('port'))
.option('-P, --project <project-path>', text('project'))
.option('--run-project <project-path>', 'like `project`, but forces Cypress into runmode')
.option('--dev', text('dev'), coerceFalse)
.action((opts) => {
debug('opening Cypress')
Expand All @@ -422,6 +423,7 @@ module.exports = {
.option('-p, --port <port>', text('port'))
.option('-P, --project <project-path>', text('project'))
.option('--dev', text('dev'), coerceFalse)
.option('-ct, --component-testing', 'Cypress Component Testing mode (alpha)')
.action((opts) => {
debug('opening Cypress')
require('./exec/open')
Expand Down
4 changes: 4 additions & 0 deletions cli/lib/exec/open.js
Expand Up @@ -37,6 +37,10 @@ module.exports = {

if (isComponentTesting) {
args.push('--componentTesting')

if (options.runProject) {
args.push('--run-project', options.runProject)
}
}

debug('opening from options %j', options)
Expand Down
8 changes: 6 additions & 2 deletions cli/lib/exec/xvfb.js
Expand Up @@ -2,11 +2,15 @@ const os = require('os')
const Promise = require('bluebird')
const Xvfb = require('@cypress/xvfb')
const { stripIndent } = require('common-tags')
const debug = require('debug')('cypress:cli')
const debugXvfb = require('debug')('cypress:xvfb')
const Debug = require('debug')
const { throwFormErrorText, errors } = require('../errors')
const util = require('../util')

const debug = Debug('cypress:cli')
const debugXvfb = Debug('cypress:xvfb')

debug.Debug = debugXvfb.Debug = Debug

const xvfbOptions = {
timeout: 30000, // milliseconds
// need to explicitly define screen otherwise electron will crash
Expand Down
1 change: 1 addition & 0 deletions cli/lib/util.js
Expand Up @@ -220,6 +220,7 @@ const parseOpts = (opts) => {
'reporter',
'reporterOptions',
'record',
'runProject',
'spec',
'tag')

Expand Down
3 changes: 2 additions & 1 deletion cli/package.json
Expand Up @@ -23,6 +23,7 @@
"@cypress/listr-verbose-renderer": "^0.4.1",
"@cypress/request": "^2.88.5",
"@cypress/xvfb": "^1.2.4",
"@types/node": "12.12.50",
"@types/sinonjs__fake-timers": "^6.0.1",
"@types/sizzle": "^2.3.2",
"arch": "^2.1.2",
Expand All @@ -35,7 +36,7 @@
"commander": "^5.1.0",
"common-tags": "^1.8.0",
"dayjs": "^1.9.3",
"debug": "^4.1.1",
"debug": "4.3.2",
"eventemitter2": "^6.4.2",
"execa": "^4.0.2",
"executable": "^4.1.1",
Expand Down

4 comments on commit af26fbe

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on af26fbe Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.5.0/circle-develop-af26fbebe6bc609132013a0493a116cc78bb1bd4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on af26fbe Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.5.0/appveyor-develop-af26fbebe6bc609132013a0493a116cc78bb1bd4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on af26fbe Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.5.0/appveyor-develop-af26fbebe6bc609132013a0493a116cc78bb1bd4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on af26fbe Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.5.0/circle-develop-af26fbebe6bc609132013a0493a116cc78bb1bd4/cypress.tgz

Please sign in to comment.