Browse Source

test: view suite, part-1

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3343/head
Raju Udava 2 years ago
parent
commit
a55a68780b
  1. 52
      scripts/cypress-v2/integration/common/4a_table_view_grid_gallery_form.js
  2. 15
      scripts/cypress-v2/integration/common/4b_table_view_share.js
  3. 10
      scripts/cypress-v2/integration/common/4c_form_view_detailed.js
  4. 12
      scripts/cypress-v2/support/page_objects/mainPage.js

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

@ -1,7 +1,11 @@
import { mainPage } from "../../support/page_objects/mainPage"; import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
let viewTypeString = ["", "Form", "Gallery", "Grid"]; // let viewTypeString = ["", "Form", "Gallery", "Grid"];
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export const genTest = (apiType, dbType) => { export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
@ -14,9 +18,18 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.fileHook(); cy.fileHook();
mainPage.tabReset(); 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 // open a table to work on views
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.get('.nc-toggle-right-navbar').should('exist').click();
}); });
beforeEach(() => { beforeEach(() => {
@ -40,13 +53,16 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal().find(".ant-btn-primary").click(); cy.getActiveModal().find(".ant-btn-primary").click();
cy.toastWait("View created successfully"); cy.toastWait("View created successfully");
// kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// validate if view was created && contains default name 'Country1' // validate if view was created && contains default name 'Country1'
cy.get(`.nc-${viewType}-view-item`) cy.get(`.nc-${viewType}-view-item`)
.contains(`${viewTypeString[viewType]}-1`) .contains(`${capitalizeFirstLetter(viewType)}-1`)
.should("exist"); .should("exist");
}); });
it.skip(`Edit ${viewType} view name`, () => { it(`Edit ${viewType} view name`, () => {
// click on edit-icon (becomes visible on hovering mouse) // click on edit-icon (becomes visible on hovering mouse)
// cy.get(".nc-view-edit-icon").last().click({ // cy.get(".nc-view-edit-icon").last().click({
// force: true, // force: true,
@ -55,11 +71,14 @@ export const genTest = (apiType, dbType) => {
cy.get(`.nc-${viewType}-view-item`).last().dblclick(); cy.get(`.nc-${viewType}-view-item`).last().dblclick();
// feed new name // feed new name
cy.get(`.nc-${viewType}-view-item input`).type( cy.get(`.nc-${viewType}-view-item input`)
`${viewType}View-1{enter}` .clear()
); .type(`${viewType}View-1{enter}`);
cy.toastWait("View renamed successfully"); cy.toastWait("View renamed successfully");
// kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// validate // validate
cy.get(`.nc-${viewType}-view-item`) cy.get(`.nc-${viewType}-view-item`)
.contains(`${viewType}View-1`) .contains(`${viewType}View-1`)
@ -70,11 +89,18 @@ export const genTest = (apiType, dbType) => {
// 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);
cy.get(`.nc-${viewType}-view-item`).last().click();
cy.wait(3000);
// click on delete icon (becomes visible on hovering mouse) // click on delete icon (becomes visible on hovering mouse)
cy.get(`.nc-${viewType}-view-item`).last().trigger("mouseover").click(); cy.get(`.nc-${viewType}-view-item`).last().trigger("mouseover").then(() => {
cy.get(".nc-view-delete-icon").should('exist').click({ force: true }); cy.get(".nc-view-delete-icon").should('exist').click({force: true});
cy.getActiveModal().find(".ant-btn-dangerous").click(); cy.getActiveModal().find(".ant-btn-dangerous").click();
cy.toastWait("View deleted successfully"); cy.toastWait("View deleted successfully");
})
// kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// 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);
@ -82,9 +108,9 @@ export const genTest = (apiType, dbType) => {
}; };
// below four scenario's will be invoked twice, once for rest & then for graphql // below four scenario's will be invoked twice, once for rest & then for graphql
viewTest("3"); // grid view viewTest("grid"); // grid view
viewTest("2"); // gallery view viewTest("gallery"); // gallery view
viewTest("1"); // form view viewTest("form"); // form view
}); });
}; };

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

@ -13,7 +13,7 @@ const generateLinkWithPwd = () => {
cy.getActiveModal().find('.ant-checkbox-input').should('exist').first().then(($el) => { cy.getActiveModal().find('.ant-checkbox-input').should('exist').first().then(($el) => {
if (!$el.prop("checked")) { if (!$el.prop("checked")) {
cy.wrap($el).click({ force: true }); cy.wrap($el).click({ force: true });
cy.getActiveModal().find('input[type="password"]').type("1"); cy.getActiveModal().find('input[type="password"]').clear().type("1");
cy.getActiveModal().find('button:contains("Save password")').click(); cy.getActiveModal().find('button:contains("Save password")').click();
cy.toastWait("Successfully updated"); cy.toastWait("Successfully updated");
} }
@ -37,6 +37,13 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.fileHook(); cy.fileHook();
mainPage.tabReset(); 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); cy.openTableTab("City", 25);
// store base URL- to re-visit and delete form view later // store base URL- to re-visit and delete form view later
@ -56,7 +63,7 @@ export const genTest = (apiType, dbType) => {
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
it.skip("Share view with incorrect password", () => { it("Share view with incorrect password", () => {
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
}); });
@ -64,7 +71,7 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal().should("exist"); cy.getActiveModal().should("exist");
// feed password // feed password
cy.getActiveModal().find('input[type="password"]').type("a"); cy.getActiveModal().find('input[type="password"]').clear().type("a");
cy.getActiveModal().find('button:contains("Unlock")').click(); cy.getActiveModal().find('button:contains("Unlock")').click();
// if pwd is incorrect, active modal requesting to feed in password again will persist // if pwd is incorrect, active modal requesting to feed in password again will persist
@ -72,7 +79,7 @@ export const genTest = (apiType, dbType) => {
}); });
// fallover test- use previously opened view & continue verification instead of opening again // fallover test- use previously opened view & continue verification instead of opening again
it.skip("Share view with correct password", () => { it("Share view with correct password", () => {
// feed password // feed password
cy.getActiveModal() cy.getActiveModal()

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

@ -49,6 +49,13 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.fileHook(); cy.fileHook();
mainPage.tabReset(); 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 // open a table to work on views
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
@ -451,8 +458,7 @@ export const genTest = (apiType, dbType) => {
}; };
// below scenario's will be invoked twice, once for rest & then for graphql // below scenario's will be invoked twice, once for rest & then for graphql
// viewTest("form"); viewTest("form");
viewTest("1");
}); });
}; };

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

@ -259,27 +259,27 @@ export class _mainPage {
shareViewList = () => { shareViewList = () => {
cy.get(".nc-actions-menu-btn").click(); cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('.nc-menu-item').contains('Shared View List'); return cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Shared View List');
}; };
downloadCsv = () => { downloadCsv = () => {
cy.get(".nc-actions-menu-btn").click(); cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('.nc-menu-item').contains('Download as CSV'); return cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Download as CSV');
}; };
downloadExcel = () => { downloadExcel = () => {
cy.get(".nc-actions-menu-btn").click(); cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('.nc-menu-item').contains('Download as XLSX'); return cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Download as XLSX');
}; };
uploadCsv = () => { uploadCsv = () => {
cy.get(".nc-actions-menu-btn").click(); cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('.nc-menu-item').contains('Upload CSV'); return cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Upload CSV');
}; };
automations = () => { automations = () => {
cy.get(".nc-actions-menu-btn").click(); cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('.nc-menu-item').contains('Webhooks'); return cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Webhooks');
}; };
hideField = (field) => { hideField = (field) => {
@ -464,7 +464,7 @@ export class _mainPage {
} }
toggleRightSidebar() { toggleRightSidebar() {
cy.get(".nc-right-sidebar-toggle").should("exist").click(); cy.get(".nc-toggle-right-navbar").should("exist").click();
} }
} }

Loading…
Cancel
Save