Skip to content

Commit

Permalink
Add Cypress tests for table transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
enjeck committed Dec 27, 2023
1 parent 044cb9c commit 720c8be
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions cypress/e2e/tables-table.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
let localUser
let user1

describe('Manage a table', () => {

before(function() {
cy.createRandomUser().then(user => {
localUser = user
})
cy.createRandomUser().then(user => {
user1 = user
})
})

beforeEach(function() {
Expand Down Expand Up @@ -51,4 +55,27 @@ describe('Manage a table', () => {
cy.wait(10).get('.toastify.toast-success').should('be.visible')
cy.get('.app-navigation__list').contains('to do list').should('not.exist')
})

it('Transfer', () => {
cy.contains('.app-menu-entry--label', 'Tables').click()
cy.contains('button', 'Create new table').click()
cy.get('.tile').contains('ToDo').click({ force: true })
cy.get('.modal__content').should('be.visible')
cy.get('.modal__content input[type="text"]').clear().type('test table')
cy.contains('button', 'Create table').click()

cy.get('.app-navigation__list').contains('test table').click({ force: true })
cy.get('[data-cy="customTableAction"] button').click()
cy.get('.action-button__text').contains('Edit table').click()

cy.get('[data-cy="editTableModal"]').should('be.visible')
cy.get('[data-cy="editTableModal"] button').contains('Change owner').click()
cy.get('[data-cy="editTableModal"]').should('not.exist')
cy.get('[data-cy="transferTableModal"]').should('be.visible')
cy.get('[data-cy="transferTableModal"] input[type="search"]').clear().type(user1.userId)
cy.get(`.vs__dropdown-menu [user="${user1.userId}"]`).click()
cy.get('[data-cy="transferTableButton"]').should('be.enabled').click()
cy.wait(10).get('.toastify.toast-success').should('be.visible')
cy.get('.app-navigation__list').contains('test table').should('not.exist')
})
})
2 changes: 1 addition & 1 deletion src/modules/modals/EditTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<NcModal v-if="showModal"
size="normal"
@close="actionCancel">
<div class="modal__content">
<div class="modal__content" data-cy="editTableModal">
<div class="row">
<div class="col-4">
<h2>{{ t('tables', 'Edit table') }}</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modals/TransferTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<div class="row">
<div class="fix-col-4 space-T justify-between">
<NcButton type="warning" :disabled="newOwnerUserId === ''" @click="transferMe">
<NcButton type="warning" :disabled="newOwnerUserId === ''" data-cy="transferTableButton" @click="transferMe">
{{ t('tables', 'Transfer') }}
</NcButton>
</div>
Expand Down

0 comments on commit 720c8be

Please sign in to comment.