-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
64 changed files
with
25,023 additions
and
12,679 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
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,93 @@ | ||
name: Bug report | ||
description: Create a report to help us improve @currents/nx | ||
labels: bug | ||
|
||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: | | ||
Before opening, please confirm: | ||
options: | ||
- 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). | ||
required: true | ||
- label: I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue. | ||
required: true | ||
|
||
- type: markdown | ||
attributes: | ||
value: | | ||
## Environment | ||
- type: textarea | ||
attributes: | ||
label: Environment information | ||
description: | | ||
Please run the following command inside your project and copy/paste the output below: | ||
``` | ||
npx envinfo --system --binaries --browsers --npmPackages --duplicates --npmGlobalPackages | ||
``` | ||
value: | | ||
<details> | ||
``` | ||
# Put output below this line | ||
``` | ||
</details> | ||
validations: | ||
required: true | ||
- type: markdown | ||
attributes: | ||
value: | | ||
## Details | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of what the bug is. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Expected behavior | ||
description: A clear and concise description of what you expected to happen. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Command and Setup | ||
description: | | ||
- The exact command or code snippet | ||
- Your cloud provider and sorry-cypress setup details | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Full log and debug output | ||
description: | | ||
Run in debug mode to provide more info - error messages and stack traces. | ||
**Include the full log - starting from running the command till receiving an error.** | ||
Attach a link / file for long outputs. | ||
Linux: `DEBUG=cy2*,cypress:* cy2 run ...` | ||
Windows: `cmd /V /C "set DEBUG=cy2*,cypress:* && cy2 run ..."` | ||
**Be sure to remove any sensitive data.** | ||
value: | | ||
<details> | ||
``` | ||
// Put your logs below this line | ||
``` | ||
</details> | ||
validations: | ||
required: true |
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 @@ | ||
name: Feature Request | ||
description: Request a new feature | ||
labels: enhancement | ||
|
||
body: | ||
- type: textarea | ||
attributes: | ||
label: Description | ||
description: | | ||
Please describe the feature in details | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Example usage | ||
description: Please provide an example of how the feature will be used - code or command line | ||
validations: | ||
required: true |
This file was deleted.
Oops, something went wrong.
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
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,53 +1,101 @@ | ||
# @currents/nx | ||
# Debug, troubleshoot and record Cypress CI tests in Cloud | ||
|
||
[NX](https://nx.dev/) plugin for running cypress tests on Currents.dev | ||
[NX](https://nx.dev/) plugin for running cypress tests using [Currents](https://currents.dev) or [Sorry Cypress](https://sorry-cypress.dev). | ||
|
||
Integrate Cypress with alternative cloud services like Currents or Sorry Cypress. | ||
|
||
The plugin is designed for CI environments and runs Cypress in headless mode. Please use `@nrwl/cypress` for running cypress in interactive mode. | ||
|
||
## Example | ||
|
||
See [./apps/web-e2e](./apps/web-e2e) for an example installation: | ||
|
||
```sh | ||
npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx | ||
``` | ||
|
||
## Setup | ||
|
||
Install `@currents/nx` | ||
|
||
```sh | ||
npm i --save-dev @currents/nx | ||
npx nx g @currents/nx:init <destination_project> | ||
``` | ||
|
||
Add `currents` target to your project configuration | ||
Add target `currents` to your project configuration: | ||
|
||
```js | ||
|
||
{ | ||
// ... | ||
"targets": { | ||
"currents": { | ||
"executor": "@currents/nx:currents", | ||
"options": { | ||
"cypressExecutor": "e2e" // target name that runs "@nrwl/cypress:cypress" | ||
} | ||
}, | ||
"e2e": { | ||
"executor": "@nrwl/cypress:cypress", | ||
"options": { | ||
// ... | ||
}, | ||
"configurations": { | ||
// ... | ||
// ... | ||
"targets": { | ||
"currents": { | ||
"executor": "@currents/nx:currents", | ||
"options": { | ||
"record": true, | ||
"parallel": true, | ||
"cypressConfig": "apps/app-e2e/cypres.config.ts", | ||
"devServerTarget": "my-react-app:serve", | ||
"testingType": "e2e" | ||
} | ||
} | ||
} | ||
} | ||
// ... | ||
// ... | ||
``` | ||
Run cypress tests, using Currents.dev as a dashboard | ||
Create a new configuration file: `currents.config.js` next to `cypress.config.{jt}s` | ||
```js | ||
// currents.config.js | ||
module.exports = { | ||
// Set the `projectId` and the record key obtained from https://app.currents.dev or your self-hosted instance of Sorry Cypress | ||
projectId: 'Ij0RfK', | ||
// Sorry Cypress users - set the director service URL | ||
cloudServiceUrl: 'https://cy.currents.dev', | ||
}; | ||
``` | ||
Add `cypress-cloud/plugin` to `cypress.config.{js|ts|mjs}` | ||
```ts | ||
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'; | ||
import { defineConfig } from 'cypress'; | ||
import cloudPlugin from 'cypress-cloud/plugin'; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
...nxE2EPreset(__dirname, { | ||
bundler: 'vite', | ||
}), | ||
specPattern: './src/**/*.cy.ts', | ||
setupNodeEvents(on, config) { | ||
return cloudPlugin(on, config); | ||
}, | ||
}, | ||
}); | ||
``` | ||
## Usage | ||
```sh | ||
nx run project:currents --group nx --record --key <key> --ci-build-id hello-currents-nx | ||
npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx | ||
``` | ||
- The plugin requires an already installed `@nrwl/cypress` and a configured target that's running `@nrwl/cypress:cypress` | ||
- `@currents/nx:currents` will run `@nrwl/cypress:cypress` behind the scenes | ||
- You can set predefined options in target definition | ||
- Update your `cypress.json` file with `projectId` obtained at https://app.currents.dev | ||
- Use the record key obtained at https://app.currents.dev | ||
### Example | ||
## Configuration | ||
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. | ||
See the [schema.json](./src/executors/schema.json) for the list of available options | ||
## Migration | ||
### Version `2.0.0` | ||
- Using [`cypress-cloud`](https://github.com/currents-dev/cypress-cloud) as the orchestration tool | ||
### Version `1.0.0` | ||
See https://github.com/currents-dev/currents-nx-example for example integration | ||
- `@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. |
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,10 @@ | ||
{ | ||
"extends": ["plugin:cypress/recommended", "../../.eslintrc"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,3 @@ | ||
module.exports = { | ||
projectId: 'Ij0RfK', | ||
}; |
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 @@ | ||
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'; | ||
import { defineConfig } from 'cypress'; | ||
import cloudPlugin from 'cypress-cloud/plugin'; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
...nxE2EPreset(__dirname, { | ||
bundler: 'vite', | ||
}), | ||
specPattern: './src/**/*.cy.ts', | ||
setupNodeEvents(on, config) { | ||
return cloudPlugin(on, 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,32 @@ | ||
{ | ||
"name": "web-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/web-e2e/src", | ||
"projectType": "application", | ||
"targets": { | ||
"currents": { | ||
"executor": "@currents/nx:currents", | ||
"options": { | ||
"projectRoot": "apps/web-e2e", | ||
"parallel": true, | ||
"record": true, | ||
"tag": "nx", | ||
"devServerTarget": "web:serve:development" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "web:serve:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/web-e2e/**/*.{js,ts}"] | ||
} | ||
} | ||
}, | ||
"tags": [], | ||
"implicitDependencies": ["web"] | ||
} |
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,13 @@ | ||
import { getGreeting } from '../support/app.po'; | ||
|
||
describe('web', () => { | ||
beforeEach(() => cy.visit('/')); | ||
|
||
it('should display welcome message', () => { | ||
// Custom command example, see `../support/commands.ts` file | ||
cy.login('[email protected]', 'myPassword'); | ||
|
||
// Function helper example, see `../support/app.po.ts` file | ||
getGreeting().contains('Welcome web'); | ||
}); | ||
}); |
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,4 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]" | ||
} |
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 @@ | ||
export const getGreeting = () => cy.get('h1'); |
Oops, something went wrong.