Browse Source

Merge branch 'develop' into develop

pull/1292/head
Raju Udava 3 years ago committed by GitHub
parent
commit
942ab9232c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 3
      scripts/cypress/cypress.json
  3. 1
      scripts/cypress/integration/common/00_pre_configurations.js
  4. 2
      scripts/cypress/integration/common/1a_table_operations.js
  5. 19
      scripts/cypress/integration/common/1b_table_column_operations.js
  6. 2
      scripts/cypress/integration/common/1d_pg_table_view_drag_drop_reorder.js
  7. 2
      scripts/cypress/integration/common/1d_table_view_drag_drop_reorder.js
  8. 15
      scripts/cypress/integration/common/1e_meta_sync.js
  9. 20
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  10. 15
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  11. 23
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  12. 3
      scripts/cypress/integration/common/3b_formula_column.js
  13. 2
      scripts/cypress/integration/common/3c_lookup_column.js
  14. 2
      scripts/cypress/integration/common/3d_rollup_column.js
  15. 7
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  16. 5
      scripts/cypress/integration/common/4b_table_view_share.js
  17. 1
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  18. 49
      scripts/cypress/integration/common/4e_form_view_share.js
  19. 41
      scripts/cypress/integration/common/4f_grid_view_share.js
  20. 2
      scripts/cypress/integration/common/5a_user_role.js
  21. 2
      scripts/cypress/integration/common/6b_downloadCsv.js
  22. 72
      scripts/cypress/integration/common/6c_swagger_api.js
  23. 7
      scripts/cypress/integration/common/6d_language_validation.js
  24. 11
      scripts/cypress/integration/common/6e_project_operations.js
  25. 17
      scripts/cypress/integration/common/6g_base_share.js
  26. 38
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  27. 64
      scripts/cypress/support/commands.js
  28. 27
      scripts/cypress/support/page_objects/mainPage.js
  29. 8
      scripts/cypress/support/page_objects/navigation.js

1
.gitignore vendored

@ -83,3 +83,4 @@ mongod
# Cypress
#=========
shared.json
/scripts/Cypress/screenshots

3
scripts/cypress/cypress.json

@ -42,7 +42,8 @@
"host": "127.0.0.1",
"user": "root",
"password": "password"
}
},
"screenshot": false
},
"fixturesFolder": "scripts/cypress/fixtures",
"integrationFolder": "scripts/cypress/integration",

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

@ -166,6 +166,7 @@ export const genTest = (apiType, dbType) => {
const createProject = (proj) => {
it(`Create ${proj.basic.name} project`, () => {
cy.snip("ProjectPage");
// click home button
cy.get(".nc-noco-brand-icon").click();

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

@ -34,6 +34,8 @@ export const genTest = (apiType, dbType) => {
it("Open Audit tab", () => {
mainPage.navigationDraw(mainPage.AUDIT).click();
cy.snip("AuditPage");
// wait for column headers to appear
//
cy.get("thead > tr > th.caption").should("have.length", 5);

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

@ -11,6 +11,7 @@ export const genTest = (apiType, dbType) => {
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(cellValue);
cy.snipActiveModal("Modal_AddNewRow");
cy.getActiveModal()
.find("button")
.contains("Save Row")
@ -59,7 +60,9 @@ export const genTest = (apiType, dbType) => {
cy.toastWait("Update table 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 })
@ -107,7 +110,10 @@ export const genTest = (apiType, dbType) => {
});
it("Update row", () => {
mainPage.getRow(1).find(".nc-row-expand-icon").click({ force: true });
mainPage
.getRow(1)
.find(".nc-row-expand-icon")
.click({ force: true });
cy.get("#data-table-form-Title > input")
.first()
.clear()
@ -120,7 +126,10 @@ export const genTest = (apiType, dbType) => {
cy.toastWait("updated successfully");
mainPage.getCell("Title", 1).contains(randVal).should("not.exist");
mainPage.getCell("Title", 1).contains(updatedRandVal).should("exist");
mainPage
.getCell("Title", 1)
.contains(updatedRandVal)
.should("exist");
});
it("Delete row", () => {
@ -154,7 +163,9 @@ export const genTest = (apiType, dbType) => {
// delete selected rows
mainPage.getCell("Title", 1).rightclick({ force: true });
cy.getActiveMenu().contains("Delete Selected Row").click({ force: true });
cy.getActiveMenu()
.contains("Delete Selected Row")
.click({ force: true });
// verify if everything is wiped off
mainPage.getCell("Title", 1).contains("a1").should("not.exist");

2
scripts/cypress/integration/common/1d_pg_table_view_drag_drop_reorder.js

@ -87,6 +87,8 @@ export const genTest = (apiType, dbType) => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
cy.snipActiveModal(`Modal_createView_${viewType}`);
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find("button:contains(Submit)").click();

2
scripts/cypress/integration/common/1d_table_view_drag_drop_reorder.js

@ -80,6 +80,8 @@ export const genTest = (apiType, dbType) => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
cy.snipActiveModal(`Modal_createView_${viewType}`);
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find("button:contains(Submit)").click();

15
scripts/cypress/integration/common/1e_meta_sync.js

@ -69,8 +69,14 @@ export const genTest = (apiType, dbType) => {
//
if (!isXcdb()) {
// Remove relation (FK)
cy.task(dbCmd, `ALTER TABLE ${projPrefix}table1 DROP FOREIGN KEY fk1`);
cy.task(dbCmd, `ALTER TABLE ${projPrefix}table1 DROP INDEX fk1_idx`);
cy.task(
dbCmd,
`ALTER TABLE ${projPrefix}table1 DROP FOREIGN KEY fk1`
);
cy.task(
dbCmd,
`ALTER TABLE ${projPrefix}table1 DROP INDEX fk1_idx`
);
mainPage.metaSyncValidate(
`${tblDisplayPrefix}table1`,
"Relation removed"
@ -121,7 +127,10 @@ export const genTest = (apiType, dbType) => {
// DROP TABLE
cy.task(dbCmd, `DROP TABLE ${projPrefix}table1`);
cy.task(dbCmd, `DROP TABLE ${projPrefix}table2`);
mainPage.metaSyncValidate(`${tblDisplayPrefix}table1`, "Table removed");
mainPage.metaSyncValidate(
`${tblDisplayPrefix}table1`,
"Table removed"
);
});
it(`Hide, Filter, Sort`, () => {

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

@ -21,12 +21,18 @@ export const genTest = (apiType, dbType) => {
it("Expand belongs-to column", () => {
// expand first row
cy.get('td[data-col="Country => City"] div:visible', { timeout: 12000 })
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')
cy.get(
'td[data-col="Country => City"] div .mdi-arrow-expand:visible'
)
.first()
.click();
cy.snipActiveModal("Modal_BelongsTo");
});
it("Expand Link record, validate", () => {
@ -34,9 +40,13 @@ export const genTest = (apiType, dbType) => {
.find("button:contains(Link to 'City')")
.click()
.then(() => {
cy.snipActiveModal("Modal_BT_LinkRecord");
// Link record form validation
cy.getActiveModal().contains("Link Record").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find("button.mdi-reload")
.should("exist");
cy.getActiveModal()
.find('button:contains("New Record")')
.should("exist");
@ -50,7 +60,9 @@ export const genTest = (apiType, dbType) => {
.find("button.mdi-close")
.click()
.then(() => {
cy.getActiveModal().find("button.mdi-close").click();
cy.getActiveModal()
.find("button.mdi-close")
.click();
});
});
});

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

@ -28,6 +28,8 @@ export const genTest = (apiType, dbType) => {
.first()
.click({ force: true });
cy.snipActiveModal("Modal_ManyToMany");
// validations
cy.getActiveModal().contains("Film").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
@ -46,9 +48,12 @@ export const genTest = (apiType, dbType) => {
.find("button:contains(Link to 'Film')")
.click()
.then(() => {
cy.snipActiveModal("Modal_M2M_LinkToRecord");
// Link record form validation
cy.getActiveModal().contains("Link Record").should("exist");
cy.getActiveModal().find("button.mdi-reload").should("exist");
cy.getActiveModal()
.find("button.mdi-reload")
.should("exist");
cy.getActiveModal()
.find('button:contains("New Record")')
.should("exist");
@ -76,9 +81,13 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal()
.find('button:contains("Save Row")')
.should("exist");
cy.getActiveModal().find('button:contains("Cancel")').should("exist");
cy.getActiveModal()
.find('button:contains("Cancel")')
.should("exist");
cy.getActiveModal().find('button:contains("Cancel")').click();
cy.getActiveModal()
.find('button:contains("Cancel")')
.click();
cy.getActiveModal().find("button.mdi-close").click();
});
});

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

@ -39,7 +39,9 @@ export const genTest = (apiType, dbType) => {
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.get("#data-table-form-Country > input")
.first()
.type("Test Country");
cy.contains("Save Row").filter("button").click();
cy.toastWait("updated successfully");
@ -69,7 +71,12 @@ export const genTest = (apiType, dbType) => {
//
it("Add row using rightclick menu option", () => {
mainPage.getCell("Country", 9).rightclick({ force: true });
cy.getActiveMenu().contains("Insert New Row").click({ force: true });
cy.snipActiveMenu("Menu_GridRightClick");
cy.getActiveMenu()
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 10)
.dblclick()
@ -79,7 +86,9 @@ export const genTest = (apiType, dbType) => {
// cy.toastWait('saved successfully')
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu().contains("Insert New Row").click({ force: true });
cy.getActiveMenu()
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 11)
.dblclick()
@ -128,7 +137,7 @@ export const genTest = (apiType, dbType) => {
describe(`Sort operations`, () => {
it("Enable sort", () => {
mainPage.sortField('Country', "Z -> A")
mainPage.sortField("Country", "Z -> A");
// Sort menu operations (Country Column, Z->A)
// cy.get(".nc-sort-menu-btn").click();
@ -163,7 +172,7 @@ export const genTest = (apiType, dbType) => {
// ".menuable__content__active .v-list-item label:contains(LastUpdate)"
// ).click();
// cy.get(".nc-fields-menu-btn").click();
mainPage.hideField('LastUpdate')
mainPage.hideField("LastUpdate");
cy.get("th:contains(LastUpdate)").should("not.be.visible");
});
@ -173,14 +182,14 @@ export const genTest = (apiType, dbType) => {
// ".menuable__content__active .v-list-item label:contains(LastUpdate)"
// ).click();
// cy.get(".nc-fields-menu-btn").click();
mainPage.unhideField('LastUpdate')
mainPage.unhideField("LastUpdate");
cy.get("th:contains(LastUpdate)").should("be.visible");
});
});
describe("Filter operations", () => {
it("Create Filter", () => {
mainPage.filterField('Country', 'is equal', 'India');
mainPage.filterField("Country", "is equal", "India");
cy.get("td:contains(India)").should("exist");
// cy.get(".nc-filter-menu-btn").click();

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

@ -49,6 +49,9 @@ export const genTest = (apiType, dbType) => {
// Column data type: to be set to formula in this context
cy.get(".nc-ui-dt-dropdown").click().type("Formula");
cy.snipActiveMenu("Formula");
cy.getActiveMenu().contains("Formula").click({ force: true });
// Configure formula

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

@ -44,6 +44,8 @@ export const genTest = (apiType, dbType) => {
fetchParentFromLabel("Child column");
cy.getActiveMenu().contains(childCol).click();
cy.snipActiveMenu("LookUp");
// click on Save
cy.get(".nc-col-create-or-edit-card").contains("Save").click();

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

@ -55,6 +55,8 @@ export const genTest = (apiType, dbType) => {
fetchParentFromLabel("Aggregate function");
cy.getActiveMenu().contains(aggregateFunc).click();
cy.snipActiveMenu("RollUp");
// click on Save
cy.get(".nc-col-create-or-edit-card").contains("Save").click();

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

@ -34,11 +34,16 @@ export const genTest = (apiType, dbType) => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Country1")
.should("exist");
cy.snip(`View_${viewType}`);
});
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(

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

@ -11,11 +11,16 @@ const generateLinkWithPwd = () => {
// .click();
mainPage.shareView().click();
cy.snipActiveModal("Modal_ShareView")
// enable checkbox & feed pwd, save
cy.getActiveModal()
.find('[role="switch"][type="checkbox"]')
.click({ force: true });
cy.getActiveModal().find('input[type="password"]').type("1");
cy.snipActiveModal("Modal_ShareView_Password");
cy.getActiveModal().find('button:contains("Save password")').click();
cy.toastWait("Successfully updated");

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

@ -25,6 +25,7 @@ export const genTest = (apiType, dbType) => {
// 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.snipActiveMenu("Menu_Collaboration")
cy.getActiveMenu().find('[role="menuitem"]').eq(menuOption).click();
// expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled

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

@ -47,20 +47,31 @@ export const genTest = (apiType, dbType) => {
// 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)
.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="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(".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("#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"]')
@ -87,6 +98,8 @@ export const genTest = (apiType, dbType) => {
// .click();
mainPage.shareView().click();
cy.snipActiveModal("Modal_ShareView");
// copy link text, visit URL
cy.getActiveModal()
.find(".share-link-box")
@ -101,6 +114,8 @@ export const genTest = (apiType, dbType) => {
// wait for share view page to load!
cy.get(".nc-form").should("exist");
cy.snip("ShareView_Form");
// New form appeared? Header & description should exist
cy.get(".nc-form", { timeout: 10000 })
.find("h2")
@ -122,13 +137,22 @@ export const genTest = (apiType, dbType) => {
.eq(0)
.contains("LastUpdate")
.should("exist");
cy.get(".nc-field-wrapper").eq(1).contains("City").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.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")
@ -136,7 +160,10 @@ export const genTest = (apiType, dbType) => {
.click();
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".nc-form")
.find("button")
.contains("Submit")
.click();
cy.toastWait("Congratulations");
cy.get(".v-alert")
.contains("Congratulations")
@ -151,7 +178,9 @@ export const genTest = (apiType, dbType) => {
.should("exist");
cy.get(".nc-form", { timeout: 10000 })
.find(".body-1")
.contains("Some description about form comes here")
.contains(
"Some description about form comes here"
)
.should("exist");
});
});

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

@ -119,7 +119,9 @@ export const genTest = (apiType, dbType) => {
.then(() => {
// cy.get(".v-overlay__content > .d-flex > .v-icon").click();
// close modal (fix me! add a close button to share view list modal)
cy.get('.v-overlay--active > .v-overlay__scrim').click({force: true});
cy.get(".v-overlay--active > .v-overlay__scrim").click({
force: true,
});
});
});
@ -132,6 +134,8 @@ export const genTest = (apiType, dbType) => {
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 18);
cy.snip("ShareView_Grid");
// verify title
cy.get("div.model-name").contains("Address1").should("exist");
});
@ -149,8 +153,14 @@ export const genTest = (apiType, dbType) => {
.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");
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`, () => {
@ -176,7 +186,10 @@ export const genTest = (apiType, dbType) => {
};
// download & verify
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.downloadAndVerifyCsv(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
@ -203,7 +216,10 @@ export const genTest = (apiType, dbType) => {
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");
mainPage
.getCell("District", 1)
.contains("Tamil")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => {
@ -228,7 +244,10 @@ export const genTest = (apiType, dbType) => {
}
}
};
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.downloadAndVerifyCsv(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
@ -270,7 +289,10 @@ export const genTest = (apiType, dbType) => {
.find("button")
.contains("Link to")
.should("not.exist");
cy.getActiveModal().find(".child-card").contains("2").should("exist");
cy.getActiveModal()
.find(".child-card")
.contains("2")
.should("exist");
cy.getActiveModal()
.find(".child-card")
.find("button")
@ -393,7 +415,10 @@ export const genTest = (apiType, dbType) => {
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.get("#data-table-form-Country > input")
.first()
.click()
.type("a");
cy.contains("Save Row").filter("button").click({ force: true });
cy.toastWait("updated successfully");

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

@ -62,6 +62,8 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-exp-imp-metadata").dblclick({ force: true });
cy.get(".nc-ui-acl-tab").click({ force: true });
cy.snip("Meta_Tab3");
// validate if it has 19 entries representing tables & views
if (isPostgres())
cy.get(".nc-acl-table-row").should("have.length", 24);

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

@ -9,12 +9,10 @@ export const genTest = (apiType, dbType) => {
before(() => {
// loginPage.loginAndOpenProject(type)
cy.openTableTab("Country", 25);
cy.screenshot("6b-before");
});
after(() => {
cy.closeTableTab("Country");
cy.screenshot("6b-after");
});
it("Download verification- base view, default columns", () => {

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

@ -67,39 +67,61 @@ export const genTest = (apiType, dbType) => {
// wait to allow time for SWAGGER Library loading to finish
cy.log(Token);
// cy.snip("Swagger");
// validate; API order assumed
cy.get("#operations-tag-Authentication", { timeout: 20000 })
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",
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"
);
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");
});
});
});
@ -111,7 +133,9 @@ export const genTest = (apiType, dbType) => {
cy.get(".auth-btn-wrapper > .authorize").click();
// Response: "Authorized" should exist on DOM
cy.get(".auth-container").contains("Authorized").should("exist");
cy.get(".auth-container")
.contains("Authorized")
.should("exist");
cy.get(".btn-done").click();
// Authorize button is LOCKED now

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

@ -9,7 +9,7 @@ export const genTest = (apiType, dbType) => {
before(() => {
//loginPage.signIn(roles.owner.credentials)
mainPage.toolBarTopLeft(mainPage.HOME).click();
cy.screenshot("6d-1");
cy.screenshot("Debug 6d-1", { overwrite: true });
});
const langVerification = (idx, lang) => {
@ -19,9 +19,12 @@ export const genTest = (apiType, dbType) => {
// toggle menu as per index
cy.get(".nc-menu-translate").click();
cy.snipActiveMenu("Menu_Translation");
cy.getActiveMenu().find(".v-list-item").eq(idx).click();
cy.screenshot("6d-2");
cy.screenshot("Debug 6d-2", { overwrite: true });
// basic validations
// 1. Page title: "My Projects"

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

@ -19,6 +19,7 @@ export const genTest = (apiType, dbType) => {
.last()
.invoke("show")
.click();
cy.snipActiveModal("Modal_StopProject");
cy.contains("Submit").closest("button").click();
cy.toastWait("stopped successfully");
@ -33,6 +34,8 @@ export const genTest = (apiType, dbType) => {
.last()
.invoke("show")
.click();
cy.snipActiveModal("Modal_StartProject");
cy.contains("Submit").closest("button").click();
cy.toastWait("started successfully");
@ -41,11 +44,15 @@ export const genTest = (apiType, dbType) => {
it("Restart Project", () => {
if (!isXcdb()) {
//cy.visit('./#/projects')
cy.get(`.nc-${apiType}-project-row .mdi-restart`, { timeout: 10000 })
cy.get(`.nc-${apiType}-project-row .mdi-restart`, {
timeout: 10000,
})
.should("exist")
.last()
.invoke("show")
.click();
cy.snipActiveModal("Modal_RestartProject");
cy.contains("Submit").closest("button").click();
cy.toastWait("restarted successfully");
@ -61,6 +68,8 @@ export const genTest = (apiType, dbType) => {
.last()
.invoke("show")
.click();
cy.snipActiveModal("Modal_DeleteProject");
cy.contains("Submit").closest("button").click();
cy.toastWait("deleted successfully");

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

@ -55,10 +55,13 @@ export const genTest = (apiType, dbType) => {
// click SHARE
cy.get(".nc-topright-menu").find(".nc-menu-share").click();
cy.snipActiveModal("Modal_BaseShare");
// Click on readonly base text
cy.getActiveModal().find(".nc-disable-shared-base").click();
// Select 'Readonly link'
cy.snipActiveMenu("Menu_ShareLink");
cy.getActiveMenu()
.find(".caption")
.contains("Anyone with the link")
@ -104,7 +107,10 @@ style="background: transparent; "></iframe>
cy.getActiveModal().find(".nc-shared-base-role").click();
cy.getActiveMenu().find('[role="menuitem"]').contains("Editor").click();
cy.getActiveMenu()
.find('[role="menuitem"]')
.contains("Editor")
.click();
});
permissionValidation("editor");
@ -118,7 +124,9 @@ style="background: transparent; "></iframe>
// for GQL- additionally close GQL Client window
if (apiType === "graphql") {
cy.iframe().find(`[title="Graphql Client"] > button.mdi-close`).click();
cy.iframe()
.find(`[title="Graphql Client"] > button.mdi-close`)
.click();
}
// validation for base menu opitons
@ -133,7 +141,10 @@ style="background: transparent; "></iframe>
.getIFrameCell("FirstName", 1)
.contains("PENELOPE")
.should("exist");
mainPage.getIFrameCell("LastName", 1).contains("GUINESS").should("exist");
mainPage
.getIFrameCell("LastName", 1)
.contains("GUINESS")
.should("exist");
});
});
};

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

@ -101,11 +101,14 @@ export const genTest = (apiType, dbType) => {
force: true,
});
cy.snipActiveModal("Modal_CreateFromExcel");
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.snip("ExcelImport");
cy.getActiveContentModal()
.find(".v-expansion-panel")
.then((sheets) => {
@ -116,14 +119,18 @@ export const genTest = (apiType, dbType) => {
// expect(blk.text().trim()).to.equal(sheetList[i])
// })
cy.wrap(sheets[i]).contains(sheetList[i]).should("exist");
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")
.should("have.length", 4);
cy.get(".v-data-table")
.find("tr:visible")
@ -134,7 +141,9 @@ export const genTest = (apiType, dbType) => {
.find('[placeholder="Column name"]')
.then((obj) => {
cy.log(obj[0].value);
expect(obj[0].value).to.equal(expectedData[j - 1][0]);
expect(obj[0].value).to.equal(
expectedData[j - 1][0]
);
});
// datatype to match expected output
@ -142,7 +151,9 @@ export const genTest = (apiType, dbType) => {
.find("span.caption")
.then((obj) => {
cy.log(obj[0].innerText);
expect(obj[0].innerText).to.equal(expectedData[j - 1][1]);
expect(obj[0].innerText).to.equal(
expectedData[j - 1][1]
);
});
}
});
@ -217,6 +228,7 @@ export const genTest = (apiType, dbType) => {
force: true,
});
cy.snipActiveModal("Modal_ImportExcelURL");
cy.getActiveModal().find(".caption").contains("URL").click();
cy.get(".nc-excel-import-tab-item")
.find('input[type="url"]')
@ -250,14 +262,20 @@ export const genTest = (apiType, dbType) => {
.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++) {
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]
UrlFileExpectedData[
j - 1
][0]
);
});
@ -266,8 +284,12 @@ export const genTest = (apiType, dbType) => {
.find("span.caption")
.then((obj) => {
cy.log(obj[0].innerText);
expect(obj[0].innerText).to.equal(
UrlFileExpectedData[j - 1][1]
expect(
obj[0].innerText
).to.equal(
UrlFileExpectedData[
j - 1
][1]
);
});
}

64
scripts/cypress/support/commands.js

@ -56,11 +56,13 @@ Cypress.Commands.add("signinOrSignup", (_args) => {
if ($body.find(".welcome-page").length > 0) {
cy.wait(8000);
cy.get("body").trigger("mousemove");
cy.snip("LetsBegin");
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.snip("SignUp");
cy.get('button:contains("SIGN UP")').click();
// handle signin
@ -69,6 +71,7 @@ Cypress.Commands.add("signinOrSignup", (_args) => {
args.username
);
cy.get('input[type="password"]').type(args.password);
cy.snip("SignIn");
cy.get('button:contains("SIGN IN")').click();
}
}
@ -86,6 +89,7 @@ Cypress.Commands.add("openOrCreateRestProject", (_args) => {
// signin/signup
cy.signinOrSignup();
cy.get(".nc-new-project-menu").should("exist");
cy.snip("ProjectPage");
cy.get("body").then(($body) => {
const filter = args.meta
? ".nc-meta-project-row"
@ -164,6 +168,8 @@ Cypress.Commands.add("openTableTab", (tn, rc) => {
if (rc != 0) {
cy.get(".nc-grid-row").should("have.length", rc);
}
cy.snip(`GridView_${tn}`);
});
Cypress.Commands.add("closeTableTab", (tn) => {
@ -254,6 +260,9 @@ Cypress.Commands.add("createTable", (name) => {
// .should("have.value", name.toLowerCase());
// }
cy.snip("CreateTable");
cy.snipActiveModal("Modal_CreateTable");
cy.get(".nc-create-table-card .nc-create-table-submit").first().click();
cy.toastWait(`Create table successful`);
cy.get(`.project-tab:contains(${name})`).should("exist");
@ -271,6 +280,7 @@ Cypress.Commands.add("deleteTable", (name, dbType) => {
.click({ force: true });
cy.get(`.project-tab:contains(${name}):visible`).should("exist");
cy.get(".nc-table-delete-btn:visible").click();
cy.snipActiveModal("Modal_DeleteTable");
cy.get("button:contains(Submit)").click();
// only for postgre project
@ -301,6 +311,7 @@ Cypress.Commands.add("renameTable", (oldName, newName) => {
// feed new name
cy.getActiveContentModal().find("input").clear().type(newName);
cy.snipActiveModal("Modal_RenameTable");
// submit
cy.getActiveContentModal().find("button").contains("Submit").click();
@ -327,6 +338,7 @@ Cypress.Commands.add("createColumn", (table, columnName) => {
force: true,
});
cy.get(".nc-column-name-input input").clear().type(columnName);
cy.getActiveMenu("Menu_CreateColumn");
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.get("th:contains(new_column)").should("exist");
});
@ -375,6 +387,58 @@ Cypress.Commands.add("closeViewsTab", (vn) => {
.click({ force: true });
});
// Support for screen-shots
//
let screenShotDb = [];
// snip entire screen
Cypress.Commands.add("snip", (filename) => {
if (
true === Cypress.env("screenshot") &&
false === screenShotDb.includes(filename)
) {
let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename);
cy.wait(1000);
cy.screenshot(storeName, { overwrite: true });
}
});
// snip current modal
Cypress.Commands.add("snipActiveModal", (filename) => {
if (
true === Cypress.env("screenshot") &&
false === screenShotDb.includes(filename)
) {
let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename);
cy.wait(1000);
// cy.getActiveModal().screenshot(filename, {
// padding: 0,
// overwrite: true,
// });
cy.screenshot(storeName, { overwrite: true });
}
});
// snip current menu
Cypress.Commands.add("snipActiveMenu", (filename) => {
if (
true === Cypress.env("screenshot") &&
false === screenShotDb.includes(filename)
) {
let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename);
cy.wait(1000);
// cy.getActiveMenu().screenshot(filename, {
// padding: 0,
// overwrite: true,
// });
cy.screenshot(storeName, { overwrite: true });
}
});
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853
/*

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

@ -89,19 +89,25 @@ export class _mainPage {
// click on New User button, feed details
cy.get('button:contains("New User")').first().click();
cy.snip("NewUser");
cy.get('label:contains("E-mail")')
.next("input")
.type(userCred.username)
.trigger("input");
cy.get('label:contains("Select User roles")').click();
// opt-in requested role & submit
cy.snipActiveMenu("Menu_RoleType");
cy.getActiveMenu().contains(roleType).click();
cy.get(".nc-invite-or-save-btn").click();
cy.toastWait("Successfully updated the user details");
// get URL, invoke
cy.snipActiveModal("Modal_NewUserURL");
cy.getActiveModal()
.find(".v-alert")
.then(($obj) => {
@ -257,6 +263,9 @@ export class _mainPage {
hideField = (field) => {
cy.get(".nc-grid-header-cell").contains(field).should("be.visible");
cy.get(".nc-fields-menu-btn").click();
cy.snipActiveMenu("Menu_HideField");
cy.get(
`.menuable__content__active .v-list-item label:contains(${field})`
).click();
@ -277,11 +286,16 @@ export class _mainPage {
sortField = (field, criteria) => {
cy.get(".nc-sort-menu-btn").click();
cy.contains("Add Sort Option").click();
cy.snipActiveMenu("Menu_SortField");
cy.get(".nc-sort-field-select div").first().click();
cy.snipActiveMenu("Menu_SortField_fieldSelection");
cy.get(`.menuable__content__active .v-list-item:contains(${field})`)
.first()
.click();
cy.get(".nc-sort-dir-select div").first().click();
cy.snipActiveMenu("Menu_SortField_criteriaSelection");
cy.get(
`.menuable__content__active .v-list-item:contains(${criteria})`
).click();
@ -297,13 +311,18 @@ export class _mainPage {
filterField = (field, operation, value) => {
cy.get(".nc-filter-menu-btn").click();
cy.contains("Add Filter").click();
cy.snipActiveMenu("Menu_FilterField");
cy.get(".nc-filter-field-select").last().click();
cy.snipActiveMenu("Menu_FilterField-fieldSelect");
cy.getActiveMenu()
.find(`.v-list-item:contains(${field})`)
.first()
.click();
cy.get(".nc-filter-operation-select").last().click();
cy.snipActiveMenu("Menu_FilterField-operationSelect");
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")
@ -343,6 +362,8 @@ export class _mainPage {
// cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
this.shareViewList().click();
cy.snipActiveModal("Modal_ShareViewList");
cy.wait(1000);
// cy.get('.container').find('button.mdi-delete-outline')
@ -379,6 +400,7 @@ export class _mainPage {
//
downloadAndVerifyCsv = (filename, verifyCsv) => {
cy.get(".nc-actions-menu-btn").click();
cy.snipActiveMenu("Menu_ActionsMenu");
cy.get(
`.menuable__content__active .v-list-item span:contains("Download as CSV")`
).click();
@ -422,6 +444,9 @@ export class _mainPage {
// open Project metadata tab
//
this.navigationDraw(this.PROJ_METADATA).click();
cy.snip("Meta_Tab0");
cy.get(".nc-meta-mgmt-metadata-tab")
.should("exist")
.click({ force: true });
@ -429,6 +454,8 @@ export class _mainPage {
cy.get(".nc-meta-mgmt-metadata-tab")
.should("exist")
.click({ force: true });
cy.snip("Meta_Tab1");
}
closeMetaTab() {

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

@ -141,6 +141,8 @@ export class _projectsPage {
cy.contains("GRAPHQL APIs").closest("label").click();
}
cy.snip("XcdbCreate");
// Submit
cy.contains("button", "Create", { timeout: 20000 }).click();
@ -211,15 +213,21 @@ export class _projectsPage {
.clear()
.type(cred.databaseName);
cy.snip("ExtDbCreate");
// Test database connection
cy.contains("Test Database Connection", { timeout: 20000 }).click();
cy.snipActiveModal("Modal_OK_SaveProject");
// Create project
cy.contains("Ok & Save Project", { timeout: 20000 }).click();
// takes a while to load project
this.waitHomePageLoad();
cy.snip("Team&Auth_UserMgmt");
return projectName;
}
}

Loading…
Cancel
Save