From b9f6aab45c851e6732b2a3ece780e5c638a03cd0 Mon Sep 17 00:00:00 2001 From: Raju Udava Date: Sat, 23 Oct 2021 02:05:18 +0530 Subject: [PATCH] [test] cypress: test re-alignment to reduce table creations Signed-off-by: Raju Udava --- .../integration/common/1a_table_operations.js | 2 +- .../common/1b_table_column_operations.js | 37 +++++++- ...operations.js => 6e_project_operations.js} | 93 +++++++++++-------- cypress/integration/test/masterSuiteGql.js | 7 +- cypress/integration/test/masterSuiteRest.js | 7 +- 5 files changed, 100 insertions(+), 46 deletions(-) rename cypress/integration/common/{0a_project_operations.js => 6e_project_operations.js} (50%) diff --git a/cypress/integration/common/1a_table_operations.js b/cypress/integration/common/1a_table_operations.js index 5d20cf506d..bbb1a010bd 100644 --- a/cypress/integration/common/1a_table_operations.js +++ b/cypress/integration/common/1a_table_operations.js @@ -9,7 +9,7 @@ export const genTest = (type, xcdb) => { describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => { before(() => { - loginPage.loginAndOpenProject(type, xcdb) + //loginPage.loginAndOpenProject(type, xcdb) cy.get('.mdi-close').click({ multiple: true }) }) diff --git a/cypress/integration/common/1b_table_column_operations.js b/cypress/integration/common/1b_table_column_operations.js index f59dbd41f7..cdde5528b3 100644 --- a/cypress/integration/common/1b_table_column_operations.js +++ b/cypress/integration/common/1b_table_column_operations.js @@ -7,9 +7,11 @@ export const genTest = (type, xcdb) => { if(!isTestSuiteActive(type, xcdb)) return; describe(`${type.toUpperCase()} api - Table Column`, () => { - const name = 'Table' + Date.now(); - const colName = 'column_name' + Date.now(); + const name = 'tablex' + const colName = 'column_name_a' const updatedColName = 'updated_column_name' + const randVal = 'Test' + const updatedRandVal = 'Updated' before(() => { // loginPage.loginAndOpenProject(type) @@ -84,6 +86,37 @@ export const genTest = (type, xcdb) => { cy.get(`th:contains(${updatedColName})`).should('not.exist'); }) + + it('Add new row', () => { + cy.wait(2000) + cy.get('.nc-add-new-row-btn').click({force: true}); + cy.get('#data-table-form-Title > input').first().type(randVal); + cy.contains('Save Row').filter('button').click({force: true}) + cy.get('td', {timeout: 10000}).contains(randVal).should('exist'); + }) + + it('Update row', () => { + cy.get('td').contains(randVal) + .closest('tr') + .find('.nc-row-expand-icon') + .click({force: true}); + + cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal); + cy.contains('Save Row').filter('button').click({force: true}) + + cy.wait(3000) + cy.get('td').contains(randVal).should('not.exist'); + cy.get('td').contains(updatedRandVal).should('exist'); + }) + + it('Delete row', () => { + cy.get('td').contains(updatedRandVal).rightclick({force: true}) + + // delete row + cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click({force: true}) + cy.wait(1000) + cy.get('td').contains(randVal).should('not.exist'); + }) }) } diff --git a/cypress/integration/common/0a_project_operations.js b/cypress/integration/common/6e_project_operations.js similarity index 50% rename from cypress/integration/common/0a_project_operations.js rename to cypress/integration/common/6e_project_operations.js index 7b067edc62..5b3d5ca2be 100644 --- a/cypress/integration/common/0a_project_operations.js +++ b/cypress/integration/common/6e_project_operations.js @@ -7,55 +7,74 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} Project operations`, () => { if(!isTestSuiteActive(type, xcdb)) return; - before(() => { - loginPage.signIn(roles.owner.credentials) - }) - - beforeEach(() => { - cy.restoreLocalStorage(); - }); + // before(() => { + // loginPage.signIn(roles.owner.credentials) + // }) - afterEach(() => { - cy.saveLocalStorage(); - }); + // beforeEach(() => { + // cy.restoreLocalStorage(); + // }); + // afterEach(() => { + // cy.saveLocalStorage(); + // }); - it('Create Project', () => { - cy.contains('New Project').trigger('onmouseover').trigger('mouseenter'); - cy.get('.create-external-db-project').click() - cy.url({timeout: 50000}).should('contain', '#/project/') - if (type === 'graphql') { - cy.contains('GRAPHQL APIs').closest('label').click() - } - cy.get('.database-field input').click().clear().type('dummy_db') - cy.contains('Test Database Connection').click() - cy.contains('Ok & Save Project', {timeout: 3000}).click() - cy.url({timeout: 50000}).should('contain', '#/nc/') - }); + // it('Create Project', () => { + // cy.contains('New Project').trigger('onmouseover').trigger('mouseenter'); + // cy.get('.create-external-db-project').click() + // cy.url({timeout: 50000}).should('contain', '#/project/') + // if (type === 'graphql') { + // cy.contains('GRAPHQL APIs').closest('label').click() + // } + // cy.get('.database-field input').click().clear().type('dummy_db') + // cy.contains('Test Database Connection').click() + // cy.contains('Ok & Save Project', {timeout: 3000}).click() + // cy.url({timeout: 50000}).should('contain', '#/nc/') + // }); it('Stop Project', () => { - cy.visit('./#/projects') - cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, {timeout: 10000}).last().invoke('show').click(); - cy.contains('Submit').closest('button').click(); - }); + //cy.visit('./#/projects') + cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, { timeout: 10000 }) + .last() + .invoke('show') + .click(); + cy.contains('Submit') + .closest('button') + .click(); + }) it('Start Project', () => { - cy.visit('./#/projects') - cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, {timeout: 10000}).last().invoke('show').click(); + //cy.visit('./#/projects') + cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, { timeout: 10000 }) + .last() + .invoke('show') + .click(); cy.contains('Submit').closest('button').click(); - }); + }) it('Restart Project', () => { - cy.visit('./#/projects') - cy.get(`.nc-${type}-project-row .mdi-restart`, {timeout: 10000}).last().invoke('show').click(); - cy.contains('Submit').closest('button').click(); - }); + //cy.visit('./#/projects') + cy.wait(1000) + cy.get(`.nc-${type}-project-row .mdi-restart`, { timeout: 10000 }) + .last() + .invoke('show') + .click(); + cy.contains('Submit') + .closest('button') + .click(); + }) it('Delete Project', () => { - cy.visit('./#/projects') - cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, {timeout: 10000}).last().invoke('show').click(); - cy.contains('Submit').closest('button').click(); - }); + //cy.visit('./#/projects') + cy.wait(1000) + cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 }) + .last() + .invoke('show') + .click(); + cy.contains('Submit') + .closest('button') + .click(); + }) }) } diff --git a/cypress/integration/test/masterSuiteGql.js b/cypress/integration/test/masterSuiteGql.js index b71e327fd3..920b6eea3c 100644 --- a/cypress/integration/test/masterSuiteGql.js +++ b/cypress/integration/test/masterSuiteGql.js @@ -1,7 +1,7 @@ let t0 = require('./explicitLogin') let t00 = require('../common/00_pre_configurations') -let t0a = require('../common/0a_project_operations') +let t0a = require('../common/6e_project_operations') let t1a = require('../common/1a_table_operations') let t1b = require('../common/1b_table_column_operations') let t1c = require('../common/1c_table_row_operations') @@ -35,10 +35,9 @@ const nocoTestSuite = (type, xcdb) => { t00.genTest(type, xcdb) } - t0a.genTest(type, xcdb) t1a.genTest(type, xcdb) t1b.genTest(type, xcdb) - t1c.genTest(type, xcdb) + // merged with t1b: t1c.genTest(type, xcdb) t2a.genTest(type, xcdb) t2b.genTest(type, xcdb) t3a.genTest(type, xcdb) @@ -56,6 +55,8 @@ const nocoTestSuite = (type, xcdb) => { // merged with t1a: t6a.genTest(type, xcdb) t6c.genTest(type, xcdb) t6d.genTest(type, xcdb) + // **deletes created project, hence place it @ end + t6e.genTest(type, xcdb) } // nocoTestSuite('rest', false) diff --git a/cypress/integration/test/masterSuiteRest.js b/cypress/integration/test/masterSuiteRest.js index a4b40a49fb..5dcb7180b5 100644 --- a/cypress/integration/test/masterSuiteRest.js +++ b/cypress/integration/test/masterSuiteRest.js @@ -1,7 +1,7 @@ let t0 = require('./explicitLogin') let t00 = require('../common/00_pre_configurations') -let t0a = require('../common/0a_project_operations') +let t0a = require('../common/6e_project_operations') let t1a = require('../common/1a_table_operations') let t1b = require('../common/1b_table_column_operations') let t1c = require('../common/1c_table_row_operations') @@ -35,10 +35,9 @@ const nocoTestSuite = (type, xcdb) => { t00.genTest(type, xcdb) } - t0a.genTest(type, xcdb) t1a.genTest(type, xcdb) t1b.genTest(type, xcdb) - t1c.genTest(type, xcdb) + // merged with t1b: t1c.genTest(type, xcdb) t2a.genTest(type, xcdb) t2b.genTest(type, xcdb) t3a.genTest(type, xcdb) @@ -56,6 +55,8 @@ const nocoTestSuite = (type, xcdb) => { // merged with t1a: t6a.genTest(type, xcdb) t6c.genTest(type, xcdb) t6d.genTest(type, xcdb) + // **deletes created project, hence place it @ end + t6e.genTest(type, xcdb) } nocoTestSuite('rest', false)