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