Browse Source

test: v2 corrections for view/ phase-1

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3365/head
Raju Udava 2 years ago
parent
commit
8cad773251
  1. 28
      scripts/cypress-v2/integration/common/4a_table_view_grid_gallery_form.js
  2. 28
      scripts/cypress-v2/integration/common/4b_table_view_share.js
  3. 129
      scripts/cypress-v2/integration/common/4c_form_view_detailed.js
  4. 3
      scripts/cypress-v2/integration/test/restViews.js
  5. 15
      scripts/cypress-v2/support/commands.js
  6. 6
      scripts/cypress-v2/support/page_objects/mainPage.js
  7. 9
      scripts/cypress-v2/support/page_objects/navigation.js

28
scripts/cypress-v2/integration/common/4a_table_view_grid_gallery_form.js

@ -1,8 +1,6 @@
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
// let viewTypeString = ["", "Form", "Gallery", "Grid"];
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
@ -16,24 +14,17 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// // 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);
// open a table to work on views
//
cy.openTableTab("Country", 25);
// toggle right navbar (open)
cy.get('.nc-toggle-right-navbar').should('exist').click();
});
beforeEach(() => {
cy.fileHook();
});
after(() => {
@ -49,7 +40,6 @@ export const genTest = (apiType, dbType) => {
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
// cy.getActiveModal().find("button:contains(Submit)").click();
cy.getActiveModal().find(".ant-btn-primary").click();
cy.toastWait("View created successfully");
@ -64,10 +54,6 @@ export const genTest = (apiType, dbType) => {
it(`Edit ${viewType} view name`, () => {
// click on edit-icon (becomes visible on hovering mouse)
// cy.get(".nc-view-edit-icon").last().click({
// force: true,
// timeout: 1000,
// });
cy.get(`.nc-${viewType}-view-item`).last().dblclick();
// feed new name
@ -89,15 +75,11 @@ export const genTest = (apiType, dbType) => {
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
cy.get(`.nc-${viewType}-view-item`).last().click();
cy.wait(3000);
// click on delete icon (becomes visible on hovering mouse)
cy.get(`.nc-${viewType}-view-item`).last().trigger("mouseover").then(() => {
cy.get(".nc-view-delete-icon").should('exist').click({force: true});
cy.getActiveModal().find(".ant-btn-dangerous").click();
cy.toastWait("View deleted successfully");
})
cy.get(".nc-view-delete-icon").click({ force: true });
cy.wait(300)
cy.getActiveModal().find('.ant-btn-dangerous').click();
cy.toastWait("View deleted successfully");
// kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')

28
scripts/cypress-v2/integration/common/4b_table_view_share.js

@ -1,5 +1,6 @@
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import {loginPage} from "../../support/page_objects/navigation";
let storedURL = "";
let linkText = "";
@ -35,32 +36,20 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// // 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);
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
});
generateLinkWithPwd();
});
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
it("Share view with incorrect password", () => {
@ -89,17 +78,22 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal().find('button:contains("Unlock")').click();
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.getActiveModal().find('button:contains("Unlock")').should('not.exist');
// cy.getActiveModal().find('button:contains("Unlock")').should('not.exist');
cy.get(".ant-modal-content:visible").should("not.exist")
// Verify Download as CSV is here
mainPage.downloadCsv().should("exist");
mainPage.downloadExcel().should("exist");
});
it("Delete view", () => {
cy.visit(storedURL, {
baseUrl: null,
});
it("Delete view", () => {
// issue with restore local storage- need to refresh page to get new URL
loginPage.loginAndOpenProject(apiType, dbType);
// cy.restoreLocalStorage();
// cy.visit(storedURL, { baseUrl: null });
cy.openTableTab("City", 25);
// wait for page load to complete
cy.get(".nc-grid-row").should("have.length", 25);

129
scripts/cypress-v2/integration/common/4c_form_view_detailed.js

@ -1,5 +1,6 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage, settingsPage } from "../../support/page_objects/mainPage";
import {loginPage} from "../../support/page_objects/navigation";
let formViewURL;
@ -11,14 +12,24 @@ function verifyFormDrawerFieldLocation(fieldName, position) {
}
function verifyFormDrawerHideObjectCount(count) {
cy.get(".nc-form")
.find(".nc-field-remove-icon")
.its("length")
.should("eq", count);
if(count) {
cy.get(".nc-form")
.find(".nc-field-remove-icon")
.its("length")
.should("eq", count);
} else {
cy.get(".nc-form")
.find(".nc-field-remove-icon")
.should("not.exist");
}
}
function verifyFormMenuDrawerCardCount(cardCount) {
cy.get('.nc-form-left-drawer').find('.ant-card').should('have.length', cardCount);
if(cardCount) {
cy.get('.nc-form-left-drawer').find('.ant-card').should('have.length', cardCount);
} else {
cy.get('.nc-form-left-drawer').find('.ant-card').should('not.exist');
}
}
function validateFormHeader() {
@ -47,14 +58,14 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// loginPage.loginAndOpenProject(apiType, dbType);
// // 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);
// kludge: wait for page load to finish
cy.wait(2000);
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
// open a table to work on views
//
@ -63,12 +74,11 @@ export const genTest = (apiType, dbType) => {
});
beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage();
// fix me!
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
});
afterEach(() => {
cy.saveLocalStorage();
});
after(() => {
@ -103,6 +113,7 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-form-drag-LastUpdate").drag(
".nc-form-drag-Country"
);
cy.wait(1000);
// Verify if order is: LastUpdate, Country, Country => City
verifyFormDrawerFieldLocation("LastUpdate", 0);
@ -197,8 +208,8 @@ export const genTest = (apiType, dbType) => {
// fill up mandatory fields
cy.get(".nc-form-input-Country").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(".ant-picker-now-btn:visible").contains("Now").click();
cy.get(".ant-btn-primary:visible").contains("Ok").click();
// default message, no update
@ -214,18 +225,15 @@ export const genTest = (apiType, dbType) => {
it(`Validate ${viewType}: Submit default, with valid Show message entry`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-grid-view-item`)
// .contains("Country")
// .click();
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Form-1")
.click();
// fill up mandatory fields
cy.get(".nc-form-input-Country").type("_abc");
cy.get(".nc-form-input-Country").should('exist').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(".ant-picker-now-btn:visible").contains("Now").click();
cy.get(".ant-btn-primary:visible").contains("Ok").click();
// add message
cy.get("textarea.nc-form-after-submit-msg")
@ -240,9 +248,6 @@ export const genTest = (apiType, dbType) => {
it(`Validate ${viewType}: Submit default, Enable checkbox "Submit another form`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-grid-view-item`)
// .contains("Country")
// .click();
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Form-1")
.click();
@ -250,8 +255,8 @@ export const genTest = (apiType, dbType) => {
// fill up mandatory fields
cy.get(".nc-form-input-Country").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(".ant-picker-now-btn:visible").contains("Now").click();
cy.get(".ant-btn-primary:visible").contains("Ok").click();
// enable "Submit another form" check box
cy.get("button.nc-form-checkbox-submit-another-form").click();
@ -274,8 +279,8 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-form-input-Country").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(".ant-picker-now-btn:visible").contains("Now").click();
cy.get(".ant-btn-primary:visible").contains("Ok").click();
// enable "New form after 5 seconds" button
cy.get("button.nc-form-checkbox-submit-another-form")
@ -303,10 +308,11 @@ export const genTest = (apiType, dbType) => {
.click();
// validate if form has appeared again
cy.wait(1000);
validateFormHeader();
cy.get(".nc-form-remove-all").click();
cy.get("button.nc-form-checkbox-send-email")
.click();
cy.get(".nc-form-checkbox-send-email").click();
// validate if toaster pops up requesting to activate SMTP
cy.toastWait(
"Please activate SMTP plugin in App store for enabling email notification"
@ -335,13 +341,17 @@ export const genTest = (apiType, dbType) => {
// validate if form has appeared again
validateFormHeader();
cy.get("button.nc-form-checkbox-send-email")
cy.get(".nc-form-checkbox-send-email")
.click();
cy.toastWait(
"Please activate SMTP plugin in App store for enabling email notification"
);
settingsPage.openMenu(settingsPage.APPSTORE)
mainPage.resetSMTP();
cy.wait(3000);
cy.wait(300);
cy.openTableTab("Country", 25);
});
@ -350,30 +360,22 @@ export const genTest = (apiType, dbType) => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Form-1")
.click();
cy.get(".nc-form-add-all").click();
cy.wait(3000);
cy.wait(300);
// validate if form has appeared again
validateFormHeader();
cy.get(".nc-form-input-LastUpdate").should("exist");
// remove "LastUpdate field"
cy.get(".nc-form").find(".nc-field-remove-icon").eq(2).click();
cy.get(".nc-form").find(".nc-field-remove-icon").eq(1).click();
cy.get(".nc-form-input-LastUpdate").should("not.exist");
// cy.get(".col-md-4")
// .find(".pointer.item")
// .contains("LastUpdate")
// .should("exist");
// add it back
// cy.get(".col-md-4")
// .find(".pointer.item")
// .contains("LastUpdate")
// .click();
cy.get('.nc-form-left-drawer').find('.ant-card').contains('LastUpdate').should('exist').click();
cy.get(".nc-form-input-LastUpdate").should("exist");
cy.wait(3000);
cy.wait(300);
});
it(`Validate ${viewType}: URL verification`, () => {
@ -391,27 +393,33 @@ export const genTest = (apiType, dbType) => {
formViewURL = url;
});
cy.wait(3000);
// cy.saveLocalStorage();
cy.wait(300);
});
it(`Validate ${viewType}: URL validation after re-access`, () => {
it.skip(`Validate ${viewType}: URL validation after re-access`, () => {
// visit URL
cy.log(formViewURL);
// cy.restoreLocalStorage();
cy.visit(formViewURL, {
baseUrl: null,
});
cy.wait(5000);
// New form appeared? Header & description should exist
validateFormHeader();
});
it(`Delete ${viewType} view`, () => {
// cy.restoreLocalStorage();
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
// click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-delete-icon").click({ force: true });
cy.wait(1000)
cy.getActiveModal().find('.ant-btn-dangerous').click();
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
@ -420,8 +428,6 @@ export const genTest = (apiType, dbType) => {
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click();
// kludge: flicker on load
// cy.wait(3000)
cy.get(".nc-grid-row").should("have.length", 13);
cy.get(".ant-checkbox").should('exist').eq(10).click({ force: true });
@ -433,27 +439,6 @@ export const genTest = (apiType, dbType) => {
cy.getActiveMenu()
.contains("Delete Selected Rows")
.click({ force: true });
// mainPage
// .getRow(10)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
// mainPage
// .getRow(11)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
// mainPage
// .getRow(12)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
// mainPage
// .getRow(13)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
//
// mainPage.getCell("Country", 10).rightclick();
// cy.getActiveMenu().contains("Delete Selected Row").click();
// cy.toastWait('Deleted selected rows successfully')
});
};

3
scripts/cypress-v2/integration/test/restViews.js

@ -14,9 +14,10 @@ const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
t01.genTest(apiType, dbType);
// place plugin related activities at top
t4c.genTest(apiType, dbType);
t4a.genTest(apiType, dbType);
t4b.genTest(apiType, dbType);
t4c.genTest(apiType, dbType);
t4d.genTest(apiType, dbType);
t4e.genTest(apiType, dbType);
t4f.genTest(apiType, dbType);

15
scripts/cypress-v2/support/commands.js

@ -154,15 +154,18 @@ Cypress.Commands.add("refreshTableTab", () => {
// rc: row count. validate row count if rc!=0
Cypress.Commands.add("openTableTab", (tn, rc) => {
cy.task("log", `[openTableTab] ${tn} ${rc}`);
cy.get(`.nc-project-tree-tbl-${tn}`, { timeout: 10000 }).should("exist")
cy.get(`.nc-project-tree-tbl-${tn}`)
.should("exist")
.first()
.click({ force: true });
.click();
// kludge to make new tab active
cy.get('.ant-tabs-tab-btn')
.contains(tn)
.should('exist')
.click({ force: true });
.click();
cy.get('.xc-row-table.nc-grid').should('exist');
// wait for page rendering to complete
@ -264,7 +267,11 @@ Cypress.Commands.add("getActiveSelection", () => {
Cypress.Commands.add("getActiveDrawer", () => {
return cy.get(".ant-drawer-content:visible").last();
});
});
Cypress.Commands.add("getActivePicker", () => {
return cy.get(".ant-picker-dropdown :visible").last();
});
Cypress.Commands.add("createTable", (name) => {
// cy.get(".nc-btn-tbl-add").click();

6
scripts/cypress-v2/support/page_objects/mainPage.js

@ -238,10 +238,11 @@ export class _mainPage {
cy.getActiveModal().find('#form_item_from').should('exist').clear().type(from)
cy.getActiveModal().find('#form_item_host').should('exist').clear().type(host)
cy.getActiveModal().find('#form_item_port').should('exist').clear().type(port)
cy.getActiveModal().find('#form_item_secure').should('exist').clear().type(secure)
// cy.getActiveModal().find('#form_item_secure').should('exist').clear().type(secure)
cy.getActiveModal().find("button").contains("Save").click();
cy.toastWait('Successfully installed and email notification will use SMTP configuration');
settingsPage.closeMenu()
};
resetSMTP = () => {
@ -251,6 +252,7 @@ export class _mainPage {
cy.getActiveModal().find("button").contains("Confirm").click();
cy.toastWait("Plugin uninstalled successfully");
settingsPage.closeMenu()
};
shareView = () => {
@ -365,7 +367,7 @@ export class _mainPage {
// one of the row would contain seggregation header ('other views)
if (5 == $tableRow[0].childElementCount) {
cy.wrap($tableRow).find(".nc-icon").last().click();
cy.wait(1000);
cy.wait(100);
}
})
.then(() => {

9
scripts/cypress-v2/support/page_objects/navigation.js

@ -68,6 +68,9 @@ export class _loginPage {
// standard pre-project activity
//
loginAndOpenProject(apiType, dbType) {
cy.restoreLocalStorage();
cy.wait(1000);
loginPage.signIn(roles.owner.credentials);
if (dbType === "mysql") {
@ -77,6 +80,12 @@ export class _loginPage {
} else if (dbType === "postgres") {
projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
}
// kludge: wait for page load to finish
cy.wait(2000);
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
}
}

Loading…
Cancel
Save