Browse Source

test: cy misc test suite local storage handling fix

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3667/head
Raju Udava 2 years ago
parent
commit
7c109785b1
  1. 29
      scripts/cypress/integration/common/6b_downloadCsv.js
  2. 13
      scripts/cypress/integration/common/6d_language_validation.js
  3. 11
      scripts/cypress/integration/common/6e_project_operations.js
  4. 28
      scripts/cypress/integration/common/6f_attachments.js
  5. 26
      scripts/cypress/integration/common/6g_base_share.js
  6. 28
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  7. 9
      scripts/cypress/integration/common/8a_webhook.js

29
scripts/cypress/integration/common/6b_downloadCsv.js

@ -9,33 +9,22 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => { describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => {
before(() => { // before(() => {
// // standalone test
// kludge: wait for page load to finish // // loginPage.loginAndOpenProject(apiType, dbType);
cy.wait(2000); // });
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage();
cy.wait(1000);
});
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
after(() => { afterEach(() => {
cy.closeTableTab("Country");
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000); })
});
it("Download verification- base view, default columns", () => { it("Download verification- base view, default columns", () => {
cy.openTableTab("Country", 25);
mainPage.hideField("LastUpdate"); mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => { const verifyCsv = (retrievedRecords) => {
// expected output, statically configured // expected output, statically configured
@ -78,6 +67,8 @@ export const genTest = (apiType, dbType) => {
// download & verify // download & verify
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv); mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate"); mainPage.unhideField("LastUpdate");
cy.closeTableTab("Country");
}); });
}); });
}; };

13
scripts/cypress/integration/common/6d_language_validation.js

@ -8,26 +8,27 @@ export const genTest = (apiType, dbType) => {
describe(`Language support`, () => { describe(`Language support`, () => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
cy.visit("/") cy.visit("/")
cy.wait(5000); cy.wait(5000);
cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
});
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage();
cy.get('.nc-menu-accounts').should('exist').click(); cy.get('.nc-menu-accounts').should('exist').click();
cy.getActiveMenu('.nc-dropdown-user-accounts-menu').find('.ant-dropdown-menu-item').eq(1).click(); cy.getActiveMenu('.nc-dropdown-user-accounts-menu').find('.ant-dropdown-menu-item').eq(1).click();
cy.wait(5000); cy.wait(5000);
cy.get('button:contains("SIGN")').should('exist') cy.get('button:contains("SIGN")').should('exist')
cy.saveLocalStorage();
}) })
const langVerification = (idx, lang) => { const langVerification = (idx, lang) => {

11
scripts/cypress/integration/common/6e_project_operations.js

@ -8,13 +8,18 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
// loginPage.signIn(roles.owner.credentials);
cy.visit("/"); cy.visit("/");
cy.wait(4000); cy.wait(4000);
}); });
cy.beforeEach(() => {
cy.restoreLocalStorage();
})
cy.afterEach(() => {
cy.saveLocalStorage();
})
it("Delete Project", () => { it("Delete Project", () => {
cy.get(`.nc-action-btn`) cy.get(`.nc-action-btn`)

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

@ -9,20 +9,19 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
});
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
// clean up // clean up
mainPage.deleteColumn("testAttach"); mainPage.deleteColumn("testAttach");
@ -44,6 +43,7 @@ export const genTest = (apiType, dbType) => {
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click(); cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
it(`Add column of type attachments`, () => { it(`Add column of type attachments`, () => {
@ -62,9 +62,8 @@ export const genTest = (apiType, dbType) => {
}); });
it(`Form view with Attachment field- Submit & verify`, () => { it(`Form view with Attachment field- Submit & verify`, () => {
// // open right navbar
// open right navbar // cy.get('.nc-toggle-right-navbar').should('exist').click();
cy.get('.nc-toggle-right-navbar').should('exist').click();
// create form-view // create form-view
cy.get(`.nc-create-form-view`).click(); cy.get(`.nc-create-form-view`).click();
@ -85,6 +84,8 @@ export const genTest = (apiType, dbType) => {
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,
}); });
@ -101,7 +102,6 @@ export const genTest = (apiType, dbType) => {
cy.get('.ant-picker-dropdown').find(".ant-picker-now-btn").click(); cy.get('.ant-picker-dropdown').find(".ant-picker-now-btn").click();
cy.get('.ant-picker-dropdown').find("button.ant-btn-primary").click(); cy.get('.ant-picker-dropdown').find("button.ant-btn-primary").click();
cy.get('.nc-attachment-cell') cy.get('.nc-attachment-cell')
.attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' }); .attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' });
@ -117,11 +117,11 @@ export const genTest = (apiType, dbType) => {
it(`Filter column which contain only attachments, download CSV`, () => { it(`Filter column which contain only attachments, download CSV`, () => {
// come back to main window // come back to main window
// loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.visit('/') // cy.visit('/')
cy.wait(5000) // cy.wait(5000)
// projectsPage.openConfiguredProject(apiType, dbType);
projectsPage.openConfiguredProject(apiType, dbType);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000); cy.wait(1000);

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

@ -57,20 +57,21 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} Base VIEW share`, () => { describe(`${apiType.toUpperCase()} Base VIEW share`, () => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); // loginPage.loginAndOpenProject(apiType, dbType);
cy.restoreLocalStorage();
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
it(`Generate base share URL`, () => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
afterEach(() => {
cy.saveLocalStorage();
})
it(`Generate base share URL`, () => {
// click SHARE // click SHARE
cy.get(".nc-share-base:visible").should('exist').click(); cy.get(".nc-share-base:visible").should('exist').click();
@ -121,10 +122,6 @@ style="background: transparent; "></iframe>
cy.log(linkText); cy.log(linkText);
cy.signOut(); cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
}); });
permissionValidation("viewer"); permissionValidation("viewer");
@ -143,10 +140,6 @@ style="background: transparent; "></iframe>
.click(); .click();
cy.signOut(); cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
}); });
permissionValidation("editor"); permissionValidation("editor");
@ -178,7 +171,6 @@ style="background: transparent; "></iframe>
// validate data (row-1) // validate data (row-1)
cy.iframe().find(`.nc-grid-cell`).eq(1).contains("PENELOPE").should("exist"); cy.iframe().find(`.nc-grid-cell`).eq(1).contains("PENELOPE").should("exist");
cy.iframe().find(`.nc-grid-cell`).eq(2).contains("GUINESS").should("exist"); cy.iframe().find(`.nc-grid-cell`).eq(2).contains("GUINESS").should("exist");
}); });
}) })
} }

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

@ -68,11 +68,9 @@ export const genTest = (apiType, dbType) => {
describe(`Import from excel`, () => { describe(`Import from excel`, () => {
before(() => { before(() => {
// loginPage.signIn(roles.owner.credentials); // loginPage.signIn(roles.owner.credentials);
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
cy.task("readSheetList", { cy.task("readSheetList", {
file: `./scripts/cypress/fixtures/${filepath}`, file: `./scripts/cypress/fixtures/${filepath}`,
@ -89,19 +87,21 @@ export const genTest = (apiType, dbType) => {
sheetData = rows; sheetData = rows;
}); });
// loginPage.signIn(roles.owner.credentials); cy.visit("/")
projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {}) projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {})
cy.wait(4000); cy.wait(4000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
afterEach(() => {
cy.saveLocalStorage();
})
it("File Upload: Upload excel as template", () => { it("File Upload: Upload excel as template", () => {
cy.get('.nc-add-new-table').should('exist').trigger('mouseover') cy.get('.nc-add-new-table').should('exist').trigger('mouseover')
@ -265,24 +265,6 @@ export const genTest = (apiType, dbType) => {
} }
cy.closeTableTab("Sheet1"); cy.closeTableTab("Sheet1");
}); });
after(() => {
// delete project once all operations are completed
// mainPage.toolBarTopLeft(mainPage.HOME).click();
// projectsPage.deleteProject("importSample");
// cy.get('.nc-noco-brand-icon').click();
//
// cy.get(`.nc-action-btn`)
// .should("exist")
// .last()
// .click();
//
// cy.getActiveModal()
// .find(".ant-btn-dangerous")
// .should("exist")
// .click();
});
}); });
}; };

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

@ -228,20 +228,21 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.createTable("Temp"); cy.createTable("Temp");
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage();
cy.deleteTable("Temp"); cy.deleteTable("Temp");
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
it("Create: 'After Insert' event", () => { it("Create: 'After Insert' event", () => {

Loading…
Cancel
Save