Browse Source

[test] cypress: test re-alignment to reduce table creations

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/694/head
Raju Udava 3 years ago
parent
commit
b9f6aab45c
  1. 2
      cypress/integration/common/1a_table_operations.js
  2. 37
      cypress/integration/common/1b_table_column_operations.js
  3. 93
      cypress/integration/common/6e_project_operations.js
  4. 7
      cypress/integration/test/masterSuiteGql.js
  5. 7
      cypress/integration/test/masterSuiteRest.js

2
cypress/integration/common/1a_table_operations.js

@ -9,7 +9,7 @@ export const genTest = (type, xcdb) => {
describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => { describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => {
before(() => { before(() => {
loginPage.loginAndOpenProject(type, xcdb) //loginPage.loginAndOpenProject(type, xcdb)
cy.get('.mdi-close').click({ multiple: true }) cy.get('.mdi-close').click({ multiple: true })
}) })

37
cypress/integration/common/1b_table_column_operations.js

@ -7,9 +7,11 @@ export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return; if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table Column`, () => { describe(`${type.toUpperCase()} api - Table Column`, () => {
const name = 'Table' + Date.now(); const name = 'tablex'
const colName = 'column_name' + Date.now(); const colName = 'column_name_a'
const updatedColName = 'updated_column_name' const updatedColName = 'updated_column_name'
const randVal = 'Test'
const updatedRandVal = 'Updated'
before(() => { before(() => {
// loginPage.loginAndOpenProject(type) // loginPage.loginAndOpenProject(type)
@ -84,6 +86,37 @@ export const genTest = (type, xcdb) => {
cy.get(`th:contains(${updatedColName})`).should('not.exist'); 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');
})
}) })
} }

93
cypress/integration/common/0a_project_operations.js → cypress/integration/common/6e_project_operations.js

@ -7,55 +7,74 @@ export const genTest = (type, xcdb) => {
describe(`${type.toUpperCase()} Project operations`, () => { describe(`${type.toUpperCase()} Project operations`, () => {
if(!isTestSuiteActive(type, xcdb)) return; if(!isTestSuiteActive(type, xcdb)) return;
before(() => { // before(() => {
loginPage.signIn(roles.owner.credentials) // loginPage.signIn(roles.owner.credentials)
}) // })
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => { // beforeEach(() => {
cy.saveLocalStorage(); // cy.restoreLocalStorage();
}); // });
// afterEach(() => {
// cy.saveLocalStorage();
// });
it('Create Project', () => { // it('Create Project', () => {
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter'); // cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.get('.create-external-db-project').click() // cy.get('.create-external-db-project').click()
cy.url({timeout: 50000}).should('contain', '#/project/') // cy.url({timeout: 50000}).should('contain', '#/project/')
if (type === 'graphql') { // if (type === 'graphql') {
cy.contains('GRAPHQL APIs').closest('label').click() // cy.contains('GRAPHQL APIs').closest('label').click()
} // }
cy.get('.database-field input').click().clear().type('dummy_db') // cy.get('.database-field input').click().clear().type('dummy_db')
cy.contains('Test Database Connection').click() // cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click() // cy.contains('Ok & Save Project', {timeout: 3000}).click()
cy.url({timeout: 50000}).should('contain', '#/nc/') // cy.url({timeout: 50000}).should('contain', '#/nc/')
}); // });
it('Stop Project', () => { it('Stop Project', () => {
cy.visit('./#/projects') //cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, {timeout: 10000}).last().invoke('show').click(); cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, { timeout: 10000 })
cy.contains('Submit').closest('button').click(); .last()
}); .invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
})
it('Start Project', () => { it('Start Project', () => {
cy.visit('./#/projects') //cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, {timeout: 10000}).last().invoke('show').click(); cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, { timeout: 10000 })
.last()
.invoke('show')
.click();
cy.contains('Submit').closest('button').click(); cy.contains('Submit').closest('button').click();
}); })
it('Restart Project', () => { it('Restart Project', () => {
cy.visit('./#/projects') //cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-restart`, {timeout: 10000}).last().invoke('show').click(); cy.wait(1000)
cy.contains('Submit').closest('button').click(); cy.get(`.nc-${type}-project-row .mdi-restart`, { timeout: 10000 })
}); .last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
})
it('Delete Project', () => { it('Delete Project', () => {
cy.visit('./#/projects') //cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, {timeout: 10000}).last().invoke('show').click(); cy.wait(1000)
cy.contains('Submit').closest('button').click(); cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
}); .last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
})
}) })
} }

7
cypress/integration/test/masterSuiteGql.js

@ -1,7 +1,7 @@
let t0 = require('./explicitLogin') let t0 = require('./explicitLogin')
let t00 = require('../common/00_pre_configurations') 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 t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations') let t1b = require('../common/1b_table_column_operations')
let t1c = require('../common/1c_table_row_operations') let t1c = require('../common/1c_table_row_operations')
@ -35,10 +35,9 @@ const nocoTestSuite = (type, xcdb) => {
t00.genTest(type, xcdb) t00.genTest(type, xcdb)
} }
t0a.genTest(type, xcdb)
t1a.genTest(type, xcdb) t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb) t1b.genTest(type, xcdb)
t1c.genTest(type, xcdb) // merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb) t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb) t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb) t3a.genTest(type, xcdb)
@ -56,6 +55,8 @@ const nocoTestSuite = (type, xcdb) => {
// merged with t1a: t6a.genTest(type, xcdb) // merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb) t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb) t6d.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
} }
// nocoTestSuite('rest', false) // nocoTestSuite('rest', false)

7
cypress/integration/test/masterSuiteRest.js

@ -1,7 +1,7 @@
let t0 = require('./explicitLogin') let t0 = require('./explicitLogin')
let t00 = require('../common/00_pre_configurations') 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 t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations') let t1b = require('../common/1b_table_column_operations')
let t1c = require('../common/1c_table_row_operations') let t1c = require('../common/1c_table_row_operations')
@ -35,10 +35,9 @@ const nocoTestSuite = (type, xcdb) => {
t00.genTest(type, xcdb) t00.genTest(type, xcdb)
} }
t0a.genTest(type, xcdb)
t1a.genTest(type, xcdb) t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb) t1b.genTest(type, xcdb)
t1c.genTest(type, xcdb) // merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb) t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb) t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb) t3a.genTest(type, xcdb)
@ -56,6 +55,8 @@ const nocoTestSuite = (type, xcdb) => {
// merged with t1a: t6a.genTest(type, xcdb) // merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb) t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb) t6d.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
} }
nocoTestSuite('rest', false) nocoTestSuite('rest', false)

Loading…
Cancel
Save