Browse Source

test: view suite local storage handling update, form view handling corrections

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3414/head
Raju Udava 2 years ago
parent
commit
d769de842a
  1. 16
      packages/nc-gui-v2/pages/[projectType]/form/[viewId]/index.vue
  2. 13
      scripts/cypress-v2/integration/common/4a_table_view_grid_gallery_form.js
  3. 19
      scripts/cypress-v2/integration/common/4b_table_view_share.js
  4. 20
      scripts/cypress-v2/integration/common/4c_form_view_detailed.js
  5. 7
      scripts/cypress-v2/integration/common/4d_table_view_grid_locked.js
  6. 167
      scripts/cypress-v2/integration/common/4e_form_view_share.js
  7. 137
      scripts/cypress-v2/integration/common/4f_grid_view_share.js
  8. 4
      scripts/cypress-v2/integration/test/pg-restViews.js
  9. 2
      scripts/cypress-v2/integration/test/restViews.js
  10. 21
      scripts/cypress-v2/support/page_objects/mainPage.js
  11. 1
      scripts/cypress-v2/support/page_objects/navigation.js

16
packages/nc-gui-v2/pages/[projectType]/form/[viewId]/index.vue

@ -69,7 +69,7 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
<div class="nc-form-wrapper"> <div class="nc-form-wrapper">
<div class="nc-form h-full max-w-3/4 mx-auto"> <div class="nc-form h-full max-w-3/4 mx-auto">
<div v-for="(field, index) in formColumns" :key="index" class="flex flex-col my-6 gap-2"> <div v-for="(field, index) in formColumns" :key="index" class="flex flex-col my-6 gap-2">
<div class="flex"> <div class="flex nc-form-column-label">
<SmartsheetHeaderVirtualCell <SmartsheetHeaderVirtualCell
v-if="isVirtualCol(field)" v-if="isVirtualCol(field)"
:column="{ ...field, title: field.label || field.title }" :column="{ ...field, title: field.label || field.title }"
@ -86,7 +86,11 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
</div> </div>
<div v-if="isVirtualCol(field)" class="mt-0"> <div v-if="isVirtualCol(field)" class="mt-0">
<SmartsheetVirtualCell class="mt-0 nc-input" :column="field" /> <SmartsheetVirtualCell
class="mt-0 nc-input"
:class="`nc-form-input-${field.title.replaceAll(' ', '')}`"
:column="field"
/>
<div v-if="field.description" class="text-gray-500 text-[10px] mb-2 ml-1">{{ field.description }}</div> <div v-if="field.description" class="text-gray-500 text-[10px] mb-2 ml-1">{{ field.description }}</div>
@ -98,7 +102,13 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
</div> </div>
<div v-else class="mt-0"> <div v-else class="mt-0">
<SmartsheetCell v-model="formState[field.title]" class="nc-input" :column="field" :edit-enabled="true" /> <SmartsheetCell
v-model="formState[field.title]"
class="nc-input"
:class="`nc-form-input-${field.title.replaceAll(' ', '')}`"
:column="field"
:edit-enabled="true"
/>
<div v-if="field.description" class="text-gray-500 text-[10px] mb-2 ml-1">{{ field.description }}</div> <div v-if="field.description" class="text-gray-500 text-[10px] mb-2 ml-1">{{ field.description }}</div>

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

@ -14,6 +14,9 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.restoreLocalStorage();
cy.wait(1000);
mainPage.tabReset(); mainPage.tabReset();
// open a table to work on views // open a table to work on views
@ -21,10 +24,12 @@ export const genTest = (apiType, dbType) => {
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
// toggle right navbar (open) // toggle right navbar (open)
cy.get('.nc-toggle-right-navbar').should('exist').click(); // cy.get('.nc-toggle-right-navbar').should('exist').click();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
}); });
after(() => { after(() => {
@ -44,7 +49,7 @@ export const genTest = (apiType, dbType) => {
cy.toastWait("View created successfully"); cy.toastWait("View created successfully");
// kludge: right navbar closes abruptly. force it open again // kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}') // 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`)
@ -63,7 +68,7 @@ export const genTest = (apiType, dbType) => {
cy.toastWait("View renamed successfully"); cy.toastWait("View renamed successfully");
// kludge: right navbar closes abruptly. force it open again // kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}') // window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// validate // validate
cy.get(`.nc-${viewType}-view-item`) cy.get(`.nc-${viewType}-view-item`)
@ -82,7 +87,7 @@ export const genTest = (apiType, dbType) => {
cy.toastWait("View deleted successfully"); cy.toastWait("View deleted successfully");
// kludge: right navbar closes abruptly. force it open again // kludge: right navbar closes abruptly. force it open again
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}') // 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);

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

@ -36,6 +36,9 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.restoreLocalStorage();
cy.wait(1000);
mainPage.tabReset(); mainPage.tabReset();
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
@ -44,6 +47,8 @@ export const genTest = (apiType, dbType) => {
storedURL = url; storedURL = url;
}); });
generateLinkWithPwd(); generateLinkWithPwd();
cy.signOut();
}); });
beforeEach(() => { beforeEach(() => {
@ -87,13 +92,14 @@ export const genTest = (apiType, dbType) => {
}); });
it("Delete view", () => { it("Delete view", () => {
// issue with restore local storage- need to refresh page to get new URL
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
// cy.restoreLocalStorage();
// cy.visit(storedURL, { baseUrl: null });
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
cy.wait(500);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage();
cy.wait(1000);
// wait for page load to complete // wait for page load to complete
cy.get(".nc-grid-row").should("have.length", 25); cy.get(".nc-grid-row").should("have.length", 25);
@ -101,6 +107,9 @@ export const genTest = (apiType, dbType) => {
}); });
after(() => { after(() => {
cy.restoreLocalStorage();
cy.wait(500);
cy.closeTableTab("City"); cy.closeTableTab("City");
}); });
}); });

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

@ -71,11 +71,16 @@ export const genTest = (apiType, dbType) => {
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
mainPage.toggleRightSidebar(); mainPage.toggleRightSidebar();
cy.saveLocalStorage();
cy.wait(500);
}); });
beforeEach(() => { beforeEach(() => {
// fix me! // fix me!
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}') // window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
cy.restoreLocalStorage();
cy.wait(500);
}); });
afterEach(() => { afterEach(() => {
@ -331,7 +336,6 @@ export const genTest = (apiType, dbType) => {
// open form view & enable "email me" option // open form view & enable "email me" option
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000); cy.wait(1000);
cy.get(`.nc-view-item.nc-${viewType}-view-item`) cy.get(`.nc-view-item.nc-${viewType}-view-item`)
@ -344,15 +348,10 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-form-checkbox-send-email") cy.get(".nc-form-checkbox-send-email")
.click(); .click();
cy.toastWait(
"Please activate SMTP plugin in App store for enabling email notification"
);
settingsPage.openMenu(settingsPage.APPSTORE) settingsPage.openMenu(settingsPage.APPSTORE)
mainPage.resetSMTP(); mainPage.resetSMTP();
cy.wait(300); cy.wait(300);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
}); });
@ -393,14 +392,12 @@ export const genTest = (apiType, dbType) => {
formViewURL = url; formViewURL = url;
}); });
// cy.saveLocalStorage();
cy.wait(300); cy.wait(300);
}); });
it.skip(`Validate ${viewType}: URL validation after re-access`, () => { it.skip(`Validate ${viewType}: URL validation after re-access`, () => {
// visit URL // visit URL
cy.log(formViewURL); cy.log(formViewURL);
// cy.restoreLocalStorage();
cy.visit(formViewURL, { cy.visit(formViewURL, {
baseUrl: null, baseUrl: null,
@ -411,7 +408,10 @@ export const genTest = (apiType, dbType) => {
}); });
it(`Delete ${viewType} view`, () => { it(`Delete ${viewType} view`, () => {
// cy.restoreLocalStorage(); // cy.visit("/");
// cy.wait(5000);
// projectsPage.openConfiguredProject(apiType, dbType);
// cy.openTableTab("Country", 25);
// 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);

7
scripts/cypress-v2/integration/common/4d_table_view_grid_locked.js

@ -8,6 +8,9 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.restoreLocalStorage();
cy.wait(500);
mainPage.tabReset(); mainPage.tabReset();
// open a table to work on views // open a table to work on views
@ -16,9 +19,13 @@ export const genTest = (apiType, dbType) => {
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(500);
}); });
after(() => { after(() => {
cy.restoreLocalStorage();
cy.wait(500)
cy.closeTableTab("Country"); cy.closeTableTab("Country");
}); });

167
scripts/cypress-v2/integration/common/4e_form_view_share.js

@ -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 });
}); });
}; };

137
scripts/cypress-v2/integration/common/4f_grid_view_share.js

@ -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 = "";
@ -40,33 +41,33 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
mainPage.tabReset(); cy.restoreLocalStorage();
cy.wait(500);
// // 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 mainPage.tabReset();
//
cy.openTableTab("Address", 25); cy.openTableTab("Address", 25);
mainPage.toggleRightSidebar();
cy.saveLocalStorage(); // loginPage.loginAndOpenProject(apiType, dbType);
//
// // open a table to work on views
// //
// cy.openTableTab("Address", 25);
// mainPage.toggleRightSidebar();
// //
// cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage();
}); });
afterEach(() => { afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
// close table // close table
// mainPage.deleteCreatedViews() // mainPage.deleteCreatedViews()
cy.restoreLocalStorage();
cy.wait(500);
cy.closeTableTab("Address"); cy.closeTableTab("Address");
}); });
@ -75,6 +76,10 @@ export const genTest = (apiType, dbType) => {
// //
const viewTest = (viewType) => { const viewTest = (viewType) => {
it(`Create ${viewType.toUpperCase()} view`, () => { it(`Create ${viewType.toUpperCase()} view`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// create a normal public view // create a normal public view
cy.get(`.nc-create-${viewType}-view`).click(); cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal().find("button:contains(Submit)").click(); cy.getActiveModal().find("button:contains(Submit)").click();
@ -83,11 +88,14 @@ export const genTest = (apiType, dbType) => {
// 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;
cy.saveLocalStorage();
}); });
}); });
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => { it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.restoreLocalStorage();
cy.wait(500);
cy.get(`.nc-view-item.nc-${viewType}-view-item`) cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Grid-1") .contains("Grid-1")
.click(); .click();
@ -99,6 +107,10 @@ export const genTest = (apiType, dbType) => {
}); });
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => { it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// generate view link multiple times // generate view link multiple times
generateViewLink("combined"); generateViewLink("combined");
generateViewLink("combined"); generateViewLink("combined");
@ -118,6 +130,8 @@ export const genTest = (apiType, dbType) => {
.then(() => { .then(() => {
cy.get('button.ant-modal-close:visible').click(); cy.get('button.ant-modal-close:visible').click();
}); });
cy.signOut();
}); });
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => { it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => {
@ -273,27 +287,27 @@ export const genTest = (apiType, dbType) => {
.find(".nc-icon.nc-action-icon.nc-plus") .find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist"); .should("not.exist");
mainPage // mainPage
.getCell("Customer List", 3) // .getCell("Customer List", 3)
.click() // .click()
.find(".nc-icon.nc-action-icon.nc-arrow-expand") // .find(".nc-icon.nc-action-icon.nc-arrow-expand")
.click({ force: true }); // .click({ force: true });
//
// reload button // // reload button
cy.getActiveModal().find(".nc-icon").should("exist"); // cy.getActiveModal().find(".nc-icon").should("exist");
cy.getActiveModal() // cy.getActiveModal()
.find("button") // .find("button")
.contains("Link to") // .contains("Link to")
.should("not.exist"); // .should("not.exist");
cy.getActiveModal() // cy.getActiveModal()
.find(".ant-card") // .find(".ant-card")
.contains("2") // .contains("2")
.should("exist"); // .should("exist");
cy.getActiveModal() // cy.getActiveModal()
.find(".ant-card") // .find(".ant-card")
.find("button") // .find("button")
.should("not.exist"); // .should("not.exist");
cy.get('button.ant-modal-close').click(); // cy.get('button.ant-modal-close').click();
}); });
it(`Share GRID view : Virtual column validation > belongs to`, () => { it(`Share GRID view : Virtual column validation > belongs to`, () => {
@ -335,23 +349,25 @@ export const genTest = (apiType, dbType) => {
.find(".nc-icon.nc-action-icon.nc-arrow-expand") .find(".nc-icon.nc-action-icon.nc-arrow-expand")
.click({ force: true }); .click({ force: true });
// reload button // // reload button
cy.getActiveModal().find(".nc-icon").should("exist"); // Fix me : ncv2@fixme
cy.getActiveModal() // cy.getActiveModal().find(".nc-icon").should("exist");
.find("button") // cy.getActiveModal()
.contains("Link to") // .find("button")
.should("not.exist"); // .contains("Link to")
cy.get('button.ant-modal-close:visible').last().click(); // .should("not.exist");
// cy.get('button.ant-modal-close:visible').last().click();
}); });
it(`Delete ${viewType.toUpperCase()} view`, () => { it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page // go back to base page
cy.restoreLocalStorage(); loginPage.loginAndOpenProject(apiType, dbType);
cy.visit(storedURL, { cy.openTableTab("Address", 25);
baseUrl: null,
});
cy.wait(5000); 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);
@ -373,24 +389,32 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
// Address table has belongs to, has many & many-to-many // Address table has belongs to, has many & many-to-many
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
// 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;
cy.saveLocalStorage();
generateViewLink("rowColUpdate"); generateViewLink("rowColUpdate");
}); });
}); });
after(() => { after(() => {
// close table // close table
cy.restoreLocalStorage(); // cy.visit(storedURL, {
cy.visit(storedURL, { // baseUrl: null,
baseUrl: null, // });
}); // cy.wait(5000);
cy.wait(5000);
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25)
cy.wait(500);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage();
cy.wait(500);
// delete row // delete row
mainPage.getPagination(5).click(); mainPage.getPagination(5).click();
@ -414,6 +438,10 @@ export const genTest = (apiType, dbType) => {
}); });
it(`Generate default Shared GRID view URL`, () => { it(`Generate default Shared GRID view URL`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// add row // add row
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
cy.get(".nc-expand-col-Country").find(".nc-cell > input") cy.get(".nc-expand-col-Country").find(".nc-cell > input")
@ -433,9 +461,10 @@ export const genTest = (apiType, dbType) => {
// add column // add column
mainPage.addColumn("dummy", "Country"); mainPage.addColumn("dummy", "Country");
cy.signOut();
// visit public view // visit public view
cy.log(viewURL["rowColUpdate"]); cy.log(viewURL["rowColUpdate"]);
cy.restoreLocalStorage();
cy.visit(viewURL["rowColUpdate"], { cy.visit(viewURL["rowColUpdate"], {
baseUrl: null, baseUrl: null,
}); });

4
scripts/cypress-v2/integration/test/pg-restViews.js

@ -19,8 +19,8 @@ const nocoTestSuite = (apiType, dbType) => {
t4a.genTest(apiType, dbType); t4a.genTest(apiType, dbType);
t4b.genTest(apiType, dbType); t4b.genTest(apiType, dbType);
t4d.genTest(apiType, dbType); t4d.genTest(apiType, dbType);
// to be fixed t4e.genTest(apiType, dbType); t4e.genTest(apiType, dbType);
t4f.genTest(apiType, dbType); // tbd t4f.genTest(apiType, dbType);
}; };
nocoTestSuite("rest", "postgres"); nocoTestSuite("rest", "postgres");

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

@ -19,7 +19,7 @@ const nocoTestSuite = (apiType, dbType) => {
t4a.genTest(apiType, dbType); t4a.genTest(apiType, dbType);
t4b.genTest(apiType, dbType); t4b.genTest(apiType, dbType);
t4d.genTest(apiType, dbType); t4d.genTest(apiType, dbType);
// to be fixed t4e.genTest(apiType, dbType); t4e.genTest(apiType, dbType);
t4f.genTest(apiType, dbType); t4f.genTest(apiType, dbType);
}; };

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

@ -291,30 +291,41 @@ export class _mainPage {
hideField = (field) => { hideField = (field) => {
cy.get(`th[data-title="${field}"]`).should("be.visible"); cy.get(`th[data-title="${field}"]`).should("be.visible");
cy.get(".nc-fields-menu-btn").click(); cy.get(".nc-fields-menu-btn").click();
cy.wait(500)
cy.getActiveMenu().find(`.nc-fields-list label:contains(${field}):visible`).click(); cy.getActiveMenu().find(`.nc-fields-list label:contains(${field}):visible`).click();
cy.wait(500)
cy.get(".nc-fields-menu-btn").click(); cy.get(".nc-fields-menu-btn").click();
cy.wait(500)
cy.get(`th[data-title="${field}"]`).should("not.exist"); cy.get(`th[data-title="${field}"]`).should("not.exist");
}; };
unhideField = (field) => { unhideField = (field) => {
cy.get(`th[data-title="${field}"]`).should("not.exist"); cy.get(`th[data-title="${field}"]`).should("not.exist");
cy.get(".nc-fields-menu-btn").click(); cy.get(".nc-fields-menu-btn").click();
cy.wait(500)
cy.getActiveMenu().find(`.nc-fields-list label:contains(${field}):visible`).click(); cy.getActiveMenu().find(`.nc-fields-list label:contains(${field}):visible`).click();
cy.wait(500)
cy.get(".nc-fields-menu-btn").click(); cy.get(".nc-fields-menu-btn").click();
cy.wait(500)
cy.get(`th[data-title="${field}"]`).should("be.visible"); cy.get(`th[data-title="${field}"]`).should("be.visible");
}; };
sortField = (field, criteria) => { sortField = (field, criteria) => {
cy.get(".nc-sort-menu-btn").click(); cy.get(".nc-sort-menu-btn").click();
cy.wait(500)
cy.getActiveMenu().contains("Add Sort Option").click(); cy.getActiveMenu().contains("Add Sort Option").click();
cy.wait(500)
// cy.get(".nc-sort-field-select div").first().click().type(field); // cy.get(".nc-sort-field-select div").first().click().type(field);
cy.get(".nc-sort-field-select div").first().click(); cy.get(".nc-sort-field-select div").first().click();
cy.wait(500) cy.wait(500)
cy.get('.ant-select-dropdown:visible').find(`.ant-select-item`).contains(new RegExp("^" + field + "$", "g")).should('exist').click(); cy.get('.ant-select-dropdown:visible').find(`.ant-select-item`).contains(new RegExp("^" + field + "$", "g")).should('exist').click();
cy.wait(500)
cy.get(".nc-sort-dir-select div").first().click(); cy.get(".nc-sort-dir-select div").first().click();
cy.wait(500) cy.wait(500)
cy.get('.ant-select-dropdown:visible').find(`.ant-select-item`).contains(criteria).should('exist').click(); cy.get('.ant-select-dropdown:visible').find(`.ant-select-item`).contains(criteria).should('exist').click();
cy.wait(500)
cy.get(".nc-sort-menu-btn").click(); cy.get(".nc-sort-menu-btn").click();
cy.wait(500)
}; };
clearSort = () => { clearSort = () => {
@ -324,11 +335,15 @@ export class _mainPage {
cy.wait(500) cy.wait(500)
cy.get(".nc-sort-item-remove-btn:visible").should("not.exist"); cy.get(".nc-sort-item-remove-btn:visible").should("not.exist");
cy.get(".nc-sort-menu-btn").click(); cy.get(".nc-sort-menu-btn").click();
cy.wait(500)
}; };
filterField = (field, operation, value) => { filterField = (field, operation, value) => {
cy.get(".nc-filter-menu-btn").click(); cy.get(".nc-filter-menu-btn").click();
cy.wait(500)
cy.contains("Add Filter").click(); cy.contains("Add Filter").click();
cy.wait(500)
// cy.get(".nc-filter-field-select").should("exist").last().click().type(field); // cy.get(".nc-filter-field-select").should("exist").last().click().type(field);
cy.get(".nc-filter-field-select").should("exist").last().click(); cy.get(".nc-filter-field-select").should("exist").last().click();
cy.wait(500) cy.wait(500)
@ -337,21 +352,27 @@ export class _mainPage {
cy.get(".nc-filter-operation-select").should("exist").last().click(); cy.get(".nc-filter-operation-select").should("exist").last().click();
cy.wait(500) cy.wait(500)
cy.get('.ant-select-dropdown:visible').should('exist').find(`.ant-select-item`).contains(operation).should('exist').click(); cy.get('.ant-select-dropdown:visible').should('exist').find(`.ant-select-item`).contains(operation).should('exist').click();
cy.wait(500)
if (operation != "is null" && operation != "is not null") { if (operation != "is null" && operation != "is not null") {
cy.get(".nc-filter-value-select") cy.get(".nc-filter-value-select")
.should("exist") .should("exist")
.last() .last()
.type(value); .type(value);
cy.get(".nc-filter-operation-select").last().click(); cy.get(".nc-filter-operation-select").last().click();
cy.wait(500)
} }
cy.get(".nc-filter-menu-btn").click(); cy.get(".nc-filter-menu-btn").click();
cy.wait(500)
}; };
filterReset = () => { filterReset = () => {
cy.get(".nc-filter-menu-btn").click(); cy.get(".nc-filter-menu-btn").click();
cy.wait(500)
cy.get(".nc-filter-item-remove-btn").click(); cy.get(".nc-filter-item-remove-btn").click();
cy.wait(500)
cy.get(".nc-filter-item-remove-btn").should("not.exist"); cy.get(".nc-filter-item-remove-btn").should("not.exist");
cy.get(".nc-filter-menu-btn").click(); cy.get(".nc-filter-menu-btn").click();
cy.wait(500)
}; };
// delete created views // delete created views

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

@ -200,6 +200,7 @@ export class _projectsPage {
// Create project // Create project
cy.contains("Ok & Save Project", { timeout: 20000 }).click(); cy.contains("Ok & Save Project", { timeout: 20000 }).click();
cy.wait(5000)
// takes a while to load project // takes a while to load project
this.waitHomePageLoad(); this.waitHomePageLoad();

Loading…
Cancel
Save