Browse Source

Merge pull request #1027 from nocodb/test/cypress-stability

Test/cypress stability - [kludge] delay induced between successive sqlite triggers during xcdb project meta-sync
pull/1044/head
Raju Udava 3 years ago committed by GitHub
parent
commit
96e756c56b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 63
      scripts/cypress/support/page_objects/mainPage.js

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

@ -198,6 +198,7 @@ export const genTest = (type, xcdb) => {
let query = prepareSqliteQuery(projId);
for (let i = 0; i < query.length; i++) {
cy.task("sqliteExec", query[i]);
cy.wait(1000);
}
})
.then(() => {

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

@ -130,7 +130,8 @@ export class _mainPage {
cy.get(".nc-invite-or-save-btn").click();
cy.toastWait("Successfully updated the user details");
this.roleURL[role] = "http://localhost:3000/#/user/authentication/signin";
this.roleURL[role] =
"http://localhost:3000/#/user/authentication/signin";
};
getCell = (columnHeader, cellNumber) => {
@ -230,28 +231,28 @@ export class _mainPage {
};
shareView = () => {
return cy.get('.nc-btn-share-view');
}
return cy.get(".nc-btn-share-view");
};
shareViewList = () => {
cy.get('.nc-actions-menu-btn').click();
cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(2);
}
};
downloadCsv = () => {
cy.get('.nc-actions-menu-btn').click();
cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(0);
}
};
uploadCsv = () => {
cy.get('.nc-actions-menu-btn').click();
cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(1);
}
};
automations = () => {
cy.get('.nc-actions-menu-btn').click();
cy.get(".nc-actions-menu-btn").click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(3);
}
};
hideField = (field) => {
cy.get(".nc-grid-header-cell").contains(field).should("be.visible");
@ -298,11 +299,16 @@ export class _mainPage {
cy.contains("Add Filter").click();
cy.get(".nc-filter-field-select").last().click();
cy.getActiveMenu().find(`.v-list-item:contains(${field})`).first().click();
cy.getActiveMenu()
.find(`.v-list-item:contains(${field})`)
.first()
.click();
cy.get(".nc-filter-operation-select").last().click();
cy.getActiveMenu().find(`.v-list-item:contains(${operation})`).click();
if (operation != "is null" && operation != "is not null") {
cy.get(".nc-filter-value-select input:text").last().type(`${value}`);
cy.get(".nc-filter-value-select input:text")
.last()
.type(`${value}`);
cy.get(".nc-filter-operation-select").last().click();
}
@ -359,10 +365,10 @@ export class _mainPage {
.then(() => {
cy.toastWait("Deleted shared view successfully");
// close modal
cy.get('.v-overlay--active > .v-overlay__scrim').click({force: true});
cy.get(".v-overlay--active > .v-overlay__scrim").click({
force: true,
});
});
};
// download CSV & verify
@ -395,7 +401,9 @@ export class _mainPage {
getIFrameCell = (columnHeader, cellNumber) => {
return cy
.iframe()
.find(`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`);
.find(
`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`
);
};
// https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Sharing-Context
@ -414,9 +422,13 @@ export class _mainPage {
// open Project metadata tab
//
this.navigationDraw(this.PROJ_METADATA).click();
cy.get(".nc-meta-mgmt-metadata-tab").should("exist").click({ force: true });
cy.get(".nc-meta-mgmt-metadata-tab")
.should("exist")
.click({ force: true });
// kludge, at times test failed to open tab on click
cy.get(".nc-meta-mgmt-metadata-tab").should("exist").click({ force: true });
cy.get(".nc-meta-mgmt-metadata-tab")
.should("exist")
.click({ force: true });
}
closeMetaTab() {
@ -429,9 +441,16 @@ export class _mainPage {
}
metaSyncValidate(tbl, msg) {
cy.get(".nc-btn-metasync-reload").should("exist").click({ force: true });
cy.get(".nc-btn-metasync-reload")
.should("exist")
.click({ force: true });
cy.get(`.nc-metasync-row-${tbl}`).contains(msg).should("exist");
cy.get(".nc-btn-metasync-sync-now").should("exist").click({ force: true });
cy.get(".nc-btn-metasync-sync-now")
.should("exist")
.click({ force: true })
.then(() => {
cy.toastWait(`Table metadata recreated successfully`);
});
cy.get(".nc-metasync-row").then((row) => {
for (let i = 0; i < row.length; i++) {
cy.wrap(row).contains("No change identified").should("exist");
@ -441,7 +460,7 @@ export class _mainPage {
// cy.get(`.nc-metasync-row-${tbl}`)
// .contains("No change identified")
// .should("exist");
cy.toastWait(`Table metadata recreated successfully`);
// cy.toastWait(`Table metadata recreated successfully`);
// cy.get(`.nc-metasync-row-${tbl}`).should("exist");
}
}

Loading…
Cancel
Save