Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test:replace assertPageSave with AssertAutoSave #33972

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe(
cy.get(commonlocators.singleSelectMenuItem)
.contains(pageid)
.click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace function expression with an arrow function for consistency and potential performance benefits.

- function () {
+ () => {

Committable suggestion was skipped due to low confidence.

});

it("3. Validate NavigateTo Page functionality ", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe(
cy.get(commonlocators.singleSelectMenuItem)
.contains(pageid)
.click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
});

it("2. Validate NavigateTo Page functionality ", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe(
cy.get(commonlocators.singleSelectMenuItem)
.contains(pageid)
.click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace function expression with an arrow function for consistency and potential performance benefits.

- function () {
+ () => {

Committable suggestion was skipped due to low confidence.

//Validate NavigateTo Page functionality
cy.wait(2000);
deployMode.DeployApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe(
});
});
cy.wait("@blockImport").then(() => {
cy.assertPageSave();
agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace any with a more specific type to enhance type safety.

- const option = {
-   eventConstructor: "MouseEvent",
-   scrollBehavior: false,
- } as any;
+ const option: MouseEventInit = {
+   eventConstructor: "MouseEvent",
+   scrollBehavior: false,
+ };

Committable suggestion was skipped due to low confidence.

// check that the widgets are present on the canvas
agHelper.AssertElementVisibility('[data-testid="t--ide-list"]');
agHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ describe("App Theming funtionality", { tags: ["@tag.Theme"] }, function () {
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
cy.get(commonlocators.changeThemeBtn).click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
// select a theme
cy.get(commonlocators.themeCard).last().click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
// check for alert
cy.get(`${commonlocators.themeCard}`)
.last()
Expand Down Expand Up @@ -81,7 +81,7 @@ describe("App Theming funtionality", { tags: ["@tag.Theme"] }, function () {

// change app border radius
cy.get(commonlocators.themeAppBorderRadiusBtn).eq(1).click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
// check if border radius is changed on button
cy.get(commonlocators.themeAppBorderRadiusBtn)
.eq(1)
Expand Down Expand Up @@ -656,7 +656,7 @@ describe("App Theming funtionality", { tags: ["@tag.Theme"] }, function () {
"rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px",
);

cy.assertPageSave();
agHelper.AssertAutoSave();

//Add deploy mode verification here also!
deployMode.DeployApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe(
//Changing the text on the Button
cy.testJsontext("label", this.dataSet.ButtonLabel);

cy.assertPageSave();
_.agHelper.AssertAutoSave();

//Verify the Button name and label
cy.get(widgetsPage.buttonWidget).trigger("mouseover");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { agHelper } from "../../../../../support/Objects/ObjectsCore";

const widgetName = "inputwidgetv2";
const widgetInput = `.t--widget-${widgetName} input`;

Expand Down Expand Up @@ -364,7 +366,7 @@ describe("Input widget V2 - ", { tags: ["@tag.Widget", "@tag.Input"] }, () => {
".t--property-control-text",
"{{appsmith.store.textPayloadOnSubmit}}",
);
cy.assertPageSave();
agHelper.AssertAutoSave();

cy.closePropertyPane();
cy.get(widgetInput).clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe(
x: 250,
y: 50,
});
cy.assertPageSave();
_.agHelper.AssertAutoSave();

// Verify drop
cy.get(publishLocators.inputWidget).should("exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe(
entityExplorer.DragDropWidgetNVerify(widget);
//cy.dragAndDropToWidget(widget, "listwidgetv2", { x: 350, y: 50 });
agHelper.GetNClick(propPane._deleteWidget);
cy.assertPageSave();
agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace function expression with an arrow function for consistency and potential performance benefits.

- function () {
+ () => {

Also applies to: 89-92

Committable suggestion was skipped due to low confidence.

cy.wait(800);
});
},
Expand All @@ -86,10 +86,10 @@ describe(
entityExplorer.DragDropWidgetNVerify(widget);

//cy.dragAndDropToWidget(widget, "listwidgetv2", { x: 350, y: 50 });
cy.assertPageSave();
agHelper.AssertAutoSave();
cy.get(`.t--draggable-${widget}`).should("exist");
cy.get(widgetsPage.removeWidget).click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
cy.wait(800);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("Tab widget test", { tags: ["@tag.Widget", "@tag.Tab"] }, function () {
cy.get(Layoutpage.tabContainer)
.scrollIntoView({ easing: "linear" })
.should("be.visible");
cy.assertPageSave();
agHelper.AssertAutoSave();
deployMode.DeployApp();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe(
// select the green color

cy.wait("@updateLayout");
cy.assertPageSave();
_.agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace function expression with an arrow function for consistency and potential performance benefits.

- function () {
+ () => {

Also applies to: 59-59

Committable suggestion was skipped due to low confidence.

_.deployMode.DeployApp();
cy.wait(4000);

Expand All @@ -56,7 +56,7 @@ describe(
.clear({ force: true })
.type("purple", { force: true, delay: 0 });
cy.wait("@updateLayout");
cy.assertPageSave();
_.agHelper.AssertAutoSave();
_.deployMode.DeployApp();
cy.wait(4000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe(
// select the green color

cy.wait("@updateLayout");
cy.assertPageSave();
_.agHelper.AssertAutoSave();
_.deployMode.DeployApp();
cy.wait(4000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const testdata = require("../../../../fixtures/testdata.json");
const apiwidget = require("../../../../locators/apiWidgetslocator.json");

import {
agHelper,
apiPage,
entityExplorer,
} from "../../../../support/Objects/ObjectsCore";
Expand All @@ -20,7 +21,7 @@ describe(
cy.Createpage("SecondPage");
cy.CreateAPI("FirstAPI");
cy.enterDatasourceAndPath(testdata.baseUrl, "{{ '/random' }}");
cy.assertPageSave();
agHelper.AssertAutoSave();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace function expression with an arrow function for consistency and potential performance benefits.

- function () {
+ () => {

Committable suggestion was skipped due to low confidence.

cy.get("body").click(0, 0);
PageLeftPane.switchSegment(PagePaneSegment.Queries);
entityExplorer.ActionContextMenuByEntityName({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe(
widgetsPage.inputWidget,
widgetsPage.widgetNameSpan,
);
cy.assertPageSave();
agHelper.AssertAutoSave();
},
);

Expand All @@ -85,7 +85,7 @@ describe(
widgetsPage.inputWidget,
widgetsPage.widgetNameSpan,
);
cy.assertPageSave();
agHelper.AssertAutoSave();
},
);

Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/ApiCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Cypress.Commands.add("enterDatasource", (datasource) => {
.type(datasource, { parseSpecialCharSequences: false });
//.type("{esc}}");
cy.wait(2000);
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add("ResponseStatusCheck", (statusCode) => {
Expand Down
12 changes: 1 addition & 11 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
.trigger("mousemove", x, y, option)
.trigger("mousemove", x, y, option)
.trigger("mouseup", x, y, option);
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add(
Expand Down Expand Up @@ -919,16 +919,6 @@ Cypress.Commands.add("CheckForPageSaveError", () => {
});
});

Cypress.Commands.add("assertPageSave", (validateSavedState = true) => {
if (validateSavedState) {
cy.CheckForPageSaveError();
cy.get(commonlocators.saveStatusContainer).should("not.exist", {
timeout: 30000,
});
}
//assertHelper.AssertNetworkStatus("@sucessSave", 200);
});

Cypress.Commands.add(
"validateCodeEditorContent",
(selector, contentToValidate) => {
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/gitSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Cypress.Commands.add("latestDeployPreview", () => {
// Wait before publish
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.assertPageSave();
agHelper.AssertAutoSave();

// Stubbing window.open to open in the same tab
cy.window().then((window) => {
Expand Down
16 changes: 8 additions & 8 deletions app/client/cypress/support/widgetCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Cypress.Commands.add("createModal", (ModalName, property) => {
cy.wait(2000);
cy.get(modalWidgetPage.createModalButton).click({ force: true });
cy.wait(3000);
cy.assertPageSave();
agHelper.AssertAutoSave();
// changing the model name verify
// cy.widgetText(
// ModalName,
Expand All @@ -162,7 +162,7 @@ Cypress.Commands.add("createModal", (ModalName, property) => {
cy.testCodeMirror(ModalName);
cy.moveToStyleTab();
cy.xpath(widgetsPage.textCenterAlign).first().click({ force: true });
cy.assertPageSave();
agHelper.AssertAutoSave();
cy.get(".bp3-overlay-backdrop").last().click({ force: true });
});

Expand All @@ -186,14 +186,14 @@ Cypress.Commands.add("CheckWidgetProperties", (checkboxCss) => {
cy.get(checkboxCss).check({
force: true,
});
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add("UncheckWidgetProperties", (checkboxCss) => {
cy.get(checkboxCss).uncheck({
force: true,
});
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add("EditWidgetPropertiesUsingJS", (checkboxCss, inputJS) => {
Expand All @@ -202,7 +202,7 @@ Cypress.Commands.add("EditWidgetPropertiesUsingJS", (checkboxCss, inputJS) => {
.should("exist")
.dblclick({ force: true })
.type(inputJS);
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add(
Expand All @@ -228,7 +228,7 @@ Cypress.Commands.add("verifyUpdatedWidgetName", (text, txtToVerify) => {
.click({ force: true })
.type(text)
.type("{enter}");
cy.assertPageSave();
agHelper.AssertAutoSave();
if (!txtToVerify) cy.get(".editable-text-container").contains(text);
else cy.get(".editable-text-container").contains(txtToVerify);
cy.wait(2000); //for widget name to reflect!
Expand Down Expand Up @@ -840,7 +840,7 @@ Cypress.Commands.add("SetDateToToday", () => {
cy.get(".react-datepicker .react-datepicker__day--today").click({
force: true,
});
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add("enterActionValue", (value, property) => {
Expand Down Expand Up @@ -916,7 +916,7 @@ Cypress.Commands.add("enterNavigatePageName", (value) => {

Cypress.Commands.add("ClearDate", () => {
cy.get(".t--property-control-defaultdate input").clear();
cy.assertPageSave();
agHelper.AssertAutoSave();
});

Cypress.Commands.add("ClearDateFooter", () => {
Expand Down
Loading