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;
describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => {
before(() => {
// kludge: wait for page load to finish
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);
});
// before(() => {
// // standalone test
// // loginPage.loginAndOpenProject(apiType, dbType);
// });
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
after(() => {
cy.closeTableTab("Country");
afterEach(() => {
cy.saveLocalStorage();
cy.wait(1000);
});
})
it("Download verification- base view, default columns", () => {
cy.openTableTab("Country", 25);
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
@ -78,6 +67,8 @@ export const genTest = (apiType, dbType) => {
// download & verify
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
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`, () => {
before(() => {
cy.restoreLocalStorage();
cy.wait(1000);
cy.visit("/")
cy.wait(5000);
cy.saveLocalStorage();
cy.wait(1000);
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.restoreLocalStorage();
cy.get('.nc-menu-accounts').should('exist').click();
cy.getActiveMenu('.nc-dropdown-user-accounts-menu').find('.ant-dropdown-menu-item').eq(1).click();
cy.wait(5000);
cy.get('button:contains("SIGN")').should('exist')
cy.saveLocalStorage();
})
const langVerification = (idx, lang) => {

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

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

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

@ -9,20 +9,19 @@ export const genTest = (apiType, dbType) => {
before(() => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage();
cy.wait(1000);
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.restoreLocalStorage();
cy.wait(1000);
// clean up
mainPage.deleteColumn("testAttach");
@ -44,6 +43,7 @@ export const genTest = (apiType, dbType) => {
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click();
cy.closeTableTab("Country");
cy.saveLocalStorage();
});
it(`Add column of type attachments`, () => {
@ -62,9 +62,8 @@ export const genTest = (apiType, dbType) => {
});
it(`Form view with Attachment field- Submit & verify`, () => {
// open right navbar
cy.get('.nc-toggle-right-navbar').should('exist').click();
// // open right navbar
// cy.get('.nc-toggle-right-navbar').should('exist').click();
// create form-view
cy.get(`.nc-create-form-view`).click();
@ -85,6 +84,8 @@ export const genTest = (apiType, dbType) => {
let linkText = $obj.text().trim();
cy.log(linkText);
cy.signOut();
cy.visit(linkText, {
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("button.ant-btn-primary").click();
cy.get('.nc-attachment-cell')
.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`, () => {
// come back to main window
// loginPage.loginAndOpenProject(apiType, dbType);
cy.visit('/')
cy.wait(5000)
loginPage.loginAndOpenProject(apiType, dbType);
// cy.visit('/')
// cy.wait(5000)
// projectsPage.openConfiguredProject(apiType, dbType);
projectsPage.openConfiguredProject(apiType, dbType);
cy.openTableTab("Country", 25);
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`, () => {
before(() => {
loginPage.loginAndOpenProject(apiType, dbType);
// loginPage.loginAndOpenProject(apiType, dbType);
cy.restoreLocalStorage();
cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage();
cy.wait(1000);
});
it(`Generate base share URL`, () => {
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
})
afterEach(() => {
cy.saveLocalStorage();
})
it(`Generate base share URL`, () => {
// click SHARE
cy.get(".nc-share-base:visible").should('exist').click();
@ -121,10 +122,6 @@ style="background: transparent; "></iframe>
cy.log(linkText);
cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
});
permissionValidation("viewer");
@ -143,10 +140,6 @@ style="background: transparent; "></iframe>
.click();
cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
});
permissionValidation("editor");
@ -178,7 +171,6 @@ style="background: transparent; "></iframe>
// validate data (row-1)
cy.iframe().find(`.nc-grid-cell`).eq(1).contains("PENELOPE").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`, () => {
before(() => {
// loginPage.signIn(roles.owner.credentials);
cy.restoreLocalStorage();
cy.wait(1000);
cy.task("readSheetList", {
file: `./scripts/cypress/fixtures/${filepath}`,
@ -89,19 +87,21 @@ export const genTest = (apiType, dbType) => {
sheetData = rows;
});
// loginPage.signIn(roles.owner.credentials);
cy.visit("/")
projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {})
cy.wait(4000);
cy.saveLocalStorage();
cy.wait(1000);
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
afterEach(() => {
cy.saveLocalStorage();
})
it("File Upload: Upload excel as template", () => {
cy.get('.nc-add-new-table').should('exist').trigger('mouseover')
@ -265,24 +265,6 @@ export const genTest = (apiType, dbType) => {
}
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(() => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.createTable("Temp");
cy.wait(1000);
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.wait(1000);
});
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.restoreLocalStorage();
cy.deleteTable("Temp");
cy.saveLocalStorage();
cy.wait(1000);
});
it("Create: 'After Insert' event", () => {

Loading…
Cancel
Save