Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Refactored README.md file to reflect the new changes to Cypress
  • Loading branch information
FahadDarw authored Jan 10, 2024
1 parent bb76fde commit 04b0d55
Showing 1 changed file with 12 additions and 65 deletions.
77 changes: 12 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,24 @@ Install cypress and dependencies:
- Run 'npm install' from the Dfe.PrepareConversions.CypressTests directory

### Test execution
You will need to set a secret in `secrets.json` in the following format to run the Cypress command against (you can use any value):

To execute the tests locally and view the output, you will need to set environment variables. Create a new file named `cypress.env.json` in the project root with the following content:

```json
{
"CypressTestSecret": "<SECRET HERE>"
"url": "BASE_URL_OF_APP",
"cypressTestSecret": "<SECRET HERE>",
"academisationApiUrl": "<SECRET HERE>",
"academisationApiKey": "<SECRET HERE>"
}
```

To execute the tests locally and view the output:

First set the database config as an environment variable -
For bash -
```
export db='{"server":"localhost", "userName":"sa", "password":"StrongPassword905", "options": { "database": "sip" } }'
```
For windows -
```
set db='{"server":"localhost", "userName":"sa", "password":"StrongPassword905", "options": { "database": "sip" } }'
```

The secret in the below command should match what was set in the `secrets.json` file.
```
npm run cy:open -- --env url="BASE_URL_OF_APP",cypressTestSecret="<SECRET HERE>"
```
Please make sure to replace `<SECRET HERE>` with the actual secret values in the `cypress.env.json` file before running the tests.

To execute the tests in headless mode, run the following (the output will log to the console):
### Open the Cypress Test Runner for interactive testing
npx cypress open

```
npm run cy:run -- --env url="BASE_URL_OF_APP",cypressTestSecret="<SECRET HERE>"
```

### Loading users from Azure Active Directory
You will need to set a secret in `secrets.json` in the following format to run the Cypress command against (you can use any value):

```
"AzureAd": {
"ClientId": "<clientid>",
"ClientSecret": "<clientsecret>",
"TenantId": "<tenantid>",
"GroupId": "<activedirectory-groupid>"
}
```
### Run the Cypress tests in headless mode
npx cypress run

### Useful tips

Expand Down Expand Up @@ -143,35 +119,6 @@ it('Has no detectable a11y violations on load (with custom parameters)', () => {
For more receipes: https://www.npmjs.com/package/cypress-axe
##### Upgrading Cypress version
EVERY 6 to 8 weeks, there is a significant update that will be rolled out with some changes.
To see the cypress change longs navigate to this link: https://docs.cypress.io/guides/references/changelog#
Here you can view the bug fixes, performance fixes and features etc. Latest version you will find at the top of the list with release date. You can jump to the specific version by clicking on the links on the right side under section on this page.

## Update Cypress using NPM
-Close the cypress runner properly by clicking on Stop button then x button.

-Type below command. Here replace 12.2.0 with latest version
`npm install --save-dev [email protected]`

-Check Cypress version is updated using below command
`$ npx cypress --version`

##Update Cypress using package.json
-Cose the cypress runner properly by clicking on Stop button then x button.

-Navigate to your package.json.

-Change the cypress version to the current updated version in package.json
`"cypress": "12.2.0"`

-Type below command
`$ npx install cypress`

-Check cypress version
`$ npx cypress --version`


##### Cypress Linting
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs.
Expand Down Expand Up @@ -250,4 +197,4 @@ NO_PROXY="<list-of-urls-to-ignore>"
```
and setting the runtime variables
`zapReport=true,zapApiKey=<zap-api-key>,zapUrl="<zap-daemon-url>"`
`zapReport=true,zapApiKey=<zap-api-key>,zapUrl="<zap-daemon-url>"`

0 comments on commit 04b0d55

Please sign in to comment.