Skip to content

Commit

Permalink
Merge branch 'safe-global:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dargon789 authored Nov 16, 2024
2 parents 22894b4 + 35decc8 commit 46d83dc
Show file tree
Hide file tree
Showing 32 changed files with 548 additions and 219 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/e2e-full-ondemand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Full Regression on demand tests

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1-5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-20.04
timeout-minutes: 40
name: Cypress Full Regression on demand tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/cypress
with:
secrets: ${{ toJSON(secrets) }}
spec: |
cypress/e2e/happypath_2/*.cy.js
cypress/e2e/regression/*.cy.js
cypress/e2e/safe-apps/*.cy.js
cypress/e2e/smoke/*.cy.js
group: 'Full Regression on demand tests'
tag: 'full_regression'

- name: Python setup
if: always()
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install junitparser
if: always()
run: |
pip install junitparser
- name: Merge JUnit reports for TestRail
if: always()
run: |
junitparser merge --suite-name "Root Suite" --glob "reports/junit-*" "reports/junit-report.xml"
- name: TestRail CLI upload results
if: always()
run: |
pip install trcli
if ! trcli -y \
-h https://gno.testrail.io/ \
--project "Safe- Web App" \
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Full Regression Automated Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"; then
echo -e "\e[41;32mTestRail upload failed. Pipeline will continue, please check the upload process.\e[0m"
fi
2 changes: 1 addition & 1 deletion .github/workflows/e2e-hp-ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ jobs:
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Happy path Tests, branch: ${GITHUB_REF_NAME}" \
--title "Happy Path Automated Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"
4 changes: 1 addition & 3 deletions .github/workflows/e2e-ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Regression on demand tests

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1-5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -57,7 +55,7 @@ jobs:
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Automated Tests, branch: ${GITHUB_REF_NAME}" \
--title "Regression Automated Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"; then
echo -e "\e[41;32mTestRail upload failed. Pipeline will continue, please check the upload process.\e[0m"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-prod-ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Automated Tests, branch: ${GITHUB_REF_NAME}" \
--title "Production Health Checks Automated Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"; then
echo -e "\e[41;32mTestRail upload failed. Pipeline will continue, please check the upload process.\e[0m"
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/e2e-regression.yml

This file was deleted.

100 changes: 100 additions & 0 deletions cypress/e2e/happypath_2/add_owner.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as owner from '../pages/owners.pages'
import * as addressBook from '../pages/address_book.page'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as createTx from '../pages/create_tx.pages.js'
import * as navigation from '../pages/navigation.page'
import { getEvents, events, checkDataLayerEvents } from '../../support/utils/gtag.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_1_PRIVATE_KEY

describe('Happy path Add Owners tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_4)
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

it(
'Verify creation, confirmation and deletion of Add owner tx. GA tx_confirm',
{ defaultCommandTimeout: 30000 },
() => {
const tx_confirmed = [
{
eventLabel: events.txConfirmedAddOwner.eventLabel,
eventCategory: events.txConfirmedAddOwner.category,
eventType: events.txConfirmedAddOwner.eventType,
safeAddress: staticSafes.SEP_STATIC_SAFE_24.slice(6),
},
]
function step1() {
// Clean txs in the queue
cy.visit(constants.transactionQueueUrl + staticSafes.SEP_STATIC_SAFE_24)
wallet.connectSigner(signer2)
cy.wait(5000)
createTx.deleteAllTx()
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()

cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_24)
wallet.connectSigner(signer2)
owner.waitForConnectionStatus()
owner.openAddOwnerWindow()
owner.typeOwnerAddress(constants.SEPOLIA_OWNER_2)
createTx.changeNonce(1)
owner.clickOnNextBtn()
createTx.clickOnSignTransactionBtn()
createTx.clickViewTransaction()

navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
wallet.connectSigner(signer)
}

function step2() {
createTx.clickOnConfirmTransactionBtn()
createTx.clickOnNoLaterOption()
createTx.clickOnSignTransactionBtn()

navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
getEvents()
checkDataLayerEvents(tx_confirmed)
wallet.connectSigner(signer2)
createTx.deleteTx()
}

step1()
cy.get('body').then(($body) => {
if ($body.find(`button:contains("${createTx.executeStr}")`).length > 0) {
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
wallet.connectSigner(signer2)
createTx.deleteTx()
cy.wait(5000)
step1()
step2()
} else {
createTx.clickOnConfirmTransactionBtn()
createTx.clickOnNoLaterOption()
createTx.clickOnSignTransactionBtn()

navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
getEvents()
checkDataLayerEvents(tx_confirmed)
wallet.connectSigner(signer2)
createTx.deleteTx()
}
})
},
)
})
50 changes: 50 additions & 0 deletions cypress/e2e/happypath_2/multichain_create_safe.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as createwallet from '../pages/create_wallet.pages'
import * as createtx from '../pages/create_tx.pages.js'
import * as tx from '../pages/transactions.page.js'
import * as owner from '../pages/owners.pages'
import * as navigation from '../pages/navigation.page.js'

let staticSafes = []

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Happy path Multichain safe creation tests', { defaultCommandTimeout: 60000 }, () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.welcomeUrl + '?chain=sep')
cy.wait(2000)
wallet.connectSigner(signer)
})

it('Verify that L2 safe created during multichain safe creation has 1.4.1 L2 contract after deployment', () => {
createwallet.clickOnContinueWithWalletBtn()
createwallet.clickOnCreateNewSafeBtn()
createwallet.clickOnNetwrokRemoveIcon()
createwallet.selectMultiNetwork(1, constants.networks.ethereum.toLowerCase())
createwallet.selectMultiNetwork(1, constants.networks.sepolia.toLowerCase())
createwallet.selectMultiNetwork(1, constants.networks.polygon.toLowerCase())
createwallet.clickOnNextBtn()
createwallet.clickOnNextBtn()
createwallet.clickOnReviewStepNextBtn()
createwallet.clickOnLetsGoBtn()

cy.url().then((currentUrl) => {
const safe = `sep:${main.getSafeAddressFromUrl(currentUrl)}`
cy.visit(constants.homeUrl + safe)
createwallet.clickOnActivateAccountBtn(0)
createwallet.selectRelayOption()
createwallet.clickOnFinalActivateAccountBtn()
createwallet.clickOnLetsGoBtn()
cy.visit(constants.setupUrl + safe)
main.verifyValuesExist(navigation.setupSection, [constants.safeContractVersions.v1_4_1_L2])
})
})
})
99 changes: 99 additions & 0 deletions cypress/e2e/happypath_2/swaps.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import * as swaps from '../pages/swaps.pages.js'
import * as tx from '../pages/transactions.page.js'
import * as create_tx from '../pages/create_tx.pages.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as owner from '../pages/owners.pages'
import * as wallet from '../../support/utils/wallet.js'
import * as swaps_data from '../../fixtures/swaps_data.json'
import * as navigation from '../pages/navigation.page'
import { getEvents, events, checkDataLayerEvents } from '../../support/utils/gtag.js'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_3_WALLET_ADDRESS
const signer3 = walletCredentials.OWNER_1_PRIVATE_KEY

let staticSafes = []

let iframeSelector

const swapOrder = swaps_data.type.orderDetails

describe('Happy path Swaps tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.swapUrl + staticSafes.SEP_STATIC_SAFE_1)
main.waitForHistoryCallToComplete()
wallet.connectSigner(signer)
iframeSelector = `iframe[src*="${constants.swapWidget}"]`
})

it(
'Verify an order can be created, signed by second signer and deleted. GA tx_confirm, tx_created',
{ defaultCommandTimeout: 30000 },
() => {
const tx_created = [
{
eventLabel: events.txCreatedSwap.eventLabel,
eventCategory: events.txCreatedSwap.category,
eventType: events.txCreatedSwap.eventType,
safeAddress: staticSafes.SEP_STATIC_SAFE_30.slice(6),
},
]
const tx_confirmed = [
{
eventLabel: events.txConfirmedSwap.eventLabel,
eventCategory: events.txConfirmedSwap.category,
eventType: events.txConfirmedSwap.eventType,
safeAddress: staticSafes.SEP_STATIC_SAFE_30.slice(6),
},
]
// Clean txs in the queue
cy.visit(constants.transactionQueueUrl + staticSafes.SEP_STATIC_SAFE_30)
cy.wait(5000)
create_tx.deleteAllTx()

cy.visit(constants.swapUrl + staticSafes.SEP_STATIC_SAFE_30)
swaps.acceptLegalDisclaimer()
cy.wait(4000)
main.getIframeBody(iframeSelector).within(() => {
swaps.clickOnSettingsBtn()
swaps.setSlippage('0.30')
swaps.setExpiry('2')
swaps.clickOnSettingsBtn()
swaps.selectInputCurrency(swaps.swapTokens.cow)
swaps.setInputValue(200)
swaps.selectOutputCurrency(swaps.swapTokens.dai)
swaps.clickOnExceeFeeChkbox()
swaps.clickOnSwapBtn()
swaps.clickOnSwapBtn()
})
create_tx.changeNonce(0)
create_tx.clickOnSignTransactionBtn()
create_tx.clickViewTransaction()
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
wallet.connectSigner(signer3)

cy.wait(5000)
create_tx.verifyConfirmTransactionBtnIsVisible()
create_tx.clickOnConfirmTransactionBtn()
create_tx.clickOnNoLaterOption()

create_tx.clickOnSignTransactionBtn()
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
wallet.connectSigner(signer)
create_tx.deleteTx()

getEvents()
checkDataLayerEvents(tx_created)
checkDataLayerEvents(tx_confirmed)
},
)
})
1 change: 1 addition & 0 deletions cypress/e2e/pages/create_tx.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const gasLimitInput = '[name="gasLimit"]'
const rotateLeftIcon = '[data-testid="RotateLeftIcon"]'
export const transactionItem = '[data-testid="transaction-item"]'
export const connectedWalletExecMethod = '[data-testid="connected-wallet-execution-method"]'
export const relayExecMethod = '[data-testid="relay-execution-method"]'
export const payNowExecMethod = '[data-testid="pay-now-execution-method"]'
const addToBatchBtn = '[data-track="batching: Add to batch"]'
const accordionDetails = '[data-testid="accordion-details"]'
Expand Down
Loading

0 comments on commit 46d83dc

Please sign in to comment.