-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ksocha/add-basic-implementation
Add basic implementation
- Loading branch information
Showing
25 changed files
with
1,263 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,96 @@ | ||
version: 2.1 | ||
|
||
jobs: | ||
build: | ||
executors: | ||
node: | ||
working_directory: ~/app | ||
docker: | ||
- image: circleci/node:12 | ||
- image: circleci/node:12.16 | ||
node_cypress: | ||
working_directory: ~/app | ||
parallelism: 1 | ||
docker: | ||
- image: cypress/base:12.16.0 | ||
|
||
jobs: | ||
checkout_code: | ||
executor: node | ||
steps: | ||
- checkout | ||
- persist_to_workspace: | ||
root: ~/ | ||
paths: | ||
- app | ||
|
||
install_dependencies: | ||
executor: node | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- restore_cache: | ||
keys: | ||
- v1-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v1-deps-{{ .Branch }} | ||
- v1-deps | ||
- v2-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v2-deps-{{ .Branch }} | ||
- v2-deps | ||
- run: yarn install --frozen-lockfile | ||
- save_cache: | ||
key: v1-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
key: v2-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache | ||
- persist_to_workspace: | ||
root: ~/ | ||
paths: | ||
- .cache | ||
- app/node_modules | ||
|
||
run_linter: | ||
executor: node | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- run: | ||
name: Running linter | ||
name: Run linter | ||
command: yarn lint | ||
|
||
run_unit_tests: | ||
executor: node | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- run: | ||
name: Running unit tests | ||
name: Run unit tests | ||
command: yarn test | ||
|
||
run_cypress_tests: | ||
executor: node_cypress | ||
parallelism: 3 | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- run: | ||
name: Build app | ||
command: yarn build | ||
- run: | ||
name: Run cypress tests | ||
command: | | ||
yarn cypress run --reporter "./dist/index.js" --spec "$(circleci tests glob "./cypress/integration/**/*.spec.js" | circleci tests split --split-by=timings | paste -sd "," -)" | ||
- store_test_results: | ||
path: test_results | ||
- store_artifacts: | ||
path: test_results | ||
|
||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- checkout_code | ||
- install_dependencies: | ||
requires: | ||
- checkout_code | ||
- run_linter: | ||
requires: | ||
- install_dependencies | ||
- run_unit_tests: | ||
requires: | ||
- run_linter | ||
# - run_cypress_tests: | ||
# requires: | ||
# - run_unit_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# cypress-circleci-reporter | ||
Cypress test reporter for CircleCI | ||
|
||
Cypress test reporter for CircleCI based on [mocha-junit-reporter](https://github.com/michaelleeallen/mocha-junit-reporter). Helps with test parallelization. | ||
|
||
## Installation | ||
|
||
```shell | ||
$ npm install cypress-circleci-reporter --save-dev | ||
``` | ||
|
||
```shell | ||
$ yarn add cypress-circleci-reporter --dev | ||
``` | ||
|
||
## Usage | ||
|
||
After installing the reporter, you'll need to modify your config to use it: | ||
|
||
### CircleCI config example | ||
|
||
``` | ||
run_cypress_tests: | ||
parallelism: 3 # or any other number that suits your needs | ||
steps: | ||
# some previous steps | ||
- run: | ||
name: Run cypress tests | ||
command: yarn cypress run --spec "$(circleci tests glob "./cypress/integration/**/*.spec.js" | circleci tests split --split-by=timings | paste -sd "," -)" --reporter cypress-circleci-reporter | ||
- store_test_results: | ||
path: test_results | ||
- store_artifacts: | ||
path: test_results | ||
``` | ||
|
||
First test run with this config should create and store reports for each test file. These will be used during next runs to determine timings of each test. CircleCI will then split the test files between available containers to speed up the process. | ||
|
||
### Configuration options | ||
|
||
Options can be passed to the reported by adding `--reporter-options` parameter to the CLI command. | ||
|
||
| Parameter | Default | Effect | | ||
| -------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| project | `undefined` | If you use Cypress' `project` parameter, this should be set to the same value. | | ||
| resultsDir | `./test_results/cypress` | Name of the directory that reports will be saved into. report | | ||
| resultFileName | `cypress-[hash]` | Name of the file that will be created for each test run. Must include `[hash]` string as each spec file is processed completely separately during each `cypress run` execution. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test1', () => { | ||
it('waits for 1s', () => { | ||
cy.wait(1000); | ||
}); | ||
|
||
it.skip('should be skipped', () => { | ||
cy.wait(1000); | ||
}); | ||
|
||
it('should fail', () => { | ||
cy.click(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test2', () => { | ||
it('waits for 2s', () => { | ||
cy.wait(2000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test3', () => { | ||
it('waits for 3s', () => { | ||
cy.wait(3000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test4', () => { | ||
it('waits for 4s', () => { | ||
cy.wait(4000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test5', () => { | ||
it('waits for 5s', () => { | ||
cy.wait(5000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test6', () => { | ||
it('waits for 6s', () => { | ||
cy.wait(6000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test7', () => { | ||
it('waits for 7s', () => { | ||
cy.wait(7000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test8', () => { | ||
it('waits for 8s', () => { | ||
cy.wait(8000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context('test9', () => { | ||
it('waits for 9s', () => { | ||
cy.wait(9000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.