Skip to content

Commit

Permalink
15/07 Daily Promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
abhvsn authored Jul 15, 2024
2 parents e6a3136 + b2c850b commit 829df72
Show file tree
Hide file tree
Showing 24 changed files with 301 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ jobs:
scripts/generate_info_json.sh
fi
- name: Place server artifacts-es
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
scripts/prepare_server_artifacts.sh
fi
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
propPane,
table,
} from "../../../../../support/Objects/ObjectsCore";
const commonlocators = require("../../../../../locators/commonlocators.json");

describe("Basic flow ", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
before(() => {
_.agHelper.RestoreLocalStorageCache();
_.agHelper.AddDsl("Table/InlineEditingDSL");
agHelper.RestoreLocalStorageCache();
agHelper.AddDsl("Table/InlineEditingDSL");
});

it("1.1. should test that allow Add new row property is present", () => {
cy.openPropertyPane("tablewidgetv2");
cy.get(".t--property-control-allowaddingarow").should("exist");
cy.get(".t--property-control-allowaddingarow input").should("exist");
cy.get(".t--add-new-row").should("not.exist");
_.propPane.TogglePropertyState("Allow adding a row", "Off", null);
propPane.TogglePropertyState("Allow adding a row", "Off", null);
cy.get(".t--add-new-row").should("not.exist");
cy.get(".t--property-control-onsave").should("not.exist");
cy.get(".t--property-control-ondiscard").should("not.exist");
cy.get(".t--property-control-defaultvalues").should("not.exist");
// onSave, onDiscard and default row are showing up only when the allow add new property is enabled
_.propPane.TogglePropertyState("Allow adding a row", "On");
propPane.TogglePropertyState("Allow adding a row", "On");
cy.get(".t--add-new-row").should("exist");
cy.get(".t--property-control-onsave").should("exist");
cy.get(".t--property-control-ondiscard").should("exist");
cy.get(".t--property-control-defaultvalues").should("exist");
cy.get(".t--add-new-row.disabled").should("not.exist");
// add new row link is disabled during the inline editing flow
cy.makeColumnEditable("step");
table.toggleColumnEditableViaColSettingsPane("step");
cy.editTableCell(0, 0);
cy.get(".t--add-new-row.disabled").should("exist");
cy.openPropertyPane("tablewidgetv2");
Expand Down Expand Up @@ -98,15 +102,15 @@ describe("Basic flow ", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
cy.get(`[data-colindex=1][data-rowindex=0] .t--inlined-cell-editor`).should(
"not.exist",
);
cy.makeColumnEditable("task");
table.toggleColumnEditableViaColSettingsPane("task");
cy.get(`[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor`).should(
"exist",
);
cy.get(`[data-colindex=1][data-rowindex=0] .t--inlined-cell-editor`).should(
"exist",
);
cy.makeColumnEditable("step");
cy.makeColumnEditable("task");
table.toggleColumnEditableViaColSettingsPane("step", "v2", false);
table.toggleColumnEditableViaColSettingsPane("task", "v2", false);
cy.get(`[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor`).should(
"not.exist",
);
Expand All @@ -116,8 +120,8 @@ describe("Basic flow ", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
});

it("1.5. should test that newRow property holds the entered data", () => {
cy.makeColumnEditable("step");
cy.makeColumnEditable("task");
table.toggleColumnEditableViaColSettingsPane("step");
table.toggleColumnEditableViaColSettingsPane("task");
cy.enterTableCellValue(0, 0, "22");
cy.enterTableCellValue(1, 0, "21");
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 600 });
Expand All @@ -131,7 +135,7 @@ describe("Basic flow ", { tags: ["@tag.Widget", "@tag.Table"] }, () => {

it("1.6. should test that non data (iconBitton, button, menubutton) column cells are not showing up", () => {
cy.openPropertyPane("tablewidgetv2");
cy.editColumn("step");
table.toggleColumnEditableViaColSettingsPane("step", "v2", false, false);
["Button", "Menu button", "Icon button"].forEach((columnType) => {
cy.get(commonlocators.changeColType).last().click();
cy.get(".t--dropdown-option").children().contains(columnType).click();
Expand All @@ -151,22 +155,22 @@ describe("Basic flow ", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
"Allow filtering",
"Allow adding a row",
].forEach((val) => {
_.propPane.TogglePropertyState(val, "Off");
propPane.TogglePropertyState(val, "Off");
});
cy.wait(1000);

//intially enable 2 sections to show pagination and "add new row" button to the header section
_.propPane.TogglePropertyState("Show pagination", "On");
_.propPane.TogglePropertyState("Allow adding a row", "On");
propPane.TogglePropertyState("Show pagination", "On");
propPane.TogglePropertyState("Allow adding a row", "On");

//"add new row" button should be present
cy.get(".t--add-new-row").should("exist");
//turn off pagination and now the "add new row" button should be the only component left in the header section
_.propPane.TogglePropertyState("Show pagination", "Off");
propPane.TogglePropertyState("Show pagination", "Off");
//"add new row" should continue to be present
cy.get(".t--add-new-row").should("exist");
//finally turn off allow adding a row then the "add new row" button should be removed from the header section
_.propPane.TogglePropertyState("Allow adding a row", "Off");
propPane.TogglePropertyState("Allow adding a row", "Off");
cy.get(".t--add-new-row").should("not.exist");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ describe("Validation flow", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
cy.openPropertyPane("tablewidgetv2");
_.propPane.TogglePropertyState("Allow adding a row", "On");
cy.get(".t--add-new-row").click();
cy.makeColumnEditable("step");
cy.editColumn("step");
_.table.toggleColumnEditableViaColSettingsPane("step", "v2", true, false);

_.propPane.UpdatePropertyFieldValue("Valid", "{{editedValue === '#1'}}");
cy.wait(500);
Expand Down Expand Up @@ -124,9 +123,7 @@ describe("Validation flow", { tags: ["@tag.Widget", "@tag.Table"] }, () => {
_.propPane.UpdatePropertyFieldValue("Valid", "{{editedValue === 1}}");
cy.get("[data-testid='t--property-pane-back-btn']").click();
cy.wait(500);
cy.makeColumnEditable("task");
cy.editColumn("task");
cy.wait(500);
_.table.toggleColumnEditableViaColSettingsPane("task", "v2", true, false);
_.propPane.UpdatePropertyFieldValue(
"Valid",
"{{editedValue === 'invalid'}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ describe(
"and check that date cell edit mode can be turned on",
() => {
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
agHelper.AssertElementEnabledDisabled(
table._columnCheckbox("release_date"),
0,
false,
);
table.EditColumn("release_date", "v2");
propPane.AssertPropertySwitchState("Editable", "disabled");
propPane.TogglePropertyState("Editable", "On");
agHelper.Sleep(1000);
agHelper.AssertElementVisibility(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const commonlocators = require("../../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
import { agHelper } from "../../../../../support/Objects/ObjectsCore";
import { agHelper, table } from "../../../../../support/Objects/ObjectsCore";

describe(
"Table widget inline editing functionality",
Expand All @@ -17,174 +16,7 @@ describe(

let propPaneBack = "[data-testid='t--property-pane-back-btn']";

it("1. should check that edit check box is present in the columns list", () => {
cy.openPropertyPane("tablewidgetv2");

["step", "task", "status", "action"].forEach((column) => {
cy.get(
`[data-rbd-draggable-id="${column}"] .t--card-checkbox input[type="checkbox"]`,
).should("exist");
});
});

it("2. should check that editablity checkbox is preset top of the list", () => {
cy.openPropertyPane("tablewidgetv2");
cy.get(`.t--property-control-columns .t--uber-editable-checkbox`).should(
"exist",
);
});

it("3. should check that turning on editablity turns on edit in all the editable column in the list", () => {
cy.openPropertyPane("tablewidgetv2");
function checkEditableCheckbox(expected) {
["step", "task", "status"].forEach((column) => {
cy.get(
`[data-rbd-draggable-id="${column}"] .t--card-checkbox.t--checked`,
).should(expected);
});
}

checkEditableCheckbox("not.exist");

cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();

checkEditableCheckbox("exist");

cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();

checkEditableCheckbox("not.exist");
});

it("4. should check that turning on editablity DOESN'T turn on edit in the non editable column in the list", () => {
cy.openPropertyPane("tablewidgetv2");
cy.get(
'[data-rbd-draggable-id="action"] .t--card-checkbox.t--checked',
).should("not.exist");
cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();
cy.get(
'[data-rbd-draggable-id="action"] .t--card-checkbox.t--checked',
).should("not.exist");
cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();
cy.get(
'[data-rbd-draggable-id="action"] .t--card-checkbox.t--checked',
).should("not.exist");
});

it("5. should check that checkbox in the column list and checkbox inside the column settings ARE in sync", () => {
cy.openPropertyPane("tablewidgetv2");
cy.get(
'[data-rbd-draggable-id="step"] .t--card-checkbox.t--checked',
).should("not.exist");
cy.editColumn("step");
cy.get(".t--property-control-editable .ads-v2-switch.checked").should(
"not.exist",
);
cy.get(propPaneBack).click();
cy.get(
'[data-rbd-draggable-id="step"] .t--card-checkbox input+span',
).click();
cy.get(
'[data-rbd-draggable-id="step"] .t--card-checkbox.t--checked',
).should("exist");
cy.editColumn("step");
cy.get(".t--property-control-editable")
.find("input")
.should("have.attr", "checked");
cy.get(propPaneBack).click();
cy.get(
'[data-rbd-draggable-id="step"] .t--card-checkbox input+span',
).click();
cy.get(
'[data-rbd-draggable-id="step"] .t--card-checkbox.t--checked',
).should("not.exist");
cy.editColumn("step");
cy.get(".t--property-control-editable .ads-v2-switch.checked").should(
"not.exist",
);
});

it("6. should check that checkbox in the column list and checkbox inside the column settings ARE NOT in sync when there is js expression", () => {
cy.openPropertyPane("tablewidgetv2");
cy.editColumn("step");
cy.get(".t--property-control-editable .t--js-toggle").click();
cy.updateCodeInput(".t--property-control-editable", `{{true === true}}`);
cy.get(propPaneBack).click();
cy.makeColumnEditable("step");
cy.editColumn("step");
cy.get(
".t--property-control-editable .CodeMirror .CodeMirror-code",
).should("contain", "{{true === true}}");
cy.get(propPaneBack).click();
cy.makeColumnEditable("step");
cy.editColumn("step");
cy.get(
".t--property-control-editable .CodeMirror .CodeMirror-code",
).should("contain", "{{true === true}}");
});

it("7. should check that editable checkbox is disabled for columns that are not editable", () => {
cy.openPropertyPane("tablewidgetv2");
[
{
columnType: "URL",
expected: "be.disabled",
},
{
columnType: "Number",
expected: "not.be.disabled",
},
{
columnType: "Date",
expected: "not.be.disabled",
},
{
columnType: "Image",
expected: "be.disabled",
},
{
columnType: "Video",
expected: "be.disabled",
},
{
columnType: "Button",
expected: "be.disabled",
},
{
columnType: "Menu button",
expected: "be.disabled",
},
{
columnType: "Icon button",
expected: "be.disabled",
},
{
columnType: "Plain text",
expected: "not.be.disabled",
},
].forEach((data) => {
cy.editColumn("step");
cy.get(commonlocators.changeColType).last().click();
cy.get(".t--dropdown-option")
.children()
.contains(data.columnType)
.click();
cy.wait("@updateLayout");
cy.get(propPaneBack).click();
cy.get(`[data-rbd-draggable-id="step"] .t--card-checkbox input`).should(
data.expected,
);
});
});

it("8. should check that editable property is only available for Plain text & number columns", () => {
it("1. should check that editable property is only available for Plain text & number columns", () => {
cy.openPropertyPane("tablewidgetv2");
cy.editColumn("step");
[
Expand Down Expand Up @@ -235,12 +67,13 @@ describe(
});
});

it("9. should check that inline save option is shown only when a column is made editable", () => {
it("2. should check that inline save option is shown only when a column is made editable", () => {
cy.openPropertyPane("tablewidgetv2");
cy.get(".t--property-control-updatemode").should("not.exist");
cy.makeColumnEditable("step");

table.toggleColumnEditableViaColSettingsPane("step", "v2", true, true);
cy.get(".t--property-control-updatemode").should("exist");
cy.makeColumnEditable("step");
table.toggleColumnEditableViaColSettingsPane("step", "v2", false, true);
cy.get(".t--property-control-updatemode").should("exist");

cy.dragAndDropToCanvas("textwidget", { x: 300, y: 600 });
Expand All @@ -255,32 +88,17 @@ describe(
);
});

it("10. should check that save/discard column is added when a column is made editable and removed when made uneditable", () => {
it("3. should check that save/discard column is added when a column is made editable and removed when made uneditable", () => {
cy.openPropertyPane("tablewidgetv2");
cy.makeColumnEditable("step");
cy.get("[data-rbd-draggable-id='EditActions1']").should("exist");
cy.get(
"[data-rbd-draggable-id='EditActions1'] input[type='text']",
).should("contain.value", "Save / Discard");
cy.get("[data-colindex='4'][data-rowindex='0'] button").should(
"be.disabled",
);
cy.makeColumnEditable("step");
cy.get("[data-rbd-draggable-id='EditActions1']").should("not.exist");

cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();
table.toggleColumnEditableViaColSettingsPane("step", "v2", true, true);
cy.get("[data-rbd-draggable-id='EditActions1']").should("exist");
cy.get(
"[data-rbd-draggable-id='EditActions1'] input[type='text']",
).should("contain.value", "Save / Discard");
cy.get("[data-colindex='4'][data-rowindex='0'] button").should(
"be.disabled",
);
cy.get(
`.t--property-control-columns .t--uber-editable-checkbox input+span`,
).click();
table.toggleColumnEditableViaColSettingsPane("step", "v2", false, true);
cy.get("[data-rbd-draggable-id='EditActions1']").should("not.exist");

cy.editColumn("step");
Expand Down
Loading

0 comments on commit 829df72

Please sign in to comment.