Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/web3authcoresdk' into qa-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Nov 1, 2023
2 parents 8959da8 + ec5b97c commit 8a40409
Show file tree
Hide file tree
Showing 29 changed files with 156 additions and 272 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/pages/balances.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const tokenListOptions = {
export const currencyEUR = 'EUR'
export const currencyUSD = 'USD'

export const currentcySepoliaFormat = '0.1 ETH'
export const currentcySepoliaFormat = '0.09996 ETH'

export const currencyAave = 'AAVE'
export const currencyAaveAlttext = 'AAVE'
Expand Down
8 changes: 6 additions & 2 deletions cypress/e2e/pages/batches.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,19 @@ function addToBatchButton() {
export function openBatchtransactionsModal() {
cy.get(batchTxTopBar).should('be.visible').click()
cy.contains(batchedTransactionsStr).should('be.visible')
cy.contains(addInitialTransactionStr)
}

export function openNewTransactionModal() {
cy.get(addNewTxBatch).click()
cy.contains('h1', newTransactionTitle).should('be.visible')
cy.contains(sendTokensButn).click()
}

export function addNewTransactionToBatch(EOA, currentNonce, funds_first_tx) {
openBatchtransactionsModal()
openNewTransactionModal()
addToBatch(EOA, currentNonce, funds_first_tx)
}

export function verifyAmountTransactionsInBatch(count) {
cy.contains(batchedTransactionsStr, { timeout: 7000 })
.should('be.visible')
Expand Down
10 changes: 2 additions & 8 deletions cypress/e2e/pages/create_wallet.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,9 @@ export function clearWalletName() {

export function selectNetwork(network, regex = false) {
cy.wait(1000)
cy.get(selectNetworkBtn).should('exist').click()
cy.get(selectNetworkBtn).should('be.visible').click()
cy.wait(1000)
cy.get('li').contains(network).click()

if (regex) {
regex = constants.networks.goerli
cy.get(selectNetworkBtn).click().invoke('text').should('match', regex)
} else {
cy.get(selectNetworkBtn).click().should('have.text', network)
}
cy.get('body').click()
}

Expand Down
6 changes: 1 addition & 5 deletions cypress/e2e/pages/dashboard.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ export function verifyFeaturedAppsSection() {
cy.contains(transactionBuilderStr)
cy.get(txBuilder).should('exist')

// WalletConnect app
cy.contains(walletConnectStr)
cy.get(walletConnect).should('exist')

// Featured apps have a Safe-specific link
cy.get(safeSpecificLink).should('have.length', 2)
cy.get(safeSpecificLink).should('have.length', 1)
})
}

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/pages/main.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export function clickOnSideMenuItem(item) {
cy.get('p').contains(item).click()
}

export function acceptCookies() {
export function acceptCookies(index = 0) {
cy.wait(1000)

cy.findAllByText('Got it!')
.should('have.length.at.least', 0)
.should('have.length.at.least', index)
.each(($el) => $el.click())

cy.get('button')
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/pages/nfts.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export function verifyDataInTable(name, address, tokenID) {
cy.get('tbody tr:first-child').contains('td:nth-child(2)', tokenID)
}

export function openFirstNFT() {
cy.get('tbody tr:first-child td:nth-child(2)').click()
export function openNFT(index) {
cy.get('tbody').within(() => {
cy.get('tr').eq(index).click()
})
}

export function verifyNameInNFTModal(name) {
Expand Down
14 changes: 13 additions & 1 deletion cypress/e2e/pages/owners.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const copyToClipboardBtn = 'button[aria-label="Copy to clipboard"]'
const tooltipLabel = (label) => `span[aria-label="${label}"]`
const removeOwnerBtn = 'span[data-track="settings: Remove owner"] > span > button'
const replaceOwnerBtn = 'span[data-track="settings: Replace owner"] > span > button'
const addOwnerBtn = 'span[data-track="settings: Add owner"]'
const addOwnerBtn = 'span[data-track="settings: Add owner"] > button'
const tooltip = 'div[role="tooltip"]'
const expandMoreIcon = 'svg[data-testid="ExpandMoreIcon"]'
const sentinelStart = 'div[data-testid="sentinelStart"]'
Expand Down Expand Up @@ -87,6 +87,10 @@ export function verifyRemoveBtnIsEnabled() {
return cy.get(removeOwnerBtn).should('exist')
}

export function verifyRemoveBtnIsDisabled() {
return cy.get(removeOwnerBtn).should('exist').and('be.disabled')
}

export function hoverOverDeleteOwnerBtn(index) {
cy.get(removeOwnerBtn).eq(index).trigger('mouseover', { force: true })
}
Expand All @@ -110,6 +114,10 @@ export function verifyReplaceBtnIsEnabled() {
cy.get(replaceOwnerBtn).should('exist').and('not.be.disabled')
}

export function verifyReplaceBtnIsDisabled() {
cy.get(replaceOwnerBtn).should('exist').and('be.disabled')
}

export function hoverOverReplaceOwnerBtn() {
cy.get(replaceOwnerBtn).trigger('mouseover', { force: true })
}
Expand All @@ -118,6 +126,10 @@ export function verifyAddOwnerBtnIsEnabled() {
cy.get(addOwnerBtn).should('exist').and('not.be.disabled')
}

export function verifyAddOwnerBtnIsDisabled() {
cy.get(addOwnerBtn).should('exist').and('be.disabled')
}

export function hoverOverAddOwnerBtn() {
cy.get(addOwnerBtn).trigger('mouseover')
}
Expand Down
19 changes: 8 additions & 11 deletions cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const allowAllPermissions = /allow all/i
const appNotSupportedMsg = "The app doesn't support Safe App functionality"

export const pinWalletConnectStr = /pin walletconnect/i
export const transactionBuilderStr = /pin transaction builder/i
export const transactionBuilderStr = 'Transaction Builder'
export const logoWalletConnect = /logo.*walletconnect/i
export const walletConnectHeadlinePreview = /walletconnect/i
export const availableNetworksPreview = /available networks/i
export const connecttextPreview = 'Connect your Safe to any dApp that supports WalletConnect'
export const transactiobUilderHeadlinePreview = 'Transaction Builder'
export const availableNetworksPreview = 'Available networks'
export const connecttextPreview = 'Compose custom contract interactions and batch them into a single transaction'
const warningDefaultAppStr = 'The application you are trying to access is not in the default Safe Apps list'
export const localStorageItem =
'{"https://safe-test-app.com":[{"feature":"camera","status":"granted"},{"feature":"microphone","status":"denied"}]}'
Expand Down Expand Up @@ -70,20 +71,16 @@ export function verifyLinkName(name) {
}

export function clickOnApp(app) {
cy.findByRole('link', { name: app }).click()
cy.contains(app).click()
}

export function verifyNoAppsTextPresent() {
cy.contains(noAppsStr).should('exist')
}

export function pinApp(app, pin = true) {
cy.findByLabelText(app).click()
cy.wait(200)
cy.findByLabelText(app).should(($el) => {
const ariaLabel = $el.attr('aria-label')
expect(ariaLabel).to.include(pin ? 'Unpin' : 'Pin')
})
const option = pin ? 'Pin' : 'Unpin'
cy.get(`[aria-label="${option} ${app}"]`).click()
}

export function clickOnBookmarkedAppsTab() {
Expand Down Expand Up @@ -146,7 +143,7 @@ function verifyDisclaimerIsVisible() {
}

export function clickOnContinueBtn() {
return cy.findByRole('button', { name: continueBtnStr }).click()
return cy.findByRole('button', { name: continueBtnStr }).click().wait(1000)
}

export function verifyCameraCheckBoxExists() {
Expand Down
7 changes: 2 additions & 5 deletions cypress/e2e/safe-apps/apps_list.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Safe Apps tests', () => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.SEPOLIA_TEST_SAFE_4 + constants.appsUrl, { failOnStatusCode: false })
main.acceptCookies()
main.acceptCookies(1)
})

it('Verify app list can be filtered by app name [C56130]', () => {
Expand All @@ -32,15 +32,12 @@ describe('Safe Apps tests', () => {

it('Verify apps can be pinned [C56133]', () => {
safeapps.clearSearchAppInput()
safeapps.pinApp(safeapps.pinWalletConnectStr)
safeapps.pinApp(safeapps.transactionBuilderStr)
safeapps.verifyPinnedAppCount(2)
safeapps.verifyPinnedAppCount(1)
})

it('Verify apps can be unpinned [C56134]', () => {
safeapps.pinApp(safeapps.pinWalletConnectStr)
safeapps.pinApp(safeapps.transactionBuilderStr)
safeapps.pinApp(safeapps.pinWalletConnectStr, false)
safeapps.pinApp(safeapps.transactionBuilderStr, false)
safeapps.verifyPinnedAppCount(0)
})
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/safe-apps/browser_permissions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ describe('Browser permissions tests', () => {
safe_apps_permissions: ['camera', 'microphone'],
})
})
cy.visitSafeApp(`${constants.testAppUrl}/app`)
main.acceptCookies(1)
})

it('Verify a permissions slide to the user is displayed [C56137]', () => {
cy.visitSafeApp(`${constants.testAppUrl}/app`)
main.acceptCookies()
safeapps.clickOnContinueBtn()
safeapps.verifyCameraCheckBoxExists()
safeapps.verifyMicrofoneCheckBoxExists()
Expand All @@ -29,6 +29,7 @@ describe('Browser permissions tests', () => {
safeapps.clickOnContinueBtn()
safeapps.verifyWarningDefaultAppMsgIsDisplayed()
safeapps.verifyCameraCheckBoxExists()
safeapps.clickOnContinueBtn()
safeapps.clickOnContinueBtn().should(() => {
expect(window.localStorage.getItem(constants.BROWSER_PERMISSIONS_KEY)).to.eq(safeapps.localStorageItem)
})
Expand Down
8 changes: 5 additions & 3 deletions cypress/e2e/safe-apps/info_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ describe('Safe Apps info modal tests', () => {
})

it('Verify the disclaimer is displayed when a Safe App is opened [C56139]', () => {
safeapps.clickOnApp(safeapps.logoWalletConnect)
safeapps.clickOnApp(safeapps.transactionBuilderStr)
safeapps.clickOnOpenSafeAppBtn()
})

it('Verify the permissions slide is shown if the app require permissions [C56140]', () => {
// Skip tests due to changed logic
// TODO: Discuss furthers
it.skip('Verify the permissions slide is shown if the app require permissions [C56140]', () => {
safeapps.clickOnContinueBtn()
cy.wait(500) // wait for the animation to finish
safeapps.verifyCameraCheckBoxExists()
})

it('Verify the permissions and consents decision are stored when accepted [C56141]', () => {
it.skip('Verify the permissions and consents decision are stored when accepted [C56141]', () => {
safeapps.storeAndVerifyPermissions()
})
})
6 changes: 2 additions & 4 deletions cypress/e2e/safe-apps/preview_drawer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ describe('Safe Apps info modal tests', () => {
})

it('Verify the preview drawer is displayed when opening a Safe App from the app list [C56149]', () => {
safeapps.clickOnApp(safeapps.logoWalletConnect)
safeapps.clickOnApp(safeapps.transactionBuilderStr)

cy.findByRole('presentation').within(() => {
safeapps.verifyPreviewWindow(
safeapps.walletConnectHeadlinePreview,
safeapps.transactiobUilderHeadlinePreview,
safeapps.connecttextPreview,
safeapps.availableNetworksPreview,
)
safeapps.pinApp(safeapps.pinWalletConnectStr)
safeapps.pinApp(safeapps.pinWalletConnectStr, false)
safeapps.closePreviewWindow()
})
cy.findByRole('presentation').should('not.exist')
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/safe-apps/safe_permissions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import * as safeapps from '../pages/safeapps.pages'
import * as main from '../pages/main.page'

describe('Safe permissions system tests', () => {
before(() => {
cy.clearLocalStorage()
})
beforeEach(() => {
cy.clearLocalStorage()
cy.fixture('safe-app').then((html) => {
cy.intercept('GET', `${constants.testAppUrl}/*`, html)
cy.intercept('GET', `*/manifest.json`, {
Expand All @@ -19,7 +17,7 @@ describe('Safe permissions system tests', () => {

it('Verify that requesting permissions with wallet_requestPermissions shows the permissions prompt and return the permissions on accept [C56150]', () => {
cy.visitSafeApp(constants.testAppUrl + constants.requestPermissionsUrl)
main.acceptCookies()
main.acceptCookies(1)
safeapps.clickOnContinueBtn()
safeapps.verifyWarningDefaultAppMsgIsDisplayed()
safeapps.clickOnContinueBtn()
Expand Down Expand Up @@ -58,7 +56,7 @@ describe('Safe permissions system tests', () => {
})

cy.visitSafeApp(constants.testAppUrl + constants.getPermissionsUrl)
main.acceptCookies()
main.acceptCookies(1)
safeapps.clickOnContinueBtn()
safeapps.verifyWarningDefaultAppMsgIsDisplayed()
safeapps.clickOnContinueBtn()
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/smoke/add_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Add Owners tests', () => {
beforeEach(() => {
cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_1)
cy.clearLocalStorage()
main.acceptCookies()
main.acceptCookies(1)
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

Expand All @@ -17,16 +17,14 @@ describe('Add Owners tests', () => {

it('Verify “Add new owner” button tooltip displays correct message for Non-Owner [C56018]', () => {
cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_2)
owner.hoverOverAddOwnerBtn()
owner.verifyTooltiptext(owner.nonOwnerErrorMsg)
owner.verifyAddOwnerBtnIsDisabled()
})

it('Verify Tooltip displays correct message for disconnected user [C56019]', () => {
owner.waitForConnectionStatus()
owner.clickOnWalletExpandMoreIcon()
owner.clickOnDisconnectBtn()
owner.hoverOverAddOwnerBtn()
owner.verifyTooltiptext(owner.disconnectedUserErrorMsg)
owner.verifyAddOwnerBtnIsDisabled()
})

it('Verify the Add New Owner Form can be opened [C56020]', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/smoke/assets.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Assets tests', () => {
beforeEach(() => {
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
cy.clearLocalStorage()
main.acceptCookies()
main.acceptCookies(2)
})

it('Verify that the token tab is selected by default and the table is visible [C56039]', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/smoke/balances.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Balance tests', () => {
before(() => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
main.acceptCookies(2)
cy.contains('Assets')
cy.get(balances.balanceSingleRow).should('have.length.lessThan', ASSETS_LENGTH)
balances.selectTokenList(balances.tokenListOptions.allTokens)
Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/smoke/balances_pagination.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as constants from '../../support/constants'
import * as balances from '../pages/balances.pages'
import * as main from '../../e2e/pages/main.page'

const ASSETS_LENGTH = 8

Expand All @@ -8,9 +9,7 @@ describe('Balance tests', () => {
cy.clearLocalStorage()
// Open the Safe used for testing
cy.visit(constants.BALANCE_URL + constants.PAGINATION_TEST_SAFE)
cy.contains('button', 'Accept selection').click()
// Table is loaded
cy.contains('Görli Ether')
main.acceptCookies(2)

cy.contains('div', 'Default tokens').click()
cy.wait(100)
Expand Down
Loading

0 comments on commit 8a40409

Please sign in to comment.