Browse Source

chore: code formatting corrections applied (prettier)

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/865/head
Raju Udava 3 years ago
parent
commit
4ef9a6bcad
  1. 128
      scripts/cypress/integration/common/1a_table_operations.js
  2. 163
      scripts/cypress/integration/common/1b_table_column_operations.js
  3. 72
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  4. 106
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  5. 259
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  6. 395
      scripts/cypress/integration/common/3b_formula_column.js
  7. 171
      scripts/cypress/integration/common/3c_lookup_column.js
  8. 138
      scripts/cypress/integration/common/3d_rollup_column.js
  9. 72
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  10. 184
      scripts/cypress/integration/common/4b_table_view_share.js
  11. 722
      scripts/cypress/integration/common/4c_form_view_detailed.js
  12. 135
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  13. 361
      scripts/cypress/integration/common/4e_form_view_share.js
  14. 757
      scripts/cypress/integration/common/4f_grid_view_share.js
  15. 313
      scripts/cypress/integration/common/5a_user_role.js
  16. 189
      scripts/cypress/integration/common/5b_preview_role.js
  17. 71
      scripts/cypress/integration/common/6b_downloadCsv.js
  18. 406
      scripts/cypress/integration/common/6c_swagger_api.js
  19. 118
      scripts/cypress/integration/common/6d_language_validation.js
  20. 89
      scripts/cypress/integration/common/6e_project_operations.js
  21. 137
      scripts/cypress/integration/common/6f_attachments.js
  22. 247
      scripts/cypress/integration/common/6g_base_share.js
  23. 539
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  24. 324
      scripts/cypress/integration/spec/roleValidation.spec.js
  25. 35
      scripts/cypress/integration/test/explicitLogin.js
  26. 56
      scripts/cypress/integration/test/gqlMisc.js
  27. 34
      scripts/cypress/integration/test/gqlRoles.js
  28. 62
      scripts/cypress/integration/test/gqlTableOps.js
  29. 54
      scripts/cypress/integration/test/gqlViews.js
  30. 110
      scripts/cypress/integration/test/masterSuiteGql.js
  31. 110
      scripts/cypress/integration/test/masterSuiteRest.js
  32. 66
      scripts/cypress/integration/test/restMisc.js
  33. 34
      scripts/cypress/integration/test/restRoles.js
  34. 62
      scripts/cypress/integration/test/restTableOps.js
  35. 54
      scripts/cypress/integration/test/restViews.js
  36. 35
      scripts/cypress/plugins/index.js
  37. 34
      scripts/cypress/plugins/read-xlsx.js
  38. 341
      scripts/cypress/support/commands.js
  39. 17
      scripts/cypress/support/index.js
  40. 685
      scripts/cypress/support/page_objects/mainPage.js
  41. 524
      scripts/cypress/support/page_objects/navigation.js
  42. 198
      scripts/cypress/support/page_objects/projectConstants.js

128
scripts/cypress/integration/common/1a_table_operations.js

@ -1,98 +1,100 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => {
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${xcdb ? "Meta - " : ""}${type.toUpperCase()} api - Table`, () => {
before(() => {
cy.get('.mdi-close').click({ multiple: true })
})
cy.get(".mdi-close").click({ multiple: true });
});
after(() => {
cy.get('.mdi-close').click({ multiple: true })
})
cy.get(".mdi-close").click({ multiple: true });
});
const name = 'tablex'
const name = "tablex";
// create a new random table
it('Create Table', () => {
cy.createTable(name)
})
it("Create Table", () => {
cy.createTable(name);
});
// delete newly created table
it('Delete Table', () => {
cy.deleteTable(name)
})
it("Delete Table", () => {
cy.deleteTable(name);
});
const getAuditCell = (row, col) => {
return cy.get('table > tbody > tr').eq(row).find('td').eq(col)
}
return cy.get("table > tbody > tr").eq(row).find("td").eq(col);
};
it('Open Audit tab', ()=> {
mainPage.navigationDraw(mainPage.AUDIT).click()
it("Open Audit tab", () => {
mainPage.navigationDraw(mainPage.AUDIT).click();
// wait for column headers to appear
//
cy.get('thead > tr > th.caption').should('have.length', 5)
cy.get("thead > tr > th.caption").should("have.length", 5);
// Audit table entries
// [Header] Operation Type, Operation Sub Type, Description, User, Created
// [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ...
// [1] TABLE, Created, created table table-x, user@nocodb.com, ...
// Audit table entries
// [Header] Operation Type, Operation Sub Type, Description, User, Created
// [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ...
// [1] TABLE, Created, created table table-x, user@nocodb.com, ...
getAuditCell(0,0).contains('TABLE').should('exist')
getAuditCell(0,1).contains('DELETED').should('exist')
getAuditCell(0,3).contains('user@nocodb.com').should('exist')
getAuditCell(0, 0).contains("TABLE").should("exist");
getAuditCell(0, 1).contains("DELETED").should("exist");
getAuditCell(0, 3).contains("user@nocodb.com").should("exist");
getAuditCell(1,0).contains('TABLE').should('exist')
getAuditCell(1,1).contains('CREATED').should('exist')
getAuditCell(1,3).contains('user@nocodb.com').should('exist')
})
it('Table Rename operation', () => {
getAuditCell(1, 0).contains("TABLE").should("exist");
getAuditCell(1, 1).contains("CREATED").should("exist");
getAuditCell(1, 3).contains("user@nocodb.com").should("exist");
});
cy.renameTable('City', 'CityX')
it("Table Rename operation", () => {
cy.renameTable("City", "CityX");
// verify
// 1. Table name in project tree has changed
cy.get('.nc-project-tree')
.contains('CityX')
.should('exist')
cy.get(".nc-project-tree").contains("CityX").should("exist");
// 2. Table tab name has changed
cy.get(`.project-tab:contains('CityX'):visible`)
.should('exist')
cy.get(`.project-tab:contains('CityX'):visible`).should("exist");
// 3. contents of the table are valid
mainPage.getCell(`City`, 1)
.contains('A Corua (La Corua)')
.should('exist')
cy.closeTableTab('CityX')
mainPage
.getCell(`City`, 1)
.contains("A Corua (La Corua)")
.should("exist");
cy.closeTableTab("CityX");
// 4. verify linked contents in other table
// 4a. Address table, has many field
cy.openTableTab('Address', 25)
cy.openTableTab("Address", 25);
mainPage.getCell('City <= Address', 1).scrollIntoView()
mainPage.getCell('City <= Address', 1).find('.name').contains('Lethbridge').should('exist')
cy.closeTableTab('Address')
mainPage.getCell("City <= Address", 1).scrollIntoView();
mainPage
.getCell("City <= Address", 1)
.find(".name")
.contains("Lethbridge")
.should("exist");
cy.closeTableTab("Address");
// 4b. Country table, belongs to field
cy.openTableTab('Country', 25)
mainPage.getCell('Country => City', 1).find('.name').contains('Kabul').should('exist')
cy.closeTableTab('Country')
cy.openTableTab("Country", 25);
mainPage
.getCell("Country => City", 1)
.find(".name")
.contains("Kabul")
.should("exist");
cy.closeTableTab("Country");
// revert re-name operation to not impact rest of test suite
cy.renameTable('CityX', 'City')
})
})
}
cy.renameTable("CityX", "City");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -115,4 +117,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

163
scripts/cypress/integration/common/1b_table_column_operations.js

@ -1,121 +1,135 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table Column`, () => {
const name = 'tablex'
const colName = 'column_name_a'
const updatedColName = 'updated_column_name'
const randVal = 'Test@1234.com'
const updatedRandVal = 'Updated@1234.com'
const name = "tablex";
const colName = "column_name_a";
const updatedColName = "updated_column_name";
const randVal = "Test@1234.com";
const updatedRandVal = "Updated@1234.com";
before(() => {
cy.createTable(name)
cy.createTable(name);
});
// delete table
after(() => {
cy.deleteTable(name)
cy.deleteTable(name);
});
it('Create Table Column', () => {
cy.get(`.project-tab:contains(${name}):visible`).should('exist')
mainPage.addColumn(colName, name)
it("Create Table Column", () => {
cy.get(`.project-tab:contains(${name}):visible`).should("exist");
mainPage.addColumn(colName, name);
cy.get(`th:contains(${colName})`).should('exist');
})
cy.get(`th:contains(${colName})`).should("exist");
});
// edit the newly created column
it('Edit table column - change datatype', () => {
it("Edit table column - change datatype", () => {
cy.get(`th:contains(${colName}) .mdi-menu-down`)
.trigger('mouseover', {force: true})
.click({force: true})
.trigger("mouseover", { force: true })
.click({ force: true });
cy.get('.nc-column-edit').click()
cy.get(".nc-column-edit").click();
// change column type and verify
cy.get('.nc-ui-dt-dropdown').click()
cy.contains('LongText').click()
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.get(".nc-ui-dt-dropdown").click();
cy.contains("LongText").click();
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait('Update table.tablex successful')
cy.toastWait("Update table.tablex successful");
cy.get(`th[data-col="${colName}"] .mdi-text-subject`).should('exist')
cy.get(`th[data-col="${colName}"] .mdi-text-subject`).should("exist");
cy.get(`th:contains(${colName}) .mdi-menu-down`)
.trigger('mouseover', {force: true})
.click({force: true})
.trigger("mouseover", { force: true })
.click({ force: true });
cy.get('.nc-column-edit').click()
})
cy.get(".nc-column-edit").click();
});
// edit the newly created column
it('Edit table column - rename', () => {
it("Edit table column - rename", () => {
cy.get(`th:contains(${colName}) .mdi-menu-down`)
.trigger('mouseover', {force: true})
.click({force: true})
.trigger("mouseover", { force: true })
.click({ force: true });
cy.get('.nc-column-edit').click()
cy.get(".nc-column-edit").click();
// rename column and verify
cy.get('.nc-column-name-input input').clear().type(updatedColName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.get(".nc-column-name-input input").clear().type(updatedColName);
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait('Update table.tablex successful')
cy.toastWait("Update table.tablex successful");
cy.get(`th:contains(${colName})`).should('not.exist')
cy.get(`th:contains(${updatedColName})`).should('exist')
})
cy.get(`th:contains(${colName})`).should("not.exist");
cy.get(`th:contains(${updatedColName})`).should("exist");
});
// delete the newly created column
it('Delete table column', () => {
cy.get(`th:contains(${updatedColName})`).should('exist');
it("Delete table column", () => {
cy.get(`th:contains(${updatedColName})`).should("exist");
cy.get(`th:contains(${updatedColName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
cy.get('.nc-column-delete').click()
cy.get('button:contains(Confirm)').click()
cy.toastWait('Update table.tablex successful')
cy.get(`th:contains(${updatedColName})`).should('not.exist');
})
.trigger("mouseover")
.click();
it('Add new row', () => {
cy.get('.nc-add-new-row-btn:visible').should('exist')
cy.get('.nc-add-new-row-btn').click({force: true});
cy.get('#data-table-form-Title > input').first().type(randVal);
cy.getActiveModal().find('button').contains('Save Row').click({ force: true })
cy.get(".nc-column-delete").click();
cy.get("button:contains(Confirm)").click();
cy.toastWait("Update table.tablex successful");
cy.toastWait('updated successfully')
mainPage.getCell('Title', 1).contains(randVal).should('exist')
})
cy.get(`th:contains(${updatedColName})`).should("not.exist");
});
it('Update row', () => {
mainPage.getRow(1).find('.nc-row-expand-icon').click({force: true})
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal);
cy.getActiveModal().find('button').contains('Save Row').click({force: true})
it("Add new row", () => {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.get(".nc-add-new-row-btn").click({ force: true });
cy.get("#data-table-form-Title > input").first().type(randVal);
cy.getActiveModal()
.find("button")
.contains("Save Row")
.click({ force: true });
cy.toastWait("updated successfully");
mainPage.getCell("Title", 1).contains(randVal).should("exist");
});
cy.toastWait('updated successfully')
mainPage.getCell('Title', 1).contains(randVal).should('not.exist')
mainPage.getCell('Title', 1).contains(updatedRandVal).should('exist')
})
it("Update row", () => {
mainPage.getRow(1).find(".nc-row-expand-icon").click({ force: true });
cy.get("#data-table-form-Title > input")
.first()
.clear()
.type(updatedRandVal);
cy.getActiveModal()
.find("button")
.contains("Save Row")
.click({ force: true });
cy.toastWait("updated successfully");
mainPage.getCell("Title", 1).contains(randVal).should("not.exist");
mainPage.getCell("Title", 1).contains(updatedRandVal).should("exist");
});
it('Delete row', () => {
mainPage.getCell('Title', 1).contains(updatedRandVal).rightclick({ force: true })
it("Delete row", () => {
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.rightclick({ force: true });
// delete row
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click({force: true})
cy.getActiveMenu()
.find('.v-list-item:contains("Delete Row")')
.first()
.click({ force: true });
// cy.toastWait('Deleted row successfully')
cy.get('td').contains(randVal).should('not.exist');
})
})
}
cy.get("td").contains(randVal).should("not.exist");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -139,4 +153,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

72
scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -1,49 +1,61 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table: belongs to, link record`, () => {
before(() => {
cy.openTableTab('Country', 25)
})
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab('Country')
})
cy.closeTableTab("Country");
});
it('Table column header, URL validation', () => {
it("Table column header, URL validation", () => {
// column name validation
cy.get(`.project-tab:contains(Country):visible`).should('exist')
cy.get(`.project-tab:contains(Country):visible`).should("exist");
// URL validation
cy.url().should('contain', `name=Country`)
})
cy.url().should("contain", `name=Country`);
});
it('Expand belongs-to column', () => {
it("Expand belongs-to column", () => {
// expand first row
cy.get('td[data-col="Country => City"] div:visible', {timeout: 12000}).first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click()
})
cy.get('td[data-col="Country => City"] div:visible', { timeout: 12000 })
.first()
.click();
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible')
.first()
.click();
});
it('Expand Link record, validate', () => {
cy.getActiveModal().find('button:contains(Link to \'City\')').click()
it("Expand Link record, validate", () => {
cy.getActiveModal()
.find("button:contains(Link to 'City')")
.click()
.then(() => {
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('A Corua (La Corua)').should('exist')
cy.getActiveModal().contains("Link Record").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find('button:contains("New Record")')
.should("exist");
cy.getActiveModal()
.find(".child-card")
.eq(0)
.contains("A Corua (La Corua)")
.should("exist");
cy.getActiveModal().find('button.mdi-close').click().then(() => {
cy.getActiveModal().find('button.mdi-close').click()
})
})
})
})
}
cy.getActiveModal()
.find("button.mdi-close")
.click()
.then(() => {
cy.getActiveModal().find("button.mdi-close").click();
});
});
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

106
scripts/cypress/integration/common/2b_table_with_m2m_column.js

@ -1,66 +1,89 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - M2M Column validation`, () => {
before(() => {
cy.openTableTab('Actor', 25)
})
cy.openTableTab("Actor", 25);
});
after(() => {
cy.closeTableTab('Actor')
})
it('Table column header, URL validation', () => {
cy.closeTableTab("Actor");
});
it("Table column header, URL validation", () => {
// column name validation
cy.get(`.project-tab:contains(Actor):visible`).should('exist')
cy.get(`.project-tab:contains(Actor):visible`).should("exist");
// URL validation
cy.url().should('contain', `name=Actor`)
})
it('Expand m2m column', () => {
cy.url().should("contain", `name=Actor`);
});
it("Expand m2m column", () => {
// expand first row
cy.get('td[data-col="Actor <=> Film"] div', {timeout: 12000}).first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div', { timeout: 12000 })
.first()
.click({ force: true });
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand')
.first()
.click({ force: true });
// validations
cy.getActiveModal().contains('Film').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains(Link to \'Film\')').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('ACADEMY DINOSAUR').should('exist')
})
cy.getActiveModal().contains("Film").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find("button:contains(Link to 'Film')")
.should("exist");
cy.getActiveModal()
.find(".child-card")
.eq(0)
.contains("ACADEMY DINOSAUR")
.should("exist");
});
it('Expand "Link to" record, validate', () => {
cy.getActiveModal().find('button:contains(Link to \'Film\')').click()
cy.getActiveModal()
.find("button:contains(Link to 'Film')")
.click()
.then(() => {
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('ACE GOLDFINGER').should('exist')
cy.get('body').type('{esc}')
})
})
cy.getActiveModal().contains("Link Record").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find('button:contains("New Record")')
.should("exist");
cy.getActiveModal()
.find(".child-card")
.eq(0)
.contains("ACE GOLDFINGER")
.should("exist");
cy.get("body").type("{esc}");
});
});
it('Expand first linked card, validate', () => {
cy.getActiveModal().find('.child-card').eq(0).contains('ACADEMY DINOSAUR', {timeout: 2000}).click()
it("Expand first linked card, validate", () => {
cy.getActiveModal()
.find(".child-card")
.eq(0)
.contains("ACADEMY DINOSAUR", { timeout: 2000 })
.click()
.then(() => {
// Link card validation
cy.getActiveModal().find('h5').contains("ACADEMY DINOSAUR").should('exist')
cy.getActiveModal().find('button:contains("Save Row")').should('exist')
cy.getActiveModal().find('button:contains("Cancel")').should('exist')
cy.getActiveModal()
.find("h5")
.contains("ACADEMY DINOSAUR")
.should("exist");
cy.getActiveModal()
.find('button:contains("Save Row")')
.should("exist");
cy.getActiveModal().find('button:contains("Cancel")').should("exist");
cy.getActiveModal().find('button:contains("Cancel")').click()
cy.getActiveModal().find('button.mdi-close').click()
})
})
})
}
cy.getActiveModal().find('button:contains("Cancel")').click();
cy.getActiveModal().find("button.mdi-close").click();
});
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -84,4 +107,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

259
scripts/cypress/integration/common/3a_filter_sort_fields_operations.js

@ -1,176 +1,205 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => {
before(() => {
// open country table
cy.openTableTab('Country', 25);
})
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab('Country')
})
cy.closeTableTab("Country");
});
describe(`Pagination`, () => {
// check pagination
it('Check country table - Pagination', () => {
cy.get('.nc-pagination').should('exist')
it("Check country table - Pagination", () => {
cy.get(".nc-pagination").should("exist");
// verify > pagination option
mainPage.getPagination('>').click()
mainPage.getPagination(2).should('have.class', 'v-pagination__item--active')
mainPage.getPagination(">").click();
mainPage
.getPagination(2)
.should("have.class", "v-pagination__item--active");
// verify < pagination option
mainPage.getPagination('<').click()
mainPage.getPagination(1).should('have.class', 'v-pagination__item--active')
})
})
mainPage.getPagination("<").click();
mainPage
.getPagination(1)
.should("have.class", "v-pagination__item--active");
});
});
describe(`Row operations`, () => {
// create new row using + button in header
//
it('Add row using tool header button', () => {
it("Add row using tool header button", () => {
// add a row to end of Country table
cy.get('.nc-add-new-row-btn').click();
cy.get('#data-table-form-Country > input').first().type('Test Country');
cy.contains('Save Row').filter('button').click()
cy.get(".nc-add-new-row-btn").click();
cy.get("#data-table-form-Country > input").first().type("Test Country");
cy.contains("Save Row").filter("button").click();
cy.toastWait('updated successfully')
cy.toastWait("updated successfully");
// verify
mainPage.getPagination(5).click()
mainPage.getCell("Country", 10).contains("Test Country").should('exist')
})
mainPage.getPagination(5).click();
mainPage
.getCell("Country", 10)
.contains("Test Country")
.should("exist");
});
// delete slingle row
//
it('Delete row', () => {
it("Delete row", () => {
// delete row added in previous step
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Row').click()
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu().contains("Delete Row").click();
// cy.toastWait('Deleted row successfully')
// verify
mainPage.getCell("Country", 10).should('not.exist')
})
mainPage.getCell("Country", 10).should("not.exist");
});
// create new row using right click menu option
//
it('Add row using rightclick menu option', () => {
mainPage.getCell("Country", 9).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 10).dblclick().find('input').type('Test Country-1{enter}')
it("Add row using rightclick menu option", () => {
mainPage.getCell("Country", 9).rightclick({ force: true });
cy.getActiveMenu().contains("Insert New Row").click({ force: true });
mainPage
.getCell("Country", 10)
.dblclick()
.find("input")
.type("Test Country-1{enter}");
// cy.toastWait('saved successfully')
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 11).dblclick().find('input').type('Test Country-2{enter}')
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu().contains("Insert New Row").click({ force: true });
mainPage
.getCell("Country", 11)
.dblclick()
.find("input")
.type("Test Country-2{enter}");
// cy.toastWait('saved successfully')
// verify
mainPage.getCell("Country", 10).contains("Test Country-1").should('exist')
mainPage.getCell("Country", 11).contains("Test Country-2").should('exist')
})
mainPage
.getCell("Country", 10)
.contains("Test Country-1")
.should("exist");
mainPage
.getCell("Country", 11)
.contains("Test Country-2")
.should("exist");
});
// delete selected rows (multiple)
//
it('Delete Selected', () => {
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({force: true})
mainPage.getRow(11).find('.mdi-checkbox-blank-outline').click({force: true})
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Delete Selected Row').click({force: true})
it("Delete Selected", () => {
mainPage
.getRow(10)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage
.getRow(11)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu()
.contains("Delete Selected Row")
.click({ force: true });
// cy.toastWait('Deleted 2 selected rows successfully')
// verify
mainPage.getCell("Country", 10).should('not.exist')
mainPage.getCell("Country", 11).should('not.exist')
mainPage.getCell("Country", 10).should("not.exist");
mainPage.getCell("Country", 11).should("not.exist");
mainPage.getPagination(1).click()
})
mainPage.getPagination(1).click();
});
});
})
describe(`Sort operations`, () => {
it('Enable sort', () => {
it("Enable sort", () => {
// Sort menu operations (Country Column, Z->A)
cy.get('.nc-sort-menu-btn').click()
cy.contains('Add Sort Option').click();
cy.get('.nc-sort-field-select div').first().click()
cy.get('.menuable__content__active .v-list-item:contains(Country)').click()
cy.get('.nc-sort-dir-select div').first().click()
cy.get('.menuable__content__active .v-list-item:contains("Z -> A")').click()
cy.contains('Zambia').should('exist')
})
it('Disable sort', () => {
cy.get(".nc-sort-menu-btn").click();
cy.contains("Add Sort Option").click();
cy.get(".nc-sort-field-select div").first().click();
cy.get(
".menuable__content__active .v-list-item:contains(Country)"
).click();
cy.get(".nc-sort-dir-select div").first().click();
cy.get(
'.menuable__content__active .v-list-item:contains("Z -> A")'
).click();
cy.contains("Zambia").should("exist");
});
it("Disable sort", () => {
// remove sort and validate
cy.get('.nc-sort-item-remove-btn').click()
cy.contains('Zambia').should('not.exist')
})
})
describe('Field Operation', () => {
cy.get(".nc-sort-item-remove-btn").click();
cy.contains("Zambia").should("not.exist");
});
});
it('Hide field', () => {
cy.get('th:contains(LastUpdate)').should('be.visible')
describe("Field Operation", () => {
it("Hide field", () => {
cy.get("th:contains(LastUpdate)").should("be.visible");
// toggle and confirm it's hidden
cy.get('.nc-fields-menu-btn').click()
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click()
cy.get('.nc-fields-menu-btn').click()
cy.get('th:contains(LastUpdate)').should('not.be.visible')
})
it('Show field', () => {
cy.get('.nc-fields-menu-btn').click()
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click()
cy.get('.nc-fields-menu-btn').click()
cy.get('th:contains(LastUpdate)').should('be.visible')
})
})
describe('Filter operations', () => {
it('Create Filter', () => {
cy.get('.nc-filter-menu-btn').click()
cy.contains('Add Filter').click();
cy.get('.nc-filter-field-select').last().click();
cy.getActiveMenu().find('.v-list-item:contains(Country)').click()
cy.get('.nc-filter-operation-select').last().click();
cy.getActiveMenu().find('.v-list-item:contains("is equal")').click()
cy.get('.nc-filter-value-select input:text').last().type('India');
cy.get('.nc-filter-menu-btn').click()
cy.get(".nc-fields-menu-btn").click();
cy.get(
".menuable__content__active .v-list-item label:contains(LastUpdate)"
).click();
cy.get(".nc-fields-menu-btn").click();
cy.get("th:contains(LastUpdate)").should("not.be.visible");
});
it("Show field", () => {
cy.get(".nc-fields-menu-btn").click();
cy.get(
".menuable__content__active .v-list-item label:contains(LastUpdate)"
).click();
cy.get(".nc-fields-menu-btn").click();
cy.get("th:contains(LastUpdate)").should("be.visible");
});
});
describe("Filter operations", () => {
it("Create Filter", () => {
cy.get(".nc-filter-menu-btn").click();
cy.contains("Add Filter").click();
cy.get(".nc-filter-field-select").last().click();
cy.getActiveMenu().find(".v-list-item:contains(Country)").click();
cy.get(".nc-filter-operation-select").last().click();
cy.getActiveMenu().find('.v-list-item:contains("is equal")').click();
cy.get(".nc-filter-value-select input:text").last().type("India");
cy.get(".nc-filter-menu-btn")
.click()
.then(() => {
cy.get('td:contains(India)').should('exist')
})
})
cy.get("td:contains(India)").should("exist");
});
});
it('Delete Filter', () => {
it("Delete Filter", () => {
// remove sort and check
cy.get('.nc-filter-menu-btn').click()
cy.get('.nc-filter-item-remove-btn').click()
cy.get('.nc-filter-menu-btn').click()
cy.contains('td:contains(India)').should('not.exist')
})
})
})
}
cy.get(".nc-filter-menu-btn").click();
cy.get(".nc-filter-item-remove-btn").click();
cy.get(".nc-filter-menu-btn").click();
cy.contains("td:contains(India)").should("not.exist");
});
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -192,4 +221,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

395
scripts/cypress/integration/common/3b_formula_column.js

@ -1,190 +1,214 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORMULA`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('City', 25);
})
after(() => {
cy.closeTableTab('City')
})
// Given rowname & expected result for first 10 entries, validate
// NOTE: Scroll issue with Cypress automation, to fix
// validating partial data, row number 5 to 9
//
const rowValidation = (rowName, result) => {
// scroll back
cy.get(`tbody > :nth-child(1) > [data-col="City"]`).scrollIntoView()
// for (let i = 0; i < 10; i++)
for (let i = 3; i < 6; i++)
cy.get(`tbody > :nth-child(${i + 1}) > [data-col="${rowName}"]`)
.contains(result[i].toString())
.should('exist')
}
// Routine to create a new look up column
//
const addFormulaBasedColumn = (columnName, formula) => {
// (+) icon at end of column header (to add a new column)
// opens up a pop up window
//
cy.get('.new-column-header').click()
// Column name
cy.get('.nc-column-name-input input').clear().type(`${columnName}{enter}`)
// Column data type: to be set to formula in this context
cy.get('.nc-ui-dt-dropdown').click().type('Formula')
cy.getActiveMenu().contains('Formula').click({ force: true })
// Configure formula
cy.get('label').contains('Formula').parent().click().type(formula)
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Formula column saved successfully')
// Verify if column exists.
//
cy.get(`th:contains(${columnName})`)
.should('exist');
}
// routine to delete column
//
const deleteColumnByName = (columnName) => {
// verify if column exists before delete
cy.get(`th:contains(${columnName})`)
.should('exist');
// delete opiton visible on mouse-over
cy.get(`th:contains(${columnName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
// delete/ confirm on pop-up
cy.get('.nc-column-delete').click()
cy.getActiveModal().find('button:contains(Confirm)').click()
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${columnName})`)
.should('not.exist');
}
// routine to edit column
//
const editColumnByName = (oldName, newName, newFormula) => {
// verify if column exists before delete
cy.get(`th:contains(${oldName})`)
.should('exist');
// delete opiton visible on mouse-over
cy.get(`th:contains(${oldName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
// edit/ save on pop-up
cy.get('.nc-column-edit').click()
cy.get('.nc-column-name-input input').clear().type(newName)
cy.get('label')
.contains('Formula').parent().find('input').clear().type(newFormula)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Formula column updated successfully')
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`)
.should('not.exist');
cy.get(`th:contains(${newName})`)
.should('exist');
}
///////////////////////////////////////////////////
// Test case
// On City table (from Sakila DB), first 10 entries recorded here for verification
let cityId = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
let countryId = [87, 82, 101, 60, 97, 31, 107, 44, 44, 50]
let city = ['A corua (La Corua)', 'Abha', 'Abu Dhabi', 'Acua', 'Adana', 'Addis Abeba', 'Aden', 'Adoni', 'Ahmadnagar', 'Akishima']
// Temporary locally computed expected results
let RESULT_STRING = []
let RESULT_MATH_0 = []
let RESULT_MATH_1 = []
let RESULT_MATH_2 = []
for (let i = 0; i < 10; i++) {
// CONCAT, LOWER, UPPER, TRIM
RESULT_STRING[i] = `${city[i].toUpperCase()}${city[i].toLowerCase()}trimmed`
// ADD, AVG, LEN
RESULT_MATH_0[i] = ((cityId[i] + countryId[i]) +
((cityId[i] + countryId[i]) / 2) +
(city[i].length))
// CEILING, FLOOR, ROUND, MOD, MIN, MAX
RESULT_MATH_1[i] = (Math.ceil(1.4) +
Math.floor(1.6) +
Math.round(2.5) +
(cityId[i] % 3) +
Math.min(cityId[i], countryId[i]) +
Math.max(cityId[i], countryId[i]))
// LOG, EXP, POWER, SQRT
// only integer verification being computed, hence trunc
RESULT_MATH_2[i] = Math.trunc(Math.log(cityId[i]) +
Math.exp(cityId[i]) +
Math.pow(cityId[i], 3) +
Math.sqrt(countryId[i]))
}
it('Formula: CONCAT, LOWER, UPPER, TRIM', () => {
addFormulaBasedColumn('NC_MATH_0', 'ADD(CityId, CountryId) + AVG(CityId, CountryId) + LEN(City)')
rowValidation('NC_MATH_0', RESULT_MATH_0)
})
it('Formula: ADD, AVG, LEN', () => {
editColumnByName('NC_MATH_0', 'NC_STR_1', `CONCAT(UPPER(City), LOWER(City), TRIM(' trimmed '))`)
rowValidation('NC_STR_1', RESULT_STRING)
})
it('Formula: CEILING, FLOOR, ROUND, MOD, MIN, MAX', () => {
editColumnByName('NC_STR_1', 'NC_MATH_1', `CEILING(1.4) + FLOOR(1.6) + ROUND(2.5) + MOD(CityId, 3) + MIN(CityId, CountryId) + MAX(CityId, CountryId)`)
rowValidation('NC_MATH_1', RESULT_MATH_1)
})
it('Formula: LOG, EXP, POWER, SQRT', () => {
editColumnByName('NC_MATH_1', 'NC_MATH_2', `LOG(CityId) + EXP(CityId) + POWER(CityId, 3) + SQRT(CountryId)`)
rowValidation('NC_MATH_2', RESULT_MATH_2)
})
it('Formula: NOW, EDIT & Delete column', () => {
editColumnByName('NC_MATH_2', 'NC_NOW', `NOW()`)
deleteColumnByName('NC_NOW')
})
})
}
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORMULA`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab("City", 25);
});
after(() => {
cy.closeTableTab("City");
});
// Given rowname & expected result for first 10 entries, validate
// NOTE: Scroll issue with Cypress automation, to fix
// validating partial data, row number 5 to 9
//
const rowValidation = (rowName, result) => {
// scroll back
cy.get(`tbody > :nth-child(1) > [data-col="City"]`).scrollIntoView();
// for (let i = 0; i < 10; i++)
for (let i = 3; i < 6; i++)
cy.get(`tbody > :nth-child(${i + 1}) > [data-col="${rowName}"]`)
.contains(result[i].toString())
.should("exist");
};
// Routine to create a new look up column
//
const addFormulaBasedColumn = (columnName, formula) => {
// (+) icon at end of column header (to add a new column)
// opens up a pop up window
//
cy.get(".new-column-header").click();
// Column name
cy.get(".nc-column-name-input input")
.clear()
.type(`${columnName}{enter}`);
// Column data type: to be set to formula in this context
cy.get(".nc-ui-dt-dropdown").click().type("Formula");
cy.getActiveMenu().contains("Formula").click({ force: true });
// Configure formula
cy.get("label").contains("Formula").parent().click().type(formula);
// click on Save
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait("Formula column saved successfully");
// Verify if column exists.
//
cy.get(`th:contains(${columnName})`).should("exist");
};
// routine to delete column
//
const deleteColumnByName = (columnName) => {
// verify if column exists before delete
cy.get(`th:contains(${columnName})`).should("exist");
// delete opiton visible on mouse-over
cy.get(`th:contains(${columnName}) .mdi-menu-down`)
.trigger("mouseover")
.click();
// delete/ confirm on pop-up
cy.get(".nc-column-delete").click();
cy.getActiveModal().find("button:contains(Confirm)").click();
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${columnName})`).should("not.exist");
};
// routine to edit column
//
const editColumnByName = (oldName, newName, newFormula) => {
// verify if column exists before delete
cy.get(`th:contains(${oldName})`).should("exist");
// delete opiton visible on mouse-over
cy.get(`th:contains(${oldName}) .mdi-menu-down`)
.trigger("mouseover")
.click();
// edit/ save on pop-up
cy.get(".nc-column-edit").click();
cy.get(".nc-column-name-input input").clear().type(newName);
cy.get("label")
.contains("Formula")
.parent()
.find("input")
.clear()
.type(newFormula);
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait("Formula column updated successfully");
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`).should("not.exist");
cy.get(`th:contains(${newName})`).should("exist");
};
///////////////////////////////////////////////////
// Test case
// On City table (from Sakila DB), first 10 entries recorded here for verification
let cityId = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let countryId = [87, 82, 101, 60, 97, 31, 107, 44, 44, 50];
let city = [
"A corua (La Corua)",
"Abha",
"Abu Dhabi",
"Acua",
"Adana",
"Addis Abeba",
"Aden",
"Adoni",
"Ahmadnagar",
"Akishima",
];
// Temporary locally computed expected results
let RESULT_STRING = [];
let RESULT_MATH_0 = [];
let RESULT_MATH_1 = [];
let RESULT_MATH_2 = [];
for (let i = 0; i < 10; i++) {
// CONCAT, LOWER, UPPER, TRIM
RESULT_STRING[i] = `${city[i].toUpperCase()}${city[
i
].toLowerCase()}trimmed`;
// ADD, AVG, LEN
RESULT_MATH_0[i] =
cityId[i] +
countryId[i] +
(cityId[i] + countryId[i]) / 2 +
city[i].length;
// CEILING, FLOOR, ROUND, MOD, MIN, MAX
RESULT_MATH_1[i] =
Math.ceil(1.4) +
Math.floor(1.6) +
Math.round(2.5) +
(cityId[i] % 3) +
Math.min(cityId[i], countryId[i]) +
Math.max(cityId[i], countryId[i]);
// LOG, EXP, POWER, SQRT
// only integer verification being computed, hence trunc
RESULT_MATH_2[i] = Math.trunc(
Math.log(cityId[i]) +
Math.exp(cityId[i]) +
Math.pow(cityId[i], 3) +
Math.sqrt(countryId[i])
);
}
it("Formula: CONCAT, LOWER, UPPER, TRIM", () => {
addFormulaBasedColumn(
"NC_MATH_0",
"ADD(CityId, CountryId) + AVG(CityId, CountryId) + LEN(City)"
);
rowValidation("NC_MATH_0", RESULT_MATH_0);
});
it("Formula: ADD, AVG, LEN", () => {
editColumnByName(
"NC_MATH_0",
"NC_STR_1",
`CONCAT(UPPER(City), LOWER(City), TRIM(' trimmed '))`
);
rowValidation("NC_STR_1", RESULT_STRING);
});
it("Formula: CEILING, FLOOR, ROUND, MOD, MIN, MAX", () => {
editColumnByName(
"NC_STR_1",
"NC_MATH_1",
`CEILING(1.4) + FLOOR(1.6) + ROUND(2.5) + MOD(CityId, 3) + MIN(CityId, CountryId) + MAX(CityId, CountryId)`
);
rowValidation("NC_MATH_1", RESULT_MATH_1);
});
it("Formula: LOG, EXP, POWER, SQRT", () => {
editColumnByName(
"NC_MATH_1",
"NC_MATH_2",
`LOG(CityId) + EXP(CityId) + POWER(CityId, 3) + SQRT(CountryId)`
);
rowValidation("NC_MATH_2", RESULT_MATH_2);
});
it("Formula: NOW, EDIT & Delete column", () => {
editColumnByName("NC_MATH_2", "NC_NOW", `NOW()`);
deleteColumnByName("NC_NOW");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -208,4 +232,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

171
scripts/cypress/integration/common/3c_lookup_column.js

@ -1,117 +1,102 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - LookUp column`, () => {
// to retrieve few v-input nodes from their label
//
const fetchParentFromLabel = (label) => {
cy.get('label')
.contains(label)
.parents('.v-input')
.click()
}
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('City', 25);
})
after(() => {
cy.closeTableTab('City')
})
// Routine to create a new look up column
//
const addLookUpColumn = (childTable, childCol) => {
// (+) icon at end of column header (to add a new column)
// opens up a pop up window
//
cy.get('.new-column-header').click()
// Redundant to feed column name. as alias is displayed & referred for
cy.get('.nc-column-name-input input').clear().type(childCol)
// Column data type: to be set to lookup in this context
cy.get('.nc-ui-dt-dropdown').click()
cy.getActiveMenu().contains('Lookup').click()
// Configure Child table & column names
fetchParentFromLabel('Child Table')
cy.getActiveMenu().contains(childTable).click()
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - LookUp column`, () => {
// to retrieve few v-input nodes from their label
//
const fetchParentFromLabel = (label) => {
cy.get("label").contains(label).parents(".v-input").click();
};
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab("City", 25);
});
fetchParentFromLabel('Child column')
cy.getActiveMenu().contains(childCol).click()
after(() => {
cy.closeTableTab("City");
});
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
// Routine to create a new look up column
//
const addLookUpColumn = (childTable, childCol) => {
// (+) icon at end of column header (to add a new column)
// opens up a pop up window
//
cy.get(".new-column-header").click();
// Verify if column exists.
//
cy.get(`th:contains(${childCol})`)
.should('exist');
}
// Redundant to feed column name. as alias is displayed & referred for
cy.get(".nc-column-name-input input").clear().type(childCol);
// routine to delete column
//
const deleteColumnByName = (childCol) => {
// Column data type: to be set to lookup in this context
cy.get(".nc-ui-dt-dropdown").click();
cy.getActiveMenu().contains("Lookup").click();
// verify if column exists before delete
cy.get(`th:contains(${childCol})`)
.should('exist');
// Configure Child table & column names
fetchParentFromLabel("Child Table");
cy.getActiveMenu().contains(childTable).click();
// delete opiton visible on mouse-over
cy.get(`th:contains(${childCol}) .mdi-menu-down`)
.trigger('mouseover')
.click()
fetchParentFromLabel("Child column");
cy.getActiveMenu().contains(childCol).click();
// delete/ confirm on pop-up
cy.get('.nc-column-delete').click()
cy.getActiveModal().find('button:contains(Confirm)').click()
// click on Save
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${childCol})`)
.should('not.exist');
// Verify if column exists.
//
cy.get(`th:contains(${childCol})`).should("exist");
};
}
// routine to delete column
//
const deleteColumnByName = (childCol) => {
// verify if column exists before delete
cy.get(`th:contains(${childCol})`).should("exist");
///////////////////////////////////////////////////
// Test case
// delete opiton visible on mouse-over
cy.get(`th:contains(${childCol}) .mdi-menu-down`)
.trigger("mouseover")
.click();
it('Add Lookup column (Address, District) & Delete', () => {
// delete/ confirm on pop-up
cy.get(".nc-column-delete").click();
cy.getActiveModal().find("button:contains(Confirm)").click();
addLookUpColumn('Address', 'District')
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${childCol})`).should("not.exist");
};
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(1) > [data-col="District"]`)
.contains('Galicia')
.should('exist')
///////////////////////////////////////////////////
// Test case
deleteColumnByName('District')
it("Add Lookup column (Address, District) & Delete", () => {
addLookUpColumn("Address", "District");
})
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(1) > [data-col="District"]`)
.contains("Galicia")
.should("exist");
it.skip('Add Lookup column (Country, CountryId) & Delete', () => {
deleteColumnByName("District");
});
addLookUpColumn('Country', 'CountryId')
it.skip("Add Lookup column (Country, CountryId) & Delete", () => {
addLookUpColumn("Country", "CountryId");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(1) > [data-col="CountryId"]`)
.contains('87')
.should('exist')
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(1) > [data-col="CountryId"]`)
.contains("87")
.should("exist");
deleteColumnByName('CountryId')
})
deleteColumnByName("CountryId");
});
}
});
};
// genTest('rest', false)
// genTest('graphql', false)
@ -137,4 +122,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

138
scripts/cypress/integration/common/3d_rollup_column.js

@ -1,154 +1,141 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - RollUp column`, () => {
// to retrieve few v-input nodes from their label
//
const fetchParentFromLabel = (label) => {
cy.get('label')
.contains(label)
.parents('.v-input')
.click()
}
cy.get("label").contains(label).parents(".v-input").click();
};
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('Country', 25);
})
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab('Country');
})
cy.closeTableTab("Country");
});
// Routine to create a new look up column
//
const addLookUpColumn = (columnName, childTable, childCol, aggregateFunc) => {
const addLookUpColumn = (
columnName,
childTable,
childCol,
aggregateFunc
) => {
// (+) icon at end of column header (to add a new column)
// opens up a pop up window
//
cy.get('.new-column-header').click()
cy.get(".new-column-header").click();
// Column name
cy.get('.nc-column-name-input input').clear().type(`${columnName}{enter}`)
cy.get(".nc-column-name-input input")
.clear()
.type(`${columnName}{enter}`);
// Column data type: to be set to rollup in this context
// Type 'Rollup' ensures item outside view is also listed (note, rollup is at bottom of scroll list)
cy.get('.nc-ui-dt-dropdown').click().type('Rollup')
cy.getActiveMenu().contains('Rollup').click({ force: true })
cy.get(".nc-ui-dt-dropdown").click().type("Rollup");
cy.getActiveMenu().contains("Rollup").click({ force: true });
// Configure Child table & column names
fetchParentFromLabel('Child Table')
cy.getActiveMenu().contains(childTable).click()
fetchParentFromLabel("Child Table");
cy.getActiveMenu().contains(childTable).click();
fetchParentFromLabel('Child column')
cy.getActiveMenu().contains(childCol).click()
fetchParentFromLabel("Child column");
cy.getActiveMenu().contains(childCol).click();
fetchParentFromLabel('Aggregate function')
cy.getActiveMenu().contains(aggregateFunc).click()
fetchParentFromLabel("Aggregate function");
cy.getActiveMenu().contains(aggregateFunc).click();
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
// Verify if column exists.
// Verify if column exists.
//
cy.get(`th:contains(${columnName})`)
.should('exist');
}
cy.get(`th:contains(${columnName})`).should("exist");
};
// routine to delete column
//
const deleteColumnByName = (columnName) => {
// verify if column exists before delete
cy.get(`th:contains(${columnName})`)
.should('exist');
cy.get(`th:contains(${columnName})`).should("exist");
// delete opiton visible on mouse-over
cy.get(`th:contains(${columnName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
.trigger("mouseover")
.click();
// delete/ confirm on pop-up
cy.get('.nc-column-delete').click()
cy.getActiveModal().find('button:contains(Confirm)').click()
cy.get(".nc-column-delete").click();
cy.getActiveModal().find("button:contains(Confirm)").click();
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${columnName})`)
.should('not.exist');
}
cy.get(`th:contains(${columnName})`).should("not.exist");
};
// routine to edit column
//
const editColumnByName = (oldName, newName) => {
// verify if column exists before delete
cy.get(`th:contains(${oldName})`)
.should('exist');
cy.get(`th:contains(${oldName})`).should("exist");
// delete opiton visible on mouse-over
cy.get(`th:contains(${oldName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
.trigger("mouseover")
.click();
// edit/ save on pop-up
cy.get('.nc-column-edit').click()
cy.get('.nc-column-name-input input').clear().type(newName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.get(".nc-column-edit").click();
cy.get(".nc-column-name-input input").clear().type(newName);
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait('Successfully updated alias')
cy.toastWait("Successfully updated alias");
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`)
.should('not.exist');
cy.get(`th:contains(${newName})`)
.should('exist');
}
cy.get(`th:contains(${oldName})`).should("not.exist");
cy.get(`th:contains(${newName})`).should("exist");
};
///////////////////////////////////////////////////
// Test case
it('Add Rollup column (City, CityId, sum) & Delete', () => {
addLookUpColumn('RollUpCol_2', 'City', 'CityId', 'sum')
it("Add Rollup column (City, CityId, sum) & Delete", () => {
addLookUpColumn("RollUpCol_2", "City", "CityId", "sum");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
// intentionally verifying 4th item, as initial items are being masked out by list scroll down
// to be fixed
//
cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_2"]`)
.contains('427')
.should('exist')
editColumnByName('RollUpCol_2', 'RollUpCol_New')
deleteColumnByName('RollUpCol_New')
})
.contains("427")
.should("exist");
it.skip('Add Rollup column (City, CountryId, count) & Delete', () => {
editColumnByName("RollUpCol_2", "RollUpCol_New");
deleteColumnByName("RollUpCol_New");
});
addLookUpColumn('RollUpCol_1', 'City', 'CountryId', 'count')
it.skip("Add Rollup column (City, CountryId, count) & Delete", () => {
addLookUpColumn("RollUpCol_1", "City", "CountryId", "count");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`)
.contains('2')
.should('exist')
.contains("2")
.should("exist");
editColumnByName('RollUpCol_1', 'RollUpCol_New')
deleteColumnByName('RollUpCol_New')
})
editColumnByName("RollUpCol_1", "RollUpCol_New");
deleteColumnByName("RollUpCol_New");
});
});
}
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -172,4 +159,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

72
scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js

@ -1,81 +1,76 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views: Create/Edit/Delete`, () => {
const name = 'Test' + Date.now();
const name = "Test" + Date.now();
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('Country', 25);
})
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab('Country')
})
cy.closeTableTab("Country");
});
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
cy.getActiveModal().find("button:contains(Submit)").click();
cy.toastWait("View created successfully");
// validate if view was creted && contains default name 'Country1'
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').should('exist')
})
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.should("exist");
});
it(`Edit ${viewType} view name`, () => {
// click on edit-icon (becomes visible on hovering mouse)
cy.get('.nc-view-edit-icon').click({ force: true, timeout: 1000 })
cy.get(".nc-view-edit-icon").click({ force: true, timeout: 1000 });
// feed new name
cy.get(`.nc-${viewType}-view-item input`).type(`${viewType}View-1{enter}`)
cy.toastWait('View renamed successfully')
cy.get(`.nc-${viewType}-view-item input`).type(
`${viewType}View-1{enter}`
);
cy.toastWait("View renamed successfully");
// validate
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains(`${viewType}View-1`).should('exist')
})
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains(`${viewType}View-1`)
.should("exist");
});
it(`Delete ${viewType} view`, () => {
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
cy.get(".nc-view-item").its("length").should("eq", 2);
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.toastWait('View deleted successfully')
cy.get(".nc-view-delete-icon").click({ force: true });
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
})
}
cy.get(".nc-view-item").its("length").should("eq", 1);
});
};
// below two scenario's will be invoked twice, once for rest & then for graphql
viewTest('grid')
viewTest('gallery')
viewTest('form')
})
}
viewTest("grid");
viewTest("gallery");
viewTest("form");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -99,4 +94,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

184
scripts/cypress/integration/common/4b_table_view_share.js

@ -1,99 +1,99 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
let storedURL = ''
let linkText = ''
let storedURL = "";
let linkText = "";
const generateLinkWithPwd = () => {
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
// enable checkbox & feed pwd, save
cy.getActiveModal().find('[role="switch"][type="checkbox"]').click( {force: true} )
cy.getActiveModal().find('input[type="password"]').type('1')
cy.getActiveModal().find('button:contains("Save password")').click()
cy.toastWait('Successfully updated')
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.then(($obj) => {
linkText = $obj.text().trim()
cy.log(linkText)
})
}
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// enable checkbox & feed pwd, save
cy.getActiveModal()
.find('[role="switch"][type="checkbox"]')
.click({ force: true });
cy.getActiveModal().find('input[type="password"]').type("1");
cy.getActiveModal().find('button:contains("Save password")').click();
cy.toastWait("Successfully updated");
// copy link text, visit URL
cy.getActiveModal()
.find(".share-link-box")
.then(($obj) => {
linkText = $obj.text().trim();
cy.log(linkText);
});
};
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Shared VIEWs (GRID)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.openTableTab('City', 25)
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
})
generateLinkWithPwd()
})
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
it('Share view with incorrect password', () => {
cy.visit(linkText, {
baseUrl: null
})
cy.getActiveModal().should('exist')
// feed password
cy.getActiveModal().find('input[type="password"]').type('a')
cy.getActiveModal().find('button:contains("Unlock")').click()
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get('body').find('.v-dialog.v-dialog--active').should('exist')
})
// fallover test- use previously opened view & continue verification instead of opening again
it('Share view with correct password', () => {
// cy.visit(linkText, {
// baseUrl: null
// })
// feed password
cy.getActiveModal().find('input[type="password"]').clear().type('1')
cy.getActiveModal().find('button:contains("Unlock")').click()
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get('body').find('.v-dialog.v-dialog--active').should('not.exist')
})
it('Delete view', () => {
cy.visit(storedURL, {
baseUrl: null
})
mainPage.deleteCreatedViews()
})
after(() => {
cy.closeTableTab('City')
})
})
}
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Shared VIEWs (GRID)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.openTableTab("City", 25);
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
});
generateLinkWithPwd();
});
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
it("Share view with incorrect password", () => {
cy.visit(linkText, {
baseUrl: null,
});
cy.getActiveModal().should("exist");
// feed password
cy.getActiveModal().find('input[type="password"]').type("a");
cy.getActiveModal().find('button:contains("Unlock")').click();
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get("body").find(".v-dialog.v-dialog--active").should("exist");
});
// fallover test- use previously opened view & continue verification instead of opening again
it("Share view with correct password", () => {
// cy.visit(linkText, {
// baseUrl: null
// })
// feed password
cy.getActiveModal().find('input[type="password"]').clear().type("1");
cy.getActiveModal().find('button:contains("Unlock")').click();
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get("body").find(".v-dialog.v-dialog--active").should("not.exist");
});
it("Delete view", () => {
cy.visit(storedURL, {
baseUrl: null,
});
mainPage.deleteCreatedViews();
});
after(() => {
cy.closeTableTab("City");
});
});
};
// genTest('rest', false)
// genTest('graphql', false)
@ -119,4 +119,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

722
scripts/cypress/integration/common/4c_form_view_detailed.js

@ -1,333 +1,438 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
let formViewURL
let formViewURL;
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORM view`, () => {
const name = 'Test' + Date.now();
const name = "Test" + Date.now();
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('Country', 25);
})
// open a table to work on views
//
cy.openTableTab("Country", 25);
});
beforeEach(() => {
cy.restoreLocalStorage();
})
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
})
cy.saveLocalStorage();
});
after(() => {
cy.closeTableTab('Country')
})
cy.closeTableTab("Country");
});
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// validate if view was creted && contains default name 'Country1'
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').should('exist')
})
it(`Validate ${viewType} view: Drag & drop for re-order items`, () => {
// default order: Country, LastUpdate, Country => City
cy.get('.nc-field-wrapper').eq(0).contains('Country').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('LastUpdate').should('exist')
// move Country field down (drag, drop)
cy.get('#data-table-form-Country').drag('#data-table-form-LastUpdate')
// Verify if order is: LastUpdate, Country, Country => City
cy.get('.nc-field-wrapper').eq(0).contains('LastUpdate').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('Country').should('exist')
})
it(`Validate ${viewType} view: Drag & drop for add/remove items`, () => {
// default, only one item in menu-bar; ensure LastUpdate field was present in form view
cy.get('.col-md-4').find('.pointer.item').should('not.exist')
cy.get('.nc-field-wrapper').eq(0).contains('LastUpdate').should('exist')
// drag 'LastUpdate' & drop into menu bar drag-drop box
cy.get('#data-table-form-LastUpdate').drag('.nc-drag-n-drop-to-hide')
// validate- fields count in menu bar to be increased by 1 &&
// first member in 'formView' is Country
cy.get('.nc-field-wrapper').eq(0).contains('Country').should('exist')
cy.get('.col-md-4').find('.pointer.item').its('length').should('eq', 1)
})
it(`Validate ${viewType} view: Inverted order field member addition from menu`, () => {
cy.get('.col-md-4').find('.pointer.caption').contains('remove all').click()
// click fields in inverted order: LastUpdate, Country => City
cy.get('.col-md-4').find('.pointer.item').eq(1).click()
cy.get('.col-md-4').find('.pointer.item').eq(0).click()
// verify if order of appearance in form is right
// Country was never removed as its required field. Other two will appear in inverted order
cy.get('.nc-field-wrapper').eq(0).contains('Country').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('Country => City').should('exist')
cy.get('.nc-field-wrapper').eq(2).contains('LastUpdate').should('exist')
})
it(`Validate ${viewType}: Form header & description validation`, () => {
// Header & description should exist
cy.get('.nc-form').find('[placeholder="Form Title"]').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').should('exist')
// Update header & add some description, verify
cy.get('.nc-form').find('[placeholder="Form Title"]').type('A B C D')
cy.get('.nc-form').find('[placeholder="Add form description"]').type('Some description about form comes here')
// validate new contents
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').contains('Some description about form comes here').should('exist')
})
it(`Validate ${viewType}: Add all, Remove all validation`, () => {
// .col-md-4 : left hand menu
// .nc-form : form view (right hand side)
// ensure buttons exist on left hand menu
cy.get('.col-md-4').find('.pointer.caption').contains('add all').should('not.exist')
cy.get('.col-md-4').find('.pointer.caption').contains('remove all').should('exist')
// click: remove-all
cy.get('.col-md-4').find('.pointer.caption').contains('remove all').click()
// form should not contain any "field remove icons" -- except for mandatory field (Country)
cy.get('.nc-form').find('.nc-field-remove-icon').its('length').should('eq', 1)
// menu bar should contain 3 .pointer.item (LastUpdate, County->City)
cy.get('.col-md-4').find('.pointer.item').its('length').should('eq', 2)
// click: add all
// cy.get('.col-md-4').find('.pointer.caption').contains('remove all').should('not.exist')
cy.get('.col-md-4').find('.pointer.caption').contains('add all').click()
cy.get('.col-md-4').find('.pointer.caption').contains('remove all').should('exist')
// form should contain "field remove icons"
cy.get('.nc-form').find('.nc-field-remove-icon').should('exist')
// Fix me: a dummy remove icon is left over on screen
cy.get('.nc-form').find('.nc-field-remove-icon').its('length').should('eq', 3)
// menu bar should not contain .pointer.item (column name/ field name add options)
cy.get('.col-md-4').find('.pointer.item').should('not.exist')
})
it(`Validate ${viewType}: Submit default, empty show this message textbox`, () => {
// fill up mandatory fields
cy.get('#data-table-form-Country').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
// default message, no update
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Saved successfully')
cy.get('.v-alert').contains('Successfully submitted form data').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
it(`Validate ${viewType}: Submit default, with valid Show message entry`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
// fill up mandatory fields
cy.get('#data-table-form-Country').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
// add message
cy.get('.nc-form > .mx-auto').find('textarea').type('Congratulations!')
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
it(`Validate ${viewType}: Submit default, Enable checkbox "Submit another form`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
// fill up mandatory fields
cy.get('#data-table-form-Country').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
// enable "Submit another form" check box
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(0).click()
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist')
cy.get('button').contains('Submit Another Form').should('exist')
cy.get('button').contains('Submit Another Form').click()
cy.get('.nc-form').should('exist')
// New form appeared? Header & description should exist
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').contains('Some description about form comes here').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
it(`Validate ${viewType}: Submit default, Enable checkbox "blank form after 5 seconds"`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
cy.get('#data-table-form-Country').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
// enable "New form after 5 seconds" button
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(0).click( {force: true} )
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).click()
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist').then(() => {
// wait for 5 seconds
cy.get('.nc-form').should('exist')
// validate if form has appeared again
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').contains('Some description about form comes here').should('exist')
})
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
it(`Validate ${viewType}: Email me verification, without SMTP configuration`, () => {
// open formview & enable "email me" option
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(2).click({ force: true })
// validate if toaster pops up requesting to activate SMTP
cy.toastWait('Please activate SMTP plugin in App store for enabling email notification')
})
it(`Validate ${viewType}: Email me verification, with SMTP configuration`, () => {
// activate SMTP, dummy profile
mainPage.navigationDraw(mainPage.APPSTORE).click()
mainPage.configureSMTP('admin@ex.com', 'smtp.ex.com', '8080', 'TLS')
// open form view & enable "email me" option
cy.openTableTab('Country', 25);
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(2).click({ force: true })
// validate if toaster pops up informing installation of email notification
// cy.get('.toasted:visible', { timout: 6000 })
// .contains('Successfully installed and email notification will use SMTP configuration')
// .should('exist')
// reset SMPT config's
mainPage.navigationDraw(mainPage.APPSTORE).click()
mainPage.resetSMTP()
cy.openTableTab('Country', 25);
})
it(`Validate ${viewType}: Add/ remove field verification"`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
cy.get('#data-table-form-LastUpdate').should('exist')
// remove "LastUpdate field"
cy.get('.nc-form').find('.nc-field-remove-icon').eq(1).click()
cy.get('#data-table-form-lastUpdate').should('not.exist')
cy.get('.col-md-4').find('.pointer.item').contains('LastUpdate').should('exist')
// add it back
cy.get('.col-md-4').find('.pointer.item').contains('LastUpdate').click()
cy.get('#data-table-form-LastUpdate').should('exist')
})
it(`Validate ${viewType}: URL verification`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
// verify URL & copy it for subsequent test
cy.url().should('contain', `&view=Country1`)
cy.url().then((url) => {
cy.log(url)
formViewURL = url
})
})
it(`Validate ${viewType}: URL validation after re-access`, () => {
// visit URL
cy.log(formViewURL)
cy.visit(formViewURL, {
baseUrl: null
})
// New form appeared? Header & description should exist
cy.get('.nc-form', { timeout: 10000 })
.find('[placeholder="Form Title"]')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('[placeholder="Add form description"]')
.contains('Some description about form comes here')
.should('exist')
})
it(`Delete ${viewType} view`, () => {
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click()
cy.get('.nc-grid-row').should('have.length', 13)
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getRow(11).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getRow(12).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getRow(13).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
// cy.toastWait('Deleted selected rows successfully')
})
}
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find("button:contains(Submit)").click();
cy.toastWait("View created successfully");
// validate if view was creted && contains default name 'Country1'
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.should("exist");
});
it(`Validate ${viewType} view: Drag & drop for re-order items`, () => {
// default order: Country, LastUpdate, Country => City
cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist");
cy.get(".nc-field-wrapper")
.eq(1)
.contains("LastUpdate")
.should("exist");
// move Country field down (drag, drop)
cy.get("#data-table-form-Country").drag("#data-table-form-LastUpdate");
// Verify if order is: LastUpdate, Country, Country => City
cy.get(".nc-field-wrapper")
.eq(0)
.contains("LastUpdate")
.should("exist");
cy.get(".nc-field-wrapper").eq(1).contains("Country").should("exist");
});
it(`Validate ${viewType} view: Drag & drop for add/remove items`, () => {
// default, only one item in menu-bar; ensure LastUpdate field was present in form view
cy.get(".col-md-4").find(".pointer.item").should("not.exist");
cy.get(".nc-field-wrapper")
.eq(0)
.contains("LastUpdate")
.should("exist");
// drag 'LastUpdate' & drop into menu bar drag-drop box
cy.get("#data-table-form-LastUpdate").drag(".nc-drag-n-drop-to-hide");
// validate- fields count in menu bar to be increased by 1 &&
// first member in 'formView' is Country
cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist");
cy.get(".col-md-4").find(".pointer.item").its("length").should("eq", 1);
});
it(`Validate ${viewType} view: Inverted order field member addition from menu`, () => {
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("remove all")
.click();
// click fields in inverted order: LastUpdate, Country => City
cy.get(".col-md-4").find(".pointer.item").eq(1).click();
cy.get(".col-md-4").find(".pointer.item").eq(0).click();
// verify if order of appearance in form is right
// Country was never removed as its required field. Other two will appear in inverted order
cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist");
cy.get(".nc-field-wrapper")
.eq(1)
.contains("Country => City")
.should("exist");
cy.get(".nc-field-wrapper")
.eq(2)
.contains("LastUpdate")
.should("exist");
});
it(`Validate ${viewType}: Form header & description validation`, () => {
// Header & description should exist
cy.get(".nc-form").find('[placeholder="Form Title"]').should("exist");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.should("exist");
// Update header & add some description, verify
cy.get(".nc-form").find('[placeholder="Form Title"]').type("A B C D");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.type("Some description about form comes here");
// validate new contents
cy.get(".nc-form")
.find('[placeholder="Form Title"]')
.contains("A B C D")
.should("exist");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.contains("Some description about form comes here")
.should("exist");
});
it(`Validate ${viewType}: Add all, Remove all validation`, () => {
// .col-md-4 : left hand menu
// .nc-form : form view (right hand side)
// ensure buttons exist on left hand menu
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("add all")
.should("not.exist");
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("remove all")
.should("exist");
// click: remove-all
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("remove all")
.click();
// form should not contain any "field remove icons" -- except for mandatory field (Country)
cy.get(".nc-form")
.find(".nc-field-remove-icon")
.its("length")
.should("eq", 1);
// menu bar should contain 3 .pointer.item (LastUpdate, County->City)
cy.get(".col-md-4").find(".pointer.item").its("length").should("eq", 2);
// click: add all
// cy.get('.col-md-4').find('.pointer.caption').contains('remove all').should('not.exist')
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("add all")
.click();
cy.get(".col-md-4")
.find(".pointer.caption")
.contains("remove all")
.should("exist");
// form should contain "field remove icons"
cy.get(".nc-form").find(".nc-field-remove-icon").should("exist");
// Fix me: a dummy remove icon is left over on screen
cy.get(".nc-form")
.find(".nc-field-remove-icon")
.its("length")
.should("eq", 3);
// menu bar should not contain .pointer.item (column name/ field name add options)
cy.get(".col-md-4").find(".pointer.item").should("not.exist");
});
it(`Validate ${viewType}: Submit default, empty show this message textbox`, () => {
// fill up mandatory fields
cy.get("#data-table-form-Country").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
// default message, no update
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Saved successfully");
cy.get(".v-alert")
.contains("Successfully submitted form data")
.should("exist");
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
it(`Validate ${viewType}: Submit default, with valid Show message entry`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
// fill up mandatory fields
cy.get("#data-table-form-Country").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
// add message
cy.get(".nc-form > .mx-auto").find("textarea").type("Congratulations!");
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Congratulations");
cy.get(".v-alert").contains("Congratulations").should("exist");
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
it(`Validate ${viewType}: Submit default, Enable checkbox "Submit another form`, () => {
// clicking again on view name shows blank still. work around- toggling between two views
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
// fill up mandatory fields
cy.get("#data-table-form-Country").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
// enable "Submit another form" check box
cy.get(".nc-form > .mx-auto").find('[type="checkbox"]').eq(0).click();
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Congratulations");
cy.get(".v-alert").contains("Congratulations").should("exist");
cy.get("button").contains("Submit Another Form").should("exist");
cy.get("button").contains("Submit Another Form").click();
cy.get(".nc-form").should("exist");
// New form appeared? Header & description should exist
cy.get(".nc-form")
.find('[placeholder="Form Title"]')
.contains("A B C D")
.should("exist");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.contains("Some description about form comes here")
.should("exist");
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
it(`Validate ${viewType}: Submit default, Enable checkbox "blank form after 5 seconds"`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click()
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
cy.get("#data-table-form-Country").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
// enable "New form after 5 seconds" button
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(0)
.click({ force: true });
cy.get(".nc-form > .mx-auto").find('[type="checkbox"]').eq(1).click();
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Congratulations");
cy.get(".v-alert")
.contains("Congratulations")
.should("exist")
.then(() => {
// wait for 5 seconds
cy.get(".nc-form").should("exist");
// validate if form has appeared again
cy.get(".nc-form")
.find('[placeholder="Form Title"]')
.contains("A B C D")
.should("exist");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.contains("Some description about form comes here")
.should("exist");
});
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
it(`Validate ${viewType}: Email me verification, without SMTP configuration`, () => {
// open formview & enable "email me" option
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(2)
.click({ force: true });
// validate if toaster pops up requesting to activate SMTP
cy.toastWait(
"Please activate SMTP plugin in App store for enabling email notification"
);
});
it(`Validate ${viewType}: Email me verification, with SMTP configuration`, () => {
// activate SMTP, dummy profile
mainPage.navigationDraw(mainPage.APPSTORE).click();
mainPage.configureSMTP("admin@ex.com", "smtp.ex.com", "8080", "TLS");
// open form view & enable "email me" option
cy.openTableTab("Country", 25);
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(2)
.click({ force: true });
// validate if toaster pops up informing installation of email notification
// cy.get('.toasted:visible', { timout: 6000 })
// .contains('Successfully installed and email notification will use SMTP configuration')
// .should('exist')
// reset SMPT config's
mainPage.navigationDraw(mainPage.APPSTORE).click();
mainPage.resetSMTP();
cy.openTableTab("Country", 25);
});
it(`Validate ${viewType}: Add/ remove field verification"`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
cy.get("#data-table-form-LastUpdate").should("exist");
// remove "LastUpdate field"
cy.get(".nc-form").find(".nc-field-remove-icon").eq(1).click();
cy.get("#data-table-form-lastUpdate").should("not.exist");
cy.get(".col-md-4")
.find(".pointer.item")
.contains("LastUpdate")
.should("exist");
// add it back
cy.get(".col-md-4")
.find(".pointer.item")
.contains("LastUpdate")
.click();
cy.get("#data-table-form-LastUpdate").should("exist");
});
it(`Validate ${viewType}: URL verification`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.click();
// verify URL & copy it for subsequent test
cy.url().should("contain", `&view=Country1`);
cy.url().then((url) => {
cy.log(url);
formViewURL = url;
});
});
it(`Validate ${viewType}: URL validation after re-access`, () => {
// visit URL
cy.log(formViewURL);
cy.visit(formViewURL, {
baseUrl: null,
});
// New form appeared? Header & description should exist
cy.get(".nc-form", { timeout: 10000 })
.find('[placeholder="Form Title"]')
.contains("A B C D")
.should("exist");
cy.get(".nc-form", { timeout: 10000 })
.find('[placeholder="Add form description"]')
.contains("Some description about form comes here")
.should("exist");
});
it(`Delete ${viewType} view`, () => {
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
// click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-delete-icon").click({ force: true });
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1);
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click();
cy.get(".nc-grid-row").should("have.length", 13);
mainPage
.getRow(10)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage
.getRow(11)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage
.getRow(12)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage
.getRow(13)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu().contains("Delete Selected Row").click();
// cy.toastWait('Deleted selected rows successfully')
});
};
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest('form')
})
}
viewTest("form");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -351,4 +456,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

135
scripts/cypress/integration/common/4d_table_view_grid_locked.js

@ -1,71 +1,93 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Lock view`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('Country', 25);
})
describe(`${type.toUpperCase()} api - Lock view`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab("Country", 25);
});
after(() => {
cy.closeTableTab('Country')
})
after(() => {
cy.closeTableTab("Country");
});
const lockViewTest = (enabled) => {
it(`Grid: lock view set to ${enabled}: validation`, () => {
let vString = enabled ? 'not.' : ''
let menuOption = enabled ? 1 : 0
// on menu, collaboration view appears first (at index 0)
// followed by Locked view (at index 1)
cy.get('.xc-toolbar').find('.nc-view-lock-menu:enabled').click()
cy.getActiveMenu().find('[role="menuitem"]').eq(menuOption).click()
const lockViewTest = (enabled) => {
it(`Grid: lock view set to ${enabled}: validation`, () => {
let vString = enabled ? "not." : "";
let menuOption = enabled ? 1 : 0;
// expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled
//
cy.get('.xc-toolbar').find('.nc-view-lock-menu:enabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-table-reload-btn:enabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-add-new-row-btn:enabled') .should(`${vString}exist`)
// cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-fields-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-sort-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-filter-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-table-delete-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-toggle-nav-drawer:enabled') .should('exist')
// dblClick on a cell & see if we can edit
mainPage.getCell('Country', 1).dblclick()
mainPage.getCell('Country', 1).find('input').should(`${vString}exist`)
// on menu, collaboration view appears first (at index 0)
// followed by Locked view (at index 1)
cy.get(".xc-toolbar").find(".nc-view-lock-menu:enabled").click();
cy.getActiveMenu().find('[role="menuitem"]').eq(menuOption).click();
// check if expand row option is available?
cy.get('td').find('.nc-row-expand-icon').should(`${vString}exist`)
// alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`)
// expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled
//
cy.get(".xc-toolbar")
.find(".nc-view-lock-menu:enabled")
.should("exist");
cy.get(".xc-toolbar")
.find(".nc-table-reload-btn:enabled")
.should("exist");
cy.get(".xc-toolbar")
.find(".nc-add-new-row-btn:enabled")
.should(`${vString}exist`);
// cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist')
cy.get(".xc-toolbar")
.find(".nc-fields-menu-btn:enabled")
.should(`${vString}exist`);
cy.get(".xc-toolbar")
.find(".nc-sort-menu-btn:enabled")
.should(`${vString}exist`);
cy.get(".xc-toolbar")
.find(".nc-filter-menu-btn:enabled")
.should(`${vString}exist`);
cy.get(".xc-toolbar")
.find(".nc-table-delete-btn:enabled")
.should(`${vString}exist`);
cy.get(".xc-toolbar")
.find(".nc-toggle-nav-drawer:enabled")
.should("exist");
// check if add/ expand options available for 'has many' column type
mainPage.getCell('Country => City', 1).click().find('button.mdi-plus').should(`${vString}exist`)
mainPage.getCell('Country => City', 1).click().find('button.mdi-arrow-expand').should(`${vString}exist`)
// dblClick on a cell & see if we can edit
mainPage.getCell("Country", 1).dblclick();
mainPage.getCell("Country", 1).find("input").should(`${vString}exist`);
// update row option (right click) - should not be available for Lock view
mainPage.getCell('Country => City', 1).rightclick()
cy.get('.menuable__content__active').should(`${vString}be.visible`)
})
}
// check if expand row option is available?
cy.get("td").find(".nc-row-expand-icon").should(`${vString}exist`);
// alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`)
// Locked view
lockViewTest(true)
// check if add/ expand options available for 'has many' column type
mainPage
.getCell("Country => City", 1)
.click()
.find("button.mdi-plus")
.should(`${vString}exist`);
mainPage
.getCell("Country => City", 1)
.click()
.find("button.mdi-arrow-expand")
.should(`${vString}exist`);
// collaboration view
lockViewTest(false)
})
}
// update row option (right click) - should not be available for Lock view
mainPage.getCell("Country => City", 1).rightclick();
cy.get(".menuable__content__active").should(`${vString}be.visible`);
});
};
// Locked view
lockViewTest(true);
// collaboration view
lockViewTest(false);
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -89,4 +111,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

361
scripts/cypress/integration/common/4e_form_view_share.js

@ -1,176 +1,196 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
let storedURL = ''
let storedURL = "";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORM view (Share)`, () => {
const name = 'Test' + Date.now();
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('City', 25)
})
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.closeTableTab('City')
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// Prepare form
// add header, description
// add post submission message
// swap position for City, LastUpdate fields
// remove City=>Address field
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).click()
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
cy.get('.nc-form').find('[placeholder="Form Title"]').type('A B C D')
cy.get('.nc-form').find('[placeholder="Add form description"]').type('Some description about form comes here')
cy.get('.nc-form > .mx-auto').find('textarea').type('Congratulations!')
cy.get('#data-table-form-City').drag('#data-table-form-LastUpdate')
cy.get('[title="City => Address"]').drag('.nc-drag-n-drop-to-hide')
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
})
})
it(`Share form view`, () => {
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('City1').click()
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.contains('/nc/form/', {timeout: 10000})
.then(($obj) => {
let linkText = $obj.text().trim()
cy.log(linkText)
cy.visit(linkText, {
baseUrl: null
})
// wait for share view page to load!
cy.get('.nc-form').should('exist')
// New form appeared? Header & description should exist
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
// all fields, barring removed field should exist
cy.get('[title="City"]').should('exist')
cy.get('[title="LastUpdate"]').should('exist')
cy.get('[title="Country <= City"]').should('exist')
cy.get('[title="City => Address"]').should('not.exist')
// order of LastUpdate & City field is retained
cy.get('.nc-field-wrapper').eq(0).contains('LastUpdate').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('City').should('exist')
// submit form, to read message
cy.get('#data-table-form-City').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
cy.get('button').contains("Link to 'Country'").click()
cy.getActiveModal().find('.child-card').contains('Afghanistan').click()
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist').then(() => {
cy.get('.nc-form').should('exist')
// validate if form has appeared again
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
})
})
})
it(`Delete ${viewType} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null
})
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(25).click()
cy.get('.nc-grid-row').should('have.length', 1)
mainPage.getRow(1).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getCell("City", 1).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
// cy.toastWait('Deleted selected rows successfully')
})
}
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest('form')
})
}
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORM view (Share)`, () => {
const name = "Test" + Date.now();
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab("City", 25);
});
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
after(() => {
cy.closeTableTab("City");
});
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find("button:contains(Submit)").click();
cy.toastWait("View created successfully");
// Prepare form
// add header, description
// add post submission message
// swap position for City, LastUpdate fields
// remove City=>Address field
cy.get(".nc-form > .mx-auto").find('[type="checkbox"]').eq(1).click();
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(1)
.should("be.checked");
cy.get(".nc-form").find('[placeholder="Form Title"]').type("A B C D");
cy.get(".nc-form")
.find('[placeholder="Add form description"]')
.type("Some description about form comes here");
cy.get(".nc-form > .mx-auto").find("textarea").type("Congratulations!");
cy.get("#data-table-form-City").drag("#data-table-form-LastUpdate");
cy.get('[title="City => Address"]').drag(".nc-drag-n-drop-to-hide");
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(1)
.should("be.checked");
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
});
});
it(`Share form view`, () => {
cy.get(".nc-form > .mx-auto")
.find('[type="checkbox"]')
.eq(1)
.should("be.checked");
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("City1")
.click();
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// copy link text, visit URL
cy.getActiveModal()
.find(".share-link-box")
.contains("/nc/form/", { timeout: 10000 })
.then(($obj) => {
let linkText = $obj.text().trim();
cy.log(linkText);
cy.visit(linkText, {
baseUrl: null,
});
// wait for share view page to load!
cy.get(".nc-form").should("exist");
// New form appeared? Header & description should exist
cy.get(".nc-form", { timeout: 10000 })
.find("h2")
.contains("A B C D")
.should("exist");
cy.get(".nc-form", { timeout: 10000 })
.find(".body-1")
.contains("Some description about form comes here")
.should("exist");
// all fields, barring removed field should exist
cy.get('[title="City"]').should("exist");
cy.get('[title="LastUpdate"]').should("exist");
cy.get('[title="Country <= City"]').should("exist");
cy.get('[title="City => Address"]').should("not.exist");
// order of LastUpdate & City field is retained
cy.get(".nc-field-wrapper")
.eq(0)
.contains("LastUpdate")
.should("exist");
cy.get(".nc-field-wrapper").eq(1).contains("City").should("exist");
// submit form, to read message
cy.get("#data-table-form-City").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
cy.get("button").contains("Link to 'Country'").click();
cy.getActiveModal()
.find(".child-card")
.contains("Afghanistan")
.click();
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Congratulations");
cy.get(".v-alert")
.contains("Congratulations")
.should("exist")
.then(() => {
cy.get(".nc-form").should("exist");
// validate if form has appeared again
cy.get(".nc-form", { timeout: 10000 })
.find("h2")
.contains("A B C D")
.should("exist");
cy.get(".nc-form", { timeout: 10000 })
.find(".body-1")
.contains("Some description about form comes here")
.should("exist");
});
});
});
it(`Delete ${viewType} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null,
});
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
// click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-delete-icon").click({ force: true });
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1);
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(25).click();
cy.get(".nc-grid-row").should("have.length", 1);
mainPage
.getRow(1)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage.getCell("City", 1).rightclick();
cy.getActiveMenu().contains("Delete Selected Row").click();
// cy.toastWait('Deleted selected rows successfully')
});
};
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest("form");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -194,4 +214,3 @@ export const genTest = (type, xcdb) => {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

757
scripts/cypress/integration/common/4f_grid_view_share.js

@ -1,8 +1,7 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
let storedURL = ''
let storedURL = "";
// 0: all enabled
// 1: field hide
@ -10,348 +9,418 @@ let storedURL = ''
// 3: field filter
// 4: default (address table): for view operation validation
// 5: default (country table): for update row/column validation
let viewURL = {}
let viewURL = {};
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
const generateViewLink = (viewName) => {
// click on share view
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
// wait, as URL initially will be /undefined
cy.getActiveModal().find('.share-link-box')
.contains('/nc/view/', {timeout: 10000}).should('exist')
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.contains('/nc/view/', {timeout: 10000})
.then(($obj) => {
cy.get('body').type('{esc}')
// viewURL.push($obj.text())
viewURL[viewName] = $obj.text().trim()
})
}
describe(`${type.toUpperCase()} api - GRID view (Share)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab('Address', 25);
cy.saveLocalStorage()
})
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
// close table
// mainPage.deleteCreatedViews()
cy.closeTableTab('Address')
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType.toUpperCase()} view`, () => {
// create a normal public view
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
})
})
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Address1').click()
mainPage.hideField('Address2')
mainPage.sortField('District', 'Z -> A')
mainPage.filterField('Address', 'is like', 'Ab')
generateViewLink('combined')
cy.log(viewURL['combined'])
})
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
// generate view link multiple times
generateViewLink('combined')
generateViewLink('combined')
// verify if only one link exists in table
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.parent().find('button.mdi-dots-vertical').click()
cy.getActiveMenu().find('.v-list-item').contains('Views List').click()
cy.get('th:contains("View Link")').should('exist')
cy.get('th:contains("View Link")').parent().parent()
.next().find('tr').its('length').should('eq', 1)
.then(() => {
cy.get('.v-overlay__content > .d-flex > .v-icon').click()
})
})
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => {
// visit public view
cy.visit(viewURL['combined'], {
baseUrl: null
})
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 18)
// verify title
cy.get('div.model-name').contains('Address1').should('exist')
})
it(`Share ${viewType.toUpperCase()} view : verify fields hidden/open`, () => {
// verify column headers
cy.get('[data-col="Address"]').should('exist')
cy.get('[data-col="Address2"]').should('not.exist')
cy.get('[data-col="District"]').should('exist')
})
it(`Share ${viewType.toUpperCase()} view : verify fields sort/ filter`, () => {
// country column content verification before sort
mainPage.getCell("District", 1).contains("West Bengali").should('exist')
mainPage.getCell("District", 2).contains("Tutuila").should('exist')
mainPage.getCell("District", 3).contains("Tamil Nadu").should('exist')
})
it(`Share ${viewType.toUpperCase()} view : verify download CSV`, () => {
mainPage.hideField('LastUpdate')
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Address => Customer,Address => Staff,City <= Address,Address <=> Staff`,
`1013 Tabuk Boulevard,West Bengali,96203,158399646978,[object Object],2,,Kanchrapara,`,
`1892 Nabereznyje Telny Lane,Tutuila,28396,478229987054,[object Object],2,,Tafuna,`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`
]
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(',')
let retCol = retrievedRecords[i].split(',')
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j])
}
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
}
}
// download & verify
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv)
mainPage.unhideField('LastUpdate')
})
it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => {
// remove sort and validate
mainPage.clearSort()
mainPage.getCell("District", 1).contains("Southern Mindanao").should('exist')
})
it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z->A)
mainPage.sortField('District', 'Z -> A')
mainPage.getCell("District", 1).contains("West Bengali").should('exist')
})
it(`Share ${viewType.toUpperCase()} view : Create Filter`, () => {
// add filter & validate
mainPage.filterField('District', 'is like', 'Tamil')
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 2)
mainPage.getCell("District", 1).contains("Tamil").should('exist')
})
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
mainPage.hideField('LastUpdate')
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Address => Customer,Address => Staff,City <= Address,Address <=> Staff`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`
]
// for (let i = 0; i < storedRecords.length; i++) {
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
// }
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(',')
let retCol = retrievedRecords[i].split(',')
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j])
}
}
}
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv)
mainPage.unhideField('LastUpdate')
})
it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => {
// Remove sort and Validate
mainPage.filterReset()
mainPage.getCell("District", 1).contains("West Bengali").should('exist')
})
it(`Share GRID view : Virtual column validation > has many`, () => {
// verify column headers
cy.get('[data-col="Address => Customer"]').should('exist')
cy.get('[data-col="Address => Staff"]').should('exist')
cy.get('[data-col="City <= Address"]').should('exist')
cy.get('[data-col="Address <=> Staff"]').should('exist')
// has many field validation
mainPage.getCell("Address => Customer", 3).click().find('button.mdi-close-thick').should('not.exist')
mainPage.getCell("Address => Customer", 3).click().find('button.mdi-plus').should('not.exist')
mainPage.getCell("Address => Customer", 3).click().find('button.mdi-arrow-expand').click()
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button').contains('Link to').should('not.exist')
cy.getActiveModal().find('.child-card').contains('2').should('exist')
cy.getActiveModal().find('.child-card').find('button').should('not.exist')
cy.get('body').type('{esc}')
})
it(`Share GRID view : Virtual column validation > belongs to`, () => {
// belongs to field validation
mainPage.getCell("City <= Address", 1).click().find('button.mdi-close-thick').should('not.exist')
mainPage.getCell("City <= Address", 1).click().find('button.mdi-arrow-expand').should('not.exist')
mainPage.getCell("City <= Address", 1).find('.v-chip').contains('Kanchrapara').should('exist')
})
it(`Share GRID view : Virtual column validation > many to many`, () => {
// many-to-many field validation
mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-close-thick').should('not.exist')
mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-plus').should('not.exist')
mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-arrow-expand').click()
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button').contains('Link to').should('not.exist')
cy.get('body').type('{esc}')
})
it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null
})
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
cy.get('.nc-view-delete-icon').eq(0).click({ force: true })
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
})
}
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest('grid')
})
describe(`${type.toUpperCase()} api - Grid view/ row-column update verification`, () => {
before(() => {
// Address table has belongs to, has many & many-to-many
cy.openTableTab('Country', 25)
cy.saveLocalStorage()
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
generateViewLink('rowColUpdate')
})
})
after(() => {
// close table
cy.restoreLocalStorage();
cy.visit(storedURL, {
baseUrl: null
})
// delete row
mainPage.getPagination(5).click()
// 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 })
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
// delete column
cy.get(`th:contains('dummy') .mdi-menu-down`)
.trigger('mouseover')
.click()
cy.get('.nc-column-delete').click()
cy.get('button:contains(Confirm)').click()
cy.toastWait('Update table.Country successful')
mainPage.deleteCreatedViews()
// close table
cy.closeTableTab('Country')
})
it(`Generate default Shared GRID view URL`, () => {
// add row
cy.get('.nc-add-new-row-btn').click({force: true})
cy.get('#data-table-form-Country > input').first().click().type('a')
cy.contains('Save Row').filter('button').click({ force: true })
cy.toastWait('updated successfully')
// add column
mainPage.addColumn('dummy', 'Country')
// visit public view
cy.log(viewURL['rowColUpdate'])
cy.restoreLocalStorage();
cy.visit(viewURL['rowColUpdate'], {
baseUrl: null
}) //5
// wait for public view page to load!
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
it(`Share GRID view : new row visible`, () => {
// verify row
cy.get(`.v-pagination > li:contains('5') button`).click()
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 10)
mainPage.getCell('Country', 10).contains('a').should('exist')
})
it.skip(`Share GRID view : new column visible`, () => {
// verify column headers
cy.get('[data-col="dummy"]').should('exist')
})
})
}
if (!isTestSuiteActive(type, xcdb)) return;
const generateViewLink = (viewName) => {
// click on share view
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// wait, as URL initially will be /undefined
cy.getActiveModal()
.find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 })
.should("exist");
// copy link text, visit URL
cy.getActiveModal()
.find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 })
.then(($obj) => {
cy.get("body").type("{esc}");
// viewURL.push($obj.text())
viewURL[viewName] = $obj.text().trim();
});
};
describe(`${type.toUpperCase()} api - GRID view (Share)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// open a table to work on views
//
cy.openTableTab("Address", 25);
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
after(() => {
// close table
// mainPage.deleteCreatedViews()
cy.closeTableTab("Address");
});
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType.toUpperCase()} view`, () => {
// create a normal public view
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal().find("button:contains(Submit)").click();
cy.toastWait("View created successfully");
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
});
});
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Address1")
.click();
mainPage.hideField("Address2");
mainPage.sortField("District", "Z -> A");
mainPage.filterField("Address", "is like", "Ab");
generateViewLink("combined");
cy.log(viewURL["combined"]);
});
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
// generate view link multiple times
generateViewLink("combined");
generateViewLink("combined");
// verify if only one link exists in table
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.parent()
.find("button.mdi-dots-vertical")
.click();
cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
cy.get('th:contains("View Link")').should("exist");
cy.get('th:contains("View Link")')
.parent()
.parent()
.next()
.find("tr")
.its("length")
.should("eq", 1)
.then(() => {
cy.get(".v-overlay__content > .d-flex > .v-icon").click();
});
});
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => {
// visit public view
cy.visit(viewURL["combined"], {
baseUrl: null,
});
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 18);
// verify title
cy.get("div.model-name").contains("Address1").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields hidden/open`, () => {
// verify column headers
cy.get('[data-col="Address"]').should("exist");
cy.get('[data-col="Address2"]').should("not.exist");
cy.get('[data-col="District"]').should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields sort/ filter`, () => {
// country column content verification before sort
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
mainPage.getCell("District", 2).contains("Tutuila").should("exist");
mainPage.getCell("District", 3).contains("Tamil Nadu").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV`, () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Address => Customer,Address => Staff,City <= Address,Address <=> Staff`,
`1013 Tabuk Boulevard,West Bengali,96203,158399646978,[object Object],2,,Kanchrapara,`,
`1892 Nabereznyje Telny Lane,Tutuila,28396,478229987054,[object Object],2,,Tafuna,`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
];
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(",");
let retCol = retrievedRecords[i].split(",");
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j]);
}
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
}
};
// download & verify
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => {
// remove sort and validate
mainPage.clearSort();
mainPage
.getCell("District", 1)
.contains("Southern Mindanao")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z->A)
mainPage.sortField("District", "Z -> A");
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : Create Filter`, () => {
// add filter & validate
mainPage.filterField("District", "is like", "Tamil");
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 2);
mainPage.getCell("District", 1).contains("Tamil").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Address => Customer,Address => Staff,City <= Address,Address <=> Staff`,
`1993 Tabuk Lane,Tamil Nadu,64221,648482415405,[object Object],2,,Tambaram,`,
`1661 Abha Drive,Tamil Nadu,14400,270456873752,[object Object],1,,Pudukkottai,`,
];
// for (let i = 0; i < storedRecords.length; i++) {
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
// }
for (let i = 0; i < storedRecords.length; i++) {
let strCol = storedRecords[i].split(",");
let retCol = retrievedRecords[i].split(",");
for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j]);
}
}
};
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => {
// Remove sort and Validate
mainPage.filterReset();
mainPage
.getCell("District", 1)
.contains("West Bengali")
.should("exist");
});
it(`Share GRID view : Virtual column validation > has many`, () => {
// verify column headers
cy.get('[data-col="Address => Customer"]').should("exist");
cy.get('[data-col="Address => Staff"]').should("exist");
cy.get('[data-col="City <= Address"]').should("exist");
cy.get('[data-col="Address <=> Staff"]').should("exist");
// has many field validation
mainPage
.getCell("Address => Customer", 3)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("Address => Customer", 3)
.click()
.find("button.mdi-plus")
.should("not.exist");
mainPage
.getCell("Address => Customer", 3)
.click()
.find("button.mdi-arrow-expand")
.click();
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find("button")
.contains("Link to")
.should("not.exist");
cy.getActiveModal().find(".child-card").contains("2").should("exist");
cy.getActiveModal()
.find(".child-card")
.find("button")
.should("not.exist");
cy.get("body").type("{esc}");
});
it(`Share GRID view : Virtual column validation > belongs to`, () => {
// belongs to field validation
mainPage
.getCell("City <= Address", 1)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("City <= Address", 1)
.click()
.find("button.mdi-arrow-expand")
.should("not.exist");
mainPage
.getCell("City <= Address", 1)
.find(".v-chip")
.contains("Kanchrapara")
.should("exist");
});
it(`Share GRID view : Virtual column validation > many to many`, () => {
// many-to-many field validation
mainPage
.getCell("Address <=> Staff", 1)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("Address <=> Staff", 1)
.click()
.find("button.mdi-plus")
.should("not.exist");
mainPage
.getCell("Address <=> Staff", 1)
.click()
.find("button.mdi-arrow-expand")
.click();
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find("button")
.contains("Link to")
.should("not.exist");
cy.get("body").type("{esc}");
});
it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null,
});
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
cy.get(".nc-view-delete-icon").eq(0).click({ force: true });
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1);
});
};
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest("grid");
});
describe(`${type.toUpperCase()} api - Grid view/ row-column update verification`, () => {
before(() => {
// Address table has belongs to, has many & many-to-many
cy.openTableTab("Country", 25);
cy.saveLocalStorage();
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
generateViewLink("rowColUpdate");
});
});
after(() => {
// close table
cy.restoreLocalStorage();
cy.visit(storedURL, {
baseUrl: null,
});
// delete row
mainPage.getPagination(5).click();
// 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 });
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu().contains("Delete Selected Row").click();
// delete column
cy.get(`th:contains('dummy') .mdi-menu-down`)
.trigger("mouseover")
.click();
cy.get(".nc-column-delete").click();
cy.get("button:contains(Confirm)").click();
cy.toastWait("Update table.Country successful");
mainPage.deleteCreatedViews();
// close table
cy.closeTableTab("Country");
});
it(`Generate default Shared GRID view URL`, () => {
// add row
cy.get(".nc-add-new-row-btn").click({ force: true });
cy.get("#data-table-form-Country > input").first().click().type("a");
cy.contains("Save Row").filter("button").click({ force: true });
cy.toastWait("updated successfully");
// add column
mainPage.addColumn("dummy", "Country");
// visit public view
cy.log(viewURL["rowColUpdate"]);
cy.restoreLocalStorage();
cy.visit(viewURL["rowColUpdate"], {
baseUrl: null,
}); //5
// wait for public view page to load!
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 25);
});
it(`Share GRID view : new row visible`, () => {
// verify row
cy.get(`.v-pagination > li:contains('5') button`).click();
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).contains("a").should("exist");
});
it.skip(`Share GRID view : new column visible`, () => {
// verify column headers
cy.get('[data-col="dummy"]').should("exist");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

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

@ -1,155 +1,168 @@
import { loginPage, projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { roles, staticProjects } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { _advSettings, _editSchema, _editData, _editComment, _viewMenu, _topRightMenu } from "../spec/roleValidation.spec"
import { loginPage, projectsPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
import {
roles,
staticProjects,
} from "../../support/page_objects/projectConstants";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import {
_advSettings,
_editSchema,
_editData,
_editComment,
_viewMenu,
_topRightMenu,
} from "../spec/roleValidation.spec";
export const genTest = (type, xcdb) => {
if (!isTestSuiteActive(type, xcdb)) return;
describe('Static user creations (different roles)', () => {
// beforeEach(() => {
// loginPage.signIn(roles.owner.credentials)
// projectsPage.openProject(getPrimarySuite().basic.name)
// })
before(() => {
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).click()
})
const addUser = (user) => {
it(`RoleType: ${user.name}`, () => {
// for first project, users need to be added explicitly using "New User" button
// for subsequent projects, they will be required to just add to this project
// using ROW count to identify if its former or latter scenario
// 5 users (owner, creator, editor, viewer, commenter) + row header = 6
cy.get(`tr`).then((obj) => {
cy.log(obj.length)
if (obj.length == 6) {
mainPage.addExistingUserToProject(user.credentials.username, user.name)
} else {
mainPage.addNewUserToProject(user.credentials, user.name)
}
})
})
}
addUser(roles.creator)
addUser(roles.editor)
addUser(roles.commenter)
addUser(roles.viewer)
})
const roleValidation = (roleType) => {
describe(`User role validation`, () => {
if (roleType != 'owner') {
it(`[${roles[roleType].name}] SignIn, Open project`, () => {
cy.log(mainPage.roleURL[roleType])
cy.visit(mainPage.roleURL[roleType], {
baseUrl: null
})
// 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')
if('rest' == type)
projectsPage.openProject(staticProjects.externalREST.basic.name)
else
projectsPage.openProject(staticProjects.externalGQL.basic.name)
if (roleType != 'creator') {
cy.closeTableTab('Actor')
}
})
}
///////////////////////////////////////////////////////
// Test suite
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => {
// project configuration settings
//
_advSettings(roleType, false)
})
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, () => {
// Schema related validations
// - Add/delete table
// - Add/Update/delete column
//
_editSchema(roleType, false)
})
it(`[${roles[roleType].name}] Data: add/modify/delete row, update cell contents`, () => {
// Table data related validations
// - Add/delete/modify row
//
_editData(roleType, false)
})
it(`[${roles[roleType].name}] Comments: view/add`, () => {
// read &/ update comment
// Viewer: only allowed to read
// Everyone else: read &/ update
//
if (roleType != 'viewer')
_editComment(roleType, false)
})
it(`[${roles[roleType].name}] Right navigation menu, share view`, () => {
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
_viewMenu(roleType, false)
})
it(`[${roles[roleType].name}] Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, false)
})
it(`[${roles[roleType].name}] Download files`, () => {
// #ID, City, LastUpdate, City => Address, Country <= City, +
mainPage.hideField('LastUpdate')
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`City,City => Address,Country <= City`,
`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`
]
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')
})
})
}
// skip owner validation as rest of the cases pretty much cover the same
// roleValidation('owner')
roleValidation('creator')
roleValidation('editor')
roleValidation('commenter')
roleValidation('viewer')
}
if (!isTestSuiteActive(type, xcdb)) return;
describe("Static user creations (different roles)", () => {
// beforeEach(() => {
// loginPage.signIn(roles.owner.credentials)
// projectsPage.openProject(getPrimarySuite().basic.name)
// })
before(() => {
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).click();
});
const addUser = (user) => {
it(`RoleType: ${user.name}`, () => {
// for first project, users need to be added explicitly using "New User" button
// for subsequent projects, they will be required to just add to this project
// using ROW count to identify if its former or latter scenario
// 5 users (owner, creator, editor, viewer, commenter) + row header = 6
cy.get(`tr`).then((obj) => {
cy.log(obj.length);
if (obj.length == 6) {
mainPage.addExistingUserToProject(
user.credentials.username,
user.name
);
} else {
mainPage.addNewUserToProject(user.credentials, user.name);
}
});
});
};
addUser(roles.creator);
addUser(roles.editor);
addUser(roles.commenter);
addUser(roles.viewer);
});
const roleValidation = (roleType) => {
describe(`User role validation`, () => {
if (roleType != "owner") {
it(`[${roles[roleType].name}] SignIn, Open project`, () => {
cy.log(mainPage.roleURL[roleType]);
cy.visit(mainPage.roleURL[roleType], {
baseUrl: null,
});
// 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");
if ("rest" == type)
projectsPage.openProject(staticProjects.externalREST.basic.name);
else projectsPage.openProject(staticProjects.externalGQL.basic.name);
if (roleType != "creator") {
cy.closeTableTab("Actor");
}
});
}
///////////////////////////////////////////////////////
// Test suite
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => {
// project configuration settings
//
_advSettings(roleType, false);
});
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, () => {
// Schema related validations
// - Add/delete table
// - Add/Update/delete column
//
_editSchema(roleType, false);
});
it(`[${roles[roleType].name}] Data: add/modify/delete row, update cell contents`, () => {
// Table data related validations
// - Add/delete/modify row
//
_editData(roleType, false);
});
it(`[${roles[roleType].name}] Comments: view/add`, () => {
// read &/ update comment
// Viewer: only allowed to read
// Everyone else: read &/ update
//
if (roleType != "viewer") _editComment(roleType, false);
});
it(`[${roles[roleType].name}] Right navigation menu, share view`, () => {
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
_viewMenu(roleType, false);
});
it(`[${roles[roleType].name}] Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, false);
});
it(`[${roles[roleType].name}] Download files`, () => {
// #ID, City, LastUpdate, City => Address, Country <= City, +
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`City,City => Address,Country <= City`,
`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`,
];
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");
});
});
};
// skip owner validation as rest of the cases pretty much cover the same
// roleValidation('owner')
roleValidation("creator");
roleValidation("editor");
roleValidation("commenter");
roleValidation("viewer");
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

189
scripts/cypress/integration/common/5b_preview_role.js

@ -1,98 +1,101 @@
// pre-requisite:
// pre-requisite:
// user@nocodb.com signed up as admin
// sakilaDb database created already
import { loginPage, projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { _advSettings, _editSchema, _editData, _editComment, _viewMenu, _topRightMenu } from "../spec/roleValidation.spec"
// sakilaDb database created already
import { loginPage, projectsPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import {
_advSettings,
_editSchema,
_editData,
_editComment,
_viewMenu,
_topRightMenu,
} from "../spec/roleValidation.spec";
export const genTest = (type, xcdb, roleType) => {
if(!isTestSuiteActive(type, xcdb)) return;
///////////////////////////////////////////////////////////
//// Test Suite
describe('Role preview validations', () => {
// Sign in/ open project
before(() => {
loginPage.loginAndOpenProject(type, xcdb)
})
after(() => {
cy.get('.nc-preview-reset').click({ force: true })
// cy.wait(20000)
// wait for page rendering to complete
cy.get('.nc-grid-row', { timeout: 25000 }).should('have.length', 25)
// cy.get('.nc-preview-reset:visible').should('not-exist')
// mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
// cy.get('.nc-preview-reset').should('not-exist')
cy.closeTableTab('City')
})
const genTestSub = (roleType) => {
it(`Role preview: ${roleType}: Enable preview`, () => {
cy.get(`.nc-preview-${roleType}`).click()
cy.openTableTab('City', 25)
})
it(`Role preview: ${roleType}: Advance settings`, () => {
// project configuration settings
//
_advSettings(roleType, true)
})
it(`Role preview: ${roleType}: Edit data`, () => {
// Table data related validations
// - Add/delete/modify row
//
_editData(roleType, true)
})
it(`Role preview: ${roleType}: Edit comment`, () => {
// read &/ update comment
// Viewer: not allowed to read
// Everyone else: read &/ update
//
_editComment(roleType, true)
})
it(`Role preview: ${roleType}: Preview menu`, () => {
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
_viewMenu(roleType, true)
})
it(`Role preview: ${roleType}: Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, false)
})
it(`Role preview: ${roleType}: Edit Schema`, () => {
// Schema related validations
// - Add/delete table
// - Add/Update/delete column
//
_editSchema(roleType, true)
})
}
genTestSub('editor')
genTestSub('commenter')
genTestSub('viewer')
})
}
if (!isTestSuiteActive(type, xcdb)) return;
///////////////////////////////////////////////////////////
//// Test Suite
describe("Role preview validations", () => {
// Sign in/ open project
before(() => {
loginPage.loginAndOpenProject(type, xcdb);
});
after(() => {
cy.get(".nc-preview-reset").click({ force: true });
// cy.wait(20000)
// wait for page rendering to complete
cy.get(".nc-grid-row", { timeout: 25000 }).should("have.length", 25);
// cy.get('.nc-preview-reset:visible').should('not-exist')
// mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
// cy.get('.nc-preview-reset').should('not-exist')
cy.closeTableTab("City");
});
const genTestSub = (roleType) => {
it(`Role preview: ${roleType}: Enable preview`, () => {
cy.get(`.nc-preview-${roleType}`).click();
cy.openTableTab("City", 25);
});
it(`Role preview: ${roleType}: Advance settings`, () => {
// project configuration settings
//
_advSettings(roleType, true);
});
it(`Role preview: ${roleType}: Edit data`, () => {
// Table data related validations
// - Add/delete/modify row
//
_editData(roleType, true);
});
it(`Role preview: ${roleType}: Edit comment`, () => {
// read &/ update comment
// Viewer: not allowed to read
// Everyone else: read &/ update
//
_editComment(roleType, true);
});
it(`Role preview: ${roleType}: Preview menu`, () => {
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
_viewMenu(roleType, true);
});
it(`Role preview: ${roleType}: Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, false);
});
it(`Role preview: ${roleType}: Edit Schema`, () => {
// Schema related validations
// - Add/delete table
// - Add/Update/delete column
//
_editSchema(roleType, true);
});
};
genTestSub("editor");
genTestSub("commenter");
genTestSub("viewer");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -115,4 +118,4 @@ export const genTest = (type, xcdb, roleType) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

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

@ -1,45 +1,44 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} Upload/ Download CSV`, () => {
before(() => {
// loginPage.loginAndOpenProject(type)
cy.openTableTab("Country", 25);
});
describe(`${type.toUpperCase()} Upload/ Download CSV`, () => {
before(() => {
// loginPage.loginAndOpenProject(type)
cy.openTableTab('Country', 25);
})
after(() => {
cy.closeTableTab("Country");
});
after(() => {
cy.closeTableTab('Country')
})
it("Download verification- base view, default columns", () => {
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Country,Country => City`,
`Afghanistan,Kabul`,
`Algeria,"Batna,Bchar,Skikda"`,
`American Samoa,Tafuna`,
`Angola,"Benguela,Namibe"`,
];
it('Download verification- base view, default columns', () => {
mainPage.hideField('LastUpdate')
const verifyCsv = (retrievedRecords) => {
// expected output, statically configured
let storedRecords = [
`Country,Country => City`,
`Afghanistan,Kabul`,
`Algeria,"Batna,Bchar,Skikda"`,
`American Samoa,Tafuna`,
`Angola,"Benguela,Namibe"`
]
for (let i = 0; i < storedRecords.length; i++) {
cy.log(retrievedRecords[i])
expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
}
}
for (let i = 0; i < storedRecords.length; i++) {
cy.log(retrievedRecords[i]);
expect(retrievedRecords[i]).to.be.equal(storedRecords[i]);
}
};
// download & verify
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv)
mainPage.unhideField('LastUpdate')
})
})
}
// download & verify
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

406
scripts/cypress/integration/common/6c_swagger_api.js

@ -1,188 +1,228 @@
import { loginPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { roles } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { loginPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
import { roles } from "../../support/page_objects/projectConstants";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} : API List - Test preparation`, () => {
before(()=> {
loginPage.loginAndOpenProject(type, false)
})
it("Open project & record swagger URL, AuthToken", () => {
let authToken = mainPage.getAuthToken()
cy.url().then( (url) => {
// retrieve project name from URL & use it to construct Swagger URL
// URL on homepage: http://localhost:3000/#/nc/externalrest_weUO?type=roles&dbalias=&name=Team%20%26%20Auth%20
// [REST] Swagger URL: http://localhost:8080/nc/externalrest_weUO/db/swagger
// [GQL] http://localhost:8080/nc/externalgql_dgwx/v1/graphql
const projectName = url.split("/")[5].split("?")[0];
let swaggerURL = ``
if ('rest' == type) {
swaggerURL = `http://localhost:8080/nc/${projectName}/db/swagger`
}
else {
swaggerURL = `http://localhost:8080/nc/${projectName}/v1/graphql`
}
// exchange information between two tests using a file
// https://stackoverflow.com/questions/52050657/what-is-the-best-practice-of-pass-states-between-tests-in-cypress
//
cy.writeFile("shared.json", {SWAGGER_URL: swaggerURL, AUTH_TOKEN: authToken})
})
})
})
if ('rest' == type) {
describe(`Swagger page, base verification`, () => {
// returns swagger button intended for
//
const getSwaggerButton = (tag, idx, desc) => {
return cy.get(`#operations-tag-${tag}`).next().find('.opblock').eq(idx).find(`button:contains(${desc})`)
}
let Token
// basic authentication tag verification
//
it("Swagger URL access & basic validation", () => {
// retrieve information stored in previous IT block
//
cy.readFile("shared.json").then((jsonPayload) => {
let URL = jsonPayload.SWAGGER_URL
Token = jsonPayload.AUTH_TOKEN
cy.visit(URL, {
baseUrl: null
}).then(() => {
// wait to allow time for SWAGGER Library loading to finish
cy.log(Token)
// validate; API order assumed
cy.get('#operations-tag-Authentication', {timeout: 20000}).should('exist').next().find('.opblock').should('has.length', 9)
getSwaggerButton("Authentication", 0, "User login").should('exist')
getSwaggerButton("Authentication", 1, "User signup").should('exist')
getSwaggerButton("Authentication", 2, "Password Forgot").should('exist')
getSwaggerButton("Authentication", 3, "Email validate link").should('exist')
getSwaggerButton("Authentication", 4, "Validate password reset token").should('exist')
getSwaggerButton("Authentication", 5, "Password reset").should('exist')
getSwaggerButton("Authentication", 6, "User details").should('exist')
getSwaggerButton("Authentication", 7, "Update user details").should('exist')
getSwaggerButton("Authentication", 8, "Update user details").should('exist')
})
})
})
it("Authorize success: Valid token", ()=> {
// authorize button, feed token, click authorize
cy.get('[class="btn authorize unlocked"]').click()
cy.get('input').type(Token)
cy.get('.auth-btn-wrapper > .authorize').click()
// Response: "Authorized" should exist on DOM
cy.get('.auth-container').contains('Authorized').should('exist')
cy.get('.btn-done').click()
// Authorize button is LOCKED now
cy.get('[class="btn authorize locked"]').should('exist')
})
it("Execute Authentication (valid token case) > GET: User details API", ()=> {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click()
// "Try it out" button, followed by "Execute"
cy.get('.try-out > .btn').click()
cy.get('.execute-wrapper > .btn').click()
// check response: validate email credentials
cy.get('.highlight-code > .microlight').contains('email').should('exist')
cy.get('.highlight-code > .microlight').contains(roles.owner.credentials.username).should('exist')
// reset operations (clear, cancel, windback User details tab)
cy.get('.btn-clear').click()
cy.get('.try-out > .btn').click()
getSwaggerButton("Authentication", 6, "User details").click()
})
it("Logout post authorization", ()=> {
// authorize button, logout
cy.get('[class="btn authorize locked"]').click()
cy.get('.auth-btn-wrapper > button:contains("Logout")').click()
cy.get('.btn-done').click()
// Authorize button is UNLOCKED now
cy.get('[class="btn authorize unlocked"]').should('exist')
})
it("Execute Authentication (logout case) > GET: User details API", ()=> {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click()
// "Try it out" button, followed by "Execute"
cy.get('.try-out > .btn').click()
cy.get('.execute-wrapper > .btn').click()
// check response: email credentials shouldnt exist. should display 'guest:true'
cy.get('.highlight-code > .microlight').contains('guest').should('exist')
cy.get('.highlight-code > .microlight').contains('email').should('not.exist')
cy.get('.highlight-code > .microlight').contains(roles.owner.credentials.username).should('not.exist')
// reset operations (clear, cancel, windback User details tab)
cy.get('.btn-clear').click()
cy.get('.try-out > .btn').click()
getSwaggerButton("Authentication", 6, "User details").click()
})
it("Authorize failure: invalid token", ()=> {
// authorize button, feed *invalid* token, click authorize
cy.get('[class="btn authorize unlocked"]').click()
cy.get('input').type('xyz')
cy.get('.auth-btn-wrapper > .authorize').click()
// Response: "Authorized" should *not* exist on DOM
// TBD: cy.get('.auth-container').contains('Authorized').should('not.exist')
cy.get('.btn-done').click()
// Authorize button should be UNLOCKED now
// TBD: cy.get('[class="btn authorize unlocked"]').should('exist')
})
it("Execute Authentication (invalid token case) > GET: User details API", ()=> {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click()
// "Try it out" button, followed by "Execute"
cy.get('.try-out > .btn').click()
cy.get('.execute-wrapper > .btn').click()
// check response: email credentials shouldnt exist. should display 'guest:true'
cy.get('.highlight-code > .microlight').contains('guest').should('exist')
cy.get('.highlight-code > .microlight').contains('email').should('not.exist')
cy.get('.highlight-code > .microlight').contains(roles.owner.credentials.username).should('not.exist')
// reset operations (clear, cancel, windback User details tab)
cy.get('.btn-clear').click()
cy.get('.try-out > .btn').click()
getSwaggerButton("Authentication", 6, "User details").click()
})
// clean-up created file (shared.json)
// after(() => {
// cy.exec("del shared.json").then(()=> {
// cy.log("file cleaned up!")
// })
// })
})
}
}
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} : API List - Test preparation`, () => {
before(() => {
loginPage.loginAndOpenProject(type, false);
});
it("Open project & record swagger URL, AuthToken", () => {
let authToken = mainPage.getAuthToken();
cy.url().then((url) => {
// retrieve project name from URL & use it to construct Swagger URL
// URL on homepage: http://localhost:3000/#/nc/externalrest_weUO?type=roles&dbalias=&name=Team%20%26%20Auth%20
// [REST] Swagger URL: http://localhost:8080/nc/externalrest_weUO/db/swagger
// [GQL] http://localhost:8080/nc/externalgql_dgwx/v1/graphql
const projectName = url.split("/")[5].split("?")[0];
let swaggerURL = ``;
if ("rest" == type) {
swaggerURL = `http://localhost:8080/nc/${projectName}/db/swagger`;
} else {
swaggerURL = `http://localhost:8080/nc/${projectName}/v1/graphql`;
}
// exchange information between two tests using a file
// https://stackoverflow.com/questions/52050657/what-is-the-best-practice-of-pass-states-between-tests-in-cypress
//
cy.writeFile("shared.json", {
SWAGGER_URL: swaggerURL,
AUTH_TOKEN: authToken,
});
});
});
});
if ("rest" == type) {
describe(`Swagger page, base verification`, () => {
// returns swagger button intended for
//
const getSwaggerButton = (tag, idx, desc) => {
return cy
.get(`#operations-tag-${tag}`)
.next()
.find(".opblock")
.eq(idx)
.find(`button:contains(${desc})`);
};
let Token;
// basic authentication tag verification
//
it("Swagger URL access & basic validation", () => {
// retrieve information stored in previous IT block
//
cy.readFile("shared.json").then((jsonPayload) => {
let URL = jsonPayload.SWAGGER_URL;
Token = jsonPayload.AUTH_TOKEN;
cy.visit(URL, {
baseUrl: null,
}).then(() => {
// wait to allow time for SWAGGER Library loading to finish
cy.log(Token);
// validate; API order assumed
cy.get("#operations-tag-Authentication", { timeout: 20000 })
.should("exist")
.next()
.find(".opblock")
.should("has.length", 9);
getSwaggerButton("Authentication", 0, "User login").should("exist");
getSwaggerButton("Authentication", 1, "User signup").should(
"exist"
);
getSwaggerButton("Authentication", 2, "Password Forgot").should(
"exist"
);
getSwaggerButton("Authentication", 3, "Email validate link").should(
"exist"
);
getSwaggerButton(
"Authentication",
4,
"Validate password reset token"
).should("exist");
getSwaggerButton("Authentication", 5, "Password reset").should(
"exist"
);
getSwaggerButton("Authentication", 6, "User details").should(
"exist"
);
getSwaggerButton("Authentication", 7, "Update user details").should(
"exist"
);
getSwaggerButton("Authentication", 8, "Update user details").should(
"exist"
);
});
});
});
it("Authorize success: Valid token", () => {
// authorize button, feed token, click authorize
cy.get('[class="btn authorize unlocked"]').click();
cy.get("input").type(Token);
cy.get(".auth-btn-wrapper > .authorize").click();
// Response: "Authorized" should exist on DOM
cy.get(".auth-container").contains("Authorized").should("exist");
cy.get(".btn-done").click();
// Authorize button is LOCKED now
cy.get('[class="btn authorize locked"]').should("exist");
});
it("Execute Authentication (valid token case) > GET: User details API", () => {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click();
// "Try it out" button, followed by "Execute"
cy.get(".try-out > .btn").click();
cy.get(".execute-wrapper > .btn").click();
// check response: validate email credentials
cy.get(".highlight-code > .microlight")
.contains("email")
.should("exist");
cy.get(".highlight-code > .microlight")
.contains(roles.owner.credentials.username)
.should("exist");
// reset operations (clear, cancel, windback User details tab)
cy.get(".btn-clear").click();
cy.get(".try-out > .btn").click();
getSwaggerButton("Authentication", 6, "User details").click();
});
it("Logout post authorization", () => {
// authorize button, logout
cy.get('[class="btn authorize locked"]').click();
cy.get('.auth-btn-wrapper > button:contains("Logout")').click();
cy.get(".btn-done").click();
// Authorize button is UNLOCKED now
cy.get('[class="btn authorize unlocked"]').should("exist");
});
it("Execute Authentication (logout case) > GET: User details API", () => {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click();
// "Try it out" button, followed by "Execute"
cy.get(".try-out > .btn").click();
cy.get(".execute-wrapper > .btn").click();
// check response: email credentials shouldnt exist. should display 'guest:true'
cy.get(".highlight-code > .microlight")
.contains("guest")
.should("exist");
cy.get(".highlight-code > .microlight")
.contains("email")
.should("not.exist");
cy.get(".highlight-code > .microlight")
.contains(roles.owner.credentials.username)
.should("not.exist");
// reset operations (clear, cancel, windback User details tab)
cy.get(".btn-clear").click();
cy.get(".try-out > .btn").click();
getSwaggerButton("Authentication", 6, "User details").click();
});
it("Authorize failure: invalid token", () => {
// authorize button, feed *invalid* token, click authorize
cy.get('[class="btn authorize unlocked"]').click();
cy.get("input").type("xyz");
cy.get(".auth-btn-wrapper > .authorize").click();
// Response: "Authorized" should *not* exist on DOM
// TBD: cy.get('.auth-container').contains('Authorized').should('not.exist')
cy.get(".btn-done").click();
// Authorize button should be UNLOCKED now
// TBD: cy.get('[class="btn authorize unlocked"]').should('exist')
});
it("Execute Authentication (invalid token case) > GET: User details API", () => {
// Auth> User details API
getSwaggerButton("Authentication", 6, "User details").click();
// "Try it out" button, followed by "Execute"
cy.get(".try-out > .btn").click();
cy.get(".execute-wrapper > .btn").click();
// check response: email credentials shouldnt exist. should display 'guest:true'
cy.get(".highlight-code > .microlight")
.contains("guest")
.should("exist");
cy.get(".highlight-code > .microlight")
.contains("email")
.should("not.exist");
cy.get(".highlight-code > .microlight")
.contains(roles.owner.credentials.username)
.should("not.exist");
// reset operations (clear, cancel, windback User details tab)
cy.get(".btn-clear").click();
cy.get(".try-out > .btn").click();
getSwaggerButton("Authentication", 6, "User details").click();
});
// clean-up created file (shared.json)
// after(() => {
// cy.exec("del shared.json").then(()=> {
// cy.log("file cleaned up!")
// })
// })
});
}
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

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

@ -1,68 +1,66 @@
const { mainPage } = require("../../support/page_objects/mainPage")
const { loginPage } = require("../../support/page_objects/navigation")
const { roles } = require("../../support/page_objects/projectConstants")
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const { mainPage } = require("../../support/page_objects/mainPage");
const { loginPage } = require("../../support/page_objects/navigation");
const { roles } = require("../../support/page_objects/projectConstants");
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`Language support`, () => {
if (!isTestSuiteActive(type, xcdb)) return;
describe(`Language support`, () => {
before(() => {
//loginPage.signIn(roles.owner.credentials)
mainPage.toolBarTopLeft(mainPage.HOME).click();
});
before(() => {
//loginPage.signIn(roles.owner.credentials)
mainPage.toolBarTopLeft(mainPage.HOME).click()
})
const langVerification = (idx, lang) => {
// pick json from the file specified
it(`Language verification: ${lang} > Projects page`, () => {
let json = require(`../../../../packages/nc-gui/lang/${lang}`);
const langVerification = (idx, lang) => {
// pick json from the file specified
it(`Language verification: ${lang} > Projects page`, () => {
let json = require(`../../../../packages/nc-gui/lang/${lang}`);
// toggle menu as per index
cy.get('.nc-menu-translate').click()
cy.getActiveMenu().find('.v-list-item').eq(idx).click()
// toggle menu as per index
cy.get(".nc-menu-translate").click();
cy.getActiveMenu().find(".v-list-item").eq(idx).click();
// basic validations
// 1. Page title: "My Projects"
// 2. Button: "New Project"
// 3. Search box palceholder text: "Search Projects"
cy.get('b')
.contains(json.projects.my_projects)
.should('exist')
cy.get('button.v-btn')
.contains(json.projects.create_new_project_button.text)
.should('exist')
cy.get(`[placeholder="${json.projects.search_project}"]`)
.should('exist')
})
}
// basic validations
// 1. Page title: "My Projects"
// 2. Button: "New Project"
// 3. Search box palceholder text: "Search Projects"
cy.get("b").contains(json.projects.my_projects).should("exist");
cy.get("button.v-btn")
.contains(json.projects.create_new_project_button.text)
.should("exist");
cy.get(`[placeholder="${json.projects.search_project}"]`).should(
"exist"
);
});
};
// Index is the order in which menu options appear
langVerification(0, 'da.json')
langVerification(1, 'de.json')
langVerification(2, 'en.json')
langVerification(3, 'es.json')
langVerification(4, 'fi.json')
langVerification(5, 'fr.json')
langVerification(6, 'hr.json')
langVerification(7, 'id.json')
langVerification(8, 'it_IT.json')
langVerification(9, 'iw.json')
langVerification(10, 'ja.json')
langVerification(11, 'ko.json')
langVerification(12, 'nl.json')
langVerification(13, 'no.json')
langVerification(14, 'pt_BR.json')
langVerification(15, 'ru.json')
langVerification(16, 'sl.json')
langVerification(17, 'sv.json')
langVerification(18, 'th.json')
langVerification(19, 'uk.json')
langVerification(20, 'vi.json')
langVerification(21, 'zh_CN.json')
langVerification(22, 'zh_HK.json')
langVerification(23, 'zh_TW.json')
})
}
// Index is the order in which menu options appear
langVerification(0, "da.json");
langVerification(1, "de.json");
langVerification(2, "en.json");
langVerification(3, "es.json");
langVerification(4, "fi.json");
langVerification(5, "fr.json");
langVerification(6, "hr.json");
langVerification(7, "id.json");
langVerification(8, "it_IT.json");
langVerification(9, "iw.json");
langVerification(10, "ja.json");
langVerification(11, "ko.json");
langVerification(12, "nl.json");
langVerification(13, "no.json");
langVerification(14, "pt_BR.json");
langVerification(15, "ru.json");
langVerification(16, "sl.json");
langVerification(17, "sv.json");
langVerification(18, "th.json");
langVerification(19, "uk.json");
langVerification(20, "vi.json");
langVerification(21, "zh_CN.json");
langVerification(22, "zh_HK.json");
langVerification(23, "zh_TW.json");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -84,4 +82,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

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

@ -1,71 +1,70 @@
import { loginPage } from "../../support/page_objects/navigation"
import { roles } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { loginPage } from "../../support/page_objects/navigation";
import { roles } from "../../support/page_objects/projectConstants";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
describe(`${type.toUpperCase()} Project operations`, () => {
if(!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
before(() => {
loginPage.signIn(roles.owner.credentials)
})
loginPage.signIn(roles.owner.credentials);
});
it('Stop Project', () => {
it("Stop Project", () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, { timeout: 10000 })
.should('exist')
cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.invoke("show")
.click();
cy.contains("Submit").closest("button").click();
cy.toastWait('stopped successfully')
})
cy.toastWait("stopped successfully");
});
it('Start Project', () => {
it("Start Project", () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, { timeout: 10000 })
.should('exist')
cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke('show')
.invoke("show")
.click();
cy.contains('Submit').closest('button').click();
cy.contains("Submit").closest("button").click();
cy.toastWait('started successfully')
})
cy.toastWait("started successfully");
});
it('Restart Project', () => {
it("Restart Project", () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-restart`, { timeout: 10000 })
.should('exist')
.should("exist")
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.invoke("show")
.click();
cy.toastWait('restarted successfully')
})
cy.contains("Submit").closest("button").click();
it('Delete Project', () => {
cy.toastWait("restarted successfully");
});
it("Delete Project", () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.invoke("show")
.click();
cy.toastWait('deleted successfully')
})
})
}
cy.contains("Submit").closest("button").click();
cy.toastWait("deleted successfully");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -87,4 +86,4 @@ export const genTest = (type, xcdb) => {
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
*/

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

@ -1,117 +1,126 @@
import {mainPage} from "../../support/page_objects/mainPage"
import {loginPage} from "../../support/page_objects/navigation"
import {isTestSuiteActive} from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} Columns of type attachment`, () => {
before(() => {
loginPage.loginAndOpenProject(type)
cy.openTableTab('Country', 25);
})
loginPage.loginAndOpenProject(type);
cy.openTableTab("Country", 25);
});
after(() => {
mainPage.deleteColumn('testAttach')
mainPage.deleteColumn("testAttach");
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click()
mainPage.getPagination(5).click();
// 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})
cy.get(".nc-grid-row").should("have.length", 10);
mainPage
.getRow(10)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu().contains("Delete Selected Row").click();
cy.closeTableTab('Country')
})
cy.closeTableTab("Country");
});
it(`Add column of type attachments`, () => {
mainPage.addColumnWithType('testAttach', 'Attachment', 'Country')
mainPage.addColumnWithType("testAttach", "Attachment", "Country");
for (let i = 1; i <= 2; i++) {
let filepath = `sampleFiles/${i}.json`
mainPage.getCell('testAttach', i).click().find('input[type="file"]').attachFile(filepath)
mainPage.getCell('testAttach', i).find('.mdi-file').should('exist')
let filepath = `sampleFiles/${i}.json`;
mainPage
.getCell("testAttach", i)
.click()
.find('input[type="file"]')
.attachFile(filepath);
mainPage.getCell("testAttach", i).find(".mdi-file").should("exist");
}
})
});
it(`Form view with Attachment field- Submit & verify`, () => {
// create form-view
cy.get(`.nc-create-form-view`).click();
cy.getActiveModal().find('button:contains(Submit)').click()
cy.getActiveModal().find("button:contains(Submit)").click();
cy.toastWait('View created successfully')
cy.toastWait("View created successfully");
cy.get(`.nc-view-item.nc-form-view-item`).contains('Country1').click()
cy.get(`.nc-view-item.nc-form-view-item`).contains("Country1").click();
cy.get('.v-navigation-drawer__content > .container')
.should('exist')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
cy.get(".v-navigation-drawer__content > .container")
.should("exist")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.contains('/nc/form/', {timeout: 10000})
cy.getActiveModal()
.find(".share-link-box")
.contains("/nc/form/", { timeout: 10000 })
.then(($obj) => {
let linkText = $obj.text().trim()
cy.log(linkText)
let linkText = $obj.text().trim();
cy.log(linkText);
cy.visit(linkText, {
baseUrl: null
})
baseUrl: null,
});
// wait for share view page to load!
cy.get('#data-table-form-Country').should('exist').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
cy.get("#data-table-form-Country").should("exist").type("_abc");
cy.get("#data-table-form-LastUpdate").click();
cy.getActiveModal().find("button").contains("19").click();
cy.getActiveModal().find("button").contains("OK").click();
cy.get('.nc-field-editables')
cy.get(".nc-field-editables")
.last()
.find('input[type="file"]')
.attachFile(`sampleFiles/1.json`)
.attachFile(`sampleFiles/1.json`);
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Saved successfully')
})
})
cy.get(".nc-form").find("button").contains("Submit").click();
cy.toastWait("Saved successfully");
});
});
it(`Filter column which contain only attachments, download CSV`, () => {
// come back to main window
loginPage.loginAndOpenProject(type)
cy.openTableTab('Country', 25);
loginPage.loginAndOpenProject(type);
cy.openTableTab("Country", 25);
mainPage.filterField('testAttach', 'is not null', null)
mainPage.hideField('LastUpdate')
mainPage.filterField("testAttach", "is not null", null);
mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => {
let storedRecords = [
`Country,Country => City,testAttach`,
`Afghanistan,Kabul,1.json(http://localhost:8080/dl/externalrest_5agd/db/country/testAttach_VWk3fz_1.json)`
]
`Afghanistan,Kabul,1.json(http://localhost:8080/dl/externalrest_5agd/db/country/testAttach_VWk3fz_1.json)`,
];
expect(retrievedRecords[0]).to.be.equal(storedRecords[0])
expect(retrievedRecords[0]).to.be.equal(storedRecords[0]);
for (let i = 1; i < storedRecords.length; i++) {
const columns = retrievedRecords[i].split(',')
expect(columns[2]).to.contain('.json(http://localhost:8080/dl/external')
const columns = retrievedRecords[i].split(",");
expect(columns[2]).to.contain(
".json(http://localhost:8080/dl/external"
);
}
cy.log(retrievedRecords[109])
cy.log(retrievedRecords[110])
cy.log(retrievedRecords[111])
}
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv)
mainPage.unhideField('LastUpdate')
mainPage.filterReset()
})
})
}
cy.log(retrievedRecords[109]);
cy.log(retrievedRecords[110]);
cy.log(retrievedRecords[111]);
};
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate");
mainPage.filterReset();
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

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

@ -1,77 +1,77 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { projectsPage } from "../../support/page_objects/navigation"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { _advSettings, _editSchema, _editData, _editComment, _viewMenu, _topRightMenu } from "../spec/roleValidation.spec"
let linkText = ''
import { mainPage } from "../../support/page_objects/mainPage";
import { projectsPage } from "../../support/page_objects/navigation";
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import {
_advSettings,
_editSchema,
_editData,
_editComment,
_viewMenu,
_topRightMenu,
} from "../spec/roleValidation.spec";
let linkText = "";
export const genTest = (type, xcdb) => {
if (!isTestSuiteActive(type, xcdb)) return;
const permissionValidation = (roleType) => {
it(`${roleType}: Visit base shared URL`, () => {
cy.log(linkText)
// visit URL & wait for page load to complete
cy.visit(linkText, {
baseUrl: null
})
projectsPage.waitHomePageLoad()
cy.closeTableTab('Actor')
})
it(`${roleType}: Validate access permissions: advance menu`, () => {
_advSettings(roleType, false)
})
it(`${roleType}: Validate access permissions: edit schema`, () => {
_editSchema(roleType, false)
})
it(`${roleType}: Validate access permissions: edit data`, () => {
_editData(roleType, false)
})
it(`${roleType}: Validate access permissions: edit comments`, () => {
_editComment(roleType, false)
})
it(`${roleType}: Validate access permissions: view's menu`, () => {
_viewMenu(roleType, false)
})
}
describe(`${type.toUpperCase()} Base VIEW share`, () => {
it(`Generate base share URL`, () => {
// click SHARE
cy.get('.nc-topright-menu')
.find('.nc-menu-share')
.click()
// Click on readonly base text
cy.getActiveModal()
.find('.nc-disable-shared-base')
.click()
// Select 'Readonly link'
cy.getActiveMenu()
.find('.caption')
.contains('Anyone with the link')
.click()
// Copy URL
cy.getActiveModal()
.find('.nc-url')
.then(($obj) => {
cy.log($obj[0])
linkText = $obj[0].innerText.trim()
const htmlFile = `
if (!isTestSuiteActive(type, xcdb)) return;
const permissionValidation = (roleType) => {
it(`${roleType}: Visit base shared URL`, () => {
cy.log(linkText);
// visit URL & wait for page load to complete
cy.visit(linkText, {
baseUrl: null,
});
projectsPage.waitHomePageLoad();
cy.closeTableTab("Actor");
});
it(`${roleType}: Validate access permissions: advance menu`, () => {
_advSettings(roleType, false);
});
it(`${roleType}: Validate access permissions: edit schema`, () => {
_editSchema(roleType, false);
});
it(`${roleType}: Validate access permissions: edit data`, () => {
_editData(roleType, false);
});
it(`${roleType}: Validate access permissions: edit comments`, () => {
_editComment(roleType, false);
});
it(`${roleType}: Validate access permissions: view's menu`, () => {
_viewMenu(roleType, false);
});
};
describe(`${type.toUpperCase()} Base VIEW share`, () => {
it(`Generate base share URL`, () => {
// click SHARE
cy.get(".nc-topright-menu").find(".nc-menu-share").click();
// Click on readonly base text
cy.getActiveModal().find(".nc-disable-shared-base").click();
// Select 'Readonly link'
cy.getActiveMenu()
.find(".caption")
.contains("Anyone with the link")
.click();
// Copy URL
cy.getActiveModal()
.find(".nc-url")
.then(($obj) => {
cy.log($obj[0]);
linkText = $obj[0].innerText.trim();
const htmlFile = `
<!DOCTYPE html>
<html>
<body>
@ -86,58 +86,57 @@ style="background: transparent; "></iframe>
</body>
</html>
`
cy.writeFile("scripts/cypress/fixtures/sampleFiles/iFrame.html", htmlFile)
})
})
permissionValidation('viewer')
it('Update to EDITOR base share link', () => {
loginPage.loginAndOpenProject(type)
// click SHARE
cy.get('.nc-topright-menu')
.find('.nc-menu-share')
.click()
cy.getActiveModal()
.find('.nc-shared-base-role')
.click()
cy.getActiveMenu()
.find('[role="menuitem"]')
.contains('Editor')
.click()
})
permissionValidation('editor')
it('Generate & verify embed HTML IFrame', { baseUrl: null }, () => {
// open iFrame html
cy.visit('scripts/cypress/fixtures/sampleFiles/iFrame.html')
// wait for iFrame to load
cy.frameLoaded('.nc-embed')
// for GQL- additionally close GQL Client window
if (type === 'graphql') {
cy.iframe().find(`[title="Graphql Client"] > button.mdi-close`).click()
}
// validation for base menu opitons
cy.iframe().find('.nc-project-tree').should('exist')
cy.iframe().find('.nc-fields-menu-btn').should('exist')
cy.iframe().find('.nc-sort-menu-btn').should('exist')
cy.iframe().find('.nc-filter-menu-btn').should('exist')
cy.iframe().find('.nc-actions-menu-btn').should('exist')
// validate data (row-1)
mainPage.getIFrameCell('FirstName', 1).contains("PENELOPE").should('exist')
mainPage.getIFrameCell('LastName', 1).contains("GUINESS").should('exist')
})
})
}
`;
cy.writeFile(
"scripts/cypress/fixtures/sampleFiles/iFrame.html",
htmlFile
);
});
});
permissionValidation("viewer");
it("Update to EDITOR base share link", () => {
loginPage.loginAndOpenProject(type);
// click SHARE
cy.get(".nc-topright-menu").find(".nc-menu-share").click();
cy.getActiveModal().find(".nc-shared-base-role").click();
cy.getActiveMenu().find('[role="menuitem"]').contains("Editor").click();
});
permissionValidation("editor");
it("Generate & verify embed HTML IFrame", { baseUrl: null }, () => {
// open iFrame html
cy.visit("scripts/cypress/fixtures/sampleFiles/iFrame.html");
// wait for iFrame to load
cy.frameLoaded(".nc-embed");
// for GQL- additionally close GQL Client window
if (type === "graphql") {
cy.iframe().find(`[title="Graphql Client"] > button.mdi-close`).click();
}
// validation for base menu opitons
cy.iframe().find(".nc-project-tree").should("exist");
cy.iframe().find(".nc-fields-menu-btn").should("exist");
cy.iframe().find(".nc-sort-menu-btn").should("exist");
cy.iframe().find(".nc-filter-menu-btn").should("exist");
cy.iframe().find(".nc-actions-menu-btn").should("exist");
// validate data (row-1)
mainPage
.getIFrameCell("FirstName", 1)
.contains("PENELOPE")
.should("exist");
mainPage.getIFrameCell("LastName", 1).contains("GUINESS").should("exist");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

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

@ -1,47 +1,49 @@
// Cypress test suite: Project creation using EXCEL
//
import { projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { roles, isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { projectsPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
import {
roles,
isTestSuiteActive,
} from "../../support/page_objects/projectConstants";
// stores sheet names (table name)
let sheetList
let sheetList;
// stores table data (read from excel)
let sheetData
let sheetData;
//let UrlSheetData
let URL = 'https://go.microsoft.com/fwlink/?LinkID=521962'
let URL = "https://go.microsoft.com/fwlink/?LinkID=521962";
let filepath = `sampleFiles/simple.xlsx`
let filepath = `sampleFiles/simple.xlsx`;
// let UrlFilePath = `sampleFiles/Financial Sample.xlsx`
let expectedData = {
0: ['number', 'Number'],
1: ['float', 'Decimal'],
2: ['text', 'SingleLineText']
}
0: ["number", "Number"],
1: ["float", "Decimal"],
2: ["text", "SingleLineText"],
};
let UrlFileExpectedData = {
0: ['Segment', 'SingleSelect', ['Government']],
1: ['Country', 'SingleSelect', ['Canada']],
2: ['Product', 'SingleSelect', ['Carretera']],
3: ['Discount Band', 'SingleSelect', ['None']],
4: ['Units Sold', 'Decimal', [1618.5]],
5: ['Manufacturing Price', 'Number', [3]],
6: ['Sale Price', 'Number', [20]],
7: ['Gross Sales', 'Decimal', [32370]],
8: ['Discounts', 'Decimal', [0]],
9: ['Sales', 'Decimal', [32370]],
10: ['COGS', 'Decimal', [16185]],
11: ['Profit', 'Decimal', [16185]],
12: ['Date', 'Date', ['2014-01-01']],
13: ['Month Number', 'Number', [1]],
14: ['Month Name', 'SingleSelect', ['January']],
15: ['Year', 'SingleSelect', [2014]]
}
0: ["Segment", "SingleSelect", ["Government"]],
1: ["Country", "SingleSelect", ["Canada"]],
2: ["Product", "SingleSelect", ["Carretera"]],
3: ["Discount Band", "SingleSelect", ["None"]],
4: ["Units Sold", "Decimal", [1618.5]],
5: ["Manufacturing Price", "Number", [3]],
6: ["Sale Price", "Number", [20]],
7: ["Gross Sales", "Decimal", [32370]],
8: ["Discounts", "Decimal", [0]],
9: ["Sales", "Decimal", [32370]],
10: ["COGS", "Decimal", [16185]],
11: ["Profit", "Decimal", [16185]],
12: ["Date", "Date", ["2014-01-01"]],
13: ["Month Number", "Number", [1]],
14: ["Month Name", "SingleSelect", ["January"]],
15: ["Year", "SingleSelect", [2014]],
};
// let filepath = `sampleFiles/sample.xlsx`
// let expectedData = {
@ -61,231 +63,260 @@ let UrlFileExpectedData = {
// }
export const genTest = (type, xcdb) => {
if (!isTestSuiteActive(type, xcdb)) return;
describe(`Import from excel`, () => {
before(() => {
cy.task('readSheetList', { file: `./scripts/cypress/fixtures/${filepath}` })
.then((rows) => {
cy.log(rows)
sheetList = rows
})
cy.task('readXlsx', { file: `./scripts/cypress/fixtures/${filepath}`, sheet: "Sheet2" })
.then((rows) => {
cy.log(rows)
sheetData = rows
})
// cy.task('readXlsx', { file: `./scripts/cypress/fixtures/${UrlFilePath}`, sheet: "Sheet1" })
// .then((rows) => {
// cy.log(rows)
// UrlSheetData = rows
// })
})
it('File Upload: Upload excel as template', () => {
mainPage.toolBarTopLeft(mainPage.HOME).click()
// click on "New Project"
cy.get(':nth-child(5) > .v-btn', { timeout: 20000 }).click()
// Subsequent form, select (+ Create) option
cy.get('.nc-create-project-from-excel', { timeout: 20000 }).click({ force: true })
cy.get('.nc-excel-import-input').attachFile(filepath)
cy.get('.nc-btn-use-template', { timeout: 120000 }).should('exist')
})
it('File Upload: Verify pre-load template page', () => {
cy.getActiveContentModal().find('.v-expansion-panel').then((sheets) => {
for (let i = 0; i < sheets.length; i++) {
// verify if all sheet names are correct
// cy.wrap(sheets[i]).find('.title').then((blk) => {
// cy.log(blk.text().trim())
// expect(blk.text().trim()).to.equal(sheetList[i])
// })
cy.wrap(sheets[i]).contains(sheetList[i]).should('exist')
// for each sheet, expand to verify table names & their data types
cy.wrap(sheets[i]).find('.mdi-chevron-down').click()
// wait for 4 DOM rows to become visible, corresponding to 4 column names in excel
// change to avoid static wait
cy.get('.v-data-table').find('tr:visible').should('have.length', 4)
cy.get('.v-data-table').find('tr:visible').then((row) => {
for (let j = 1; j < row.length; j++) {
// column name to match input in excel
cy.wrap(row[j]).find('[placeholder="Column name"]').then((obj) => {
cy.log(obj[0].value)
expect(obj[0].value).to.equal(expectedData[j-1][0])
})
// datatype to match expected output
cy.wrap(row[j]).find('span.caption').then((obj) => {
cy.log(obj[0].innerText)
expect(obj[0].innerText).to.equal(expectedData[j-1][1])
})
}
})
// unwind
cy.wrap(sheets[i]).find('.mdi-chevron-down').click()
}
})
})
it('File Upload: Verify loaded data', () => {
// create rest/ gql project
cy.get('.nc-btn-use-template', { timeout: 120000 }).click()
// if (type == 'rest') {
// cy.getActiveMenu().find('[role="menuitem"]').contains('REST').click()
// } else {
// cy.getActiveMenu().find('[role="menuitem"]').contains('GQL').click()
// }
// wait for loading to be completed
projectsPage.waitHomePageLoad()
// open sheet & validate contents
// sheetData contains data read from excel in format
// 0: { float: 1.1, number: 1, text: "abc" }
// 1: { float: 1.2, number: 0, text: "def" }
cy.openTableTab('Sheet2', 2)
for (const [key, value] of Object.entries(expectedData)) {
mainPage.getCell(value[0], 1).contains(sheetData[0][value[0]]).should('exist')
mainPage.getCell(value[0], 2).contains(sheetData[1][value[0]]).should('exist')
}
cy.closeTableTab('Sheet2')
cy.openTableTab('Sheet3', 2)
for (const [key, value] of Object.entries(expectedData)) {
mainPage.getCell(value[0], 1).contains(sheetData[0][value[0]]).should('exist')
mainPage.getCell(value[0], 2).contains(sheetData[1][value[0]]).should('exist')
}
cy.closeTableTab('Sheet3')
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click()
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
})
it('URL: Upload excel as template', () => {
// click on "New Project"
cy.get(':nth-child(5) > .v-btn', { timeout: 20000 }).click()
// Subsequent form, select (+ Create) option
cy.get('.nc-create-project-from-excel', { timeout: 20000 }).click({ force: true })
cy.getActiveModal().find('.caption').contains('URL').click()
cy.get('.nc-excel-import-tab-item').find('input[type="url"]').click().type(URL)
cy.get('.nc-excel-import-tab-item').find('button').contains('Load').click()
cy.get('.nc-btn-use-template', { timeout: 120000 }).should('exist')
})
it('URL: Verify pre-load template page', () => {
cy.getActiveContentModal().find('.v-expansion-panel').then((sheets) => {
for (let i = 0; i < sheets.length; i++) {
// verify if all sheet names are correct
// cy.wrap(sheets[i]).find('.title').then((blk) => {
// cy.log(blk.text().trim())
// expect(blk.text().trim()).to.equal('Sheet1')
// })
cy.wrap(sheets[i]).contains('Sheet1').should('exist')
// for each sheet, expand to verify table names & their data types
cy.wrap(sheets[i]).find('.mdi-chevron-down').click()
cy.wait(3000).then(() => {
cy.get('.v-data-table').find('tr:visible').then((row) => {
// verification restricting to 10, as others need to be scrolled back into view
for (let j = 1; j <= 10/*row.length*/; j++) {
// column name to match input in excel
cy.wrap(row[j]).find('[placeholder="Column name"]').then((obj) => {
cy.log(obj[0].value)
expect(obj[0].value).to.equal(UrlFileExpectedData[j-1][0])
})
// datatype to match expected output
cy.wrap(row[j]).find('span.caption').then((obj) => {
cy.log(obj[0].innerText)
expect(obj[0].innerText).to.equal(UrlFileExpectedData[j-1][1])
})
}
})
})
// unwind
cy.wrap(sheets[i]).find('.mdi-chevron-down').click()
if (!isTestSuiteActive(type, xcdb)) return;
describe(`Import from excel`, () => {
before(() => {
cy.task("readSheetList", {
file: `./scripts/cypress/fixtures/${filepath}`,
}).then((rows) => {
cy.log(rows);
sheetList = rows;
});
cy.task("readXlsx", {
file: `./scripts/cypress/fixtures/${filepath}`,
sheet: "Sheet2",
}).then((rows) => {
cy.log(rows);
sheetData = rows;
});
// cy.task('readXlsx', { file: `./scripts/cypress/fixtures/${UrlFilePath}`, sheet: "Sheet1" })
// .then((rows) => {
// cy.log(rows)
// UrlSheetData = rows
// })
});
it("File Upload: Upload excel as template", () => {
mainPage.toolBarTopLeft(mainPage.HOME).click();
// click on "New Project"
cy.get(":nth-child(5) > .v-btn", { timeout: 20000 }).click();
// Subsequent form, select (+ Create) option
cy.get(".nc-create-project-from-excel", { timeout: 20000 }).click({
force: true,
});
cy.get(".nc-excel-import-input").attachFile(filepath);
cy.get(".nc-btn-use-template", { timeout: 120000 }).should("exist");
});
it("File Upload: Verify pre-load template page", () => {
cy.getActiveContentModal()
.find(".v-expansion-panel")
.then((sheets) => {
for (let i = 0; i < sheets.length; i++) {
// verify if all sheet names are correct
// cy.wrap(sheets[i]).find('.title').then((blk) => {
// cy.log(blk.text().trim())
// expect(blk.text().trim()).to.equal(sheetList[i])
// })
cy.wrap(sheets[i]).contains(sheetList[i]).should("exist");
// for each sheet, expand to verify table names & their data types
cy.wrap(sheets[i]).find(".mdi-chevron-down").click();
// wait for 4 DOM rows to become visible, corresponding to 4 column names in excel
// change to avoid static wait
cy.get(".v-data-table").find("tr:visible").should("have.length", 4);
cy.get(".v-data-table")
.find("tr:visible")
.then((row) => {
for (let j = 1; j < row.length; j++) {
// column name to match input in excel
cy.wrap(row[j])
.find('[placeholder="Column name"]')
.then((obj) => {
cy.log(obj[0].value);
expect(obj[0].value).to.equal(expectedData[j - 1][0]);
});
// datatype to match expected output
cy.wrap(row[j])
.find("span.caption")
.then((obj) => {
cy.log(obj[0].innerText);
expect(obj[0].innerText).to.equal(expectedData[j - 1][1]);
});
}
})
})
it('URL: Verify loaded data', () => {
// create rest/ gql project
cy.get('.nc-btn-use-template', { timeout: 120000 }).click()
// wait for loading to be completed
projectsPage.waitHomePageLoad()
// open sheet & validate contents
// sheetData contains data read from excel in format
// 0: { float: 1.1, number: 1, text: "abc" }
// 1: { float: 1.2, number: 0, text: "def" }
cy.openTableTab('Sheet1', 25)
let idx = 0
for (const [key, value] of Object.entries(UrlFileExpectedData)) {
if(UrlFileExpectedData[idx][1] != 'Date')
mainPage.getCell(value[0], 1).contains(UrlFileExpectedData[idx++][2][0]).should('exist')
}
cy.closeTableTab('Sheet1')
})
after(() => {
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click()
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
})
})
}
});
// unwind
cy.wrap(sheets[i]).find(".mdi-chevron-down").click();
}
});
});
it("File Upload: Verify loaded data", () => {
// create rest/ gql project
cy.get(".nc-btn-use-template", { timeout: 120000 }).click();
// if (type == 'rest') {
// cy.getActiveMenu().find('[role="menuitem"]').contains('REST').click()
// } else {
// cy.getActiveMenu().find('[role="menuitem"]').contains('GQL').click()
// }
// wait for loading to be completed
projectsPage.waitHomePageLoad();
// open sheet & validate contents
// sheetData contains data read from excel in format
// 0: { float: 1.1, number: 1, text: "abc" }
// 1: { float: 1.2, number: 0, text: "def" }
cy.openTableTab("Sheet2", 2);
for (const [key, value] of Object.entries(expectedData)) {
mainPage
.getCell(value[0], 1)
.contains(sheetData[0][value[0]])
.should("exist");
mainPage
.getCell(value[0], 2)
.contains(sheetData[1][value[0]])
.should("exist");
}
cy.closeTableTab("Sheet2");
cy.openTableTab("Sheet3", 2);
for (const [key, value] of Object.entries(expectedData)) {
mainPage
.getCell(value[0], 1)
.contains(sheetData[0][value[0]])
.should("exist");
mainPage
.getCell(value[0], 2)
.contains(sheetData[1][value[0]])
.should("exist");
}
cy.closeTableTab("Sheet3");
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click();
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke("show")
.click();
cy.contains("Submit").closest("button").click();
});
it("URL: Upload excel as template", () => {
// click on "New Project"
cy.get(":nth-child(5) > .v-btn", { timeout: 20000 }).click();
// Subsequent form, select (+ Create) option
cy.get(".nc-create-project-from-excel", { timeout: 20000 }).click({
force: true,
});
cy.getActiveModal().find(".caption").contains("URL").click();
cy.get(".nc-excel-import-tab-item")
.find('input[type="url"]')
.click()
.type(URL);
cy.get(".nc-excel-import-tab-item")
.find("button")
.contains("Load")
.click();
cy.get(".nc-btn-use-template", { timeout: 120000 }).should("exist");
});
it("URL: Verify pre-load template page", () => {
cy.getActiveContentModal()
.find(".v-expansion-panel")
.then((sheets) => {
for (let i = 0; i < sheets.length; i++) {
// verify if all sheet names are correct
// cy.wrap(sheets[i]).find('.title').then((blk) => {
// cy.log(blk.text().trim())
// expect(blk.text().trim()).to.equal('Sheet1')
// })
cy.wrap(sheets[i]).contains("Sheet1").should("exist");
// for each sheet, expand to verify table names & their data types
cy.wrap(sheets[i]).find(".mdi-chevron-down").click();
cy.wait(3000).then(() => {
cy.get(".v-data-table")
.find("tr:visible")
.then((row) => {
// verification restricting to 10, as others need to be scrolled back into view
for (let j = 1; j <= 10 /*row.length*/; j++) {
// column name to match input in excel
cy.wrap(row[j])
.find('[placeholder="Column name"]')
.then((obj) => {
cy.log(obj[0].value);
expect(obj[0].value).to.equal(
UrlFileExpectedData[j - 1][0]
);
});
// datatype to match expected output
cy.wrap(row[j])
.find("span.caption")
.then((obj) => {
cy.log(obj[0].innerText);
expect(obj[0].innerText).to.equal(
UrlFileExpectedData[j - 1][1]
);
});
}
});
});
// unwind
cy.wrap(sheets[i]).find(".mdi-chevron-down").click();
}
});
});
it("URL: Verify loaded data", () => {
// create rest/ gql project
cy.get(".nc-btn-use-template", { timeout: 120000 }).click();
// wait for loading to be completed
projectsPage.waitHomePageLoad();
// open sheet & validate contents
// sheetData contains data read from excel in format
// 0: { float: 1.1, number: 1, text: "abc" }
// 1: { float: 1.2, number: 0, text: "def" }
cy.openTableTab("Sheet1", 25);
let idx = 0;
for (const [key, value] of Object.entries(UrlFileExpectedData)) {
if (UrlFileExpectedData[idx][1] != "Date")
mainPage
.getCell(value[0], 1)
.contains(UrlFileExpectedData[idx++][2][0])
.should("exist");
}
cy.closeTableTab("Sheet1");
});
after(() => {
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click();
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke("show")
.click();
cy.contains("Submit").closest("button").click();
});
});
};
// if (typeof require !== 'undefined') XLSX = require('xlsx');
@ -313,7 +344,7 @@ export const genTest = (type, xcdb) => {
// columnA.push(worksheet[z].v);
// }
// }
// return columnA
// return columnA
// }
// const getCell = (sheet, cellIdx) => {

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

@ -1,5 +1,5 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { roles } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
import { roles } from "../../support/page_objects/projectConstants";
// Left hand navigation bar, validation for
// 1. Audit menu
@ -7,107 +7,115 @@ import { roles } from "../../support/page_objects/projectConstants"
// 3. Preview mode menu
//
export function _advSettings(roleType, previewMode) {
let validationString = (true == roles[roleType].validations.advSettings) ? 'exist' : 'not.exist'
// audit/advance settings menu visible only for owner/ creator
mainPage.navigationDraw(mainPage.AUDIT).should(validationString)
mainPage.navigationDraw(mainPage.APPSTORE).should(validationString)
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString)
mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString)
// option to add new user conditionally visible only to owner/ creator
cy.get('button:contains("New User")').should(validationString)
if (true == previewMode) {
// preview mode, role toggle menubar is visible
mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should('exist')
mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should('exist')
mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should('exist')
mainPage.navigationDraw(mainPage.ROLE_VIEW_RESET).should('exist')
} else {
// normal mode, role toggle menubar is visible only for owner/ creator
mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should(validationString)
mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should(validationString)
mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should(validationString)
}
let validationString =
true == roles[roleType].validations.advSettings ? "exist" : "not.exist";
// audit/advance settings menu visible only for owner/ creator
mainPage.navigationDraw(mainPage.AUDIT).should(validationString);
mainPage.navigationDraw(mainPage.APPSTORE).should(validationString);
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString);
mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString);
// option to add new user conditionally visible only to owner/ creator
cy.get('button:contains("New User")').should(validationString);
if (true == previewMode) {
// preview mode, role toggle menubar is visible
mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should("exist");
mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should("exist");
mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should("exist");
mainPage.navigationDraw(mainPage.ROLE_VIEW_RESET).should("exist");
} else {
// normal mode, role toggle menubar is visible only for owner/ creator
mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should(validationString);
mainPage
.navigationDraw(mainPage.ROLE_VIEW_COMMENTER)
.should(validationString);
mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should(validationString);
}
}
export function _editSchema(roleType, previewMode) {
let columnName = 'City'
let validationString = (true == roles[roleType].validations.editSchema) ? 'exist' : 'not.exist'
if (false == previewMode) {
cy.openTableTab(columnName, 25)
}
// create table options
//
cy.get('.add-btn').should(validationString)
cy.get('.v-tabs-bar').eq(0).find('button.mdi-plus-box').should(validationString)
// delete table option
//
cy.get('.nc-table-delete-btn').should(validationString)
// add new column option
//
cy.get('.new-column-header').should(validationString)
// update column (edit/ delete menu)
//
cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(validationString)
let columnName = "City";
let validationString =
true == roles[roleType].validations.editSchema ? "exist" : "not.exist";
if (false == previewMode) {
cy.openTableTab(columnName, 25);
}
// create table options
//
cy.get(".add-btn").should(validationString);
cy.get(".v-tabs-bar")
.eq(0)
.find("button.mdi-plus-box")
.should(validationString);
// delete table option
//
cy.get(".nc-table-delete-btn").should(validationString);
// add new column option
//
cy.get(".new-column-header").should(validationString);
// update column (edit/ delete menu)
//
cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(validationString);
}
export function _editData(roleType, previewMode) {
let columnName = "City";
let validationString =
true == roles[roleType].validations.editData ? "exist" : "not.exist";
let columnName = 'City'
let validationString = (true == roles[roleType].validations.editData) ? 'exist' : 'not.exist'
cy.openTableTab(columnName, 25);
cy.openTableTab(columnName, 25)
// add new row option (from menu header)
//
cy.get(".nc-add-new-row-btn").should(validationString);
// add new row option (from menu header)
//
cy.get('.nc-add-new-row-btn').should(validationString)
// update row option (right click)
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick();
cy.get(".menuable__content__active").should(validationString);
// update row option (right click)
if (validationString == "exist") {
// right click options will exist (only for 'exist' case)
//
cy.getActiveMenu().contains("Insert New Row").should(validationString);
cy.getActiveMenu().contains("Delete Row").should(validationString);
cy.getActiveMenu()
.contains("Delete Selected Rows")
.should(validationString);
cy.get("body").type("{esc}");
// update cell contents option using row expander should be enabled
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick()
cy.get('.menuable__content__active').should(validationString)
if (validationString == 'exist') {
// right click options will exist (only for 'exist' case)
//
cy.getActiveMenu().contains('Insert New Row').should(validationString)
cy.getActiveMenu().contains('Delete Row').should(validationString)
cy.getActiveMenu().contains('Delete Selected Rows').should(validationString)
cy.get('body').type('{esc}')
// update cell contents option using row expander should be enabled
//
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get('.v-input.row-checkbox').eq(4).next().next().click({ force: true })
cy.getActiveModal().find('button').contains('Save Row').should('exist')
cy.get('body').type('{esc}')
}
else {
// update cell contents option using row expander should be disabled
//
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get('.v-input.row-checkbox').eq(4).next().next().click({ force: true })
cy.getActiveModal().find('button:disabled').contains('Save Row').should('exist')
cy.getActiveModal().find('button').contains('Cancel').click()
cy.get('body').type('{esc}')
}
// double click cell entries to edit
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true });
cy.getActiveModal().find("button").contains("Save Row").should("exist");
cy.get("body").type("{esc}");
} else {
// update cell contents option using row expander should be disabled
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).dblclick().find('input').should(validationString)
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true });
cy.getActiveModal()
.find("button:disabled")
.contains("Save Row")
.should("exist");
cy.getActiveModal().find("button").contains("Cancel").click();
cy.get("body").type("{esc}");
}
// double click cell entries to edit
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`)
.dblclick()
.find("input")
.should(validationString);
}
// read &/ update comment
@ -115,81 +123,95 @@ export function _editData(roleType, previewMode) {
// Everyone else: read &/ update
//
export function _editComment(roleType, previewMode) {
let columnName = 'City'
let validationString = (true == roles[roleType].validations.editComment) ? 'Comment added successfully' : 'Not allowed'
cy.openTableTab(columnName, 25)
// click on comment icon & type comment
//
cy.get('.v-input.row-checkbox').eq(4).next().next().click({ force: true })
// Expected response:
// Viewer: Not able to see comment option
// Everyone else: Comment added/read successfully
//
if ('viewer' == roleType) {
cy.getActiveModal().find('.mdi-comment-multiple-outline').should('not.exist')
}
else {
cy.getActiveModal().find('.mdi-comment-multiple-outline').should('exist').click()
cy.getActiveModal().find('.comment-box').type('Comment-1{enter}')
// cy.toastWait('Comment added successfully')
cy.getActiveModal().find('.mdi-door-open').click()
cy.get('body').contains(validationString, { timeout: 2000 }).should('exist')
}
cy.getActiveModal().find('button').contains('Cancel').should('exist').click()
cy.get('body').type('{esc}')
let columnName = "City";
let validationString =
true == roles[roleType].validations.editComment
? "Comment added successfully"
: "Not allowed";
cy.openTableTab(columnName, 25);
// click on comment icon & type comment
//
cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true });
// Expected response:
// Viewer: Not able to see comment option
// Everyone else: Comment added/read successfully
//
if ("viewer" == roleType) {
cy.getActiveModal()
.find(".mdi-comment-multiple-outline")
.should("not.exist");
} else {
cy.getActiveModal()
.find(".mdi-comment-multiple-outline")
.should("exist")
.click();
cy.getActiveModal().find(".comment-box").type("Comment-1{enter}");
// cy.toastWait('Comment added successfully')
cy.getActiveModal().find(".mdi-door-open").click();
cy.get("body")
.contains(validationString, { timeout: 2000 })
.should("exist");
}
cy.getActiveModal().find("button").contains("Cancel").should("exist").click();
cy.get("body").type("{esc}");
}
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
export function _viewMenu(roleType, previewMode) {
let columnName = "City";
let navDrawListCnt = 2;
let columnName = 'City'
let navDrawListCnt = 2
cy.openTableTab(columnName, 25);
cy.openTableTab(columnName, 25)
let validationString = (true == roles[roleType].validations.shareView) ? 'exist' : 'not.exist'
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
// validate if Share button is visible at header tool bar
cy.get('header.v-toolbar').eq(0).find('button:contains("Share")').should(validationString)
// validate if Share button is visible at header tool bar
cy.get("header.v-toolbar")
.eq(0)
.find('button:contains("Share")')
.should(validationString);
// Owner, Creator will have two navigation drawer (on each side of center panel)
if (roleType == 'owner' || roleType == 'creator') {
navDrawListCnt = 4
}
// Owner, Creator will have two navigation drawer (on each side of center panel)
if (roleType == "owner" || roleType == "creator") {
navDrawListCnt = 4;
}
cy.get('.v-navigation-drawer__content').eq(1).find('[role="list"]').should('have.length', navDrawListCnt)
cy.get(".v-navigation-drawer__content")
.eq(1)
.find('[role="list"]')
.should("have.length", navDrawListCnt);
// view list field (default GRID view)
cy.get(`.nc-view-item`).should('exist')
// view list field (default GRID view)
cy.get(`.nc-view-item`).should("exist");
// view create option, exists only for owner/ creator
cy.get(`.nc-create-gallery-view`).should(validationString)
cy.get(`.nc-create-grid-view`).should(validationString)
cy.get(`.nc-create-form-view`).should(validationString)
// view create option, exists only for owner/ creator
cy.get(`.nc-create-gallery-view`).should(validationString);
cy.get(`.nc-create-grid-view`).should(validationString);
cy.get(`.nc-create-form-view`).should(validationString);
// share view & automations, exists only for owner/creator
cy.get(`.nc-share-view`).should(validationString)
cy.get(`.nc-automations`).should(validationString)
// share view & automations, exists only for owner/creator
cy.get(`.nc-share-view`).should(validationString);
cy.get(`.nc-automations`).should(validationString);
}
export function _topRightMenu(roleType, previewMode) {
let validationString = (true == roles[roleType].validations.shareView) ? 'exist' : 'not.exist'
cy.get('.nc-topright-menu').find('.nc-menu-share').should(validationString)
cy.get('.nc-topright-menu').find('.nc-menu-theme').should('exist')
cy.get('.nc-topright-menu').find('.nc-menu-dark-theme').should('exist')
cy.get('.nc-topright-menu').find('.nc-menu-translate').should('exist')
cy.get('.nc-topright-menu').find('.nc-menu-account').should('exist')
cy.get('.nc-topright-menu').find('.nc-menu-alert').should('exist')
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
cy.get(".nc-topright-menu").find(".nc-menu-share").should(validationString);
cy.get(".nc-topright-menu").find(".nc-menu-theme").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-dark-theme").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-translate").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-account").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-alert").should("exist");
}

35
scripts/cypress/integration/test/explicitLogin.js

@ -1,26 +1,25 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (type, xcdb) => {
if (!isTestSuiteActive(type, xcdb)) return;
if (!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Login & Open project`, () => {
describe(`${type.toUpperCase()} api - Login & Open project`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type);
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// open a table to work on views
//
// cy.openTableTab('City');
});
// open a table to work on views
//
// cy.openTableTab('City');
})
it(``, () => {
cy.log('Test-1')
})
})
}
it(``, () => {
cy.log("Test-1");
});
});
};
// genTest('rest', false)

56
scripts/cypress/integration/test/gqlMisc.js

@ -1,35 +1,33 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t6b = require('../common/6b_downloadCsv')
let t6c = require('../common/6c_swagger_api')
let t6d = require('../common/6d_language_validation')
let t6e = require('../common/6e_project_operations')
let t6f = require('../common/6f_attachments')
let t6g = require('../common/6g_base_share')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t6b = require("../common/6b_downloadCsv");
let t6c = require("../common/6c_swagger_api");
let t6d = require("../common/6d_language_validation");
let t6e = require("../common/6e_project_operations");
let t6f = require("../common/6f_attachments");
let t6g = require("../common/6g_base_share");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t6b.genTest(type, xcdb)
t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb)
t6f.genTest(type, xcdb)
t6g.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
}
nocoTestSuite('graphql', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t6b.genTest(type, xcdb);
t6c.genTest(type, xcdb);
t6d.genTest(type, xcdb);
t6f.genTest(type, xcdb);
t6g.genTest(type, xcdb);
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb);
};
nocoTestSuite("graphql", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -52,7 +50,3 @@ nocoTestSuite('graphql', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

34
scripts/cypress/integration/test/gqlRoles.js

@ -1,26 +1,24 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t5a = require('../common/5a_user_role')
let t5b = require('../common/5b_preview_role')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t5a = require("../common/5a_user_role");
let t5b = require("../common/5b_preview_role");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t5a.genTest(type, xcdb)
t5b.genTest(type, xcdb)
}
t5a.genTest(type, xcdb);
t5b.genTest(type, xcdb);
};
nocoTestSuite('graphql', false)
nocoTestSuite("graphql", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -43,7 +41,3 @@ nocoTestSuite('graphql', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

62
scripts/cypress/integration/test/gqlTableOps.js

@ -1,38 +1,36 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations')
let t2a = require('../common/2a_table_with_belongs_to_colulmn')
let t2b = require('../common/2b_table_with_m2m_column')
let t3a = require('../common/3a_filter_sort_fields_operations')
let t3b = require('../common/3b_formula_column')
let t3c = require('../common/3c_lookup_column')
let t3d = require('../common/3d_rollup_column')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t1a = require("../common/1a_table_operations");
let t1b = require("../common/1b_table_column_operations");
let t2a = require("../common/2a_table_with_belongs_to_colulmn");
let t2b = require("../common/2b_table_with_m2m_column");
let t3a = require("../common/3a_filter_sort_fields_operations");
let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)
t3b.genTest(type, xcdb)
t3c.genTest(type, xcdb)
t3d.genTest(type, xcdb)
}
nocoTestSuite('graphql', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t1a.genTest(type, xcdb);
t1b.genTest(type, xcdb);
t2a.genTest(type, xcdb);
t2b.genTest(type, xcdb);
t3a.genTest(type, xcdb);
t3b.genTest(type, xcdb);
t3c.genTest(type, xcdb);
t3d.genTest(type, xcdb);
};
nocoTestSuite("graphql", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -55,7 +53,3 @@ nocoTestSuite('graphql', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

54
scripts/cypress/integration/test/gqlViews.js

@ -1,34 +1,32 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t4a = require('../common/4a_table_view_grid_gallery_form')
let t4b = require('../common/4b_table_view_share')
let t4c = require('../common/4c_form_view_detailed')
let t4d = require('../common/4d_table_view_grid_locked')
let t4e = require('../common/4e_form_view_share')
let t4f = require('../common/4f_grid_view_share')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t4a = require("../common/4a_table_view_grid_gallery_form");
let t4b = require("../common/4b_table_view_share");
let t4c = require("../common/4c_form_view_detailed");
let t4d = require("../common/4d_table_view_grid_locked");
let t4e = require("../common/4e_form_view_share");
let t4f = require("../common/4f_grid_view_share");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t4a.genTest(type, xcdb)
t4b.genTest(type, xcdb)
t4c.genTest(type, xcdb)
t4d.genTest(type, xcdb)
t4e.genTest(type, xcdb)
t4f.genTest(type, xcdb)
}
nocoTestSuite('graphql', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t4a.genTest(type, xcdb);
t4b.genTest(type, xcdb);
t4c.genTest(type, xcdb);
t4d.genTest(type, xcdb);
t4e.genTest(type, xcdb);
t4f.genTest(type, xcdb);
};
nocoTestSuite("graphql", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -51,7 +49,3 @@ nocoTestSuite('graphql', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

110
scripts/cypress/integration/test/masterSuiteGql.js

@ -1,66 +1,64 @@
let t0 = require('./explicitLogin')
let t00 = require('../common/00_pre_configurations')
let t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations')
let t1c = require('../common/1c_table_row_operations')
let t2a = require('../common/2a_table_with_belongs_to_colulmn')
let t2b = require('../common/2b_table_with_m2m_column')
let t3a = require('../common/3a_filter_sort_fields_operations')
let t3b = require('../common/3b_formula_column')
let t3c = require('../common/3c_lookup_column')
let t3d = require('../common/3d_rollup_column')
let t4a = require('../common/4a_table_view_grid_gallery_form')
let t4b = require('../common/4b_table_view_share')
let t4c = require('../common/4c_form_view_detailed')
let t4d = require('../common/4d_table_view_grid_locked')
let t4e = require('../common/4e_form_view_share')
let t4f = require('../common/4f_grid_view_share')
let t5a = require('../common/5a_user_role')
let t5b = require('../common/5b_preview_role')
let t0 = require("./explicitLogin");
let t00 = require("../common/00_pre_configurations");
let t1a = require("../common/1a_table_operations");
let t1b = require("../common/1b_table_column_operations");
let t1c = require("../common/1c_table_row_operations");
let t2a = require("../common/2a_table_with_belongs_to_colulmn");
let t2b = require("../common/2b_table_with_m2m_column");
let t3a = require("../common/3a_filter_sort_fields_operations");
let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
let t4a = require("../common/4a_table_view_grid_gallery_form");
let t4b = require("../common/4b_table_view_share");
let t4c = require("../common/4c_form_view_detailed");
let t4d = require("../common/4d_table_view_grid_locked");
let t4e = require("../common/4e_form_view_share");
let t4f = require("../common/4f_grid_view_share");
let t5a = require("../common/5a_user_role");
let t5b = require("../common/5b_preview_role");
// merged with t1a: let t6a = require('../common/6a_audit')
let t6c = require('../common/6c_swagger_api')
let t6d = require('../common/6d_language_validation')
let t6e = require('../common/6e_project_operations')
let t6c = require("../common/6c_swagger_api");
let t6d = require("../common/6d_language_validation");
let t6e = require("../common/6e_project_operations");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t00.genTest(type, xcdb);
}
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t00.genTest(type, xcdb)
}
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
// merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)
t3b.genTest(type, xcdb)
t3c.genTest(type, xcdb)
t3d.genTest(type, xcdb)
t4a.genTest(type, xcdb)
t4b.genTest(type, xcdb)
t4c.genTest(type, xcdb)
t4d.genTest(type, xcdb)
t4e.genTest(type, xcdb)
t4f.genTest(type, xcdb)
t5a.genTest(type, xcdb)
t5b.genTest(type, xcdb)
// merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
}
t1a.genTest(type, xcdb);
t1b.genTest(type, xcdb);
// merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb);
t2b.genTest(type, xcdb);
t3a.genTest(type, xcdb);
t3b.genTest(type, xcdb);
t3c.genTest(type, xcdb);
t3d.genTest(type, xcdb);
t4a.genTest(type, xcdb);
t4b.genTest(type, xcdb);
t4c.genTest(type, xcdb);
t4d.genTest(type, xcdb);
t4e.genTest(type, xcdb);
t4f.genTest(type, xcdb);
t5a.genTest(type, xcdb);
t5b.genTest(type, xcdb);
// merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb);
t6d.genTest(type, xcdb);
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb);
};
// nocoTestSuite('rest', false)
nocoTestSuite('graphql', false)
nocoTestSuite("graphql", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -83,7 +81,3 @@ nocoTestSuite('graphql', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

110
scripts/cypress/integration/test/masterSuiteRest.js

@ -1,65 +1,63 @@
let t0 = require('./explicitLogin')
let t00 = require('../common/00_pre_configurations')
let t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations')
let t1c = require('../common/1c_table_row_operations')
let t2a = require('../common/2a_table_with_belongs_to_colulmn')
let t2b = require('../common/2b_table_with_m2m_column')
let t3a = require('../common/3a_filter_sort_fields_operations')
let t3b = require('../common/3b_formula_column')
let t3c = require('../common/3c_lookup_column')
let t3d = require('../common/3d_rollup_column')
let t4a = require('../common/4a_table_view_grid_gallery_form')
let t4b = require('../common/4b_table_view_share')
let t4c = require('../common/4c_form_view_detailed')
let t4d = require('../common/4d_table_view_grid_locked')
let t4e = require('../common/4e_form_view_share')
let t4f = require('../common/4f_grid_view_share')
let t5a = require('../common/5a_user_role')
let t5b = require('../common/5b_preview_role')
let t0 = require("./explicitLogin");
let t00 = require("../common/00_pre_configurations");
let t1a = require("../common/1a_table_operations");
let t1b = require("../common/1b_table_column_operations");
let t1c = require("../common/1c_table_row_operations");
let t2a = require("../common/2a_table_with_belongs_to_colulmn");
let t2b = require("../common/2b_table_with_m2m_column");
let t3a = require("../common/3a_filter_sort_fields_operations");
let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
let t4a = require("../common/4a_table_view_grid_gallery_form");
let t4b = require("../common/4b_table_view_share");
let t4c = require("../common/4c_form_view_detailed");
let t4d = require("../common/4d_table_view_grid_locked");
let t4e = require("../common/4e_form_view_share");
let t4f = require("../common/4f_grid_view_share");
let t5a = require("../common/5a_user_role");
let t5b = require("../common/5b_preview_role");
// merged with t1a: let t6a = require('../common/6a_audit')
let t6c = require('../common/6c_swagger_api')
let t6d = require('../common/6d_language_validation')
let t6e = require('../common/6e_project_operations')
let t6c = require("../common/6c_swagger_api");
let t6d = require("../common/6d_language_validation");
let t6e = require("../common/6e_project_operations");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t00.genTest(type, xcdb);
}
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t00.genTest(type, xcdb)
}
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
// merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)
t3b.genTest(type, xcdb)
t3c.genTest(type, xcdb)
t3d.genTest(type, xcdb)
t4a.genTest(type, xcdb)
t4b.genTest(type, xcdb)
t4c.genTest(type, xcdb)
t4d.genTest(type, xcdb)
t4e.genTest(type, xcdb)
t4f.genTest(type, xcdb)
t5a.genTest(type, xcdb)
t5b.genTest(type, xcdb)
// merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
}
t1a.genTest(type, xcdb);
t1b.genTest(type, xcdb);
// merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb);
t2b.genTest(type, xcdb);
t3a.genTest(type, xcdb);
t3b.genTest(type, xcdb);
t3c.genTest(type, xcdb);
t3d.genTest(type, xcdb);
t4a.genTest(type, xcdb);
t4b.genTest(type, xcdb);
t4c.genTest(type, xcdb);
t4d.genTest(type, xcdb);
t4e.genTest(type, xcdb);
t4f.genTest(type, xcdb);
t5a.genTest(type, xcdb);
t5b.genTest(type, xcdb);
// merged with t1a: t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb);
t6d.genTest(type, xcdb);
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb);
};
nocoTestSuite('rest', false)
nocoTestSuite("rest", false);
// nocoTestSuite('graphql', false)
/**
@ -83,7 +81,3 @@ nocoTestSuite('rest', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

66
scripts/cypress/integration/test/restMisc.js

@ -1,40 +1,38 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t6b = require('../common/6b_downloadCsv')
let t6c = require('../common/6c_swagger_api')
let t6d = require('../common/6d_language_validation')
let t6e = require('../common/6e_project_operations')
let t6f = require('../common/6f_attachments')
let t6g = require('../common/6g_base_share')
let t7a = require('../common/7a_create_project_from_excel')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t6b = require("../common/6b_downloadCsv");
let t6c = require("../common/6c_swagger_api");
let t6d = require("../common/6d_language_validation");
let t6e = require("../common/6e_project_operations");
let t6f = require("../common/6f_attachments");
let t6g = require("../common/6g_base_share");
let t7a = require("../common/7a_create_project_from_excel");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t6b.genTest(type, xcdb)
t6d.genTest(type, xcdb)
t6c.genTest(type, xcdb)
t6f.genTest(type, xcdb)
t6g.genTest(type, xcdb)
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb)
// intended to keep this after earlier project deletion
// creates project using excel & deletes it
t7a.genTest(type, xcdb)
}
nocoTestSuite('rest', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t6b.genTest(type, xcdb);
t6d.genTest(type, xcdb);
t6c.genTest(type, xcdb);
t6f.genTest(type, xcdb);
t6g.genTest(type, xcdb);
// **deletes created project, hence place it @ end
t6e.genTest(type, xcdb);
// intended to keep this after earlier project deletion
// creates project using excel & deletes it
t7a.genTest(type, xcdb);
};
nocoTestSuite("rest", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -57,7 +55,3 @@ nocoTestSuite('rest', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

34
scripts/cypress/integration/test/restRoles.js

@ -1,26 +1,24 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t5a = require('../common/5a_user_role')
let t5b = require('../common/5b_preview_role')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t5a = require("../common/5a_user_role");
let t5b = require("../common/5b_preview_role");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t5a.genTest(type, xcdb)
t5b.genTest(type, xcdb)
}
t5a.genTest(type, xcdb);
t5b.genTest(type, xcdb);
};
nocoTestSuite('rest', false)
nocoTestSuite("rest", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -43,7 +41,3 @@ nocoTestSuite('rest', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

62
scripts/cypress/integration/test/restTableOps.js

@ -1,38 +1,36 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations')
let t2a = require('../common/2a_table_with_belongs_to_colulmn')
let t2b = require('../common/2b_table_with_m2m_column')
let t3a = require('../common/3a_filter_sort_fields_operations')
let t3b = require('../common/3b_formula_column')
let t3c = require('../common/3c_lookup_column')
let t3d = require('../common/3d_rollup_column')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t1a = require("../common/1a_table_operations");
let t1b = require("../common/1b_table_column_operations");
let t2a = require("../common/2a_table_with_belongs_to_colulmn");
let t2b = require("../common/2b_table_with_m2m_column");
let t3a = require("../common/3a_filter_sort_fields_operations");
let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)
t3b.genTest(type, xcdb)
t3c.genTest(type, xcdb)
t3d.genTest(type, xcdb)
}
nocoTestSuite('rest', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t1a.genTest(type, xcdb);
t1b.genTest(type, xcdb);
t2a.genTest(type, xcdb);
t2b.genTest(type, xcdb);
t3a.genTest(type, xcdb);
t3b.genTest(type, xcdb);
t3c.genTest(type, xcdb);
t3d.genTest(type, xcdb);
};
nocoTestSuite("rest", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -55,7 +53,3 @@ nocoTestSuite('rest', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

54
scripts/cypress/integration/test/restViews.js

@ -1,34 +1,32 @@
let t0 = require('./explicitLogin')
let t01 = require('../common/00_pre_configurations')
let t4a = require('../common/4a_table_view_grid_gallery_form')
let t4b = require('../common/4b_table_view_share')
let t4c = require('../common/4c_form_view_detailed')
let t4d = require('../common/4d_table_view_grid_locked')
let t4e = require('../common/4e_form_view_share')
let t4f = require('../common/4f_grid_view_share')
let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t4a = require("../common/4a_table_view_grid_gallery_form");
let t4b = require("../common/4b_table_view_share");
let t4c = require("../common/4c_form_view_detailed");
let t4d = require("../common/4d_table_view_grid_locked");
let t4e = require("../common/4e_form_view_share");
let t4f = require("../common/4f_grid_view_share");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const executionMode = 1
const executionMode = 1;
const nocoTestSuite = (type, xcdb) => {
if (0 == executionMode) {
t0.genTest(type, xcdb)
} else {
t01.genTest(type, xcdb)
}
t4a.genTest(type, xcdb)
t4b.genTest(type, xcdb)
t4c.genTest(type, xcdb)
t4d.genTest(type, xcdb)
t4e.genTest(type, xcdb)
t4f.genTest(type, xcdb)
}
nocoTestSuite('rest', false)
if (0 == executionMode) {
t0.genTest(type, xcdb);
} else {
t01.genTest(type, xcdb);
}
t4a.genTest(type, xcdb);
t4b.genTest(type, xcdb);
t4c.genTest(type, xcdb);
t4d.genTest(type, xcdb);
t4e.genTest(type, xcdb);
t4f.genTest(type, xcdb);
};
nocoTestSuite("rest", false);
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
@ -51,7 +49,3 @@ nocoTestSuite('rest', false)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

35
scripts/cypress/plugins/index.js

@ -11,10 +11,10 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const { rmdir } = require('fs')
const { rmdir } = require("fs");
// https://stackoverflow.com/questions/61934443/read-excel-files-in-cypress
const readXlsx = require('./read-xlsx')
const readXlsx = require("./read-xlsx");
/**
* @type {Cypress.PluginConfig}
@ -25,28 +25,27 @@ module.exports = (on, config) => {
// `config` is the resolved Cypress config
// register utility tasks to read and parse Excel files
on('task', {
deleteFolder (folderName) {
console.log('deleting folder %s', folderName)
on("task", {
deleteFolder(folderName) {
console.log("deleting folder %s", folderName);
return new Promise((resolve, reject) => {
rmdir(folderName, { maxRetries: 10, recursive: true }, (err) => {
if (err) {
console.error(err)
console.error(err);
return reject(err)
return reject(err);
}
resolve(null)
})
})
resolve(null);
});
});
},
'readXlsx': readXlsx.read,
'readSheetList': readXlsx.sheetList,
readXlsx: readXlsx.read,
readSheetList: readXlsx.sheetList,
log(message) {
console.log(message)
return null
}
})
}
console.log(message);
return null;
},
});
};

34
scripts/cypress/plugins/read-xlsx.js

@ -1,14 +1,14 @@
// https://stackoverflow.com/questions/61934443/read-excel-files-in-cypress
const fs = require('fs');
const XLSX = require('xlsx');
const fs = require("fs");
const XLSX = require("xlsx");
const read = ({file, sheet}) => {
const buf = fs.readFileSync(file);
const workbook = XLSX.read(buf, { type: 'buffer' });
const rows = XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
return rows
}
const read = ({ file, sheet }) => {
const buf = fs.readFileSync(file);
const workbook = XLSX.read(buf, { type: "buffer" });
const rows = XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
return rows;
};
// const read = ({file, sheet}) => {
// const buf = fs.readFileSync(file);
@ -20,14 +20,14 @@ const read = ({file, sheet}) => {
// return rows
// }
const sheetList = ({file}) => {
const buf = fs.readFileSync(file);
const workbook = XLSX.read(buf, { type: 'buffer' });
const rows = workbook.SheetNames
return rows
}
const sheetList = ({ file }) => {
const buf = fs.readFileSync(file);
const workbook = XLSX.read(buf, { type: "buffer" });
const rows = workbook.SheetNames;
return rows;
};
module.exports = {
read,
sheetList,
}
read,
sheetList,
};

341
scripts/cypress/support/commands.js

@ -24,259 +24,272 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
import 'cypress-file-upload';
import "cypress-file-upload";
require('@4tw/cypress-drag-drop')
require("@4tw/cypress-drag-drop");
// for waiting until page load
Cypress.Commands.add('waitForSpinners', () => {
cy.visit('http://localhost:3000', {
Cypress.Commands.add("waitForSpinners", () => {
cy.visit("http://localhost:3000", {
retryOnNetworkFailure: true,
timeout: 1200000,
headers: {
"Accept-Encoding": "gzip, deflate"
}
})
cy.get('#nuxt-loading', {timeout: 10_0000}).should('have.length', 0)
})
"Accept-Encoding": "gzip, deflate",
},
});
cy.get("#nuxt-loading", { timeout: 10_0000 }).should("have.length", 0);
});
Cypress.Commands.add('signinOrSignup', (_args) => {
const args = Object.assign({username: 'user@nocodb.com', password: 'Password123.'}, _args)
Cypress.Commands.add("signinOrSignup", (_args) => {
const args = Object.assign(
{ username: "user@nocodb.com", password: "Password123." },
_args
);
// signin/signup
cy.get('body').then(($body) => {
cy.get("body").then(($body) => {
// cy.wait(1000)
cy.url().then(url => {
if (!url.includes('/projects')) {
cy.url().then((url) => {
if (!url.includes("/projects")) {
// handle initial load
if ($body.find('.welcome-page').length > 0) {
if ($body.find(".welcome-page").length > 0) {
cy.wait(8000);
cy.get('body').trigger('mousemove');
cy.contains('Let\'s Begin').click();
cy.get("body").trigger("mousemove");
cy.contains("Let's Begin").click();
cy.get('input[type="text"]', { timeout: 12000 }).type(args.username);
cy.get('input[type="password"]').type(args.password);
cy.get('button:contains("SIGN UP")').click()
cy.get('button:contains("SIGN UP")').click();
// handle signin
} else {
cy.get('input[type="text"]', { timeout: 12000 }).type(args.username);
cy.get('input[type="password"]').type(args.password);
cy.get('button:contains("SIGN IN")').click()
cy.get('button:contains("SIGN IN")').click();
}
}
})
})
});
});
// indicates page-load complete
cy.get('.nc-noco-brand-icon', { timeout: 12000 }).should('exist')
cy.get(".nc-noco-brand-icon", { timeout: 12000 }).should("exist");
});
// for opening/creating a rest project
Cypress.Commands.add('openOrCreateRestProject', (_args) => {
const args = Object.assign({new: false}, _args)
// signin/signup
cy.signinOrSignup()
cy.get('.nc-new-project-menu').should('exist')
cy.get('body').then($body => {
const filter = args.meta ? '.nc-meta-project-row' : ':not(.nc-meta-project-row)';
// if project exist open
if ($body.find('.nc-rest-project-row').filter(filter).length && !args.new) {
cy.get('.nc-rest-project-row').filter(filter).first().click()
Cypress.Commands.add("openOrCreateRestProject", (_args) => {
const args = Object.assign({ new: false }, _args);
// signin/signup
cy.signinOrSignup();
cy.get(".nc-new-project-menu").should("exist");
cy.get("body").then(($body) => {
const filter = args.meta
? ".nc-meta-project-row"
: ":not(.nc-meta-project-row)";
// if project exist open
if ($body.find(".nc-rest-project-row").filter(filter).length && !args.new) {
cy.get(".nc-rest-project-row").filter(filter).first().click();
} else {
cy.contains("New Project").trigger("onmouseover").trigger("mouseenter");
if (args.meta) {
cy.get(".nc-create-xc-db-project").click();
cy.url({ timeout: 6000 }).should("contain", "#/project/xcdb");
cy.get(".nc-metadb-project-name").type("test_proj" + Date.now());
cy.contains("button", "Create", { timeout: 3000 }).click();
} else {
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
if (args.meta) {
cy.get('.nc-create-xc-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project/xcdb')
cy.get('.nc-metadb-project-name').type('test_proj' + Date.now())
cy.contains('button','Create', {timeout: 3000}).click()
} else {
cy.get('.nc-create-external-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project')
cy.get('.database-field input').click().clear().type('sakila')
cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click()
}
cy.get(".nc-create-external-db-project").click();
cy.url({ timeout: 6000 }).should("contain", "#/project");
cy.get(".database-field input").click().clear().type("sakila");
cy.contains("Test Database Connection").click();
cy.contains("Ok & Save Project", { timeout: 3000 }).click();
}
})
cy.url({timeout: 20000}).should('contain', '#/nc/')
}
)
}
});
cy.url({ timeout: 20000 }).should("contain", "#/nc/");
});
// tn: table name
// rc: row count. validate row count if rc!=0
Cypress.Commands.add('openTableTab', (tn, rc) => {
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.should('exist')
.first().click()
Cypress.Commands.add("openTableTab", (tn, rc) => {
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.should("exist")
.first()
.click();
cy.get('.nc-project-tree')
cy.get(".nc-project-tree")
.contains(tn, { timeout: 6000 })
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${tn}):visible`)
.should('exist')
cy.get(`.project-tab:contains(${tn}):visible`).should("exist");
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click();
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.first().click()
// wait for page rendering to complete
if (rc != 0) {
cy.get('.nc-grid-row').should('have.length', rc)
cy.get(".nc-grid-row").should("have.length", rc);
}
})
});
Cypress.Commands.add('closeTableTab', (tn) => {
cy.get(`[href="#table||db||${tn}"]`).find('button.mdi-close').click()
})
Cypress.Commands.add("closeTableTab", (tn) => {
cy.get(`[href="#table||db||${tn}"]`).find("button.mdi-close").click();
});
Cypress.Commands.add('openOrCreateGqlProject', (_args) => {
const args = Object.assign({new: false, meta: false}, _args)
Cypress.Commands.add("openOrCreateGqlProject", (_args) => {
const args = Object.assign({ new: false, meta: false }, _args);
cy.signinOrSignup()
cy.signinOrSignup();
cy.get('.nc-new-project-menu').should('exist')
cy.get('body').then($body => {
const filter = args.meta ? '.nc-meta-project-row' : ':not(.nc-meta-project-row)';
cy.get(".nc-new-project-menu").should("exist");
cy.get("body").then(($body) => {
const filter = args.meta
? ".nc-meta-project-row"
: ":not(.nc-meta-project-row)";
// if project exist open
if ($body.find('.nc-graphql-project-row').filter(filter).length && !args.new) {
cy.get('.nc-graphql-project-row').filter(filter).first().click()
if (
$body.find(".nc-graphql-project-row").filter(filter).length &&
!args.new
) {
cy.get(".nc-graphql-project-row").filter(filter).first().click();
} else {
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.contains("New Project").trigger("onmouseover").trigger("mouseenter");
if (args.meta) {
cy.get('.nc-create-xc-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project/xcdb')
cy.contains('GRAPHQL APIs').closest('label').click();
cy.get('.nc-metadb-project-name').type('test_proj' + Date.now())
cy.contains('button','Create', {timeout: 3000}).click()
cy.get(".nc-create-xc-db-project").click();
cy.url({ timeout: 6000 }).should("contain", "#/project/xcdb");
cy.contains("GRAPHQL APIs").closest("label").click();
cy.get(".nc-metadb-project-name").type("test_proj" + Date.now());
cy.contains("button", "Create", { timeout: 3000 }).click();
} else {
cy.get('.nc-create-external-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project')
cy.contains('GRAPHQL APIs').closest('label').click()
cy.get('.database-field input').click().clear().type('sakila')
cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click()
cy.get(".nc-create-external-db-project").click();
cy.url({ timeout: 6000 }).should("contain", "#/project");
cy.contains("GRAPHQL APIs").closest("label").click();
cy.get(".database-field input").click().clear().type("sakila");
cy.contains("Test Database Connection").click();
cy.contains("Ok & Save Project", { timeout: 3000 }).click();
}
}
})
cy.url({timeout: 20000}).should('contain', '#/nc/')
})
});
cy.url({ timeout: 20000 }).should("contain", "#/nc/");
});
let LOCAL_STORAGE_MEMORY = {};
Cypress.Commands.add("saveLocalStorage", () => {
Object.keys(localStorage).forEach(key => {
Object.keys(localStorage).forEach((key) => {
LOCAL_STORAGE_MEMORY[key] = localStorage[key];
});
});
Cypress.Commands.add("restoreLocalStorage", () => {
Object.keys(LOCAL_STORAGE_MEMORY).forEach(key => {
Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
});
});
Cypress.Commands.add("getActiveModal", () => {
return cy.get('.v-dialog.v-dialog--active').last()
return cy.get(".v-dialog.v-dialog--active").last();
});
Cypress.Commands.add("getActiveMenu", () => {
return cy.get('.menuable__content__active').last()
return cy.get(".menuable__content__active").last();
});
Cypress.Commands.add("getActiveContentModal", () => {
return cy.get('.v-dialog__content--active').last()
return cy.get(".v-dialog__content--active").last();
});
Cypress.Commands.add("createTable", (name) => {
cy.get(".add-btn").click();
cy.get('.nc-create-table-card .nc-table-name input[type="text"]')
.first()
.click()
.clear()
.type(name);
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]')
.first()
.should("have.value", name.toLowerCase());
cy.get(".nc-create-table-card .nc-create-table-submit").first().click();
cy.toastWait(`Create table.${name} successful`);
cy.get(`.project-tab:contains(${name})`).should("exist");
cy.url().should("contain", `name=${name}`);
});
Cypress.Commands.add('createTable', (name) => {
cy.get('.add-btn').click();
cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.toastWait(`Create table.${name} successful`)
cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `name=${name}`)
})
Cypress.Commands.add('deleteTable', (name) => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
.first().click()
cy.get('.nc-project-tree').contains(name, {timeout: 6000}).first().click({force: true});
cy.get(`.project-tab:contains(${name}):visible`).should('exist')
cy.get('.nc-table-delete-btn:visible').click()
cy.get('button:contains(Submit)').click()
cy.toastWait(`Delete table.${name} successful`)
})
Cypress.Commands.add('renameTable', (oldName, newName) => {
Cypress.Commands.add("deleteTable", (name) => {
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click();
cy.get(".nc-project-tree")
.contains(name, { timeout: 6000 })
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${name}):visible`).should("exist");
cy.get(".nc-table-delete-btn:visible").click();
cy.get("button:contains(Submit)").click();
cy.toastWait(`Delete table.${name} successful`);
});
Cypress.Commands.add("renameTable", (oldName, newName) => {
// expand project tree
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click()
.click();
// right click on project table name
cy.get('.nc-project-tree')
cy.get(".nc-project-tree")
.contains(oldName, { timeout: 6000 })
.first()
.rightclick()
.rightclick();
// choose rename option from menu
cy.getActiveMenu()
.find('[role="menuitem"]')
.contains('Table Rename')
.click({ force: true })
.contains("Table Rename")
.click({ force: true });
// feed new name
cy.getActiveContentModal()
.find('input')
.clear()
.type(newName)
cy.getActiveContentModal().find("input").clear().type(newName);
// submit
cy.getActiveContentModal()
.find('button')
.contains('Submit')
.click()
cy.toastWait('Table renamed successfully')
cy.getActiveContentModal().find("button").contains("Submit").click();
// close expanded project tree
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
cy.toastWait("Table renamed successfully");
// close expanded project tree
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click()
})
.click();
});
Cypress.Commands.add('createColumn', (table, columnName) => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
.first().click()
cy.get('.nc-project-tree').contains(table, {timeout: 6000}).first().click({force: true});
cy.get(`.project-tab:contains(${table}):visible`).should('exist')
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({force: true});
cy.get('.nc-column-name-input input').clear().type(columnName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy
.get('th:contains(new_column)')
.should('exist');
})
Cypress.Commands.add('toastWait', (msg) => {
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('exist')
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('not.exist')
})
Cypress.Commands.add("createColumn", (table, columnName) => {
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click();
cy.get(".nc-project-tree")
.contains(table, { timeout: 6000 })
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${table}):visible`).should("exist");
cy.get(".v-window-item--active .nc-grid tr > th:last button").click({
force: true,
});
cy.get(".nc-column-name-input input").clear().type(columnName);
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.get("th:contains(new_column)").should("exist");
});
Cypress.Commands.add("toastWait", (msg) => {
cy.get(".toasted:visible", { timout: 6000 }).contains(msg).should("exist");
cy.get(".toasted:visible", { timout: 6000 })
.contains(msg)
.should("not.exist");
});
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853
@ -388,5 +401,3 @@ Cypress.Commands.addAll(
}
)
*/

17
scripts/cypress/support/index.js

@ -14,20 +14,19 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
import "./commands";
// https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/
import 'cypress-iframe'
import "cypress-iframe";
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.on('uncaught:exception', (err, runnable) => {
Cypress.on("uncaught:exception", (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
console.log('uncaught:exception')
console.log(err)
console.log(runnable)
return false
})
console.log("uncaught:exception");
console.log(err);
console.log(runnable);
return false;
});

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

@ -1,4 +1,3 @@
const path = require("path");
/**
@ -6,334 +5,384 @@ const path = require("path");
* slate before starting.
*/
export const deleteDownloadsFolder = () => {
const downloadsFolder = Cypress.config('downloadsFolder')
const downloadsFolder = Cypress.config("downloadsFolder");
cy.task('deleteFolder', downloadsFolder)
}
cy.task("deleteFolder", downloadsFolder);
};
// main page
export class _mainPage {
constructor() {
// Top Right items
this.SHARE = 0
this.THEME_BODY = 1
this.THEME_HEADER = 2
this.ALERT = 3
this.LANGUAGE = 4
this.USER = 5
// Top Left items
this.HOME = 0
this.GIT_HOME = 1
this.GIT_STAR = 2
this.GIT_DOCS = 3
this.AUDIT = 0
this.APPSTORE = 2
this.TEAM_N_AUTH = 3
this.PROJ_METADATA = 4
this.ROLE_VIEW = 5
this.ROLE_VIEW_EDITOR = 6
this.ROLE_VIEW_COMMENTER = 7
this.ROLE_VIEW_VIEWER = 8
this.ROLE_VIEW_RESET = 9
this.roleURL = {}
}
toolBarTopLeft(toolBarItem) {
return cy.get('header.v-toolbar', {timeout: 20000}).eq(0).find('a').eq(toolBarItem)
constructor() {
// Top Right items
this.SHARE = 0;
this.THEME_BODY = 1;
this.THEME_HEADER = 2;
this.ALERT = 3;
this.LANGUAGE = 4;
this.USER = 5;
// Top Left items
this.HOME = 0;
this.GIT_HOME = 1;
this.GIT_STAR = 2;
this.GIT_DOCS = 3;
this.AUDIT = 0;
this.APPSTORE = 2;
this.TEAM_N_AUTH = 3;
this.PROJ_METADATA = 4;
this.ROLE_VIEW = 5;
this.ROLE_VIEW_EDITOR = 6;
this.ROLE_VIEW_COMMENTER = 7;
this.ROLE_VIEW_VIEWER = 8;
this.ROLE_VIEW_RESET = 9;
this.roleURL = {};
}
toolBarTopLeft(toolBarItem) {
return cy
.get("header.v-toolbar", { timeout: 20000 })
.eq(0)
.find("a")
.eq(toolBarItem);
}
toolBarTopRight(toolBarItem) {
return cy
.get("header.v-toolbar", { timeout: 20000 })
.eq(0)
.find("button")
.eq(toolBarItem);
}
navigationDraw(item) {
// if (item == this.ROLE_VIEW)
// return cy.get('.nc-nav-drawer').find('.v-list').last()
// else
// return cy.get('.nc-nav-drawer').find('.v-list > .v-list-item').eq(item)
switch (item) {
case this.AUDIT:
return cy.get(".nc-treeview-item-Audit");
case this.APPSTORE:
return cy.get(".nc-settings-appstore");
case this.TEAM_N_AUTH:
return cy.get(".nc-settings-teamauth");
case this.PROJ_METADATA:
return cy.get(".nc-settings-projmeta");
case this.ROLE_VIEW_EDITOR:
return cy.get(".nc-preview-editor");
case this.ROLE_VIEW_COMMENTER:
return cy.get(".nc-preview-commenter");
case this.ROLE_VIEW_VIEWER:
return cy.get(".nc-preview-viewer");
case this.ROLE_VIEW_RESET:
return cy.get(".nc-preview-reset");
}
toolBarTopRight(toolBarItem) {
return cy.get('header.v-toolbar', {timeout: 20000}).eq(0).find('button').eq(toolBarItem)
}
navigationDraw(item) {
// if (item == this.ROLE_VIEW)
// return cy.get('.nc-nav-drawer').find('.v-list').last()
// else
// return cy.get('.nc-nav-drawer').find('.v-list > .v-list-item').eq(item)
switch (item) {
case this.AUDIT:
return cy.get('.nc-treeview-item-Audit')
case this.APPSTORE:
return cy.get('.nc-settings-appstore')
case this.TEAM_N_AUTH:
return cy.get('.nc-settings-teamauth')
case this.PROJ_METADATA:
return cy.get('.nc-settings-projmeta')
case this.ROLE_VIEW_EDITOR:
return cy.get('.nc-preview-editor')
case this.ROLE_VIEW_COMMENTER:
return cy.get('.nc-preview-commenter')
case this.ROLE_VIEW_VIEWER:
return cy.get('.nc-preview-viewer')
case this.ROLE_VIEW_RESET:
return cy.get('.nc-preview-reset')
}
}
// add new user to specified role
}
// add new user to specified role
//
addNewUserToProject = (userCred, roleType) => {
let linkText;
// click on New User button, feed details
cy.get('button:contains("New User")').first().click();
cy.get('label:contains("Email")')
.next("input")
.type(userCred.username)
.trigger("input");
cy.get('label:contains("Select User roles")').click();
// opt-in requested role & submit
cy.getActiveMenu().contains(roleType).click();
cy.get(".nc-invite-or-save-btn").click();
cy.toastWait("Successfully updated the user details");
// get URL, invoke
cy.getActiveModal()
.find(".v-alert")
.then(($obj) => {
linkText = $obj.text().trim();
cy.log(linkText);
this.roleURL[roleType] = linkText;
cy.get("body").click("right");
});
};
addExistingUserToProject = (emailId, role) => {
cy.get('.v-list-item:contains("Team & Auth")').click();
cy.get(`tr:contains(${emailId})`)
.find(".mdi-plus", { timeout: 2000 })
.click();
cy.get(`tr:contains(${emailId})`)
.find(".mdi-pencil-outline", { timeout: 2000 })
.click();
cy.get("label:contains(Select User roles)").click();
// opt-in requested role & submit
//
addNewUserToProject = (userCred, roleType) => {
let linkText
// click on New User button, feed details
cy.get('button:contains("New User")').first().click()
cy.get('label:contains("Email")').next('input').type(userCred.username).trigger('input')
cy.get('label:contains("Select User roles")').click()
// opt-in requested role & submit
cy.getActiveMenu().contains(roleType).click()
cy.get('.nc-invite-or-save-btn').click()
cy.toastWait('Successfully updated the user details')
// get URL, invoke
cy.getActiveModal().find('.v-alert').then(($obj) => {
linkText = $obj.text().trim()
cy.log(linkText)
this.roleURL[roleType] = linkText
cy.get('body').click('right')
})
}
addExistingUserToProject = (emailId, role) => {
cy.get('.v-list-item:contains("Team & Auth")').click()
cy.get(`tr:contains(${emailId})`).find('.mdi-plus', { timeout: 2000 }).click()
cy.get(`tr:contains(${emailId})`).find('.mdi-pencil-outline', { timeout: 2000 }).click()
cy.get('label:contains(Select User roles)').click()
// opt-in requested role & submit
//
cy.getActiveMenu().contains(role).click()
cy.get('.nc-invite-or-save-btn').click()
cy.toastWait('Successfully updated the user details')
this.roleURL[role] = "http://localhost:3000/#/user/authentication/signin"
}
getCell = (columnHeader, cellNumber) => {
return cy.get(`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`)
}
getPagination = (pageNumber) => {
if (pageNumber == '<')
return cy.get('.nc-pagination .v-pagination > li:first-child')
if (pageNumber == '>')
return cy.get('.nc-pagination .v-pagination > li:last-child')
return cy.get(`.nc-pagination .v-pagination > li:contains(${pageNumber}) button`)
}
getRow = (rowIndex) => {
return cy.get('.xc-row-table').find('tr').eq(rowIndex)
}
addColumn = (colName, tableName) => {
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({ force: true });
cy.get('.nc-column-name-input input', { timeout: 3000 }).clear().type(colName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait(`Update table.${tableName} successful`)
}
addColumnWithType = (colName, colType, tableName) => {
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({ force: true });
cy.get('.nc-column-name-input input', { timeout: 3000 }).clear().type(colName)
// Column data type: to be set to lookup in this context
cy.get('.nc-ui-dt-dropdown').click()
cy.getActiveMenu().contains(colType).click()
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait(`Update table.${tableName} successful`)
}
deleteColumn = (colName) => {
cy.get(`th:contains(${colName}) .mdi-menu-down`)
.trigger('mouseover')
.click()
cy.get('.nc-column-delete', {timeout: 5000}).click()
cy.get('button:contains(Confirm)').click()
}
getAuthToken = () => {
let obj = JSON.parse(localStorage['vuex'])
return obj["users"]["token"]
}
configureSMTP = (from, host, port, secure) => {
cy.get('.v-card__title.title')
.contains('SMTP')
.parents('.elevatio')
.find('button')
.contains(" Install ")
.click({ force: true })
cy.getActiveModal().find('[placeholder="eg: admin@example.com"]').click().type(from)
cy.getActiveModal().find('[placeholder="eg: smtp.example.com"]').click().type(host)
cy.getActiveModal().find('[placeholder="Port"]').click().type(port)
cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure)
cy.getActiveModal().find('button').contains('Save').click()
cy.toastWait('Successfully installed and email notification will use SMTP configuration')
}
resetSMTP = () => {
cy.get('.v-card__title.title')
.contains('SMTP')
.parents('.elevatio')
.find('button')
.contains(" Reset ")
.click({ force: true })
cy.getActiveModal().find('button').contains('Submit').click()
cy.toastWait('Plugin uninstalled successfully')
}
hideField = (field) => {
cy.get('.nc-grid-header-cell').contains(field).should('be.visible')
cy.get('.nc-fields-menu-btn').click()
cy.get(`.menuable__content__active .v-list-item label:contains(${field})`).click()
cy.get('.nc-fields-menu-btn').click()
cy.get('.nc-grid-header-cell').contains(field).should('not.be.visible')
}
unhideField = (field) => {
cy.get('.nc-grid-header-cell').contains(field).should('not.be.visible')
cy.get('.nc-fields-menu-btn').click()
cy.get(`.menuable__content__active .v-list-item label:contains(${field})`).click()
cy.get('.nc-fields-menu-btn').click()
cy.get('.nc-grid-header-cell').contains(field).should('be.visible')
}
sortField = (field, criteria) => {
cy.get('.nc-sort-menu-btn').click()
cy.contains('Add Sort Option').click();
cy.get('.nc-sort-field-select div').first().click()
cy.get(`.menuable__content__active .v-list-item:contains(${field})`).click()
cy.get('.nc-sort-dir-select div').first().click()
cy.get(`.menuable__content__active .v-list-item:contains(${criteria})`).click()
cy.get('.nc-sort-menu-btn').click()
}
clearSort = () => {
cy.get('.nc-sort-menu-btn').click()
cy.get('.nc-sort-item-remove-btn').click()
cy.get('.nc-sort-menu-btn').click()
cy.getActiveMenu().contains(role).click();
cy.get(".nc-invite-or-save-btn").click();
cy.toastWait("Successfully updated the user details");
this.roleURL[role] = "http://localhost:3000/#/user/authentication/signin";
};
getCell = (columnHeader, cellNumber) => {
return cy.get(
`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`
);
};
getPagination = (pageNumber) => {
if (pageNumber == "<")
return cy.get(".nc-pagination .v-pagination > li:first-child");
if (pageNumber == ">")
return cy.get(".nc-pagination .v-pagination > li:last-child");
return cy.get(
`.nc-pagination .v-pagination > li:contains(${pageNumber}) button`
);
};
getRow = (rowIndex) => {
return cy.get(".xc-row-table").find("tr").eq(rowIndex);
};
addColumn = (colName, tableName) => {
cy.get(".v-window-item--active .nc-grid tr > th:last button").click({
force: true,
});
cy.get(".nc-column-name-input input", { timeout: 3000 })
.clear()
.type(colName);
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait(`Update table.${tableName} successful`);
};
addColumnWithType = (colName, colType, tableName) => {
cy.get(".v-window-item--active .nc-grid tr > th:last button").click({
force: true,
});
cy.get(".nc-column-name-input input", { timeout: 3000 })
.clear()
.type(colName);
// Column data type: to be set to lookup in this context
cy.get(".nc-ui-dt-dropdown").click();
cy.getActiveMenu().contains(colType).click();
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.toastWait(`Update table.${tableName} successful`);
};
deleteColumn = (colName) => {
cy.get(`th:contains(${colName}) .mdi-menu-down`)
.trigger("mouseover")
.click();
cy.get(".nc-column-delete", { timeout: 5000 }).click();
cy.get("button:contains(Confirm)").click();
};
getAuthToken = () => {
let obj = JSON.parse(localStorage["vuex"]);
return obj["users"]["token"];
};
configureSMTP = (from, host, port, secure) => {
cy.get(".v-card__title.title")
.contains("SMTP")
.parents(".elevatio")
.find("button")
.contains(" Install ")
.click({ force: true });
cy.getActiveModal()
.find('[placeholder="eg: admin@example.com"]')
.click()
.type(from);
cy.getActiveModal()
.find('[placeholder="eg: smtp.example.com"]')
.click()
.type(host);
cy.getActiveModal().find('[placeholder="Port"]').click().type(port);
cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure);
cy.getActiveModal().find("button").contains("Save").click();
cy.toastWait(
"Successfully installed and email notification will use SMTP configuration"
);
};
resetSMTP = () => {
cy.get(".v-card__title.title")
.contains("SMTP")
.parents(".elevatio")
.find("button")
.contains(" Reset ")
.click({ force: true });
cy.getActiveModal().find("button").contains("Submit").click();
cy.toastWait("Plugin uninstalled successfully");
};
hideField = (field) => {
cy.get(".nc-grid-header-cell").contains(field).should("be.visible");
cy.get(".nc-fields-menu-btn").click();
cy.get(
`.menuable__content__active .v-list-item label:contains(${field})`
).click();
cy.get(".nc-fields-menu-btn").click();
cy.get(".nc-grid-header-cell").contains(field).should("not.be.visible");
};
unhideField = (field) => {
cy.get(".nc-grid-header-cell").contains(field).should("not.be.visible");
cy.get(".nc-fields-menu-btn").click();
cy.get(
`.menuable__content__active .v-list-item label:contains(${field})`
).click();
cy.get(".nc-fields-menu-btn").click();
cy.get(".nc-grid-header-cell").contains(field).should("be.visible");
};
sortField = (field, criteria) => {
cy.get(".nc-sort-menu-btn").click();
cy.contains("Add Sort Option").click();
cy.get(".nc-sort-field-select div").first().click();
cy.get(
`.menuable__content__active .v-list-item:contains(${field})`
).click();
cy.get(".nc-sort-dir-select div").first().click();
cy.get(
`.menuable__content__active .v-list-item:contains(${criteria})`
).click();
cy.get(".nc-sort-menu-btn").click();
};
clearSort = () => {
cy.get(".nc-sort-menu-btn").click();
cy.get(".nc-sort-item-remove-btn").click();
cy.get(".nc-sort-menu-btn").click();
};
filterField = (field, operation, value) => {
cy.get(".nc-filter-menu-btn").click();
cy.contains("Add Filter").click();
cy.get(".nc-filter-field-select").last().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}`);
}
filterField = (field, operation, value) => {
cy.get('.nc-filter-menu-btn').click()
cy.contains('Add Filter').click();
cy.get('.nc-filter-field-select').last().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-field-select")
.find(".v-select__slot")
.contains(field)
.should("exist");
cy.get(".nc-filter-operation-select")
.find(".v-select__slot")
.contains(operation)
.should("exist");
cy.get(".nc-filter-menu-btn").click();
};
filterReset = () => {
cy.get(".nc-filter-menu-btn").click();
cy.get(".nc-filter-item-remove-btn").click();
cy.get(".nc-filter-menu-btn").click();
};
// delete created views
//
deleteCreatedViews = () => {
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.parent()
.find("button.mdi-dots-vertical")
.click();
cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
cy.wait(1000);
// cy.get('.container').find('button.mdi-delete-outline')
cy.get('th:contains("View Link")')
.should("exist")
.parent()
.parent()
.next()
.find("tr")
.each(($tableRow) => {
cy.log($tableRow[0].childElementCount);
// one of the row would contain seggregation header ('other views)
if (4 == $tableRow[0].childElementCount) {
cy.wrap($tableRow).find("button").last().click();
cy.wait(1000);
}
cy.get('.nc-filter-field-select').find('.v-select__slot').contains(field).should('exist')
cy.get('.nc-filter-operation-select').find('.v-select__slot').contains(operation).should('exist')
cy.get('.nc-filter-menu-btn').click()
}
filterReset = () => {
cy.get('.nc-filter-menu-btn').click()
cy.get('.nc-filter-item-remove-btn').click()
cy.get('.nc-filter-menu-btn').click()
}
// delete created views
//
deleteCreatedViews = () => {
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.parent().find('button.mdi-dots-vertical').click()
cy.getActiveMenu().find('.v-list-item').contains('Views List').click()
cy.wait(1000)
// cy.get('.container').find('button.mdi-delete-outline')
cy.get('th:contains("View Link")').should('exist').parent().parent()
.next().find('tr').each(($tableRow) => {
cy.log($tableRow[0].childElementCount)
// one of the row would contain seggregation header ('other views)
if (4 == $tableRow[0].childElementCount) {
cy.wrap($tableRow).find('button').last().click()
cy.wait(1000)
}
})
.then(() => {
cy.get('.v-overlay__content > .d-flex > .v-icon').click()
cy.toastWait('Deleted shared view successfully')
})
}
// download CSV & verify
// download folder is configurable in cypress.
// trigger download
// wait for a while & check in configured download folder for the intended file
// if it exists, verify it against 'expectedRecords' passed in as parameter
//
downloadAndVerifyCsv = (filename, verifyCsv) => {
cy.get('.nc-actions-menu-btn').click()
cy.get(`.menuable__content__active .v-list-item span:contains("Download as CSV")`).click()
cy.toastWait('Successfully exported all table data')
.then(() => {
// download folder path, read from config file
const downloadsFolder = Cypress.config("downloadsFolder")
let filePath = path.join(downloadsFolder, filename)
// append download folder path with filename to generate full file path, retrieve file
cy.readFile(filePath)
.then((fileData) => {
// from CSV, split into records (rows)
const rows = fileData.replace(/\r\n/g, '\n').split('\n');
verifyCsv(rows)
deleteDownloadsFolder()
})
})
}
getIFrameCell = (columnHeader, cellNumber) => {
return cy.iframe().find(`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`)
}
// https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Sharing-Context
getDatatype = (tableName, columnName) => {
cy.window().then(win => {
const col = win.$nuxt.$store.state.meta.metas[tableName].columns
let dataType = ''
col.forEach(element => {
if(element.cn == columnName)
dataType = element.uidt
})
cy.wrap(dataType).as('ncDatatype')
})
}
})
.then(() => {
cy.get(".v-overlay__content > .d-flex > .v-icon").click();
cy.toastWait("Deleted shared view successfully");
});
};
// download CSV & verify
// download folder is configurable in cypress.
// trigger download
// wait for a while & check in configured download folder for the intended file
// if it exists, verify it against 'expectedRecords' passed in as parameter
//
downloadAndVerifyCsv = (filename, verifyCsv) => {
cy.get(".nc-actions-menu-btn").click();
cy.get(
`.menuable__content__active .v-list-item span:contains("Download as CSV")`
).click();
cy.toastWait("Successfully exported all table data").then(() => {
// download folder path, read from config file
const downloadsFolder = Cypress.config("downloadsFolder");
let filePath = path.join(downloadsFolder, filename);
// append download folder path with filename to generate full file path, retrieve file
cy.readFile(filePath).then((fileData) => {
// from CSV, split into records (rows)
const rows = fileData.replace(/\r\n/g, "\n").split("\n");
verifyCsv(rows);
deleteDownloadsFolder();
});
});
};
getIFrameCell = (columnHeader, cellNumber) => {
return cy
.iframe()
.find(`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`);
};
// https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Sharing-Context
getDatatype = (tableName, columnName) => {
cy.window().then((win) => {
const col = win.$nuxt.$store.state.meta.metas[tableName].columns;
let dataType = "";
col.forEach((element) => {
if (element.cn == columnName) dataType = element.uidt;
});
cy.wrap(dataType).as("ncDatatype");
});
};
}
export const mainPage = new _mainPage;
export const mainPage = new _mainPage();
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

524
scripts/cypress/support/page_objects/navigation.js

@ -1,269 +1,305 @@
import { roles, staticProjects, defaultDbParams } from "./projectConstants"
import { roles, staticProjects, defaultDbParams } from "./projectConstants";
///////////////////////////////////////////////////////////
// Sign in/ Sign up page
// list of hard-wired URL that can be used by nocodb
// suffix to baseUrl needs to be defined here
//
const urlPool = {
ncUrlBase: "/",
ncUrlSignUp: "#/user/authentication/signup",
ncUrlSignIn: "#/user/authentication/signin"
}
ncUrlBase: "/",
ncUrlSignUp: "#/user/authentication/signup",
ncUrlSignIn: "#/user/authentication/signin",
};
export class _loginPage {
// prefix: baseUrl
go(urlKey) {
cy.visit(urlKey)
}
// visit SignIn URL, enter credentials passed as parameters
//
signIn(userCredentials) {
this.go(urlPool.ncUrlSignIn)
cy.get('input[type="text"]', {timeout: 20000}).type(userCredentials.username)
cy.get('input[type="password"]').type(userCredentials.password)
cy.get('button:contains("SIGN IN")').click()
this.waitProjectPageLoad()
// prefix: baseUrl
go(urlKey) {
cy.visit(urlKey);
}
// visit SignIn URL, enter credentials passed as parameters
//
signIn(userCredentials) {
this.go(urlPool.ncUrlSignIn);
cy.get('input[type="text"]', { timeout: 20000 }).type(
userCredentials.username
);
cy.get('input[type="password"]').type(userCredentials.password);
cy.get('button:contains("SIGN IN")').click();
this.waitProjectPageLoad();
}
// visit SignUp URL, enter credentials passed as parameters
//
signUp(userCredentials) {
this.go(urlPool.ncUrlSignUp);
cy.get('input[type="text"]', { timeout: 20000 }).type(
userCredentials.username
);
cy.get('input[type="password"]').type(userCredentials.password);
cy.get('button:contains("SIGN UP")').click();
this.waitProjectPageLoad();
}
// delay/ wait utility routines
//
waitProjectPageLoad() {
cy.url({ timeout: 6000 }).should("contain", "#/project");
cy.get(".nc-new-project-menu").should("exist");
}
// standard pre-project activity
//
loginAndOpenProject(apiType, xcdb) {
loginPage.signIn(roles.owner.credentials);
if (!xcdb) {
if ("rest" == apiType)
projectsPage.openProject(staticProjects.externalREST.basic.name);
else projectsPage.openProject(staticProjects.externalGQL.basic.name);
} else {
if ("rest" == apiType)
projectsPage.openProject(staticProjects.sampleREST.basic.name);
else projectsPage.openProject(staticProjects.sampleGQL.basic.name);
}
// visit SignUp URL, enter credentials passed as parameters
//
signUp(userCredentials) {
this.go(urlPool.ncUrlSignUp)
cy.get('input[type="text"]', {timeout: 20000}).type(userCredentials.username)
cy.get('input[type="password"]').type(userCredentials.password)
cy.get('button:contains("SIGN UP")').click()
this.waitProjectPageLoad()
}
// delay/ wait utility routines
//
waitProjectPageLoad() {
cy.url({ timeout: 6000 }).should('contain', '#/project')
cy.get('.nc-new-project-menu').should('exist')
}
// standard pre-project activity
//
loginAndOpenProject(apiType, xcdb) {
loginPage.signIn(roles.owner.credentials)
if(!xcdb) {
if ('rest' == apiType)
projectsPage.openProject(staticProjects.externalREST.basic.name)
else
projectsPage.openProject(staticProjects.externalGQL.basic.name)
}
else {
if ('rest' == apiType)
projectsPage.openProject(staticProjects.sampleREST.basic.name)
else
projectsPage.openProject(staticProjects.sampleGQL.basic.name)
}
}
}
}
///////////////////////////////////////////////////////////
// Projects page
export class _projectsPage {
// Project creation options
//
// {dbType, apiType, name}
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
// Open existing project
// TODO: add projectName validation
//
openProject(projectName) {
cy.get('tbody').contains('tr', projectName).should('exist').click()
// takes a while to load project
this.waitHomePageLoad()
}
// Create new project
// Input:
// projectData {dbType, apiType, name}
// dbCredentials {databaseType, hostAddress, portNumber, username, password, databaseName}
// Returns: projectName
//
// To configure
// SSL & advanced parameters
// Database type selection
//
createProject(projectData, cred) {
cy.get('body', { timeout: 2000 })
let projectName = projectData.name
if (projectData.name == '')
projectName = 'test_proj' + Date.now()
// click on "New Project"
cy.get(':nth-child(5) > .v-btn', {timeout: 20000}).click()
if ('none' == projectData.dbType) {
// Subsequent form, select (+ Create) option
cy.get('.nc-create-xc-db-project', {timeout: 20000}).click({ force: true })
// feed project name
cy.get('.nc-metadb-project-name', {timeout: 20000}).type(projectName)
// Radio button: defaults to NC_REST
if ('GQL' == projectData.apiType) {
cy.contains('GRAPHQL APIs').closest('label').click();
}
// Submit
cy.contains('button', 'Create', { timeout: 20000 }).click()
// takes a while to load project
this.waitHomePageLoad()
return projectName
}
// dbType == 'external'
else {
// Subsequent form, select (+ Create by connection to external database) option
cy.get('.nc-create-external-db-project', {timeout: 20000}).click({ force: true })
// feed project name
//cy.get('.nc-metadb-project-name').type(projectName)
cy.contains('Enter Project Name', {timeout: 20000}).parent().find('input').clear().type(projectName)
// Radio button: defaults to NC_REST
if ('GQL' == projectData.apiType) {
cy.contains('GRAPHQL APIs').closest('label').click();
}
if (cred.hostAddress != '') cy.contains('Host Address').parent().find('input').clear().type(cred.hostAddress)
if (cred.portNumber != '') cy.contains('Port Number').parent().find('input').clear().type(cred.portNumber)
if (cred.username != '') cy.contains('Username').parent().find('input').clear().type(cred.username)
if (cred.password != '') cy.contains('Password').parent().find('input').clear().type(cred.password)
if (cred.databaseName != '') cy.contains('Database : create if not exists').parent().find('input').clear().type(cred.databaseName)
// Test database connection
cy.contains('Test Database Connection', {timeout: 20000}).click()
// Create project
cy.contains('Ok & Save Project', { timeout: 20000 }).click()
// takes a while to load project
this.waitHomePageLoad()
return projectName
}
}
// create REST default project (sakila DB)
//
createDefaulRestProject() {
return this.createProject({ dbType: 1, apiType: 0, name: '' }, defaultDbParams )
}
// create GraphQL default project (sakila DB)
//
createDefaultGraphQlProject() {
return this.createProject({ dbType: 1, apiType: 1, name: '' }, defaultDbParams )
}
// Click on refresh key on projects page
//
refreshProject() {
cy.contains('My Projects').parent().find('button').click();
}
// search project with given key
// return project-name array
//
searchProject(projectNameKey) {
cy.get('input[placeholder="Search Project"]').type(projectNameKey)
const projectName = []
cy.get('table tr').each((tableRow) => {
cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
projectName.push(input.text())
})
})
.then(() => {
// TBD: validate project name to contain search key
console.log(projectName)
return projectName
})
}
// remove specified project entry
// TODO: error handling
//
deleteProject(name) {
// delete icon
cy.get('tbody').contains('tr', name).find('.mdi-delete-circle-outline').click()
cy.toastWait('deleted successfully')
// this.waitDeletePageLoad()
// pop-up, submit
cy.get('body').then((body) => {
cy.wrap(body).find('button').contains('Submit').click()
})
// Project creation options
//
// {dbType, apiType, name}
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
// Open existing project
// TODO: add projectName validation
//
openProject(projectName) {
cy.get("tbody").contains("tr", projectName).should("exist").click();
// takes a while to load project
this.waitHomePageLoad();
}
// Create new project
// Input:
// projectData {dbType, apiType, name}
// dbCredentials {databaseType, hostAddress, portNumber, username, password, databaseName}
// Returns: projectName
//
// To configure
// SSL & advanced parameters
// Database type selection
//
createProject(projectData, cred) {
cy.get("body", { timeout: 2000 });
let projectName = projectData.name;
if (projectData.name == "") projectName = "test_proj" + Date.now();
// click on "New Project"
cy.get(":nth-child(5) > .v-btn", { timeout: 20000 }).click();
if ("none" == projectData.dbType) {
// Subsequent form, select (+ Create) option
cy.get(".nc-create-xc-db-project", { timeout: 20000 }).click({
force: true,
});
// feed project name
cy.get(".nc-metadb-project-name", { timeout: 20000 }).type(projectName);
// Radio button: defaults to NC_REST
if ("GQL" == projectData.apiType) {
cy.contains("GRAPHQL APIs").closest("label").click();
}
// Submit
cy.contains("button", "Create", { timeout: 20000 }).click();
// takes a while to load project
this.waitHomePageLoad();
return projectName;
}
// remove all projects created
//
// 1. read all project names to be deleted, store in array
// 2. invoke delete project for each entry in array
//
// deleteAllProject() {
// const projectName = []
// cy.get('table tr').each((tableRow) => {
// cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
// projectName.push(input.text())
// })
// })
// .then(() => {
// console.log(projectName)
// projectName.forEach(element => {
// // bring back the DOM to normalcy
// cy.get('div').parentsUntil('body')
// this.deleteProject(element)
// // wait needed for pop up to disapper
// this.waitDeletePageLoad()
// })
// })
// }
waitHomePageLoad() {
cy.url({ timeout: 50000 }).should('contain', '&dbalias=')
// dbType == 'external'
else {
// Subsequent form, select (+ Create by connection to external database) option
cy.get(".nc-create-external-db-project", { timeout: 20000 }).click({
force: true,
});
// feed project name
//cy.get('.nc-metadb-project-name').type(projectName)
cy.contains("Enter Project Name", { timeout: 20000 })
.parent()
.find("input")
.clear()
.type(projectName);
// Radio button: defaults to NC_REST
if ("GQL" == projectData.apiType) {
cy.contains("GRAPHQL APIs").closest("label").click();
}
if (cred.hostAddress != "")
cy.contains("Host Address")
.parent()
.find("input")
.clear()
.type(cred.hostAddress);
if (cred.portNumber != "")
cy.contains("Port Number")
.parent()
.find("input")
.clear()
.type(cred.portNumber);
if (cred.username != "")
cy.contains("Username")
.parent()
.find("input")
.clear()
.type(cred.username);
if (cred.password != "")
cy.contains("Password")
.parent()
.find("input")
.clear()
.type(cred.password);
if (cred.databaseName != "")
cy.contains("Database : create if not exists")
.parent()
.find("input")
.clear()
.type(cred.databaseName);
// Test database connection
cy.contains("Test Database Connection", { timeout: 20000 }).click();
// Create project
cy.contains("Ok & Save Project", { timeout: 20000 }).click();
// takes a while to load project
this.waitHomePageLoad();
return projectName;
}
}
// create REST default project (sakila DB)
//
createDefaulRestProject() {
return this.createProject(
{ dbType: 1, apiType: 0, name: "" },
defaultDbParams
);
}
// create GraphQL default project (sakila DB)
//
createDefaultGraphQlProject() {
return this.createProject(
{ dbType: 1, apiType: 1, name: "" },
defaultDbParams
);
}
// Click on refresh key on projects page
//
refreshProject() {
cy.contains("My Projects").parent().find("button").click();
}
// search project with given key
// return project-name array
//
searchProject(projectNameKey) {
cy.get('input[placeholder="Search Project"]').type(projectNameKey);
const projectName = [];
cy.get("table tr")
.each((tableRow) => {
cy.wrap(tableRow)
.find("td")
.eq(0)
.find(".title")
.then((input) => {
projectName.push(input.text());
});
})
.then(() => {
// TBD: validate project name to contain search key
console.log(projectName);
return projectName;
});
}
// remove specified project entry
// TODO: error handling
//
deleteProject(name) {
// delete icon
cy.get("tbody")
.contains("tr", name)
.find(".mdi-delete-circle-outline")
.click();
cy.toastWait("deleted successfully");
// this.waitDeletePageLoad()
// pop-up, submit
cy.get("body").then((body) => {
cy.wrap(body).find("button").contains("Submit").click();
});
}
// remove all projects created
//
// 1. read all project names to be deleted, store in array
// 2. invoke delete project for each entry in array
//
// deleteAllProject() {
// const projectName = []
// cy.get('table tr').each((tableRow) => {
// cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
// projectName.push(input.text())
// })
// })
// .then(() => {
// console.log(projectName)
// projectName.forEach(element => {
// // bring back the DOM to normalcy
// cy.get('div').parentsUntil('body')
// this.deleteProject(element)
// // wait needed for pop up to disapper
// this.waitDeletePageLoad()
// })
// })
// }
waitHomePageLoad() {
cy.url({ timeout: 50000 }).should("contain", "&dbalias=");
}
}
export const loginPage = new _loginPage;
export const projectsPage = new _projectsPage;
export const loginPage = new _loginPage();
export const projectsPage = new _projectsPage();
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

198
scripts/cypress/support/page_objects/projectConstants.js

@ -1,12 +1,11 @@
export const defaultDbParams = {
databaseType: 0, // MySQL
hostAddress: 'localhost',
portNumber: '3306',
username: 'root',
password: 'password',
databaseName: 'sakila'
}
databaseType: 0, // MySQL
hostAddress: "localhost",
portNumber: "3306",
username: "root",
password: "password",
databaseName: "sakila",
};
// database
// validation details
@ -16,92 +15,133 @@ export const defaultDbParams = {
// editComment: add comment
// shareView: right navigation bar (share options)
export const roles = {
owner: {
name: 'owner',
credentials: { username: 'user@nocodb.com', password: 'Password123.' },
validations: { advSettings: true, editSchema: true, editData: true, editComment: true, shareView: true }
owner: {
name: "owner",
credentials: { username: "user@nocodb.com", password: "Password123." },
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
},
creator: {
name: 'creator',
credentials: { username: 'creator@nocodb.com', password: 'Password123.' },
validations: { advSettings: true, editSchema: true, editData: true, editComment: true, shareView: true }
},
creator: {
name: "creator",
credentials: { username: "creator@nocodb.com", password: "Password123." },
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
},
editor: {
name: 'editor',
credentials: { username: 'editor@nocodb.com', password: 'Password123.' },
validations: { advSettings: false, editSchema: false, editData: true, editComment: true, shareView: false }
},
editor: {
name: "editor",
credentials: { username: "editor@nocodb.com", password: "Password123." },
validations: {
advSettings: false,
editSchema: false,
editData: true,
editComment: true,
shareView: false,
},
commenter: {
name: 'commenter',
credentials: { username: 'commenter@nocodb.com', password: 'Password123.' },
validations: { advSettings: false, editSchema: false, editData: false, editComment: true, shareView: false }
},
commenter: {
name: "commenter",
credentials: { username: "commenter@nocodb.com", password: "Password123." },
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: true,
shareView: false,
},
viewer: {
name: 'viewer',
credentials: { username: 'viewer@nocodb.com', password: 'Password123.' },
validations: { advSettings: false, editSchema: false, editData: false, editComment: false, shareView: false }
}
}
},
viewer: {
name: "viewer",
credentials: { username: "viewer@nocodb.com", password: "Password123." },
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: false,
shareView: false,
},
},
};
// default projects
//
export const staticProjects = {
sampleREST: {
basic: { dbType: 'none', apiType: 'REST', name: 'sampleREST' },
config: {}
},
sampleGQL: {
basic: { dbType: 'none', apiType: 'GQL', name: 'sampleGQL' },
config: {}
},
externalREST: {
basic: { dbType: 'external', apiType: 'REST', name: 'externalREST' },
config: defaultDbParams
},
externalGQL: {
basic: { dbType: 'external', apiType: 'GQL', name: 'externalGQL' },
config: defaultDbParams
}
}
sampleREST: {
basic: { dbType: "none", apiType: "REST", name: "sampleREST" },
config: {},
},
sampleGQL: {
basic: { dbType: "none", apiType: "GQL", name: "sampleGQL" },
config: {},
},
externalREST: {
basic: { dbType: "external", apiType: "REST", name: "externalREST" },
config: defaultDbParams,
},
externalGQL: {
basic: { dbType: "external", apiType: "GQL", name: "externalGQL" },
config: defaultDbParams,
},
};
// return TRUE if test suite specified is activated from env-variables
//
export const isTestSuiteActive = (type, xcdb) => {
const env = Cypress.env('testMode')
if( !xcdb ) {
switch( type ) {
case 'rest': return env.includes('extREST')?true:false;
case 'graphql': return env.includes('extGQL')?true:false;
}
} else {
switch( type ) {
case 'rest': return env.includes('xcdbREST')?true:false;
case 'graphql': return env.includes('xcdbGQL')?true:false;
}
const env = Cypress.env("testMode");
if (!xcdb) {
switch (type) {
case "rest":
return env.includes("extREST") ? true : false;
case "graphql":
return env.includes("extGQL") ? true : false;
}
} else {
switch (type) {
case "rest":
return env.includes("xcdbREST") ? true : false;
case "graphql":
return env.includes("xcdbGQL") ? true : false;
}
}
}
};
// expecting different modes to be seperated by a .
export const getPrimarySuite = () => {
const env = Cypress.env('testMode').split('.')
switch(env[0]) {
case 'extREST': return staticProjects.externalREST;
case 'extGQL': return staticProjects.externalGQL;
case 'xcdbREST': return staticProjects.sampleREST;
case 'xcdbGQL': return staticProjects.sampleGQL;
}
}
const env = Cypress.env("testMode").split(".");
switch (env[0]) {
case "extREST":
return staticProjects.externalREST;
case "extGQL":
return staticProjects.externalGQL;
case "xcdbREST":
return staticProjects.sampleREST;
case "xcdbGQL":
return staticProjects.sampleGQL;
}
};
export const isSecondarySuite = (proj, xcdb) => {
if(!isTestSuiteActive(proj, xcdb))
return false;
const env = Cypress.env('testMode').split('.')
switch(env[0]) {
case 'extREST': return (proj=='rest' && !xcdb)?false:true;
case 'extGQL': return (proj=='graphql' && !xcdb)?false:true;
case 'xcdbREST': return (proj=='rest' && xcdb)?false:true;
case 'xcdbGQL': return (proj=='graphql' && xcdb)?false:true;
}
}
if (!isTestSuiteActive(proj, xcdb)) return false;
const env = Cypress.env("testMode").split(".");
switch (env[0]) {
case "extREST":
return proj == "rest" && !xcdb ? false : true;
case "extGQL":
return proj == "graphql" && !xcdb ? false : true;
case "xcdbREST":
return proj == "rest" && xcdb ? false : true;
case "xcdbGQL":
return proj == "graphql" && xcdb ? false : true;
}
};

Loading…
Cancel
Save