Skip to content

Commit

Permalink
Hide beamer before all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca committed Oct 7, 2024
1 parent 232c27d commit 73e2960
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING=
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION=

# Cypress wallet private keys
CYPRESS_WALLET_CREDENTIALS=
CYPRESS_WALLET_CREDENTIALS=

# Beamer keys for e2e tests
BEAMER_DATA_E2E=
3 changes: 1 addition & 2 deletions cypress/e2e/pages/batches.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ function executeTransaction() {
}

function addToBatchButton() {
cy.wait(1000)
cy.get('button').contains(addToBatchBtn).scrollIntoView().should('not.be.disabled').click()
cy.get('button').contains(addToBatchBtn).click()
}

export function openBatchtransactionsModal() {
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/safe-apps/drain_account.spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import * as safeapps from '../pages/safeapps.pages'
import * as navigation from '../pages/navigation.page'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as ls from '../../support/localstorage_data.js'
import * as wallet from '../../support/utils/wallet.js'

let safeAppSafes = []
let iframeSelector

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

describe('Drain Account tests', () => {
before(async () => {
safeAppSafes = await getSafes(CATEGORIES.safeapps)
Expand All @@ -34,15 +38,19 @@ describe('Drain Account tests', () => {
})

it('Verify drain can be created', () => {
wallet.connectSigner(signer)
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.recipientStr).type(safeAppSafes.SEP_SAFEAPP_SAFE_2)
getBody().findAllByText(safeapps.transferEverythingStr).click()
})
cy.findByRole('button', { name: safeapps.testTransfer1 })
cy.findByRole('button', { name: safeapps.nativeTransfer2 })
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
})

it('Verify partial drain can be created', () => {
wallet.connectSigner(signer)
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click()
getBody().findAllByLabelText(safeapps.selectRowChbxStr).eq(1).click()
Expand All @@ -52,6 +60,8 @@ describe('Drain Account tests', () => {
})
cy.findByRole('button', { name: safeapps.testTransfer2 })
cy.findByRole('button', { name: safeapps.nativeTransfer1 })
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
})

// TODO: ENS does not resolve
Expand Down
10 changes: 10 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import './safe-apps-commands'
const { addCompareSnapshotCommand } = require('cypress-visual-regression/dist/command')
addCompareSnapshotCommand()

const beamer = JSON.parse(Cypress.env('BEAMER_DATA_E2E'))
const productID = beamer.PRODUCT_ID

before(() => {
Cypress.on('uncaught:exception', (err, runnable) => {
return false
Expand All @@ -48,4 +51,11 @@ before(() => {
beforeEach(() => {
cy.setupInterceptors()
cy.clearAllSessionStorage()
cy.window().then((window) => {
const getDate = () => new Date().toISOString()
const beamerKey1 = `_BEAMER_FIRST_VISIT_${productID}`
const beamerKey2 = `_BEAMER_BOOSTED_ANNOUNCEMENT_DATE_${productID}`
window.localStorage.setItem(beamerKey1, getDate())
window.localStorage.setItem(beamerKey2, getDate())
})
})

0 comments on commit 73e2960

Please sign in to comment.