|
|
@ -1,5 +1,6 @@ |
|
|
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; |
|
|
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; |
|
|
|
import { mainPage } from "../../support/page_objects/mainPage"; |
|
|
|
import { mainPage } from "../../support/page_objects/mainPage"; |
|
|
|
|
|
|
|
import {loginPage} from "../../support/page_objects/navigation"; |
|
|
|
|
|
|
|
|
|
|
|
let storedURL = ""; |
|
|
|
let storedURL = ""; |
|
|
|
|
|
|
|
|
|
|
@ -12,30 +13,30 @@ export const genTest = (apiType, dbType) => { |
|
|
|
// Run once before test- create project (rest/graphql)
|
|
|
|
// Run once before test- create project (rest/graphql)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
before(() => { |
|
|
|
before(() => { |
|
|
|
|
|
|
|
// loginPage.loginAndOpenProject(apiType, dbType);
|
|
|
|
|
|
|
|
// cy.openTableTab("City", 25);
|
|
|
|
|
|
|
|
// cy.wait(500);
|
|
|
|
|
|
|
|
// mainPage.toggleRightSidebar();
|
|
|
|
|
|
|
|
// cy.wait(500);
|
|
|
|
|
|
|
|
// cy.saveLocalStorage();
|
|
|
|
|
|
|
|
// cy.wait(500);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
|
|
|
cy.wait(500); |
|
|
|
|
|
|
|
|
|
|
|
mainPage.tabReset(); |
|
|
|
mainPage.tabReset(); |
|
|
|
// open a table to work on views
|
|
|
|
// open a table to work on views
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
// kludge: wait for page load to finish
|
|
|
|
|
|
|
|
// cy.wait(1000);
|
|
|
|
|
|
|
|
// // close team & auth tab
|
|
|
|
|
|
|
|
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
|
|
|
|
|
|
|
|
// cy.wait(1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.openTableTab("City", 25); |
|
|
|
cy.openTableTab("City", 25); |
|
|
|
|
|
|
|
|
|
|
|
mainPage.toggleRightSidebar(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
beforeEach(() => { |
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(() => { |
|
|
|
|
|
|
|
cy.saveLocalStorage(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
after(() => { |
|
|
|
after(() => { |
|
|
|
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
|
|
|
cy.wait(500); |
|
|
|
cy.closeTableTab("City"); |
|
|
|
cy.closeTableTab("City"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -43,7 +44,10 @@ export const genTest = (apiType, dbType) => { |
|
|
|
// Input: viewType - 'grid'/'gallery'
|
|
|
|
// Input: viewType - 'grid'/'gallery'
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const viewTest = (viewType) => { |
|
|
|
const viewTest = (viewType) => { |
|
|
|
it(`Create ${viewType} view`, () => { |
|
|
|
it(`Create ${viewType} view`, () => {0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
|
|
|
cy.wait(500); |
|
|
|
|
|
|
|
|
|
|
|
// click on create grid view button
|
|
|
|
// click on create grid view button
|
|
|
|
cy.get(`.nc-create-${viewType}-view`).click(); |
|
|
|
cy.get(`.nc-create-${viewType}-view`).click(); |
|
|
@ -85,11 +89,6 @@ export const genTest = (apiType, dbType) => { |
|
|
|
|
|
|
|
|
|
|
|
cy.get('[title="Address List"]').drag(".nc-drag-n-drop-to-hide"); |
|
|
|
cy.get('[title="Address List"]').drag(".nc-drag-n-drop-to-hide"); |
|
|
|
|
|
|
|
|
|
|
|
// cy.get(".nc-form > .mx-auto")
|
|
|
|
|
|
|
|
// .find('[type="checkbox"]')
|
|
|
|
|
|
|
|
// .eq(1)
|
|
|
|
|
|
|
|
// .should("be.checked");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// store base URL- to re-visit and delete form view later
|
|
|
|
// store base URL- to re-visit and delete form view later
|
|
|
|
cy.url().then((url) => { |
|
|
|
cy.url().then((url) => { |
|
|
|
storedURL = url; |
|
|
|
storedURL = url; |
|
|
@ -97,10 +96,10 @@ export const genTest = (apiType, dbType) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it(`Share form view`, () => { |
|
|
|
it(`Share form view`, () => { |
|
|
|
// cy.get(".nc-form > .mx-auto")
|
|
|
|
|
|
|
|
// .find('[type="checkbox"]')
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
// .eq(1)
|
|
|
|
cy.wait(500); |
|
|
|
// .should("be.checked");
|
|
|
|
|
|
|
|
cy.get(`.nc-view-item.nc-${viewType}-view-item`) |
|
|
|
cy.get(`.nc-view-item.nc-${viewType}-view-item`) |
|
|
|
.contains("Form-1") |
|
|
|
.contains("Form-1") |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
@ -117,6 +116,9 @@ export const genTest = (apiType, dbType) => { |
|
|
|
.then(($obj) => { |
|
|
|
.then(($obj) => { |
|
|
|
let linkText = $obj.text().trim(); |
|
|
|
let linkText = $obj.text().trim(); |
|
|
|
cy.log(linkText); |
|
|
|
cy.log(linkText); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.signOut(); |
|
|
|
|
|
|
|
|
|
|
|
cy.visit(linkText, { |
|
|
|
cy.visit(linkText, { |
|
|
|
baseUrl: null, |
|
|
|
baseUrl: null, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -127,12 +129,12 @@ export const genTest = (apiType, dbType) => { |
|
|
|
cy.get(".nc-form").should("exist"); |
|
|
|
cy.get(".nc-form").should("exist"); |
|
|
|
|
|
|
|
|
|
|
|
// New form appeared? Header & description should exist
|
|
|
|
// New form appeared? Header & description should exist
|
|
|
|
cy.get(".nc-form", { timeout: 10000 }) |
|
|
|
cy.get(".nc-form-view", { timeout: 10000 }) |
|
|
|
.find("h2") |
|
|
|
.find("h1") |
|
|
|
.contains("A B C D") |
|
|
|
.contains("A B C D") |
|
|
|
.should("exist"); |
|
|
|
.should("exist"); |
|
|
|
cy.get(".nc-form", { timeout: 10000 }) |
|
|
|
cy.get(".nc-form-view", { timeout: 10000 }) |
|
|
|
.find(".body-1") |
|
|
|
.find("h2") |
|
|
|
.contains("Some description about form comes here") |
|
|
|
.contains("Some description about form comes here") |
|
|
|
.should("exist"); |
|
|
|
.should("exist"); |
|
|
|
|
|
|
|
|
|
|
@ -143,61 +145,64 @@ export const genTest = (apiType, dbType) => { |
|
|
|
cy.get('[title="Address List"]').should("not.exist"); |
|
|
|
cy.get('[title="Address List"]').should("not.exist"); |
|
|
|
|
|
|
|
|
|
|
|
// order of LastUpdate & City field is retained
|
|
|
|
// order of LastUpdate & City field is retained
|
|
|
|
cy.get(".nc-form-field") |
|
|
|
cy.get(".nc-form-column-label") |
|
|
|
.eq(1) |
|
|
|
.eq(0) |
|
|
|
.contains("LastUpdate") |
|
|
|
.contains("LastUpdate") |
|
|
|
.should("exist"); |
|
|
|
.should("exist"); |
|
|
|
cy.get(".nc-form-field") |
|
|
|
cy.get(".nc-form-column-label") |
|
|
|
.eq(0) |
|
|
|
.eq(1) |
|
|
|
.contains("City") |
|
|
|
.contains("City") |
|
|
|
.should("exist"); |
|
|
|
.should("exist"); |
|
|
|
|
|
|
|
|
|
|
|
// submit form, to read message
|
|
|
|
// submit form, to read message
|
|
|
|
cy.get(".nc-form-input-City").type("_abc"); |
|
|
|
cy.get(".nc-form-input-City").type("_abc"); |
|
|
|
cy.get(".nc-form-input-LastUpdate").click(); |
|
|
|
cy.get(".nc-form-input-LastUpdate").click(); |
|
|
|
cy.getActiveModal().find("button").contains("19").click(); |
|
|
|
cy.get(".ant-picker-now-btn:visible").contains("Now").click(); |
|
|
|
cy.getActiveModal().find("button").contains("OK").click(); |
|
|
|
cy.get(".ant-btn-primary:visible").contains("Ok").click(); |
|
|
|
|
|
|
|
|
|
|
|
cy.get('.nc-form-field-Country') |
|
|
|
// cy.get('.nc-form-field-Country')
|
|
|
|
.trigger('mouseover') |
|
|
|
// .trigger('mouseover')
|
|
|
|
.click() |
|
|
|
// .click()
|
|
|
|
.find('.nc-action-icon') |
|
|
|
// .find('.nc-action-icon')
|
|
|
|
.click(); |
|
|
|
// .click();
|
|
|
|
// cy.get("button").contains("Link to 'Country'").click();
|
|
|
|
// // cy.get("button").contains("Link to 'Country'").click();
|
|
|
|
cy.getActiveModal() |
|
|
|
// cy.getActiveModal()
|
|
|
|
.find(".ant-card") |
|
|
|
// .find(".ant-card")
|
|
|
|
.contains("Afghanistan") |
|
|
|
// .contains("Afghanistan")
|
|
|
|
.click(); |
|
|
|
// .click();
|
|
|
|
|
|
|
|
//
|
|
|
|
// submit button & validate
|
|
|
|
// // submit button & validate
|
|
|
|
cy.get(".nc-form") |
|
|
|
// cy.get(".nc-form")
|
|
|
|
.find("button") |
|
|
|
// .find("button")
|
|
|
|
.contains("Submit") |
|
|
|
// .contains("Submit")
|
|
|
|
.click(); |
|
|
|
// .click();
|
|
|
|
|
|
|
|
//
|
|
|
|
cy.get(".ant-alert-message") |
|
|
|
// cy.get(".ant-alert-message")
|
|
|
|
.contains("Congratulations") |
|
|
|
// .contains("Congratulations")
|
|
|
|
.should("exist") |
|
|
|
// .should("exist")
|
|
|
|
.then(() => { |
|
|
|
// .then(() => {
|
|
|
|
cy.get(".nc-form").should("exist"); |
|
|
|
// cy.get(".nc-form").should("exist");
|
|
|
|
|
|
|
|
//
|
|
|
|
// validate if form has appeared again
|
|
|
|
// // validate if form has appeared again
|
|
|
|
cy.get(".nc-share-form-title") |
|
|
|
// cy.get(".nc-share-form-title")
|
|
|
|
.contains("A B C D") |
|
|
|
// .contains("A B C D")
|
|
|
|
.should("exist"); |
|
|
|
// .should("exist");
|
|
|
|
cy.get(".nc-share-form-desc") |
|
|
|
// cy.get(".nc-share-form-desc")
|
|
|
|
.contains("Some description about form comes here") |
|
|
|
// .contains("Some description about form comes here")
|
|
|
|
.should("exist"); |
|
|
|
// .should("exist");
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it(`Delete ${viewType} view`, () => { |
|
|
|
it(`Delete ${viewType} view`, () => { |
|
|
|
// go back to base page
|
|
|
|
// go back to base page
|
|
|
|
cy.visit(storedURL, { |
|
|
|
loginPage.loginAndOpenProject(apiType, dbType); |
|
|
|
baseUrl: null, |
|
|
|
cy.openTableTab("City", 25); |
|
|
|
}); |
|
|
|
cy.wait(500); |
|
|
|
cy.wait(2000); |
|
|
|
mainPage.toggleRightSidebar(); |
|
|
|
|
|
|
|
cy.wait(500); |
|
|
|
|
|
|
|
cy.saveLocalStorage(); |
|
|
|
|
|
|
|
cy.wait(500); |
|
|
|
|
|
|
|
|
|
|
|
// number of view entries should be 2 before we delete
|
|
|
|
// number of view entries should be 2 before we delete
|
|
|
|
cy.get(".nc-view-item").its("length").should("eq", 2); |
|
|
|
cy.get(".nc-view-item").its("length").should("eq", 2); |
|
|
@ -211,18 +216,18 @@ export const genTest = (apiType, dbType) => { |
|
|
|
// confirm if the number of veiw entries is reduced by 1
|
|
|
|
// confirm if the number of veiw entries is reduced by 1
|
|
|
|
cy.get(".nc-view-item").its("length").should("eq", 1); |
|
|
|
cy.get(".nc-view-item").its("length").should("eq", 1); |
|
|
|
|
|
|
|
|
|
|
|
// clean up newly added rows into Country table operations
|
|
|
|
// // clean up newly added rows into Country table operations
|
|
|
|
// this auto verifies successfull addition of rows to table as well
|
|
|
|
// // this auto verifies successfull addition of rows to table as well
|
|
|
|
mainPage.getPagination(25).click(); |
|
|
|
// mainPage.getPagination(25).click();
|
|
|
|
// kludge: flicker on load
|
|
|
|
// // kludge: flicker on load
|
|
|
|
cy.wait(3000) |
|
|
|
// cy.wait(3000)
|
|
|
|
|
|
|
|
//
|
|
|
|
cy.get(".nc-grid-row").should("have.length", 1); |
|
|
|
// cy.get(".nc-grid-row").should("have.length", 1);
|
|
|
|
cy.get(".ant-checkbox").should('exist').eq(1).click({ force: true }); |
|
|
|
// cy.get(".ant-checkbox").should('exist').eq(1).click({ force: true });
|
|
|
|
mainPage.getCell("Country", 1).rightclick({ force: true }); |
|
|
|
// mainPage.getCell("Country", 1).rightclick({ force: true });
|
|
|
|
cy.getActiveMenu() |
|
|
|
// cy.getActiveMenu()
|
|
|
|
.contains("Delete Selected Rows") |
|
|
|
// .contains("Delete Selected Rows")
|
|
|
|
.click({ force: true }); |
|
|
|
// .click({ force: true });
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|