|
|
|
@ -23,13 +23,32 @@ export const genTest = (apiType, dbType) => {
|
|
|
|
|
|
|
|
|
|
describe("Static user creations (different roles)", () => { |
|
|
|
|
before(() => { |
|
|
|
|
cy.fileHook(); |
|
|
|
|
mainPage.tabReset(); |
|
|
|
|
|
|
|
|
|
// kludge: wait for page load to finish
|
|
|
|
|
cy.wait(4000); |
|
|
|
|
// close team & auth tab
|
|
|
|
|
cy.get('button.ant-tabs-tab-remove').should('exist').click(); |
|
|
|
|
cy.wait(1000); |
|
|
|
|
|
|
|
|
|
settingsPage.openMenu(settingsPage.TEAM_N_AUTH) |
|
|
|
|
|
|
|
|
|
cy.saveLocalStorage(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
|
cy.fileHook(); |
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
after(() => { |
|
|
|
|
// sign out
|
|
|
|
|
cy.visit(`/`); |
|
|
|
|
cy.wait(5000); |
|
|
|
|
cy.get('.nc-menu-accounts').should('exist').click(); |
|
|
|
|
cy.getActiveMenu().find('.ant-dropdown-menu-item').eq(1).click(); |
|
|
|
|
|
|
|
|
|
cy.wait(5000); |
|
|
|
|
cy.get('button:contains("SIGN")').should('exist') |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const addUser = (user) => { |
|
|
|
@ -96,69 +115,77 @@ export const genTest = (apiType, dbType) => {
|
|
|
|
|
|
|
|
|
|
const roleValidation = (roleType) => { |
|
|
|
|
describe(`User role validation`, () => { |
|
|
|
|
|
|
|
|
|
before(() => { |
|
|
|
|
cy.fileHook(); |
|
|
|
|
// cy.restoreLocalStorage();
|
|
|
|
|
cy.visit(mainPage.roleURL[roleType]) |
|
|
|
|
cy.wait(5000); |
|
|
|
|
|
|
|
|
|
cy.get('button:contains("SIGN UP")').should('exist') |
|
|
|
|
cy.get('input[type="text"]', { timeout: 20000 }).type( |
|
|
|
|
roles[roleType].credentials.username |
|
|
|
|
); |
|
|
|
|
cy.get('input[type="password"]').type(roles[roleType].credentials.password); |
|
|
|
|
cy.get('button:contains("SIGN UP")').click(); |
|
|
|
|
|
|
|
|
|
cy.wait(3000); |
|
|
|
|
|
|
|
|
|
cy.get('.nc-project-page-title').contains("My Projects").should("be.visible"); |
|
|
|
|
|
|
|
|
|
if (dbType === "xcdb") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.sampleREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.sampleGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} else if (dbType === "mysql") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.externalREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.externalGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} else if (dbType === "postgres") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.pgExternalREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.pgExternalGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (roleType === "creator") { |
|
|
|
|
// kludge: wait for page load to finish
|
|
|
|
|
// close team & auth tab
|
|
|
|
|
cy.wait(2000); |
|
|
|
|
cy.get('button.ant-tabs-tab-remove').should('exist').click(); |
|
|
|
|
cy.wait(1000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cy.saveLocalStorage(); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
|
cy.fileHook(); |
|
|
|
|
cy.restoreLocalStorage(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (roleType != "owner") { |
|
|
|
|
it(`[${roles[roleType].name}] SignIn, Open project`, () => { |
|
|
|
|
cy.log(mainPage.roleURL[roleType]); |
|
|
|
|
cy.visit(mainPage.roleURL[roleType], { |
|
|
|
|
baseUrl: null, |
|
|
|
|
}); |
|
|
|
|
cy.wait(5000); |
|
|
|
|
|
|
|
|
|
// Redirected to new URL, feed details
|
|
|
|
|
//
|
|
|
|
|
cy.get('input[type="text"]') |
|
|
|
|
.should("exist") |
|
|
|
|
.type(roles[roleType].credentials.username); |
|
|
|
|
cy.get('input[type="password"]').type( |
|
|
|
|
roles[roleType].credentials.password |
|
|
|
|
); |
|
|
|
|
cy.get('button:contains("SIGN")').click(); |
|
|
|
|
|
|
|
|
|
// cy.url({ timeout: 6000 }).should("contain", "#/project");
|
|
|
|
|
cy.get('nc-project-page-title').contains("My Projects").should("be.visible"); |
|
|
|
|
|
|
|
|
|
if (dbType === "xcdb") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.sampleREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.sampleGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} else if (dbType === "mysql") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.externalREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.externalGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} else if (dbType === "postgres") { |
|
|
|
|
if ("rest" == apiType) |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.pgExternalREST.basic.name |
|
|
|
|
); |
|
|
|
|
else |
|
|
|
|
projectsPage.openProject( |
|
|
|
|
staticProjects.pgExternalGQL.basic.name |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
after(() => { |
|
|
|
|
// sign out
|
|
|
|
|
cy.visit(`/`); |
|
|
|
|
cy.wait(5000); |
|
|
|
|
cy.get('.nc-menu-accounts').should('exist').click(); |
|
|
|
|
cy.getActiveMenu().find('.ant-dropdown-menu-item').eq(1).click(); |
|
|
|
|
|
|
|
|
|
if (roleType != "creator") { |
|
|
|
|
cy.closeTableTab("Actor"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
cy.wait(5000); |
|
|
|
|
cy.get('button:contains("SIGN")').should('exist') |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
|
// Test suite
|
|
|
|
@ -205,45 +232,44 @@ export const genTest = (apiType, dbType) => {
|
|
|
|
|
_viewMenu(roleType, "userRole"); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Top Right Menu bar`, () => { |
|
|
|
|
// Share button is conditional
|
|
|
|
|
// Rest are static/ mandatory
|
|
|
|
|
//
|
|
|
|
|
_topRightMenu(roleType, "userRole"); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Download files`, () => { |
|
|
|
|
// viewer & commenter doesn't contain hideField option in ncv2
|
|
|
|
|
// #ID, City, LastUpdate, City => Address, Country <= City, +
|
|
|
|
|
mainPage.hideField("LastUpdate"); |
|
|
|
|
|
|
|
|
|
const verifyCsv = (retrievedRecords) => { |
|
|
|
|
// expected output, statically configured
|
|
|
|
|
let storedRecords = [ |
|
|
|
|
`City,Address List,Country`, |
|
|
|
|
`A Corua (La Corua),939 Probolinggo Loop,Spain`, |
|
|
|
|
`Abha,733 Mandaluyong Place,Saudi Arabia`, |
|
|
|
|
`Abu Dhabi,535 Ahmadnagar Manor,United Arab Emirates`, |
|
|
|
|
`Acua,1789 Saint-Denis Parkway,Mexico`, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
// skip if xcdb
|
|
|
|
|
if (!isXcdb()) { |
|
|
|
|
for (let i = 0; i < storedRecords.length; i++) { |
|
|
|
|
// cy.log(retrievedRecords[i])
|
|
|
|
|
expect(retrievedRecords[i]).to.be.equal( |
|
|
|
|
storedRecords[i] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// to be fixed
|
|
|
|
|
if(roleType === 'commenter' || roleType === 'viewer') {} |
|
|
|
|
else { |
|
|
|
|
// viewer & commenter doesn't contain hideField option in ncv2
|
|
|
|
|
// #ID, City, LastUpdate, City => Address, Country <= City, +
|
|
|
|
|
mainPage.hideField("LastUpdate"); |
|
|
|
|
|
|
|
|
|
const verifyCsv = (retrievedRecords) => { |
|
|
|
|
// expected output, statically configured
|
|
|
|
|
let storedRecords = [ |
|
|
|
|
`City,Address List,Country`, |
|
|
|
|
`A Corua (La Corua),939 Probolinggo Loop,Spain`, |
|
|
|
|
`Abha,733 Mandaluyong Place,Saudi Arabia`, |
|
|
|
|
`Abu Dhabi,535 Ahmadnagar Manor,United Arab Emirates`, |
|
|
|
|
`Acua,1789 Saint-Denis Parkway,Mexico`, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
// skip if xcdb
|
|
|
|
|
if (!isXcdb()) { |
|
|
|
|
for (let i = 0; i < storedRecords.length; i++) { |
|
|
|
|
// cy.log(retrievedRecords[i])
|
|
|
|
|
expect(retrievedRecords[i]).to.be.equal( |
|
|
|
|
storedRecords[i] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// download & verify
|
|
|
|
|
mainPage.downloadAndVerifyCsv( |
|
|
|
|
`City_exported_1.csv`, |
|
|
|
|
verifyCsv |
|
|
|
|
); |
|
|
|
|
mainPage.unhideField("LastUpdate"); |
|
|
|
|
// download & verify
|
|
|
|
|
mainPage.downloadAndVerifyCsv( |
|
|
|
|
`City_exported_1.csv`, |
|
|
|
|
verifyCsv, |
|
|
|
|
roleType |
|
|
|
|
); |
|
|
|
|
mainPage.unhideField("LastUpdate"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|