Browse Source

test(misc): replace wait with appropriate page load elements

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3773/head
Raju Udava 2 years ago
parent
commit
0a91770732
  1. 2
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 9
      scripts/cypress/integration/common/4e_form_view_share.js
  3. 12
      scripts/cypress/integration/common/6f_attachments.js
  4. 4
      scripts/cypress/support/commands.js
  5. 7
      scripts/cypress/support/page_objects/navigation.js

2
scripts/cypress/integration/common/00_pre_configurations.js

@ -187,7 +187,7 @@ export const genTest = (apiType, dbType) => {
} }
} else { } else {
projectsPage.createProject(proj.basic, proj.config); projectsPage.createProject(proj.basic, proj.config);
cy.wait(5000); // cy.wait(5000);
if (dbType === "xcdb") { if (dbType === "xcdb") {
// store base URL- to re-visit and delete form view later // store base URL- to re-visit and delete form view later
let projId; let projId;

9
scripts/cypress/integration/common/4e_form_view_share.js

@ -92,7 +92,6 @@ export const genTest = (apiType, dbType) => {
cy.wait(2000); cy.wait(2000);
mainPage.shareView().click(); mainPage.shareView().click();
// copy link text, visit URL // copy link text, visit URL
cy.getActiveModal(".nc-modal-share-view") cy.getActiveModal(".nc-modal-share-view")
.should("exist") .should("exist")
@ -100,6 +99,11 @@ export const genTest = (apiType, dbType) => {
.contains("/nc/form/", { timeout: 10000 }) .contains("/nc/form/", { timeout: 10000 })
.should("exist") .should("exist")
.then(($obj) => { .then(($obj) => {
// http://localhost:8080/api/v1/db/public/shared-view/761f0200-e72c-487a-85bf-615d0d277054/rows?offset=0&filterArrJson=[]&sortArrJson=[]
cy.intercept("/api/v1/db/public/shared-view/*").as(
"waitForPageLoad"
);
let linkText = $obj.text().trim(); let linkText = $obj.text().trim();
cy.log(linkText); cy.log(linkText);
@ -108,7 +112,8 @@ export const genTest = (apiType, dbType) => {
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
}); });
cy.wait(5000); // cy.wait(5000);
cy.wait(["@waitForPageLoad"], { times: 2 });
// wait for share view page to load! // wait for share view page to load!

12
scripts/cypress/integration/common/6f_attachments.js

@ -77,7 +77,7 @@ export const genTest = (apiType, dbType) => {
mainPage.shareView().click(); mainPage.shareView().click();
cy.wait(5000); // cy.wait(5000);
// copy link text, visit URL // copy link text, visit URL
cy.getActiveModal(".nc-modal-share-view") cy.getActiveModal(".nc-modal-share-view")
@ -85,6 +85,10 @@ export const genTest = (apiType, dbType) => {
.contains("/nc/form/", { timeout: 10000 }) .contains("/nc/form/", { timeout: 10000 })
.should("exist") .should("exist")
.then(($obj) => { .then(($obj) => {
cy.intercept("/api/v1/db/public/shared-view/**").as(
"waitForSharedViewLoad"
);
let linkText = $obj.text().trim(); let linkText = $obj.text().trim();
cy.log(linkText); cy.log(linkText);
@ -93,10 +97,12 @@ export const genTest = (apiType, dbType) => {
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
}); });
cy.wait(5000); // cy.wait(5000);
cy.wait(["@waitForSharedViewLoad"]);
// wait for share view page to load! // wait for share view page to load!
cy.get(".nc-form").should("exist"); cy.get(".nc-form").should("exist");
cy.get("button:contains(Submit)").should("exist");
// fill form // fill form
// 0: Country // 0: Country
@ -128,7 +134,7 @@ export const genTest = (apiType, dbType) => {
// projectsPage.openConfiguredProject(apiType, dbType); // projectsPage.openConfiguredProject(apiType, dbType);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000); // cy.wait(1000);
mainPage.filterField("testAttach", "is not null", null); mainPage.filterField("testAttach", "is not null", null);
mainPage.hideField("LastUpdate"); mainPage.hideField("LastUpdate");

4
scripts/cypress/support/commands.js

@ -480,8 +480,8 @@ Cypress.Commands.add("signOut", () => {
.eq(1) .eq(1)
.click(); .click();
cy.wait(5000); // cy.wait(5000);
cy.get('button:contains("SIGN")').should("exist"); cy.get('button:contains("SIGN IN")').should("exist");
}); });
// Drag n Drop // Drag n Drop

7
scripts/cypress/support/page_objects/navigation.js

@ -97,6 +97,9 @@ export class _projectsPage {
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName} // for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
openConfiguredProject(apiType, dbType) { openConfiguredProject(apiType, dbType) {
// http://localhost:8080/api/v1/db/meta/projects/p_kfxgmcd5jpyrje/users?limit=10&offset=0&query=
cy.intercept("/**/users?limit=*&offset=*&query=*").as("waitForPageLoad");
if (dbType === "mysql") { if (dbType === "mysql") {
projectsPage.openProject(staticProjects.externalREST.basic.name); projectsPage.openProject(staticProjects.externalREST.basic.name);
} else if (dbType === "xcdb") { } else if (dbType === "xcdb") {
@ -106,7 +109,9 @@ export class _projectsPage {
} }
// kludge: wait for page load to finish // kludge: wait for page load to finish
cy.wait(4000); // cy.wait(4000);
cy.wait("@waitForPageLoad");
// close team & auth tab // close team & auth tab
cy.get("button.ant-tabs-tab-remove").should("exist").click(); cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.wait(1000); cy.wait(1000);

Loading…
Cancel
Save