Files
514917d232 feat(e2e): add and fix spaces e2e cases (#7548)
* feat(e2e): add and fix spaces e2e cases

* fix(e2e): add account widget test cases

* fix(e2e): add navigation info

* fix(e2e): formating

* fix(e2e): comment unfinish cases

* fix(e2e): fix data-testid and change the test accordingly

* fix(e2e): buttons data-testids

* fix(e2e): wait after sign in

* fix(e2e): add function to verify sign in

* fix(e2e): fix index handling

* fix: add data-testid attributes to SpaceSelectorDropdown for E2E tests

The Cypress spaces tests expected data-testid="space-selector-button"
and data-testid="space-selector-menu" on the space selector component,
but these attributes were missing from the rendered elements.

* tests(e2e): fix space selector dropdown assertion to use text matching

The DropdownMenuItem component renders as div[role="menuitem"], not <li>.
Replace find('li') with contains() assertions that verify both space
names are visible in the dropdown menu.

* fix(e2e): update spaces tests

* fix(e2e): refactoring

* fix(e2e): add correct numbers and remove unused function

* fix(e2e): update skills and add correct function for account information

* fix(e2e): update skills for cypress

* fix(e2e): fix safe-basicflow

* fix(e2e): fix number of elements and remove step from basicflow

* fix(e2e): fix disconnect from space

* fix(e2e): add new navigation function for the wallets

* fix(e2e): fix create space button data-testid

* fix(e2e): add delete spaces function

* fix(e2e): update remove spaces function

* fix(e2e): update because of race condition with create button before redirect

* fix(e2e): remove legacyData comment

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-04-02 13:56:45 +02:00

68 lines
2.5 KiB
JavaScript

import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import { visualSpacesApiMockSpace } from '../../fixtures/spaces/visualSpacesApiMock.js'
import { mockVisualTestApis } from '../../support/visual-mocks.js'
const SPACE_ID = '1'
function setupSpacesAuth() {
// Note: SPACES feature flag is already present in the chains fixture (all.json).
// Do NOT call enableChainFeature here — it uses req.continue() which bypasses
// the fixture mock and hits the real staging server, causing flaky failures.
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__auth, {
sessionExpiresAt: Date.now() + 24 * 60 * 60 * 1000,
lastUsedSpace: SPACE_ID,
})
cy.fixture('spaces/user.json').then((mockUser) => {
cy.intercept('GET', constants.usersEndpoint, mockUser).as('getUser')
})
cy.intercept('GET', constants.spacesSafesEndpoint, { safes: {} }).as('getSpaceSafes')
cy.intercept('GET', constants.spacesGetOneEndpoint, visualSpacesApiMockSpace).as('getSpace')
cy.intercept('GET', `${constants.stagingCGWUrlv1}/spaces`, [visualSpacesApiMockSpace]).as('getSpaces')
cy.fixture('spaces/members.json').then((mockMembers) => {
cy.intercept('GET', constants.spacesMembersEndpoint, mockMembers).as('getSpaceMembers')
})
cy.fixture('spaces/address_book.json').then((mockAddressBook) => {
cy.intercept('GET', constants.spacesAddressBookEndpoint, mockAddressBook).as('getSpaceAddressBook')
})
}
describe('[VISUAL] Spaces page screenshots', { defaultCommandTimeout: 60000, ...constants.VISUAL_VIEWPORT }, () => {
beforeEach(() => {
mockVisualTestApis()
setupSpacesAuth()
})
it('[VISUAL] Screenshot spaces welcome page', () => {
cy.visit(constants.spacesUrl)
main.awaitVisualStability()
})
it('[VISUAL] Screenshot spaces dashboard page', () => {
cy.visit(constants.spaceDashboardUrl + SPACE_ID)
main.awaitVisualStability()
})
it('[VISUAL] Screenshot spaces settings page', () => {
cy.visit(constants.spaceUrl + SPACE_ID)
main.awaitVisualStability()
})
it('[VISUAL] Screenshot spaces members page', () => {
cy.visit(constants.spaceMembersUrl + SPACE_ID)
main.awaitVisualStability()
})
it('[VISUAL] Screenshot spaces safe accounts page', () => {
cy.visit(constants.spaceSafeAccountsUrl + SPACE_ID)
main.awaitVisualStability()
})
it('[VISUAL] Screenshot spaces address book page', () => {
cy.visit(constants.spaceAddressBookUrl + SPACE_ID)
main.awaitVisualStability()
})
})