From 8d28052b5481caba4fba11eb0536c14e186f7f91 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 25 Aug 2021 20:03:36 +0530 Subject: [PATCH] test(cypress): table delete Signed-off-by: Pranav C --- cypress.json | 4 +- cypress/integration/rest/create_table_spec.js | 20 -------- .../integration/rest/table_operations_spec.js | 47 +++++++++++++++++++ docker-compose-cypress.yml | 6 +-- .../project/spreadsheet/rowsXcDataTable.vue | 1 + 5 files changed, 54 insertions(+), 24 deletions(-) delete mode 100644 cypress/integration/rest/create_table_spec.js create mode 100644 cypress/integration/rest/table_operations_spec.js diff --git a/cypress.json b/cypress.json index f8a7840408..ec7d299eb9 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,7 @@ { "baseUrl": "http://localhost:3000", "defaultCommandTimeout": 10000, - "pageLoadTimeout": 600000 + "pageLoadTimeout": 600000, + "viewportWidth": 1800, + "viewportHeight": 1000 } diff --git a/cypress/integration/rest/create_table_spec.js b/cypress/integration/rest/create_table_spec.js deleted file mode 100644 index 24e8ee101e..0000000000 --- a/cypress/integration/rest/create_table_spec.js +++ /dev/null @@ -1,20 +0,0 @@ -describe('Rest api - New table', () => { - - before(() => { - cy.waitForSpinners(); - cy.openOrCreateRestProject(); - }) - - it('Create Table', () => { - cy.get('.add-btn').click(); - const name = 'Test' + Date.now(); - cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name) - cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase()) - cy.wait(5000) - cy.get('.nc-create-table-card .nc-create-table-submit').first().click() - cy.get(`.project-tab:contains(${name})`).should('exist') - cy.url().should('contain', `?name=${name}&`) - }); - - -}) diff --git a/cypress/integration/rest/table_operations_spec.js b/cypress/integration/rest/table_operations_spec.js new file mode 100644 index 0000000000..baf9ad0bcf --- /dev/null +++ b/cypress/integration/rest/table_operations_spec.js @@ -0,0 +1,47 @@ +describe('Rest api - Table', () => { + + const name = 'Test' + Date.now(); + + before(() => { + cy.waitForSpinners(); + cy.openOrCreateRestProject(); + }) + + it('Create Table', () => { + cy.get('.add-btn').click(); + cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name) + cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase()) + cy.wait(5000) + cy.get('.nc-create-table-card .nc-create-table-submit').first().click() + cy.get(`.project-tab:contains(${name})`).should('exist') + cy.url().should('contain', `?name=${name}&`) + }); + + it('Create Table Column', () => { + + + cy.get('.nc-project-tree :contains(Tables)', {timeout: 10000}) + .first().click() + .contains(name, {timeout: 6000}).first().click({force: true}); + cy.get(`.project-tab:contains(${name}):visible`).should('exist') + + cy.get('.v-window-item--active .nc-grid tr > th:last button').click(); + + + }); + + + it('Delete Table', () => { + cy.get('.nc-project-tree :contains(Tables)', {timeout: 10000}) + .first().click() + .contains(name, {timeout: 6000}).first().click({force: true}); + cy.get(`.project-tab:contains(${name}):visible`).should('exist') + + cy.get('.nc-table-delete-btn:visible').click() + + cy.get('button:contains(Submit)').click() + cy.get(`.project-tab:contains(${name}):visible`).first().should('not.exist') + }); + + +}) diff --git a/docker-compose-cypress.yml b/docker-compose-cypress.yml index 456c7acbf8..f8188dc97c 100644 --- a/docker-compose-cypress.yml +++ b/docker-compose-cypress.yml @@ -20,7 +20,7 @@ services: - | echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" rm /home/app/package-lock.json - cd /home/app/ && npm i && npm run run + cd /home/app/ && npm i && EE=true npm run run xc-cypress-nc-gui: network_mode: host image: node:14-alpine @@ -37,5 +37,5 @@ services: echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" apk --update --no-cache add git rm /home/app/package-lock.json - # cd /home/app/ && npm i && npm run dev - cd /home/app/ && npm i && NODE_ENV=development npm run build && npm start + cd /home/app/ && npm i && npm run dev + # cd /home/app/ && npm i && NODE_ENV=development npm run build && npm start diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index 1b9d6a01d2..15e386e588 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -130,6 +130,7 @@