From 5a43ee6f763bb316660e8bbd1837b955b7beaa9a Mon Sep 17 00:00:00 2001 From: mike10ca Date: Sun, 19 Nov 2023 18:02:58 +0100 Subject: [PATCH] Update workflows. Add test ids --- .github/workflows/ondemand.yml | 45 +++++++++++++++++++ .github/workflows/regression.yml | 9 ++-- .github/workflows/{e2e.yml => smoke.yml} | 2 +- cypress/e2e/pages/create_wallet.pages.js | 7 ++- cypress/e2e/pages/main.page.js | 6 +++ .../e2e/regression/create_safe_simple.cy.js | 23 +++++----- cypress/e2e/regression/remove_owner.cy.js | 12 ++--- cypress/e2e/smoke/create_safe_simple.cy.js | 5 ++- cypress/e2e/smoke/remove_owner.cy.js | 3 +- cypress/support/constants.js | 1 + .../create/steps/OwnerPolicyStep/index.tsx | 4 +- .../create/steps/ReviewStep/index.tsx | 2 +- .../create/steps/SetNameStep/index.tsx | 4 +- .../flows/RemoveOwner/SetThreshold.tsx | 2 +- 14 files changed, 92 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/ondemand.yml rename .github/workflows/{e2e.yml => smoke.yml} (98%) diff --git a/.github/workflows/ondemand.yml b/.github/workflows/ondemand.yml new file mode 100644 index 0000000000..77fd680078 --- /dev/null +++ b/.github/workflows/ondemand.yml @@ -0,0 +1,45 @@ +name: Regression on demand tests + +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + e2e: + runs-on: ubuntu-20.04 + name: Cypress Regression on demand tests + strategy: + fail-fast: false + matrix: + containers: [1, 2, 3, 4, 5] + steps: + - uses: actions/checkout@v3 + + - uses: ./.github/workflows/yarn + + - name: Install Cypress + run: | + ./node_modules/.bin/cypress install + + - uses: ./.github/workflows/build + with: + secrets: ${{ toJSON(secrets) }} + e2e_mnemonic: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }} + + - name: Serve + run: yarn serve & + + - uses: cypress-io/github-action@v4 + with: + parallel: true + spec: cypress/e2e/**/*.cy.js + browser: chrome + record: true + config: baseUrl=http://localhost:8080 + group: 'Regression on demand tests' + env: + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 1ac97622df..25439e4b25 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -1,7 +1,10 @@ -name: regression +name: Regression tests on: - workflow_dispatch: + pull_request: + branches: + - 'release**' + - 'release/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -35,7 +38,7 @@ jobs: - uses: cypress-io/github-action@v4 with: parallel: true - spec: cypress/e2e/regression/*.cy.js + spec: cypress/e2e/**/*.cy.js browser: chrome record: true config: baseUrl=http://localhost:8080 diff --git a/.github/workflows/e2e.yml b/.github/workflows/smoke.yml similarity index 98% rename from .github/workflows/e2e.yml rename to .github/workflows/smoke.yml index ff6212b5c6..d2d0ff5acc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/smoke.yml @@ -1,4 +1,4 @@ -name: e2e +name: Smoke tests on: pull_request: diff --git a/cypress/e2e/pages/create_wallet.pages.js b/cypress/e2e/pages/create_wallet.pages.js index 48627a111f..38ff86234e 100644 --- a/cypress/e2e/pages/create_wallet.pages.js +++ b/cypress/e2e/pages/create_wallet.pages.js @@ -21,6 +21,8 @@ const safeCreationStatusInfo = '[data-testid="safe-status-info"]' const startUsingSafeBtn = '[data-testid="start-using-safe-btn"]' const sponsorIcon = '[data-testid="sponsor-icon"]' const networkFeeSection = '[data-tetid="network-fee-section"]' +const nextBtn = '[data-testid="next-btn"]' +const backBtn = '[data-testid="back-btn"]' const sponsorStr = 'Your account is sponsored by Goerli' const safeCreationProcessing = 'Transaction is being executed' @@ -32,6 +34,9 @@ export const walletName = 'test1-sepolia-safe' export const defaltSepoliaPlaceholder = 'Sepolia Safe' const welcomeToSafeStr = 'Welcome to Safe' +export function clickOnBackBtn() { + cy.get(backBtn).should('be.enabled').click() +} export function verifySafeIsBeingCreated() { cy.get(safeCreationStatusInfo).should('have.text', safeCreationProcessing) } @@ -128,7 +133,7 @@ export function selectNetwork(network, regex = false) { } export function clickOnNextBtn() { - cy.contains('button', 'Next').click() + cy.get(nextBtn).should('be.enabled').click() } export function verifyOwnerName(name, index) { diff --git a/cypress/e2e/pages/main.page.js b/cypress/e2e/pages/main.page.js index d3649fd244..5cd87d4d05 100644 --- a/cypress/e2e/pages/main.page.js +++ b/cypress/e2e/pages/main.page.js @@ -15,6 +15,12 @@ export function waitForTrnsactionHistoryToComplete() { cy.intercept('GET', constants.transactionHistoryEndpoint).as('History') cy.wait('@History') } + +export function waitForSafeListRequestToComplete() { + cy.intercept('GET', constants.safeListEndpoint).as('Safes') + cy.wait('@Safes') +} + export function acceptCookies(index = 0) { cy.wait(1000) diff --git a/cypress/e2e/regression/create_safe_simple.cy.js b/cypress/e2e/regression/create_safe_simple.cy.js index c723dd9002..f8627e89d9 100644 --- a/cypress/e2e/regression/create_safe_simple.cy.js +++ b/cypress/e2e/regression/create_safe_simple.cy.js @@ -6,6 +6,7 @@ import * as owner from '../pages/owners.pages' describe('Safe creation tests', () => { beforeEach(() => { cy.visit(constants.welcomeUrl + '?chain=sep') + main.waitForSafeListRequestToComplete() cy.clearLocalStorage() main.acceptCookies() }) @@ -41,7 +42,7 @@ describe('Safe creation tests', () => { it('Verify current connected account is shown as default owner', () => { owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() owner.verifyExistingOwnerAddress(0, constants.DEFAULT_OWNER_ADDRESS) }) @@ -65,26 +66,26 @@ describe('Safe creation tests', () => { const ownerName = 'David' owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.clickOnAddNewOwnerBtn() createwallet.typeOwnerName(ownerName, 1) createwallet.typeOwnerAddress(constants.SEPOLIA_OWNER_2, 1) - owner.clickOnBackBtn() + createwallet.clickOnBackBtn() createwallet.clearWalletName() createwallet.typeWalletName(createwallet.walletName) - owner.clickOnNextBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.verifySafeNameInSummaryStep(createwallet.walletName) createwallet.verifyOwnerNameInSummaryStep(ownerName) createwallet.verifyOwnerAddressInSummaryStep(constants.DEFAULT_OWNER_ADDRESS) createwallet.verifyOwnerAddressInSummaryStep(constants.DEFAULT_OWNER_ADDRESS) createwallet.verifyThresholdStringInSummaryStep(1, 2) createwallet.verifyNetworkInSummaryStep(constants.networks.sepolia) - owner.clickOnBackBtn() - owner.clickOnBackBtn() + createwallet.clickOnBackBtn() + createwallet.clickOnBackBtn() cy.wait(1000) - owner.clickOnNextBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.verifySafeNameInSummaryStep(createwallet.walletName) createwallet.verifyOwnerNameInSummaryStep(ownerName) createwallet.verifyOwnerAddressInSummaryStep(constants.DEFAULT_OWNER_ADDRESS) @@ -97,7 +98,7 @@ describe('Safe creation tests', () => { it('Verify tip is displayed on right side for threshold 1/1', () => { owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.verifyPolicy1_1() }) @@ -105,7 +106,7 @@ describe('Safe creation tests', () => { it('Verify address input validation rules', () => { owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.clickOnAddNewOwnerBtn() createwallet.typeOwnerAddress(main.generateRandomString(10), 1) owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.invalidFormat) diff --git a/cypress/e2e/regression/remove_owner.cy.js b/cypress/e2e/regression/remove_owner.cy.js index 4eb420e451..84758dc45a 100644 --- a/cypress/e2e/regression/remove_owner.cy.js +++ b/cypress/e2e/regression/remove_owner.cy.js @@ -4,40 +4,36 @@ import * as owner from '../pages/owners.pages' describe('Remove Owners tests', () => { beforeEach(() => { - cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_1) + cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) + main.waitForTrnsactionHistoryToComplete() cy.clearLocalStorage() main.acceptCookies() + owner.waitForConnectionStatus() cy.contains(owner.safeAccountNonceStr, { timeout: 10000 }) }) it('Verify that "Remove" icon is visible', () => { - cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) owner.verifyRemoveBtnIsEnabled().should('have.length', 2) }) it('Verify Tooltip displays correct message for Non-Owner', () => { cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_4) + main.waitForTrnsactionHistoryToComplete() owner.waitForConnectionStatus() owner.verifyRemoveBtnIsDisabled() }) it('Verify Tooltip displays correct message for disconnected user', () => { - cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) - owner.waitForConnectionStatus() owner.clickOnWalletExpandMoreIcon() owner.clickOnDisconnectBtn() owner.verifyRemoveBtnIsDisabled() }) it('Verify owner removal form can be opened', () => { - cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) - owner.waitForConnectionStatus() owner.openRemoveOwnerWindow(1) }) it('Verify threshold input displays the upper limit as the current safe number of owners minus one', () => { - cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) - owner.waitForConnectionStatus() owner.openRemoveOwnerWindow(1) owner.verifyThresholdLimit(1, 1) owner.getThresholdOptions().should('have.length', 1) diff --git a/cypress/e2e/smoke/create_safe_simple.cy.js b/cypress/e2e/smoke/create_safe_simple.cy.js index 72cb7263fd..3578417fce 100644 --- a/cypress/e2e/smoke/create_safe_simple.cy.js +++ b/cypress/e2e/smoke/create_safe_simple.cy.js @@ -6,6 +6,7 @@ import * as owner from '../pages/owners.pages' describe('[SMOKE] Safe creation tests', () => { beforeEach(() => { cy.visit(constants.welcomeUrl + '?chain=sep') + main.waitForSafeListRequestToComplete() cy.clearLocalStorage() main.acceptCookies() }) @@ -26,7 +27,7 @@ describe('[SMOKE] Safe creation tests', () => { it('[SMOKE] Verify Add and Remove Owner Row works as expected', () => { owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.clickOnAddNewOwnerBtn() owner.verifyNumberOfOwners(2) owner.verifyExistingOwnerAddress(1, '') @@ -40,7 +41,7 @@ describe('[SMOKE] Safe creation tests', () => { it('[SMOKE] Verify Threshold Setup', () => { owner.waitForConnectionStatus() createwallet.clickOnCreateNewSafeBtn() - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() createwallet.clickOnAddNewOwnerBtn() createwallet.clickOnAddNewOwnerBtn() owner.verifyNumberOfOwners(3) diff --git a/cypress/e2e/smoke/remove_owner.cy.js b/cypress/e2e/smoke/remove_owner.cy.js index 5d3e287b81..d6127941ce 100644 --- a/cypress/e2e/smoke/remove_owner.cy.js +++ b/cypress/e2e/smoke/remove_owner.cy.js @@ -1,6 +1,7 @@ import * as constants from '../../support/constants' import * as main from '../../e2e/pages/main.page' import * as owner from '../pages/owners.pages' +import * as createwallet from '../pages/create_wallet.pages' describe('[SMOKE] Remove Owners tests', () => { beforeEach(() => { @@ -15,7 +16,7 @@ describe('[SMOKE] Remove Owners tests', () => { cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3) owner.waitForConnectionStatus() owner.openRemoveOwnerWindow(1) - owner.clickOnNextBtn() + createwallet.clickOnNextBtn() owner.verifyOwnerDeletionWindowDisplayed() }) }) diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 8bdeebd591..a518c1c918 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -62,6 +62,7 @@ export const validAppUrl = 'https://my-valid-custom-app.com' export const proposeEndpoint = '/**/propose' export const appsEndpoint = '/**/safe-apps' export const transactionHistoryEndpoint = '**/history' +export const safeListEndpoint = '**/safes' export const mainSideMenuOptions = { home: 'Home', diff --git a/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx b/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx index 81ee517a65..c60486b05c 100644 --- a/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx +++ b/src/components/new-safe/create/steps/OwnerPolicyStep/index.tsx @@ -170,10 +170,10 @@ const OwnerPolicyStep = ({ - - diff --git a/src/components/new-safe/create/steps/ReviewStep/index.tsx b/src/components/new-safe/create/steps/ReviewStep/index.tsx index febd0bbdbd..e9b8afc372 100644 --- a/src/components/new-safe/create/steps/ReviewStep/index.tsx +++ b/src/components/new-safe/create/steps/ReviewStep/index.tsx @@ -250,7 +250,7 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps - diff --git a/src/components/tx-flow/flows/RemoveOwner/SetThreshold.tsx b/src/components/tx-flow/flows/RemoveOwner/SetThreshold.tsx index 942fbdc0ae..71b125efef 100644 --- a/src/components/tx-flow/flows/RemoveOwner/SetThreshold.tsx +++ b/src/components/tx-flow/flows/RemoveOwner/SetThreshold.tsx @@ -82,7 +82,7 @@ export const SetThreshold = ({ -