Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Cypress #834

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ exclude_patterns:
- "**/node_modules/"
- ".github/"
- ".images/"
- "cypress/"
- "plugins/"
- "src/"
- "services/database/"
Expand Down
8 changes: 4 additions & 4 deletions .env.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ VPC_SUBNET_C=local-nonsense
BROKER_STRINGS=local-nonsense

# needed for e2e tests
CYPRESS_ADMIN_USER_EMAIL=op://mdct_devs/mfp_secrets/CYPRESS_ADMIN_USER_EMAIL
JonHolman marked this conversation as resolved.
Show resolved Hide resolved
CYPRESS_ADMIN_USER_PASSWORD=op://mdct_devs/mfp_secrets/CYPRESS_ADMIN_USER_PASSWORD # pragma: allowlist secret
CYPRESS_STATE_USER_EMAIL=op://mdct_devs/mfp_secrets/CYPRESS_STATE_USER_EMAIL
CYPRESS_STATE_USER_PASSWORD=op://mdct_devs/mfp_secrets/CYPRESS_STATE_USER_PASSWORD # pragma: allowlist secret
E2E_ADMIN_USER_EMAIL=op://mdct_devs/mfp_secrets/E2E_ADMIN_USER_EMAIL
E2E_ADMIN_USER_PASSWORD=op://mdct_devs/mfp_secrets/E2E_ADMIN_USER_PASSWORD # pragma: allowlist secret
E2E_STATE_USER_EMAIL=op://mdct_devs/mfp_secrets/E2E_STATE_USER_EMAIL
E2E_STATE_USER_PASSWORD=op://mdct_devs/mfp_secrets/E2E_STATE_USER_PASSWORD # pragma: allowlist secret

# db:seed
SEED_ADMIN_USER_EMAIL=op://mdct_devs/mfp_secrets/SEED_ADMIN_USER_EMAIL
Expand Down
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

4 changes: 1 addition & 3 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ env:
es6: true
node: true
jest/globals: true
cypress/globals: true
parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
- 'jest'
- 'cypress'
parserOptions:
ecmaVersion: 6
sourceType: module
Expand All @@ -30,4 +28,4 @@ rules:
no-extra-semi: error
multiline-comment-style:
- error
- starred-block
- starred-block
1 change: 0 additions & 1 deletion .github/workflows/audit-account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
with:
path: |
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }}
- name: set path
run: |
Expand Down
89 changes: 6 additions & 83 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
with:
path: |
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }}
- name: set path
run: |
Expand Down Expand Up @@ -92,7 +91,6 @@ jobs:
with:
path: |
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }}
- name: set path
run: |
Expand Down Expand Up @@ -202,83 +200,11 @@ jobs:
ipset_name: ${{ steps.fetch-ip-set-info.outputs.IPSET_NAME }}
ipset_id: ${{ steps.fetch-ip-set-info.outputs.IPSET_ID }}

e2e-test:
name: E2E Integration Tests
needs:
- deploy
- register-runner
if: ${{ always() && !cancelled() && needs.deploy.result == 'success' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Cypress Tests
uses: cypress-io/github-action@v6
with:
working-directory: tests
spec: |
cypress/e2e/wp/*.cy.js
cypress/e2e/sar/*.cy.js
cypress/e2e/*.cy.js
browser: chrome
config: baseUrl=${{ needs.deploy.outputs.application_endpoint }}
wait-on: ${{ needs.deploy.outputs.application_endpoint }}
env: true
env:
CYPRESS_STATE_USER_EMAIL: ${{ secrets.CYPRESS_STATE_USER_EMAIL }}
CYPRESS_STATE_USER_PASSWORD: ${{ secrets.CYPRESS_STATE_USER_PASSWORD }}
CYPRESS_ADMIN_USER_EMAIL: ${{ secrets.CYPRESS_ADMIN_USER_EMAIL }}
CYPRESS_ADMIN_USER_PASSWORD: ${{ secrets.CYPRESS_ADMIN_USER_PASSWORD }}
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-test-results
path: |
${{github.workspace}}/tests/screenshots/
${{github.workspace}}/tests/videos/
retention-days: 14

a11y-tests:
name: E2E A11y Tests
needs:
- deploy
- register-runner
if: ${{ always() && !cancelled() && needs.deploy.result == 'success' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Project A11y
uses: cypress-io/github-action@v6
with:
working-directory: tests
spec: cypress/e2e/accessibility/*.cy.js
browser: chrome
config: baseUrl=${{ needs.deploy.outputs.application_endpoint }}
wait-on: ${{ needs.deploy.outputs.application_endpoint }}
env: true
env:
CYPRESS_STATE_USER_EMAIL: ${{ secrets.CYPRESS_STATE_USER_EMAIL }}
CYPRESS_STATE_USER_PASSWORD: ${{ secrets.CYPRESS_STATE_USER_PASSWORD }}
CYPRESS_ADMIN_USER_EMAIL: ${{ secrets.CYPRESS_ADMIN_USER_EMAIL }}
CYPRESS_ADMIN_USER_PASSWORD: ${{ secrets.CYPRESS_ADMIN_USER_PASSWORD }}
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: a11y-test-results
path: |
${{github.workspace}}/tests/screenshots/
${{github.workspace}}/tests/videos/
retention-days: 14


test:
name: Playwright Tests
needs:
- deploy
- register-runner
- e2e-test
- a11y-tests
if: ${{ always() && !cancelled() && needs.deploy.result == 'success' && github.ref_name != 'production' }}
timeout-minutes: 60
runs-on: ubuntu-latest
Expand All @@ -301,10 +227,10 @@ jobs:
continue-on-error: true
env:
BASE_URL: ${{ needs.deploy.outputs.application_endpoint }}
CYPRESS_STATE_USER_EMAIL: ${{ secrets.CYPRESS_STATE_USER_EMAIL }}
CYPRESS_STATE_USER_PASSWORD: ${{ secrets.CYPRESS_STATE_USER_PASSWORD }}
CYPRESS_ADMIN_USER_EMAIL: ${{ secrets.CYPRESS_ADMIN_USER_EMAIL }}
CYPRESS_ADMIN_USER_PASSWORD: ${{ secrets.CYPRESS_ADMIN_USER_PASSWORD }}
E2E_STATE_USER_EMAIL: ${{ secrets.E2E_STATE_USER_EMAIL }}
JonHolman marked this conversation as resolved.
Show resolved Hide resolved
E2E_STATE_USER_PASSWORD: ${{ secrets.E2E_STATE_USER_PASSWORD }}
E2E_ADMIN_USER_EMAIL: ${{ secrets.E2E_ADMIN_USER_EMAIL }}
E2E_ADMIN_USER_PASSWORD: ${{ secrets.E2E_ADMIN_USER_PASSWORD }}
SEED_ADMIN_USER_EMAIL: ${{ secrets.SEED_ADMIN_USER_EMAIL }}
SEED_ADMIN_USER_PASSWORD: ${{ secrets.SEED_ADMIN_USER_PASSWORD }}
SEED_STATE_USER_EMAIL: ${{ secrets.SEED_STATE_USER_EMAIL }}
Expand Down Expand Up @@ -348,10 +274,10 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./downloaded-html-report # publish downloaded dir to github pages
destination_dir: ${{ steps.timestampid.outputs.timestamp }}
# need to extract just org name for reassembling the github pages URL
# need to extract just org name for reassembling the github pages URL
- name: Extract Organization Name
id: extract-org
run: |
run: |
echo "ORG_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)" >> $GITHUB_ENV
echo "org name: ${ORG_NAME}"
# need to extract just the repo name for reassembling the github pages URL
Expand All @@ -366,15 +292,12 @@ jobs:
echo "## Playwright Test Results" >> $GITHUB_STEP_SUMMARY
echo "https://${ORG_NAME}.github.io/${REPO_NAME}/${{ steps.timestampid.outputs.timestamp }}/" >> $GITHUB_STEP_SUMMARY


cleanup:
name: Delist GHA Runner CIDR Blocks
if: ${{ github.ref_name != 'main' && github.ref_name != 'val' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
needs:
- register-runner
- a11y-tests
- e2e-test
- test
env:
SLS_DEPRECATION_DISABLE: "*" # Turn off deprecation warnings in the pipeline
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ services/uploads/local_buckets
/.env
tests_output
*.log
tests/cypress/videos
tests/cypress/screenshots
tests/cypress/downloads
tests/cypress/package-lock.json
package-lock.json
.vscode/
*._S3rver_cors.xml
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ repos:
- "@typescript-eslint/parser"
- "@typescript-eslint/eslint-plugin"
- "eslint-plugin-jest"
- "eslint-plugin-cypress"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.1
hooks:
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,12 @@ Live reload all tests
yarn test --watch
```

### Integration Testing

We use Cypress for integration tests. See additional info [here in the Cypress readme](./tests/cypress/README.md)

### Accessibility Testing

We use [axe](https://www.deque.com/axe/) and [pa11y](https://github.com/pa11y/pa11y) for primary accessibility testing.

Unit tests can use [jest-axe](https://github.com/nickcolley/jest-axe), [pa11y](https://github.com/pa11y/pa11y), and [HTML Code Sniffer](https://squizlabs.github.io/HTML_CodeSniffer/).

Integration tests can use [cypress-axe](https://github.com/component-driven/cypress-axe) and [cypress-audit/pa11y](https://mfrachet.github.io/cypress-audit/guides/pa11y/installation.html).

### Prettier and ESLint

We use Prettier to format all code. This runs as part of a Git Hook and invalid formats in changed files will cause the deploy to fail. If you followed the instructions above this is already installed and configured.
Expand All @@ -158,8 +152,6 @@ ESLint works in a similar manner for all code linting.

On a push to the repository or opening a pull request the [deploy.yml](https://github.com/Enterprise-CMCS/macpro-mdct-mfp/blob/main/.github/workflows/deploy.yml) file runs. This script sets up and does a number of things. For a simple push it's mostly checking code coverage.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice to have would just be something that explains that playwright exists and is used in this repo. That said, it's beyond the scope of the ticket so take it or leave it.

Upon opening a pull request into the main branch the scripts will also trigger a Cypress E2E and an A11y step to ensure that the code quality is still passing the End-to-End and accessibility tests.

## Deployments

This application is built and deployed via GitHub Actions.
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
},
"scripts": {
"db:seed": "cd services/app-api && yarn run db:seed",
"test": "cd tests/cypress && npm test && cd -",
"test:ci": "cd tests/cypress && yarn run test:ci",
"test:e2e": "playwright test",
"test:e2e-ui": "playwright test --ui"
},
Expand Down Expand Up @@ -43,8 +41,6 @@
"dotenv": "^8.2.0",
"eslint": "^8.33.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.x",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-jsx-a11y": "^6.x",
"eslint-plugin-react": "^7.24.0",
Expand Down
12 changes: 6 additions & 6 deletions services/ui-auth/libs/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@
]
},
{
"username": "cypressadminuser@test.com",
"username": "e2eadminuser@test.com",
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess these get fixed when we deploy again so that the dynamo tables have them in there? Pardon my ignorance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I know on new environments the create users bootstrap function will create the users based on this file, but I'm not sure about when we update an existing environment. I'll have to check after we merge to main. I'm expecting we may need to trigger the bootstrap users function manually.

"attributes": [
{
"Name": "email",
"Value": "cypressadminuser@test.com"
"Value": "e2eadminuser@test.com"
},
{
"Name": "given_name",
"Value": "CypressAutomatedIntegrationTests"
"Value": "E2EAutomatedIntegrationTests"
},
{
"Name": "family_name",
Expand All @@ -328,15 +328,15 @@
]
},
{
"username": "cypressstateuser@test.com",
"username": "e2estateuser@test.com",
"attributes": [
{
"Name": "email",
"Value": "cypressstateuser@test.com"
"Value": "e2estateuser@test.com"
},
{
"Name": "given_name",
"Value": "CypressAutomatedIntegrationTests"
"Value": "E2EAutomatedIntegrationTests"
},
{
"Name": "family_name",
Expand Down
38 changes: 0 additions & 38 deletions tests/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions tests/cypress.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions tests/cypress/e2e/accessibility/admin.cy.js

This file was deleted.

Loading
Loading