Browse Source

Merge pull request #3797 from nocodb/test/cy-wait-cleanup

test(misc): wait clean up
pull/3802/head
Raju Udava 2 years ago committed by GitHub
parent
commit
6b44884cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/nc-gui/components/smartsheet-header/Menu.vue
  2. 25
      scripts/cypress/integration/common/5a_user_role.js
  3. 14
      scripts/cypress/integration/common/6f_attachments.js
  4. 5
      scripts/cypress/integration/common/6g_base_share.js
  5. 12
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  6. 10
      scripts/cypress/integration/common/8a_webhook.js
  7. 7
      scripts/cypress/integration/common/9a_QuickTest.js
  8. 4
      scripts/cypress/integration/spec/roleValidation.spec.js
  9. 9
      scripts/cypress/support/commands.js
  10. 20
      scripts/cypress/support/page_objects/mainPage.js

1
packages/nc-gui/components/smartsheet-header/Menu.vue

@ -23,6 +23,7 @@ const { getMeta } = useMetas()
const deleteColumn = () =>
Modal.confirm({
title: h('div', ['Do you want to delete ', h('span', { class: 'font-weight-bold' }, [column?.value?.title]), ' column ?']),
wrapClassName: 'nc-modal-column-delete',
okText: t('general.delete'),
okType: 'danger',
cancelText: t('general.cancel'),

25
scripts/cypress/integration/common/5a_user_role.js

@ -102,7 +102,7 @@ export const genTest = (apiType, dbType) => {
disableTableAccess("CustomerList", "commenter");
disableTableAccess("CustomerList", "viewer");
cy.get("button.nc-acl-save").click({ force: true });
cy.get("button.nc-acl-save").click();
cy.toastWait("Updated UI ACL for tables successfully");
mainPage.closeMetaTab();
@ -110,13 +110,15 @@ export const genTest = (apiType, dbType) => {
});
const roleValidation = (roleType) => {
let clear;
describe(`User role validation`, () => {
before(() => {
cy.restoreLocalStorage();
cy.visit(mainPage.roleURL[roleType]);
cy.wait(5000);
// cy.wait(5000);
cy.get('button:contains("SIGN UP")').should("exist");
cy.get('button:contains("SIGN UP"):visible').should("exist");
cy.get('input[type="text"]', { timeout: 20000 }).type(
roles[roleType].credentials.username
);
@ -125,11 +127,11 @@ export const genTest = (apiType, dbType) => {
);
cy.get('button:contains("SIGN UP")').click();
cy.wait(3000);
// cy.wait(3000);
cy.get(".nc-project-page-title")
.contains("My Projects")
.should("be.visible");
cy.get(`.nc-project-page-title:contains("My Projects"):visible`).should(
"exist"
);
if (dbType === "xcdb") {
if ("rest" == apiType)
@ -149,12 +151,15 @@ export const genTest = (apiType, dbType) => {
if (roleType === "creator") {
// kludge: wait for page load to finish
// close team & auth tab
cy.wait(2000);
cy.wait(500);
cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.wait(1000);
cy.wait(500);
}
cy.saveLocalStorage();
clear = Cypress.LocalStorage.clear;
Cypress.LocalStorage.clear = () => {};
});
beforeEach(() => {
@ -169,6 +174,8 @@ export const genTest = (apiType, dbType) => {
cy.restoreLocalStorage();
cy.signOut();
cy.saveLocalStorage();
Cypress.LocalStorage.clear = clear;
});
///////////////////////////////////////////////////////

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

@ -27,15 +27,12 @@ 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);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
// mainPage
// .getRow(10)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
// kludge: flicker on load
// cy.wait(3000);
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
@ -129,12 +126,7 @@ export const genTest = (apiType, dbType) => {
it(`Filter column which contain only attachments, download CSV`, () => {
// come back to main window
loginPage.loginAndOpenProject(apiType, dbType);
// cy.visit('/')
// cy.wait(5000)
// projectsPage.openConfiguredProject(apiType, dbType);
cy.openTableTab("Country", 25);
// cy.wait(1000);
mainPage.filterField("testAttach", "is not null", null);
mainPage.hideField("LastUpdate");

5
scripts/cypress/integration/common/6g_base_share.js

@ -21,12 +21,15 @@ export const genTest = (apiType, dbType) => {
const permissionValidation = (roleType) => {
it(`${roleType}: Visit base shared URL`, () => {
cy.log(linkText);
// http://localhost:8080/api/v1/db/meta/projects/p_4ufoizgrorwyey/tables?includeM2M=false
cy.intercept("/api/v1/db/meta/projects/**").as("waitForPageLoad");
// visit URL & wait for page load to complete
cy.visit(linkText, {
baseUrl: null,
});
cy.wait(5000);
cy.wait(["@waitForPageLoad"]);
// cy.wait(5000);
});
it(`${roleType}: Validate access permissions: advance menu`, () => {

12
scripts/cypress/integration/common/7a_create_project_from_excel.js

@ -87,12 +87,12 @@ export const genTest = (apiType, dbType) => {
sheetData = rows;
});
cy.visit("/");
// cy.visit("/");
projectsPage.createProject(
{ dbType: "none", apiType: "REST", name: "importSample" },
{}
);
cy.wait(4000);
// cy.wait(4000);
cy.saveLocalStorage();
});
@ -122,6 +122,11 @@ export const genTest = (apiType, dbType) => {
});
it("File Upload: Verify pre-load template page", () => {
// http://localhost:8080/api/v1/db/meta/audits/comments/count?ids[]=1&ids[]=2&fk_model_id=md_fq1vxy2181bzp0
cy.intercept("/api/v1/db/meta/audits/comments/count*").as(
"waitForPageLoad"
);
cy.getActiveModal()
.find(".ant-collapse-item")
.then((sheets) => {
@ -171,7 +176,8 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal().find(".ant-btn-primary").click();
// wait for page to get loaded (issue observed in CI-CD)
cy.wait(5000);
// cy.wait(5000);
cy.wait("@waitForPageLoad");
});
it("File Upload: Verify loaded data", () => {

10
scripts/cypress/integration/common/8a_webhook.js

@ -116,7 +116,7 @@ function configureWebhook(hook, test) {
.contains(new RegExp("^" + hook.condition.column + "$", "g"))
.should("exist")
.click();
cy.wait(1000);
// cy.wait(1000);
cy.get(".nc-filter-operation-select").should("exist").last().click();
cy.get(".ant-select-dropdown:visible")
@ -162,8 +162,11 @@ function clearServerData() {
function addNewRow(index, cellValue) {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.get(".nc-add-new-row-btn").click();
cy.wait(1000);
// cy.wait(1000);
cy.get(".nc-expand-col-Title")
.should("exist")
.find(".nc-cell > input")
.first()
.type(cellValue);
@ -185,6 +188,7 @@ function updateRow(index, cellValue) {
.click({ force: true });
cy.get(".nc-expand-col-Title")
.should("exist")
.find(".nc-cell > input")
.should("exist")
.first()
@ -207,7 +211,7 @@ function updateRow(index, cellValue) {
function verifyHookTrigger(count, lastValue) {
// allow message to be received
cy.wait(500);
cy.wait(100);
cy.request("http://localhost:9090/hook/count").then((msg) => {
cy.log(msg.body);

7
scripts/cypress/integration/common/9a_QuickTest.js

@ -89,6 +89,8 @@ function verifyWebhook(config) {
}
export const genTest = (apiType, dbType, testMode) => {
let clear;
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`Quick Tests`, () => {
let cellIdx = 1;
@ -115,6 +117,9 @@ export const genTest = (apiType, dbType, testMode) => {
cy.openTableTab("Film", 3);
cy.saveLocalStorage();
clear = Cypress.LocalStorage.clear;
Cypress.LocalStorage.clear = () => {};
});
beforeEach(() => {
@ -129,6 +134,8 @@ export const genTest = (apiType, dbType, testMode) => {
cy.restoreLocalStorage();
cy.signOut();
cy.saveLocalStorage();
Cypress.LocalStorage.clear = clear;
});
it("Verify Schema", () => {

4
scripts/cypress/integration/spec/roleValidation.spec.js

@ -203,7 +203,7 @@ export function _editComment(roleType, mode) {
cy.openTableTab(columnName, 25);
cy.wait(1000);
// cy.wait(1000);
// click on comment icon & type comment
//
@ -214,7 +214,7 @@ export function _editComment(roleType, mode) {
// Everyone else: Comment added/read successfully
//
cy.wait(3000);
// cy.wait(3000);
if ("viewer" === roleType) {
cy.getActiveDrawer(".nc-drawer-expanded-form")

9
scripts/cypress/support/commands.js

@ -173,7 +173,7 @@ Cypress.Commands.add("closeTableTab", (tn) => {
.click();
// subsequent tab open commands will fail if tab is not closed completely
cy.wait(1000);
cy.wait(100);
});
Cypress.Commands.add("openOrCreateGqlProject", (_args) => {
@ -486,6 +486,13 @@ Cypress.Commands.add("signOut", () => {
cy.get('button:contains("SIGN IN")').should("exist");
});
// Navigation
//
Cypress.Commands.add("gotoProjectsPage", () => {
cy.get(".nc-noco-brand-icon").should("exist").click();
cy.get(`.nc-project-page-title:contains("My Projects")`).should("exist");
});
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853
/*

20
scripts/cypress/support/page_objects/mainPage.js

@ -256,13 +256,21 @@ export class _mainPage {
.trigger("mouseover", { force: true })
.click({ force: true });
cy.wait(500);
// cy.wait(500);
// cy.get(".nc-column-delete").click();
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-delete")
.click();
// cy.wait(500);
// cy.get(".nc-column-delete").should("not.be.visible");
// cy.get(".ant-btn-dangerous:visible").contains("Delete").click();
// cy.wait(500);
cy.get(".nc-column-delete").click();
cy.wait(500);
cy.get(".nc-column-delete").should("not.be.visible");
cy.get(".ant-btn-dangerous:visible").contains("Delete").click();
cy.wait(500);
cy.getActiveModal(".nc-modal-column-delete")
.find(".ant-btn-dangerous:visible")
.contains("Delete")
.click();
cy.get(`th:contains(${colName})`).should("not.exist");
};

Loading…
Cancel
Save