diff --git a/cypress.json b/cypress.json index ec7d299eb9..89c97246ea 100644 --- a/cypress.json +++ b/cypress.json @@ -3,5 +3,6 @@ "defaultCommandTimeout": 10000, "pageLoadTimeout": 600000, "viewportWidth": 1800, - "viewportHeight": 1000 + "viewportHeight": 1000, + "video": false } diff --git a/cypress/integration/graphql/create_table_spec.js b/cypress/integration/graphql/create_table_spec.js deleted file mode 100644 index 42274523b4..0000000000 --- a/cypress/integration/graphql/create_table_spec.js +++ /dev/null @@ -1,20 +0,0 @@ -describe('Rest api project test', () => { - - before(() => { - cy.waitForSpinners(); - cy.openOrCreateGqlProject(); - }) - - 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/graphql/table_operations_spec.js b/cypress/integration/graphql/table_operations_spec.js new file mode 100644 index 0000000000..8068f59bfb --- /dev/null +++ b/cypress/integration/graphql/table_operations_spec.js @@ -0,0 +1,72 @@ +describe('GraphQL api - Table', () => { + + const name = 'Test' + Date.now(); + + before(() => { + cy.waitForSpinners(); + cy.openOrCreateRestProject(); + }) + + // create a new random table + 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}&`) + }); + + + // add new column to newly created table + it('Create Table Column', () => { + cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) + .first().click() + + cy.get('.nc-project-tree').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({force: true}); + cy.get('.nc-column-name-input input').clear().type('new_column') + cy.get('.nc-col-create-or-edit-card').contains('Save').click() + + }); + + // delete the newly created column + it('Delete table column', () => { + cy + .get('th:contains(new_column)') + .should('exist'); + + cy.get('th:contains(new_column) .mdi-menu-down') + .trigger('mouseover') + .click() + + cy.get('.nc-column-delete').click() + cy.get('button:contains(Confirm)').click() + + + cy + .get('th:contains(new_column)') + .should('not.exist'); + + }) + + + // delete newly created table + it('Delete Table', () => { + cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) + .first().click() + + cy.get('.nc-project-tree').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/cypress/integration/rest/api_operations_spec.js b/cypress/integration/rest/api_operations_spec.js new file mode 100644 index 0000000000..5e2a4afe21 --- /dev/null +++ b/cypress/integration/rest/api_operations_spec.js @@ -0,0 +1,18 @@ +describe('Rest api - CRUD/Filter', () => { + + before(() => { + cy.waitForSpinners(); + cy.openOrCreateRestProject(); + + // open country table + cy.openTableTab('Country'); + + }) + + // create a new random table + it('Check country table - ', () => { + cy.get('.nc-pagination').should('exist') + }); + + +}) diff --git a/cypress/integration/rest/table_operations_spec.js b/cypress/integration/rest/table_operations_spec.js index baf9ad0bcf..bf34af5fed 100644 --- a/cypress/integration/rest/table_operations_spec.js +++ b/cypress/integration/rest/table_operations_spec.js @@ -7,6 +7,7 @@ describe('Rest api - Table', () => { cy.openOrCreateRestProject(); }) + // create a new random table 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) @@ -17,24 +18,94 @@ describe('Rest api - Table', () => { cy.url().should('contain', `?name=${name}&`) }); + + // add new column to newly created table it('Create Table Column', () => { + cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) + .first().click() + cy.get('.nc-project-tree').contains(name, {timeout: 6000}).first().click({force: true}); - 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(); + cy.get('.v-window-item--active .nc-grid tr > th:last button').click({force: true}); + cy.get('.nc-column-name-input input').clear().type('new_column') + cy.get('.nc-col-create-or-edit-card').contains('Save').click() + cy + .get('th:contains(new_column)') + .should('exist'); + }); + + // edit the newly created column + it('Edit table column - rename & uidt update', () => { - }); + cy.get('th:contains(new_column) .mdi-menu-down') + .trigger('mouseover') + .click() + + cy.get('.nc-column-edit').click() + + + // change column type and verify + cy.get('.nc-ui-dt-dropdown').click() + cy.contains('LongText').click() + cy.get('.nc-col-create-or-edit-card').contains('Save').click() + + cy.get('th[data-col="new_column"] .mdi-text-subject').should('exist') + + + cy.get('th:contains(new_column) .mdi-menu-down') + .trigger('mouseover') + .click() + + cy.get('.nc-column-edit').click() + + // rename column and verify + cy.get('.nc-column-name-input input').clear().type('updated_column') + cy.get('.nc-col-create-or-edit-card').contains('Save').click() + + cy + .get('th:contains(updated_column)') + .should('exist'); + cy + .get('th:contains(new_column)') + .should('not.exist'); + + }) + + + // delete the newly created column + it('Delete table column', () => { + cy + .get('th:contains(updated_column)') + .should('exist'); + + cy.get('th:contains(updated_column) .mdi-menu-down') + .trigger('mouseover') + .click() + + cy.get('.nc-column-delete').click() + cy.get('button:contains(Confirm)').click() + + + cy + .get('th:contains(updated_column)') + .should('not.exist'); + + }) + + + // delete newly created table it('Delete Table', () => { - cy.get('.nc-project-tree :contains(Tables)', {timeout: 10000}) + + cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) .first().click() - .contains(name, {timeout: 6000}).first().click({force: true}); + + cy.get('.nc-project-tree').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() diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 1f2c53daa2..b2662249fe 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -87,8 +87,18 @@ Cypress.Commands.add('openOrCreateRestProject', () => { }) +Cypress.Commands.add('openTableTab', (tn) => { + cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) + .first().click() + + cy.get('.nc-project-tree').contains(tn, {timeout: 6000}).first().click({force: true}); + + cy.get(`.project-tab:contains(${tn}):visible`).should('exist') + +}); Cypress.Commands.add('openOrCreateGqlProject', () => { + cy.signinOrSignup() @@ -111,3 +121,6 @@ Cypress.Commands.add('openOrCreateGqlProject', () => { cy.url({timeout: 20000}).should('contain', '#/nc/') }) + + + diff --git a/docker-compose-cypress.yml b/docker-compose-cypress.yml index f8188dc97c..8cd1891e8e 100644 --- a/docker-compose-cypress.yml +++ b/docker-compose-cypress.yml @@ -19,6 +19,7 @@ services: - -c - | echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + # cp -r /home/app1/ /home/app/ rm /home/app/package-lock.json cd /home/app/ && npm i && EE=true npm run run xc-cypress-nc-gui: @@ -36,6 +37,7 @@ services: - | echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" apk --update --no-cache add git + # cp -r /home/app1/ /home/app/ 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/components/editColumn.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue index 333ef08e1c..6aa2faa7a1 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue @@ -4,7 +4,7 @@ max-width="400px" max-height="95vh" style="overflow: auto" - class="elevation-0 card" + class="elevation-0 card nc-col-create-or-edit-card" > @@ -29,7 +29,7 @@ v => !!v || 'Required', v => !meta || !meta.columns || meta.columns.every(c => column && c.cn === column.cn || v !== c.cn ) && meta.v.every(c => v !== c._cn ) || 'Duplicate column name' ]" - class="caption" + class="caption nc-column-name-input" label="Column name" dense outlined @@ -72,7 +72,7 @@ hide-details item-value="name" item-text="name" - class="caption ui-type" + class="caption ui-type nc-ui-dt-dropdown" :class="{'primary lighten-5' : newColumn.uidt }" label="Column type" dense diff --git a/packages/nc-gui/components/project/spreadsheet/components/headerCell.vue b/packages/nc-gui/components/project/spreadsheet/components/headerCell.vue index 4199c79c8c..35ffbcc2f7 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/headerCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/headerCell.vue @@ -59,7 +59,7 @@ - + mdi-pencil @@ -76,7 +76,7 @@ Primary value will be shown in place of primary key - + mdi-delete-outline @@ -108,7 +108,7 @@ max-width="500" persistent > - + Confirm diff --git a/packages/nc-gui/components/project/spreadsheet/components/pagination.vue b/packages/nc-gui/components/project/spreadsheet/components/pagination.vue index 4d218b8dde..fb5e643e75 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/pagination.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/pagination.vue @@ -5,7 +5,7 @@ style="max-width: 100%" :length="Math.ceil(count / size)" :total-visible="8" - color="primary lighten-2" + color="primary lighten-2 nc-pagination" @input="$emit('input',page)" />