From 7eb677d806e82888668546b19f5469ecb1df5b50 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Sat, 26 Mar 2022 12:35:44 -0700 Subject: [PATCH] Separated stateful and stateless cypress test Run both groups in parallel Readded lost changes Readded package del and removed integration folder --- .github/workflows/ci.yml | 47 +++++++++++++++++-- .../{ => stateful}/deposit.test.ts | 0 .../integration/{ => stateful}/swap.test.ts | 0 .../{ => stateful}/withdrawal.test.ts | 0 .../{ => stateless}/accountDetail.test.ts | 0 .../{ => stateless}/advancedOption.test.ts | 0 .../integration/{ => stateless}/risk.test.ts | 0 .../{ => stateless}/topMenu.test.ts | 0 package-lock.json | 1 - package.json | 4 +- 10 files changed, 46 insertions(+), 6 deletions(-) rename cypress/integration/{ => stateful}/deposit.test.ts (100%) rename cypress/integration/{ => stateful}/swap.test.ts (100%) rename cypress/integration/{ => stateful}/withdrawal.test.ts (100%) rename cypress/integration/{ => stateless}/accountDetail.test.ts (100%) rename cypress/integration/{ => stateless}/advancedOption.test.ts (100%) rename cypress/integration/{ => stateless}/risk.test.ts (100%) rename cypress/integration/{ => stateless}/topMenu.test.ts (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c88bcf706..53753ef23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: - run: npm test env: CI: true - + coverage: runs-on: ubuntu-latest steps: @@ -76,7 +76,46 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - coverage-cypress: + coverage-cypress-stateless: + runs-on: ubuntu-latest + services: + saddle-contract: + image: saddlefinance/contracts:latest + ports: + - 8545:8545 + strategy: + fail-fast: false + matrix: + # run copies of the current job in parallel + containers: [1] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: 'UI Tests - Stateless' + uses: cypress-io/github-action@v2 + with: + install: true + start: npm run cy:coveragestateless + wait-on: 'http://localhost:3000' + wait-on-timeout: 120 + browser: chrome + spec: cypress/integration/stateless/* + - run: npx nyc report --reporter=text + - uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: E2E Failures + path: | + cypress/screenshots/ + cypress/videos/ + env: + REACT_APP_NOTIFY_DAPP_ID: ${{ secrets.REACT_APP_NOTIFY_DAPP_ID }} + + coverage-cypress-stateful: env: REACT_APP_NOTIFY_DAPP_ID: ${{ secrets.REACT_APP_NOTIFY_DAPP_ID }} runs-on: ubuntu-latest @@ -94,7 +133,7 @@ jobs: # fix for forcing git to use https when pulling deps - run: 'git config --global --replace-all url."https://github.com/".insteadOf ssh://git@github.com/' - run: npm ci - - run: npm run cy:coverage + - run: npm run cy:coveragestateful env: CHOKIDAR_USEPOLLING: 1 - run: npx nyc report --reporter=text @@ -107,4 +146,4 @@ jobs: name: E2E Failures path: | cypress/screenshots/ - cypress/videos/ + cypress/videos/ \ No newline at end of file diff --git a/cypress/integration/deposit.test.ts b/cypress/integration/stateful/deposit.test.ts similarity index 100% rename from cypress/integration/deposit.test.ts rename to cypress/integration/stateful/deposit.test.ts diff --git a/cypress/integration/swap.test.ts b/cypress/integration/stateful/swap.test.ts similarity index 100% rename from cypress/integration/swap.test.ts rename to cypress/integration/stateful/swap.test.ts diff --git a/cypress/integration/withdrawal.test.ts b/cypress/integration/stateful/withdrawal.test.ts similarity index 100% rename from cypress/integration/withdrawal.test.ts rename to cypress/integration/stateful/withdrawal.test.ts diff --git a/cypress/integration/accountDetail.test.ts b/cypress/integration/stateless/accountDetail.test.ts similarity index 100% rename from cypress/integration/accountDetail.test.ts rename to cypress/integration/stateless/accountDetail.test.ts diff --git a/cypress/integration/advancedOption.test.ts b/cypress/integration/stateless/advancedOption.test.ts similarity index 100% rename from cypress/integration/advancedOption.test.ts rename to cypress/integration/stateless/advancedOption.test.ts diff --git a/cypress/integration/risk.test.ts b/cypress/integration/stateless/risk.test.ts similarity index 100% rename from cypress/integration/risk.test.ts rename to cypress/integration/stateless/risk.test.ts diff --git a/cypress/integration/topMenu.test.ts b/cypress/integration/stateless/topMenu.test.ts similarity index 100% rename from cypress/integration/topMenu.test.ts rename to cypress/integration/stateless/topMenu.test.ts diff --git a/package-lock.json b/package-lock.json index 3755971f9..b4a9a1a63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "saddle-frontend", "version": "0.1.0", "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index a0677ca92..7189fcef6 100644 --- a/package.json +++ b/package.json @@ -98,9 +98,11 @@ "build-storybook": "build-storybook -s public", "build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` react-scripts build", "bundlemon": "bundlemon --subProject no-compression --defaultCompression none && bundlemon --subProject gzip-compression --defaultCompression gzip", - "cy:coverage": "start-test 3000 'cypress run'", + "cy:coverage": "start-test 3000 'cypress run --config video=false'", "cy:open": "cypress open", "cy:run": "cypress run", + "cy:coveragestateful": "start-test 3000 'cypress run --spec ./cypress/integration/stateful/*.test.ts'", + "cy:coveragestateless": "start-test 3000 'cypress run --spec ./cypress/integration/stateless/*.test.ts'", "cy:startopen": "start-test 3000 'cypress open'", "eject": "react-scripts eject", "lint:fix": "eslint --max-warnings=0 --ext ts,tsx --fix src/ && prettier --write 'src/**/*.{ts,tsx,scss}'",