Skip to content

Commit

Permalink
Update tests logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca committed Oct 31, 2023
1 parent 21f2707 commit de8a9c9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
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
8 changes: 2 additions & 6 deletions cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ export function verifyNoAppsTextPresent() {
}

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
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 @@ -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]', () => {
it.only('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
6 changes: 2 additions & 4 deletions cypress/e2e/smoke/remove_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ describe('Remove Owners tests', () => {
it('Verify Tooltip displays correct message for Non-Owner [C56037]', () => {
cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_4)
owner.waitForConnectionStatus()
owner.hoverOverDeleteOwnerBtn(0)
owner.verifyTooltipLabel(owner.nonOwnerErrorMsg)
owner.verifyRemoveBtnIsDisabled()
})

it('Verify Tooltip displays correct message for disconnected user [C56031]', () => {
cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_3)
owner.waitForConnectionStatus()
owner.clickOnWalletExpandMoreIcon()
owner.clickOnDisconnectBtn()
owner.hoverOverDeleteOwnerBtn(0)
owner.verifyTooltipLabel(owner.disconnectedUserErrorMsg)
owner.verifyRemoveBtnIsDisabled()
})

it('Verify owner removal form can be opened [C56032]', () => {
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/smoke/replace_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ describe('Replace Owners tests', () => {
it('Verify Tooltip displays correct message for Non-Owner [C56016]', () => {
cy.visit(constants.setupUrl + constants.SEPOLIA_TEST_SAFE_2)
owner.waitForConnectionStatus()
owner.hoverOverReplaceOwnerBtn()
owner.verifyTooltipLabel(owner.nonOwnerErrorMsg)
owner.verifyReplaceBtnIsDisabled()
})

it('Verify Tooltip displays correct message for disconnected user [C56006]', () => {
owner.waitForConnectionStatus()
owner.clickOnWalletExpandMoreIcon()
owner.clickOnDisconnectBtn()
owner.hoverOverReplaceOwnerBtn()
owner.verifyTooltipLabel(owner.disconnectedUserErrorMsg)
owner.verifyReplaceBtnIsDisabled()
})

it('Verify that the owner replacement form is opened [C56007]', () => {
Expand Down

0 comments on commit de8a9c9

Please sign in to comment.