Skip to content

Commit

Permalink
Merge branch 'dev' into last-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh authored Nov 2, 2023
2 parents 62ba0f5 + cb5da93 commit 46eac76
Show file tree
Hide file tree
Showing 58 changed files with 356 additions and 431 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ concurrency:
jobs:
e2e:
runs-on: ubuntu-20.04
name: Smoke E2E tests
name: Cypress Smoke tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
steps:
- uses: actions/checkout@v3

Expand All @@ -30,9 +34,12 @@ jobs:

- uses: cypress-io/github-action@v4
with:
parallel: true
spec: cypress/e2e/smoke/*.cy.js
browser: chrome
record: true
config: baseUrl=http://localhost:8080
group: 'Smoke tests'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 8 additions & 1 deletion .github/workflows/safe-apps-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ concurrency:
jobs:
e2e:
runs-on: ubuntu-latest
name: Safe Apps E2E tests
name: Cypress Safe Apps tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
steps:
- uses: actions/checkout@v3

Expand All @@ -31,10 +35,13 @@ jobs:

- uses: cypress-io/github-action@v4
with:
parallel: true
spec: cypress/e2e/safe-apps/*.cy.js
browser: chrome
record: true
config: baseUrl=http://localhost:8080
group: 'Safe Apps tests'
env:
CYPRESS_PROJECT_ID: okn21k
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_SAFE_APPS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export function verifyNewEntryAdded(name, address) {
cy.contains(address).should('exist')
}

export function addEntry(name, address) {
typeInName(name)
typeInAddress(address)
clickOnSaveEntryBtn()
verifyNewEntryAdded(name, address)
}

export function clickOnEditEntryBtn() {
cy.get(editEntryBtn).click({ force: true })
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/batches.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function verifyAmountTransactionsInBatch(count) {
}

export function clickOnConfirmBatchBtn() {
cy.contains(confirmBatchBtn).click()
cy.get('button').contains(confirmBatchBtn).should('be.visible').should('be.enabled').click()
}

export function verifyBatchTransactionsCount(count) {
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: 4 additions & 0 deletions cypress/e2e/pages/load_safe.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export function selectPolygon() {
cy.contains('span', constants.networks.polygon)
}

export function inputNameAndAddress(name, address) {
inputName(name)
inputAddress(address)
}
export function inputName(name) {
cy.get(nameInput).type(name).should('have.value', name)
}
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
2 changes: 1 addition & 1 deletion cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,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
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
2 changes: 1 addition & 1 deletion cypress/e2e/safe-apps/info_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as main from '../pages/main.page'
import * as safeapps from '../pages/safeapps.pages'

describe('Safe Apps info modal tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.SEPOLIA_TEST_SAFE_5 + constants.appsUrl, { failOnStatusCode: false })
main.acceptCookies()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/safe-apps/preview_drawer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as main from '../pages/main.page'
import * as safeapps from '../pages/safeapps.pages'

describe('Safe Apps info modal tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(`/${constants.SEPOLIA_TEST_SAFE_5}/apps`, { failOnStatusCode: false })
main.acceptCookies()
Expand Down
6 changes: 2 additions & 4 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 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
4 changes: 1 addition & 3 deletions cypress/e2e/safe-apps/tx_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ const testAppName = 'Cypress Test App'
const testAppDescr = 'Cypress Test App Description'

describe('Transaction modal 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 Down
15 changes: 9 additions & 6 deletions cypress/e2e/smoke/address_book.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ const NAME = 'Owner1'
const EDITED_NAME = 'Edited Owner1'

describe('Address book tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.addressBookUrl + constants.SEPOLIA_TEST_SAFE_1)
main.acceptCookies()
main.acceptCookies(1)
})

it('Verify entry can be added [C56061]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.typeInName(NAME)
addressBook.typeInAddress(constants.RECIPIENT_ADDRESS)
addressBook.clickOnSaveEntryBtn()
addressBook.verifyNewEntryAdded(NAME, constants.RECIPIENT_ADDRESS)
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
})

it('Verify entered entry in Name input can be saved [C56063]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
addressBook.clickOnEditEntryBtn()
addressBook.typeInNameInput(EDITED_NAME)
addressBook.clickOnSaveButton()
addressBook.verifyNameWasChanged(NAME, EDITED_NAME)
})

it('Verify entry can be deleted [C56062]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
// Click the delete button in the first entry
addressBook.clickDeleteEntryButton()
addressBook.clickDeleteEntryModalDeleteButton()
Expand Down Expand Up @@ -63,6 +64,8 @@ describe('Address book tests', () => {
})

it('Verify the address book file can be downloaded [C56065]', () => {
addressBook.clickOnImportFileBtn()
addressBook.importFile()
// Download the export file
const date = format(new Date(), 'yyyy-MM-dd', { timeZone: 'UTC' })
const fileName = `safe-address-book-${date}.csv` //name that is given to the file automatically
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/smoke/balances.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Balance tests', () => {
// Fiat balance regex
const fiatRegex = balances.fiatRegex

before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies(2)
Expand Down Expand Up @@ -114,6 +114,7 @@ describe('Balance tests', () => {
})

it('Verify a token can be unhidden [C56081]', () => {
balances.hideAsset(balances.currencyDaiCap)
balances.openHideTokenMenu()
balances.clickOnTokenCheckbox(balances.currencyDaiCap)
balances.saveHiddenTokenSelection()
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/smoke/dashboard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ import * as dashboard from '../pages/dashboard.pages'
import * as main from '../pages/main.page'

describe('Dashboard tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
main.acceptCookies(2)
main.clickOnSideMenuItem(constants.mainSideMenuOptions.home)
dashboard.verifyConnectTransactStrIsVisible()
})

it.skip('Verify the overview widget is displayed [C56107]', () => {
it('Verify the overview widget is displayed [C56107]', () => {
dashboard.verifyOverviewWidgetData()
})

it.skip('Verify the transaction queue widget is displayed [C56108]', () => {
it('Verify the transaction queue widget is displayed [C56108]', () => {
dashboard.verifyTxQueueWidget()
})

it.skip('Verify the featured Safe Apps are displayed [C56109]', () => {
it('Verify the featured Safe Apps are displayed [C56109]', () => {
dashboard.verifyFeaturedAppsSection()
})

it.skip('Verify the Safe Apps Section is displayed [C56110]', () => {
it('Verify the Safe Apps Section is displayed [C56110]', () => {
dashboard.verifySafeAppsSection()
})
})
20 changes: 15 additions & 5 deletions cypress/e2e/smoke/load_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OWNER_ENS_DEFAULT_NAME = 'test20.eth'
const OWNER_ADDRESS = constants.EOA

describe('Load Safe tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.loadNewSafeSepoliaUrl)
main.acceptCookies()
Expand All @@ -39,10 +39,8 @@ describe('Load Safe tests', () => {
cy.get('input[name="address"]').parent().prev('label').as('addressLabel')

createwallet.verifyDefaultWalletName(createwallet.defaltSepoliaPlaceholder)

safe.inputName(testSafeName)
safe.verifyIncorrectAddressErrorMessage()
safe.inputAddress(constants.SEPOLIA_TEST_SAFE_1)
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)

// Type an invalid address
// cy.get('input[name="address"]').clear().type(EOA_ADDRESS)
Expand All @@ -65,17 +63,29 @@ describe('Load Safe tests', () => {
})

it('Verify custom name in the first owner an be set [C56120]', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
})

it('Verify Safe and owner names are displayed in the Review step [C56121]', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
safe.verifyDataInReviewSection(testSafeName, testOwnerName)
safe.clickOnAddBtn()
})

it('Verify the custom Safe name is successfully loaded [C56122]', () => {
main.verifyHomeSafeUrl(constants.SEPOLIA_TEST_SAFE_1)
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_2)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
safe.verifyDataInReviewSection(testSafeName, testOwnerName)
safe.clickOnAddBtn()
main.verifyHomeSafeUrl(constants.SEPOLIA_TEST_SAFE_2)
safe.veriySidebarSafeNameIsVisible(testSafeName)
safe.verifyOwnerNamePresentInSettings(testOwnerName)
})
Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/smoke/nfts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ const nftsAddress = '0x373B...866c'
const nftsTokenID = 'CF'

describe('NFTs tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
main.acceptCookies(2)
nfts.clickOnNftsTab()
})

it.skip('Verify that NFTs exist in the table [C56123]', () => {
it('Verify that NFTs exist in the table [C56123]', () => {
nfts.verifyNFTNumber(20)
})

it.skip('Verify NFT row contains data [C56124]', () => {
it('Verify NFT row contains data [C56124]', () => {
nfts.verifyDataInTable(nftsName, nftsAddress, nftsTokenID)
})

it.skip('Verify NFT preview window can be opened [C56125]', () => {
nfts.openFirstNFT()
it('Verify NFT preview window can be opened [C56125]', () => {
nfts.openNFT(1)
nfts.verifyNameInNFTModal(nftsTokenID)
nfts.verifySelectedNetwrokSepolia()
nfts.closeNFTModal()
})

it.skip('Verify NFT open does not open if no NFT exits [C56126]', () => {
it('Verify NFT open does not open if no NFT exits [C56126]', () => {
nfts.clickOn6thNFT()
nfts.verifyNFTModalDoesNotExist()
})

it.skip('Verify multipls NFTs can be selected and reviewed [C56127]', () => {
it('Verify multipls NFTs can be selected and reviewed [C56127]', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(3)
nfts.deselectNFTs([2], 3)
Expand Down
Loading

0 comments on commit 46eac76

Please sign in to comment.