Skip to content

Commit

Permalink
fix: use less brittle Cypress selectors for navigation
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <[email protected]>
  • Loading branch information
enjeck committed Jul 15, 2024
1 parent 6c28efa commit a044db1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Cypress.env('baseUrl', url)
addCommands()

Cypress.Commands.add('createTable', (title) => {
cy.contains('.app-menu-entry--label', 'Tables').click()
cy.get('button[aria-label="Create new table"]').click()
cy.get('[data-cy="navigationCreateTableIcon"]').click({ force: true })
cy.wait(1000)
cy.get('[data-cy="createTableModal"]').should('be.visible')
cy.get('.tile').contains('Custom table').click({ force: true })
cy.get('.modal__content input[type="text"]').clear().type(title)
cy.contains('button', 'Create table').click()
Expand Down Expand Up @@ -92,11 +93,11 @@ Cypress.Commands.add('sortTableColumn', (columnTitle, mode = 'ASC') => {
})

Cypress.Commands.add('loadTable', (name) => {
cy.get('.app-navigation-entry a[title="' + name + '"]').click({ force: true })
cy.get('[data-cy="navigationTableItem"] a[title="' + name + '"]').click({ force: true })
})

Cypress.Commands.add('loadView', (name) => {
cy.get('.app-navigation-entry a[title="' + name + '"]').click({ force: true })
cy.get('[data-cy="navigationViewItem"] a[title="' + name + '"]').click({ force: true })
})

Cypress.Commands.add('unifiedSearch', (term) => {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/navigation/sections/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<NcAppNavigationCaption :name="t('tables', 'Tables')">
<template #actions>
<NcActionButton :aria-label="t('tables', 'Create table')" icon="icon-add"
@click.prevent="createTable" />
data-cy="navigationCreateTableIcon" @click.prevent="createTable" />
</template>
</NcAppNavigationCaption>

Expand Down

0 comments on commit a044db1

Please sign in to comment.