Browse Source

test(cypress): test suite/table operations - alignment for UI changes

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/959/head
Raju Udava 3 years ago
parent
commit
8d679e944b
  1. 2
      packages/nc-gui/components/ProjectTreeView.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/shareViewMenu.vue
  3. 10
      scripts/cypress/integration/common/1d_table_view_drag_drop_reorder.js
  4. 83
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  5. 11
      scripts/cypress/integration/common/3b_formula_column.js
  6. 2
      scripts/cypress/integration/common/3d_rollup_column.js
  7. 11
      scripts/cypress/integration/common/4b_table_view_share.js
  8. 9
      scripts/cypress/integration/common/4e_form_view_share.js
  9. 26
      scripts/cypress/integration/common/4f_grid_view_share.js
  10. 11
      scripts/cypress/integration/common/6f_attachments.js
  11. 44
      scripts/cypress/support/page_objects/mainPage.js

2
packages/nc-gui/components/ProjectTreeView.vue

@ -480,7 +480,7 @@
<v-tooltip bottom>
<template #activator="{ on }">
<v-list-item dense class="body-2 nc-settings-projmeta" @click="openAuditTab" v-on="on">
<v-list-item dense class="body-2 nc-settings-audit" @click="openAuditTab" v-on="on">
<v-list-item-icon>
<v-icon x-small>
mdi-notebook-outline

2
packages/nc-gui/components/project/spreadsheet/components/shareViewMenu.vue

@ -8,7 +8,7 @@
<template #activator="{on}">-->
<v-btn
outlined
class="nc-actions-menu-btn caption px-2 nc-remove-border font-weight-medium"
class="nc-btn-share-view caption px-2 nc-remove-border font-weight-medium"
small
text
@click="$emit('share')"

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

@ -22,11 +22,11 @@ export const genTest = (type, xcdb) => {
it(`Table & SQL View list, Drag/drop`, () => {
// expand tree-view menu
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.should("exist")
.first()
.click({ force: true });
// cy.get(".nc-project-tree")
// .find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
// .should("exist")
// .first()
// .click({ force: true });
validateTreeField(1, "Actor");

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

@ -128,24 +128,27 @@ export const genTest = (type, xcdb) => {
describe(`Sort operations`, () => {
it("Enable sort", () => {
mainPage.sortField('Country', "Z -> A")
// 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.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.get(".nc-sort-item-remove-btn").click();
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
});
@ -155,46 +158,52 @@ export const genTest = (type, xcdb) => {
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(".nc-fields-menu-btn").click();
// cy.get(
// ".menuable__content__active .v-list-item label:contains(LastUpdate)"
// ).click();
// cy.get(".nc-fields-menu-btn").click();
mainPage.hideField('LastUpdate')
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(".nc-fields-menu-btn").click();
// cy.get(
// ".menuable__content__active .v-list-item label:contains(LastUpdate)"
// ).click();
// cy.get(".nc-fields-menu-btn").click();
mainPage.unhideField('LastUpdate')
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");
});
mainPage.filterField('Country', 'is equal', 'India');
cy.get("td:contains(India)").should("exist");
// 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");
// });
});
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();
mainPage.filterReset();
// 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");
});
});

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

@ -45,17 +45,17 @@ export const genTest = (type, xcdb) => {
// Column name
cy.get(".nc-column-name-input input")
.clear()
.type(`${columnName}{enter}`);
.type(`${columnName}`);
// 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);
cy.get("label").contains("Formula").parent().click().type(formula).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({ force: true });
cy.toastWait("Formula column saved successfully");
@ -103,9 +103,10 @@ export const genTest = (type, xcdb) => {
.parent()
.find("input")
.clear()
.type(newFormula);
.type(newFormula)
.click();
cy.get(".nc-col-create-or-edit-card").contains("Save").click();
cy.get(".nc-col-create-or-edit-card").contains("Save").click({force: true});
cy.toastWait("Formula column updated successfully");

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

@ -38,7 +38,7 @@ export const genTest = (type, xcdb) => {
// Column name
cy.get(".nc-column-name-input input")
.clear()
.type(`${columnName}{enter}`);
.type(`${columnName}`);
// 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)

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

@ -5,11 +5,12 @@ let storedURL = "";
let linkText = "";
const generateLinkWithPwd = () => {
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .click();
mainPage.shareView().click();
// enable checkbox & feed pwd, save
cy.getActiveModal()
.find('[role="switch"][type="checkbox"]')

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

@ -81,10 +81,11 @@ export const genTest = (type, xcdb) => {
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();
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .click();
mainPage.shareView().click();
// copy link text, visit URL
cy.getActiveModal()

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

@ -16,10 +16,11 @@ export const genTest = (type, xcdb) => {
const generateViewLink = (viewName) => {
// click on share view
cy.get(".v-navigation-drawer__content > .container")
.find(".v-list > .v-list-item")
.contains("Share View")
.click();
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .click();
mainPage.shareView().click();
// wait, as URL initially will be /undefined
cy.getActiveModal()
@ -96,14 +97,15 @@ export const genTest = (type, xcdb) => {
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(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .parent()
// .find("button.mdi-dots-vertical")
// .click();
mainPage.shareViewList().click();
// cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
cy.get('th:contains("View Link")').should("exist");

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

@ -53,11 +53,12 @@ export const genTest = (type, xcdb) => {
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();
mainPage.shareView().click();
// copy link text, visit URL
cy.getActiveModal()

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

@ -64,7 +64,7 @@ export class _mainPage {
switch (item) {
case this.AUDIT:
return cy.get(".nc-treeview-item-Audit");
return cy.get(".nc-settings-audit");
case this.APPSTORE:
return cy.get(".nc-settings-appstore");
case this.TEAM_N_AUTH:
@ -229,6 +229,30 @@ export class _mainPage {
cy.toastWait("Plugin uninstalled successfully");
};
shareView = () => {
return cy.get('.nc-btn-share-view');
}
shareViewList = () => {
cy.get('.nc-actions-menu-btn').click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(2);
}
downloadCsv = () => {
cy.get('.nc-actions-menu-btn').click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(0);
}
uploadCsv = () => {
cy.get('.nc-actions-menu-btn').click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(1);
}
automations = () => {
cy.get('.nc-actions-menu-btn').click();
return cy.getActiveMenu().find('[role="menuitem"]').eq(3);
}
hideField = (field) => {
cy.get(".nc-grid-header-cell").contains(field).should("be.visible");
cy.get(".nc-fields-menu-btn").click();
@ -279,6 +303,7 @@ export class _mainPage {
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-operation-select").last().click();
}
cy.get(".nc-filter-field-select")
@ -302,14 +327,15 @@ export class _mainPage {
// 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.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();
this.shareViewList().click();
cy.wait(1000);

Loading…
Cancel
Save