Browse Source

[test] cypress: updates to support graphql test

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/688/head
Raju Udava 3 years ago
parent
commit
f37a83a16a
  1. 8
      cypress.json
  2. 4
      cypress/integration/common/00_pre_configurations.js
  3. 2
      cypress/integration/common/0a_project_operations.js
  4. 4
      cypress/integration/common/6a_audit.js
  5. 17
      cypress/integration/common/6c_swagger_api.js
  6. 3
      cypress/integration/common/6d_language_validation.js
  7. 5
      cypress/integration/test/masterSuite.js

8
cypress.json

@ -12,5 +12,11 @@
"screenshotOnRunFailure": false, "screenshotOnRunFailure": false,
"numTestsKeptInMemory": 0, "numTestsKeptInMemory": 0,
"env": { "env": {
"testMode": "extREST" } "testMode": "extREST" },
"supportedOptionsForTestModes": [
"extGQL",
"extREST",
"xcdbREST",
"xcdbREST",
"can configure multiple too, seperated by a . as in extREST.extGQL"]
} }

4
cypress/integration/common/00_pre_configurations.js

@ -6,8 +6,8 @@ import { loginPage, projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage" import { mainPage } from "../../support/page_objects/mainPage"
import { staticProjects, roles, isTestSuiteActive, getPrimarySuite, isSecondarySuite } from "../../support/page_objects/projectConstants" import { staticProjects, roles, isTestSuiteActive, getPrimarySuite, isSecondarySuite } from "../../support/page_objects/projectConstants"
export const genTest = () => { export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`Project pre-configurations`, () => { describe(`Project pre-configurations`, () => {
it('Admin SignUp', () => { it('Admin SignUp', () => {

2
cypress/integration/common/0a_project_operations.js

@ -30,7 +30,7 @@ export const genTest = (type, xcdb) => {
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: 12000}).should('contain', '#/nc/') cy.url({timeout: 50000}).should('contain', '#/nc/')
}); });
it('Stop Project', () => { it('Stop Project', () => {

4
cypress/integration/common/6a_audit.js

@ -17,8 +17,8 @@ export const genTest = (type, xcdb) => {
} }
it('Open Audit tab', ()=> { it('Open Audit tab', ()=> {
cy.createTable('Table-x') cy.createTable('tablex')
cy.deleteTable('Table-x') cy.deleteTable('tablex')
cy.wait(2000) cy.wait(2000)
mainPage.navigationDraw(mainPage.AUDIT).click() mainPage.navigationDraw(mainPage.AUDIT).click()

17
cypress/integration/common/6c_swagger_api.js

@ -9,7 +9,7 @@ export const genTest = (type, xcdb) => {
describe(`Swagger API - Test preparation`, () => { describe(`Swagger API - Test preparation`, () => {
before(()=> { before(()=> {
loginPage.loginAndOpenProject('rest', false) loginPage.loginAndOpenProject(type, false)
}) })
it("[REST] open project & record swagger URL, AuthToken", () => { it("[REST] open project & record swagger URL, AuthToken", () => {
@ -17,10 +17,16 @@ export const genTest = (type, xcdb) => {
cy.url().then( (url) => { cy.url().then( (url) => {
// retrieve project name from URL & use it to construct Swagger URL // retrieve project name from URL & use it to construct Swagger URL
// URL on homepage: http://localhost:3000/#/nc/externalrest_weUO?type=roles&dbalias=&name=Team%20%26%20Auth%20 // URL on homepage: http://localhost:3000/#/nc/externalrest_weUO?type=roles&dbalias=&name=Team%20%26%20Auth%20
// Swagger URL: http://localhost:8080/nc/externalrest_weUO/db/swagger // [REST] Swagger URL: http://localhost:8080/nc/externalrest_weUO/db/swagger
// // [GQL] http://localhost:8080/nc/externalgql_dgwx/v1/graphql
const projectName = url.split("/")[5].split("?")[0]; const projectName = url.split("/")[5].split("?")[0];
let swaggerURL = `http://localhost:8080/nc/${projectName}/db/swagger` let swaggerURL = ``
if ('rest' == type) {
swaggerURL = `http://localhost:8080/nc/${projectName}/db/swagger`
}
else {
swaggerURL = `http://localhost:8080/nc/${projectName}/v1/graphql`
}
// exchange information between two tests using a file // exchange information between two tests using a file
// https://stackoverflow.com/questions/52050657/what-is-the-best-practice-of-pass-states-between-tests-in-cypress // https://stackoverflow.com/questions/52050657/what-is-the-best-practice-of-pass-states-between-tests-in-cypress
@ -30,6 +36,8 @@ export const genTest = (type, xcdb) => {
}) })
}) })
if ('rest' == type) {
describe(`Swagger page, base verification`, () => { describe(`Swagger page, base verification`, () => {
// returns swagger button intended for // returns swagger button intended for
@ -167,6 +175,7 @@ export const genTest = (type, xcdb) => {
}) })
}) })
}) })
}
} }
// genTest('rest', false) // genTest('rest', false)

3
cypress/integration/common/6d_language_validation.js

@ -1,9 +1,10 @@
const { mainPage } = require("../../support/page_objects/mainPage") const { mainPage } = require("../../support/page_objects/mainPage")
const { loginPage } = require("../../support/page_objects/navigation") const { loginPage } = require("../../support/page_objects/navigation")
const { roles } = require("../../support/page_objects/projectConstants") const { roles } = require("../../support/page_objects/projectConstants")
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => { export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`Language support`, () => { describe(`Language support`, () => {
before(() => { before(() => {

5
cypress/integration/test/masterSuite.js

@ -30,9 +30,9 @@ const executionMode = 1
const nocoTestSuite = (type, xcdb) => { const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) { if (0 == executionMode) {
t0.genTest('rest', false) t0.genTest(type, xcdb)
} else { } else {
t00.genTest() t00.genTest(type, xcdb)
} }
t0a.genTest(type, xcdb) t0a.genTest(type, xcdb)
@ -65,6 +65,7 @@ const nocoTestSuite = (type, xcdb) => {
} }
nocoTestSuite('rest', false) nocoTestSuite('rest', false)
nocoTestSuite('graphql', false)
/** /**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd * @copyright Copyright (c) 2021, Xgene Cloud Ltd

Loading…
Cancel
Save