Skip to content

Commit 8bec6fe

Browse files
authored
Feat: use cypress-cloud (#18)
BREAKING CHANGE: - Use cypress-cloud as an integration tool - `@nrwl/cypress` no longer required, versions - the plugin is a standalone implementation that is not dependent on `@nrwl/cypress` * feat: standalone implementation - `@nrwl/cypress` no longer required, versions - the plugin is a standalone implementation that is not dependent on `@nrwl/cypress` - use the available options to configure the execution of your cypress runs * Release 1.0.0-beta.1 * chore: resolve security warnings * Release 1.0.0-beta.2 * feat: use cypress-cloud * chore: remove unused files * chore: remove deps * feat: use cypress-cloud
1 parent 572c047 commit 8bec6fe

64 files changed

Lines changed: 25023 additions & 12679 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc renamed to .eslintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
88
"plugin:@typescript-eslint/eslint-recommended",
99
"plugin:@typescript-eslint/recommended"
1010
],
11-
"rules": {}
11+
"rules": {},
12+
"overrides": [
13+
{
14+
"files": "*.json",
15+
"parser": "jsonc-eslint-parser",
16+
"rules": {}
17+
}
18+
]
1219
}

.github/ISSUE_TEMPLATE/1.bug.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Bug report
2+
description: Create a report to help us improve @currents/nx
3+
labels: bug
4+
5+
body:
6+
- type: checkboxes
7+
attributes:
8+
label: |
9+
Before opening, please confirm:
10+
options:
11+
- label: I have [searched for duplicate or closed issues](https://github.com/currents-dev/currents-nx/issues) and [discussions](https://github.com/currents-dev/currents-nx/discussions).
12+
required: true
13+
- label: I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
14+
required: true
15+
16+
- type: markdown
17+
attributes:
18+
value: |
19+
## Environment
20+
- type: textarea
21+
attributes:
22+
label: Environment information
23+
description: |
24+
Please run the following command inside your project and copy/paste the output below:
25+
```
26+
npx envinfo --system --binaries --browsers --npmPackages --duplicates --npmGlobalPackages
27+
```
28+
value: |
29+
<details>
30+
31+
```
32+
# Put output below this line
33+
34+
35+
```
36+
37+
</details>
38+
validations:
39+
required: true
40+
- type: markdown
41+
attributes:
42+
value: |
43+
## Details
44+
- type: textarea
45+
attributes:
46+
label: Describe the bug
47+
description: A clear and concise description of what the bug is.
48+
validations:
49+
required: true
50+
51+
- type: textarea
52+
attributes:
53+
label: Expected behavior
54+
description: A clear and concise description of what you expected to happen.
55+
validations:
56+
required: true
57+
58+
- type: textarea
59+
attributes:
60+
label: Command and Setup
61+
description: |
62+
- The exact command or code snippet
63+
- Your cloud provider and sorry-cypress setup details
64+
65+
validations:
66+
required: true
67+
68+
- type: textarea
69+
attributes:
70+
label: Full log and debug output
71+
description: |
72+
Run in debug mode to provide more info - error messages and stack traces.
73+
74+
**Include the full log - starting from running the command till receiving an error.**
75+
76+
Attach a link / file for long outputs.
77+
78+
Linux: `DEBUG=cy2*,cypress:* cy2 run ...`
79+
Windows: `cmd /V /C "set DEBUG=cy2*,cypress:* && cy2 run ..."`
80+
81+
**Be sure to remove any sensitive data.**
82+
value: |
83+
<details>
84+
85+
```
86+
// Put your logs below this line
87+
88+
89+
```
90+
91+
</details>
92+
validations:
93+
required: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Feature Request
2+
description: Request a new feature
3+
labels: enhancement
4+
5+
body:
6+
- type: textarea
7+
attributes:
8+
label: Description
9+
description: |
10+
Please describe the feature in details
11+
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
attributes:
17+
label: Example usage
18+
description: Please provide an example of how the feature will be used - code or command line
19+
validations:
20+
required: true

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [1.0.0-beta.2](https://github.com/currents-dev/currents-nx/compare/1.0.0-beta.1...1.0.0-beta.2) (2023-01-10)
2+
3+
# [1.0.0-beta.1](https://github.com/currents-dev/currents-nx/compare/0.2.1...1.0.0-beta.1) (2023-01-10)
4+
5+
### Features
6+
7+
- standalone implementation ([06d1ff1](https://github.com/currents-dev/currents-nx/commit/06d1ff1df3bb85fc4fd58c130aa4110529564a58))
8+
9+
### BREAKING CHANGES
10+
11+
- `@nrwl/cypress` no longer required, versions - the plugin is a standalone implementation that is not dependent on `@nrwl/cypress`
12+
13+
- use the available options to configure the execution of your cypress runs
14+
115
- use cy2 3.4.1 for cypress 12 (a46f56f)
216

317
* feat: cypress 12+ (1a9ca2b)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Currents.dev
3+
Copyright (c) 2021 Currents Software Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,101 @@
1-
# @currents/nx
1+
# Debug, troubleshoot and record Cypress CI tests in Cloud
22

3-
[NX](https://nx.dev/) plugin for running cypress tests on Currents.dev
3+
[NX](https://nx.dev/) plugin for running cypress tests using [Currents](https://currents.dev) or [Sorry Cypress](https://sorry-cypress.dev).
4+
5+
Integrate Cypress with alternative cloud services like Currents or Sorry Cypress.
6+
7+
The plugin is designed for CI environments and runs Cypress in headless mode. Please use `@nrwl/cypress` for running cypress in interactive mode.
8+
9+
## Example
10+
11+
See [./apps/web-e2e](./apps/web-e2e) for an example installation:
12+
13+
```sh
14+
npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx
15+
```
416

517
## Setup
618

719
Install `@currents/nx`
820

921
```sh
1022
npm i --save-dev @currents/nx
23+
npx nx g @currents/nx:init <destination_project>
1124
```
1225

13-
Add `currents` target to your project configuration
26+
Add target `currents` to your project configuration:
1427

1528
```js
16-
1729
{
18-
// ...
19-
"targets": {
20-
"currents": {
21-
"executor": "@currents/nx:currents",
22-
"options": {
23-
"cypressExecutor": "e2e" // target name that runs "@nrwl/cypress:cypress"
24-
}
25-
},
26-
"e2e": {
27-
"executor": "@nrwl/cypress:cypress",
28-
"options": {
29-
// ...
30-
},
31-
"configurations": {
32-
// ...
30+
// ...
31+
"targets": {
32+
"currents": {
33+
"executor": "@currents/nx:currents",
34+
"options": {
35+
"record": true,
36+
"parallel": true,
37+
"cypressConfig": "apps/app-e2e/cypres.config.ts",
38+
"devServerTarget": "my-react-app:serve",
39+
"testingType": "e2e"
40+
}
3341
}
3442
}
35-
}
36-
// ...
43+
// ...
3744
```
3845
39-
Run cypress tests, using Currents.dev as a dashboard
46+
Create a new configuration file: `currents.config.js` next to `cypress.config.{jt}s`
47+
48+
```js
49+
// currents.config.js
50+
module.exports = {
51+
// Set the `projectId` and the record key obtained from https://app.currents.dev or your self-hosted instance of Sorry Cypress
52+
projectId: 'Ij0RfK',
53+
// Sorry Cypress users - set the director service URL
54+
cloudServiceUrl: 'https://cy.currents.dev',
55+
};
56+
```
57+
58+
Add `cypress-cloud/plugin` to `cypress.config.{js|ts|mjs}`
59+
60+
```ts
61+
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
62+
import { defineConfig } from 'cypress';
63+
import cloudPlugin from 'cypress-cloud/plugin';
64+
65+
export default defineConfig({
66+
e2e: {
67+
...nxE2EPreset(__dirname, {
68+
bundler: 'vite',
69+
}),
70+
specPattern: './src/**/*.cy.ts',
71+
setupNodeEvents(on, config) {
72+
return cloudPlugin(on, config);
73+
},
74+
},
75+
});
76+
```
77+
78+
## Usage
4079
4180
```sh
42-
nx run project:currents --group nx --record --key <key> --ci-build-id hello-currents-nx
81+
npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx
4382
```
4483
45-
- The plugin requires an already installed `@nrwl/cypress` and a configured target that's running `@nrwl/cypress:cypress`
46-
- `@currents/nx:currents` will run `@nrwl/cypress:cypress` behind the scenes
47-
- You can set predefined options in target definition
4884
- Update your `cypress.json` file with `projectId` obtained at https://app.currents.dev
4985
- Use the record key obtained at https://app.currents.dev
5086
51-
### Example
87+
## Configuration
88+
89+
Options can be configured in `project.json` when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
90+
91+
See the [schema.json](./src/executors/schema.json) for the list of available options
92+
93+
## Migration
94+
95+
### Version `2.0.0`
96+
97+
- Using [`cypress-cloud`](https://github.com/currents-dev/cypress-cloud) as the orchestration tool
98+
99+
### Version `1.0.0`
52100
53-
See https://github.com/currents-dev/currents-nx-example for example integration
101+
- `@nrwl/cypress` no longer required - the plugin is a standalone implementation that is not dependent on `@nrwl/cypress`. Use the available configuration options to configure the execution of cypress runs.

apps/web-e2e/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["plugin:cypress/recommended", "../../.eslintrc"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
}
9+
]
10+
}

apps/web-e2e/currents.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
projectId: 'Ij0RfK',
3+
};

apps/web-e2e/cypress.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
2+
import { defineConfig } from 'cypress';
3+
import cloudPlugin from 'cypress-cloud/plugin';
4+
5+
export default defineConfig({
6+
e2e: {
7+
...nxE2EPreset(__dirname, {
8+
bundler: 'vite',
9+
}),
10+
specPattern: './src/**/*.cy.ts',
11+
setupNodeEvents(on, config) {
12+
return cloudPlugin(on, config);
13+
},
14+
},
15+
});

0 commit comments

Comments
 (0)