Skip to content

Commit

Permalink
fix: Fall of the error toasts wall (#35839)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetunandu committed Sep 5, 2024
1 parent 5aa9392 commit 65eb854
Show file tree
Hide file tree
Showing 62 changed files with 465 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe("storeValue Action test", { tags: ["@tag.JS"] }, () => {
});
agHelper.ClickButton("Test store logs");

debuggerHelper.ClickDebuggerIcon();
debuggerHelper.OpenDebugger();
debuggerHelper.ClickLogsTab();
debuggerHelper.changeLogsGroup("System logs");
debuggerHelper.DoesConsoleLogExist("storeValue('xyz', '123', true)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
draggableWidgets,
fakerHelper,
dataManager,
debuggerHelper,
} from "../../../../support/Objects/ObjectsCore";

const widgetsToTest = {
Expand Down Expand Up @@ -180,8 +181,18 @@ Object.entries(widgetsToTest).forEach(([widgetSelector, testConfig], index) => {
agHelper.GetNClick(locators._widgetInputSelector(widgetSelector));
agHelper.PressDelete();

//Since widget is removed & Button is still holding its reference
debuggerHelper.AssertDebugError(
`'${testConfig.widgetPrefixName}1' is not defined.`,
"",
true,
false,
);
debuggerHelper.CloseBottomBar();
agHelper.GetNClick(getWidgetSelector(draggableWidgets.BUTTON));
agHelper.AssertContains("is not defined"); //Since widget is removed & Button is still holding its reference
agHelper.ValidateToastMessage(
`${testConfig.widgetPrefixName}1 is not defined`,
);
agHelper.PressDelete();

agHelper.GetNClick(getWidgetSelector(draggableWidgets.TEXT)).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe(
deployMode.NavigateBacktoEditor();

//verify runAstros triggered on PageLaoad of Edit page!
debuggerHelper.ClickDebuggerIcon();
debuggerHelper.OpenDebugger();
debuggerHelper.ClickLogsTab();
debuggerHelper.DebuggerLogsFilter("JSObject1.runAstros");
debuggerHelper.DoesConsoleLogExist("JS Function executed successfully");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(
apiPage.EnterHeader("test", "test");
debuggerHelper.AssertErrorCount(1);
EditorNavigation.ShowCanvas();
debuggerHelper.ClickDebuggerIcon();
debuggerHelper.OpenDebugger();
debuggerHelper.ClicklogEntityLink();

agHelper.AssertElementVisibility(apiPage._nextCursorValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("JSObjects", () => {
shouldCreateNewJSObj: true,
});

debuggerHelper.ClickDebuggerIcon();
debuggerHelper.OpenDebugger();
debuggerHelper.ClicklogEntityLink();
agHelper.AssertCursorInput(".js-editor", { ch: 20, line: 6 });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ describe(
);
debuggerHelper.AssertErrorCount(2);

debuggerHelper.ClickDebuggerIcon();
debuggerHelper.ClicklogEntityLink();
debuggerHelper.OpenDebugger();
agHelper.AssertElementVisibility(
".t--actionConfiguration\\.formData\\.limitDocuments\\.data",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(
_.debuggerHelper.AssertErrorCount(1);
_.propPane.ToggleSection("general");
_.agHelper.AssertElementAbsence("animateloading");
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.propPane.AssertIfPropertyIsVisible("animateloading");

Expand All @@ -28,7 +28,7 @@ describe(
_.propPane.EnterJSContext("visible", "{{test}}", true, false);
_.debuggerHelper.AssertErrorCount(1);
_.propPane.NavigateBackToPropertyPane();
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "Tab 2");
_.propPane.AssertIfPropertyIsVisible("visible");
Expand All @@ -48,7 +48,7 @@ describe(
_.debuggerHelper.AssertErrorCount(1);
_.propPane.NavigateBackToPropertyPane(false);
_.propPane.NavigateBackToPropertyPane();
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "Menu Item");
_.propPane.AssertIfPropertyIsVisible("icon");
Expand All @@ -65,7 +65,7 @@ describe(
_.propPane.MoveToTab("Style");
_.debuggerHelper.AssertErrorCount(1);
_.propPane.NavigateBackToPropertyPane();
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "Second Menu Item");
_.propPane.AssertIfPropertyIsVisible("disabled");
Expand Down Expand Up @@ -110,7 +110,7 @@ describe(
_.propPane.NavigateBackToPropertyPane(false);
_.propPane.NavigateBackToPropertyPane();

_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "Custom Field 2");
_.propPane.AssertIfPropertyIsVisible("borderradius");
Expand All @@ -133,7 +133,7 @@ describe(
_.propPane.EnterJSContext("disabled", "{{test}}", true, false);
_.debuggerHelper.AssertErrorCount(2);

_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink(true);
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "First Menu Item");
_.debuggerHelper.CloseBottomBar();
Expand Down Expand Up @@ -173,7 +173,7 @@ describe(
_.propPane.ToggleSection("validation");
_.propPane.NavigateBackToPropertyPane();

_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.ClicklogEntityLink();
_.agHelper.GetNAssertContains(_.propPane._paneTitle, "imdb_id");
_.debuggerHelper.CloseBottomBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import EditorNavigation, {
EntityType,
} from "../../../../support/Pages/EditorNavigation";
import PageList from "../../../../support/Pages/PageList";
const locators = {
errorPageTitle: ".t--error-page-title",
};

describe("Pages", { tags: ["@tag.IDE"] }, function () {
let veryLongPageName = `abcdefghijklmnopqrstuvwxyz1234`;
Expand Down Expand Up @@ -36,7 +33,7 @@ describe("Pages", { tags: ["@tag.IDE"] }, function () {
EditorNavigation.SelectEntityByName("Page1 Copy", EntityType.Page);
//Checks if 404 is showing correct route
cy.visit("/route-that-does-not-exist");
cy.get(locators.errorPageTitle).should(($x) => {
cy.get(_.locators.errorPageTitle).should(($x) => {
expect($x).contain(Cypress.env("MESSAGES").PAGE_NOT_FOUND());
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
//Verify if bottom bar is closed.
_.debuggerHelper.AssertClosed();
//verify if bottom bar is open on clicking debugger icon in canvas.
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.AssertOpen(PageType.Canvas);
//Verify if selected tab is errors in tab title.
_.debuggerHelper.AssertSelectedTab(
Expand Down Expand Up @@ -48,7 +48,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
//Verify that the errors tab is still closed.
_.debuggerHelper.AssertClosed();
//Verify if bottom bar opens on clicking debugger icon in api page.
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.AssertOpen(PageType.API);
//Verify if selected tab is errors in tab title.
_.debuggerHelper.AssertSelectedTab(
Expand All @@ -70,7 +70,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
//Expecting errors tab to be closed as this is now a datasource
_.debuggerHelper.AssertClosed();
//Verify if bottom bar opens on clicking debugger icon in datasource page.
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.AssertOpen(PageType.DataSources);
});

Expand All @@ -91,7 +91,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
_.debuggerHelper.AssertClosed();
//Verify if bottom bar opens on clicking debugger icon in query page.
_.dataSources.CreateQueryAfterDSSaved();
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.AssertOpen(PageType.Query);
//Verify if bottom bar is closed on clicking close icon in query page.
_.debuggerHelper.CloseBottomBar();
Expand Down Expand Up @@ -130,7 +130,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
_.debuggerHelper.AssertClosed();
//Verify if bottom bar opens on clicking debugger icon in query page.
_.dataSources.CreateQueryAfterDSSaved();
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.debuggerHelper.AssertOpen(PageType.Query);
//Verify if bottom bar is closed on clicking close icon in query page.
_.debuggerHelper.CloseBottomBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ describe("Sanitise toast error messages", () => {
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
_.propPane.EnterJSContext("onClick", "{{a.kjbfjdfbkds()}}");
_.agHelper.ClickButton("Submit");
_.agHelper.WaitUntilToastDisappear("a is not defined");
_.debuggerHelper.AssertDebugError("'a' is not defined.", "", true, false);
});

it("2. Does not show type error label when js obj function does not exist", () => {
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
_.propPane.EnterJSContext("onClick", "{{JSObject1.myFun1efef()}}");
// Assert the lint error that shows up
_.debuggerHelper.AssertDebugError(
`"myFun1efef" doesn't exist in JSObject1`,
"",
false,
false,
);
_.agHelper.ClickButton("Submit");
// Assert the execution error that shows up
_.agHelper.WaitUntilToastDisappear("Object1.myFun1efef is not a function");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Inspect Entity", function () {
it("1. Check whether depedencies and references are shown correctly", function () {
cy.openPropertyPane("inputwidgetv2");
cy.testJsontext("defaultvalue", "{{Button1.text}}");
_.agHelper.GetNClick(".t--debugger-count");
_.debuggerHelper.OpenDebugger();
cy.contains(".ads-v2-tabs__list-tab", "Inspect entity").click();
cy.contains(".t--dependencies-item", "Button1").click();
cy.contains(".t--dependencies-item", "Input1");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import commonlocators from "../../../../locators/commonlocators.json";
import { homePage } from "../../../../support/Objects/ObjectsCore";
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
import EditorNavigation, {
EntityType,
Expand All @@ -26,18 +24,18 @@ describe("Debugger logs", function () {
logString = generateTestLogString();
});

it("3. Console log on button click with normal moustache binding", function () {
it("1. Console log on button click with normal moustache binding", function () {
ee.DragDropWidgetNVerify("buttonwidget", 200, 200);
// Testing with normal log in moustache binding
propPane.EnterJSContext("onClick", `{{console.log("${logString}")}}`);
agHelper.Sleep(2000);
agHelper.ClickButton("Submit");
debuggerHelper.ClickDebuggerIcon();
debuggerHelper.OpenDebugger();
agHelper.GetNClick(jsEditor._logsTab);
debuggerHelper.DoesConsoleLogExist(logString);
});

it("4. Console log on button click with arrow function IIFE", function () {
it("2. Console log on button click with arrow function IIFE", function () {
debuggerHelper.ClearLogs();
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
// Testing with normal log in iifee
Expand All @@ -51,7 +49,7 @@ describe("Debugger logs", function () {
debuggerHelper.DoesConsoleLogExist(logString);
});

it("5. Console log on button click with function keyword IIFE", function () {
it("3. Console log on button click with function keyword IIFE", function () {
debuggerHelper.ClearLogs();
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
// Testing with normal log in iifee
Expand All @@ -65,7 +63,7 @@ describe("Debugger logs", function () {
debuggerHelper.DoesConsoleLogExist(logString);
});

it("6. Console log on button click with async function IIFE", function () {
it("4. Console log on button click with async function IIFE", function () {
debuggerHelper.ClearLogs();
// Testing with normal log in iifee
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
Expand All @@ -79,7 +77,7 @@ describe("Debugger logs", function () {
debuggerHelper.DoesConsoleLogExist(logString);
});

it("7. Console log on button click with mixed function IIFE", function () {
it("5. Console log on button click with mixed function IIFE", function () {
debuggerHelper.ClearLogs();
// Testing with normal log in iifee
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
Expand All @@ -96,7 +94,7 @@ describe("Debugger logs", function () {
debuggerHelper.DoesConsoleLogExist(logStringChild);
});

it("8. Console log grouping on button click", function () {
it("6. Console log grouping on button click", function () {
debuggerHelper.ClearLogs();
// Testing with normal log in iifee
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
Expand All @@ -116,7 +114,7 @@ describe("Debugger logs", function () {
debuggerHelper.AssertConsecutiveConsoleLogCount(5);
});

it("9. Console log grouping on button click with different log in between", function () {
it("7. Console log grouping on button click with different log in between", function () {
debuggerHelper.ClearLogs();
// Testing with normal log in iifee
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
Expand All @@ -135,7 +133,7 @@ describe("Debugger logs", function () {
debuggerHelper.AssertConsecutiveConsoleLogCount(2);
});

it("10. Console log grouping on button click from different source", function () {
it("8. Console log grouping on button click from different source", function () {
debuggerHelper.ClearLogs();
// Testing with normal log in iifee
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Debugger logs", { tags: ["@tag.IDE"] }, function () {
_.agHelper.RefreshPage();
// Wait for the debugger icon to be visible
_.agHelper.AssertElementVisibility(".t--debugger-count");
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
_.agHelper.GetNClick(_.jsEditor._logsTab);
_.debuggerHelper.DoesConsoleLogExist(logString);
});
Expand Down Expand Up @@ -286,7 +286,7 @@ describe("Debugger logs", { tags: ["@tag.IDE"] }, function () {

EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
_.agHelper.AssertElementVisibility(".t--debugger-count");
_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();

_.debuggerHelper.ClicklogEntityLink();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Widget error state", function () {

//Check if the current value is shown in the debugger

_.debuggerHelper.ClickDebuggerIcon();
_.debuggerHelper.OpenDebugger();
cy.get("[data-testid=t--tab-ERROR]").click();
//This feature is disabled in updated error log - epic 17720
// _.debuggerHelper.LogStateContains("Test");
Expand All @@ -44,8 +44,8 @@ describe("Widget error state", function () {
);

// All errors should be expanded by default
//Updated count to 1 as the decision not to show triggerexecution/uncaughtpromise error in - epic 17720
_.debuggerHelper.AssertVisibleErrorMessagesCount(1);
//Updated count to 2 as the decision to show the widget trigger lint errors to show in the debugger
_.debuggerHelper.AssertVisibleErrorMessagesCount(2);

// Recent errors are shown at the top of the list
cy.testJsontext("label", "{{[]}}");
Expand All @@ -63,7 +63,7 @@ describe("Widget error state", function () {
cy.deleteWidget();
_.debuggerHelper.AssertVisibleErrorMessagesCount(0);
cy.get("body").type(`{${modifierKey}}z`);
_.debuggerHelper.AssertVisibleErrorMessagesCount(2);
_.debuggerHelper.AssertVisibleErrorMessagesCount(3);

//Bug-2760: Error log on a widget property not clearing out when the widget property is deleted
_.entityExplorer.DragDropWidgetNVerify(WIDGET.TABLE, 150, 300);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ describe(
.should("be.visible")
.contains("'lintError' is not defined.");

cy.get(commonlocators.debugger)
.should("be.visible")
.click({ force: true });

cy.get(commonlocators.errorTab)
.should("be.visible")
.click({ force: true });
_.debuggerHelper.OpenDebugger();

cy.get(commonlocators.debugErrorMsg).should("have.length", 3);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ describe(
.should("be.visible")
.contains("'DATA' is not defined.");

cy.get(commonlocators.debugger)
.should("be.visible")
.click({ force: true });

cy.get(commonlocators.errorTab)
.should("be.visible")
.click({ force: true });
_.debuggerHelper.OpenDebugger();

cy.get(commonlocators.debugErrorMsg).should("have.length", 6);
});
Expand Down
Loading

0 comments on commit 65eb854

Please sign in to comment.