From 3e594bc7e181f369a200de4e1c5ddb55d5de3598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Tue, 3 Dec 2024 00:32:44 +0530 Subject: [PATCH 1/9] test: adding tests for custom lib --- .../ClientSide/JSLibrary/Custom_lib_spec.ts | 129 ++++++++++++++++++ app/client/cypress/limited-tests.txt | 2 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts new file mode 100644 index 000000000000..e08afb50343b --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -0,0 +1,129 @@ +import { + agHelper, + entityExplorer, + jsEditor, + deployMode, + installer, + draggableWidgets, + propPane, + locators, + apiPage, + table, +} from "../../../../support/Objects/ObjectsCore"; +import EditorNavigation, { + AppSidebar, + AppSidebarButton, + EntityType, +} from "../../../../support/Pages/EditorNavigation"; + +describe( + "Tests JS Libraries", + { tags: ["@tag.excludeForAirgap", "@tag.JS", "@tag.Binding"] }, + () => { + before(() => { + entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 500, 100); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 200, 200); + apiPage.CreateAndFillApi( + "http://host.docker.internal:5001/v1/mock-api?records=5", + ); + apiPage.RunAPI(); + EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); + propPane.EnterJSContext("tabledata", `{{Api1.data}}`, true, false); + }); + + it("1. Verify moment library", () => { + jsEditor.CreateJSObject(`showAlert(moment().daysInMonth().toString())`, { + paste: true, + completeReplace: false, + toRun: true, + shouldCreateNewJSObj: true, + prettify: true, + }); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + propPane.EnterJSContext( + "onClick", + `{{JSObject1.myFun1();}}`, + true, + false, + ); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.WaitUntilAllToastsDisappear(); + + // Deploy + // deployMode.DeployApp(); + // agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + // agHelper.WaitUntilAllToastsDisappear(); + // deployMode.NavigateBacktoEditor(); + }); + + it("2. Verify install/uninstall of Library ", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibraryViaURL( + "https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", + "swiper", + ); + agHelper.WaitUntilAllToastsDisappear(); + installer.uninstallLibrary("swiper"); + installer.assertUnInstall("swiper"); + }); + + it("3. Verify jspdf library", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibrary("jspdf", "jspdf"); + jsEditor.CreateJSObject( + `export default { + genPDF: () => { + const doc = new jspdf.jsPDF(); + doc.text('Users', 20, 20); + doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); + download(doc.output(), 'users_list.pdf'); + } + }`, + { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + prettify: true, + }, + ); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + propPane.EnterJSContext( + "onClick", + `{{JSObject2.genPDF();}}`, + true, + false, + ); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + + // Deploy + // deployMode.DeployApp(); + // agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + // table.ValidateDownloadNVerify("users_list.pdf"); + // deployMode.NavigateBacktoEditor(); + }); + + it("4. Verify deleting jspdf library deletes all its references as well", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.uninstallLibrary("jspdf"); + installer.assertUnInstall("jspdf"); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.ValidateToastMessage("jspdf is not defined"); + + // Install jspdf and verify references are working + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibrary("jspdf", "jspdf"); + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + }); + }, +); diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index aa00835ffb0e..a940f5675b5e 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,5 +1,5 @@ # To run only limited tests - give the spec names in below format: -cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js +cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts # For running all specs - uncomment below: #cypress/e2e/**/**/* From 353d9246cf1d86cb91fa9f6c8ecd5159f909d9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Fri, 6 Dec 2024 22:16:53 +0530 Subject: [PATCH 2/9] test updated with deploy tests --- .../ClientSide/JSLibrary/Custom_lib_spec.ts | 79 ++++++++++++++++--- 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts index e08afb50343b..21466b5fbd44 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -9,6 +9,8 @@ import { locators, apiPage, table, + partialImportExport, + homePage, } from "../../../../support/Objects/ObjectsCore"; import EditorNavigation, { AppSidebar, @@ -51,10 +53,10 @@ describe( agHelper.WaitUntilAllToastsDisappear(); // Deploy - // deployMode.DeployApp(); - // agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - // agHelper.WaitUntilAllToastsDisappear(); - // deployMode.NavigateBacktoEditor(); + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.WaitUntilAllToastsDisappear(); + deployMode.NavigateBacktoEditor(); }); it("2. Verify install/uninstall of Library ", () => { @@ -102,10 +104,10 @@ describe( table.ValidateDownloadNVerify("users_list.pdf"); // Deploy - // deployMode.DeployApp(); - // agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - // table.ValidateDownloadNVerify("users_list.pdf"); - // deployMode.NavigateBacktoEditor(); + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + deployMode.NavigateBacktoEditor(); }); it("4. Verify deleting jspdf library deletes all its references as well", () => { @@ -115,8 +117,15 @@ describe( EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.ValidateToastMessage("jspdf is not defined"); + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.ValidateToastMessage("jspdf is not defined"); + deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working AppSidebar.navigate(AppSidebarButton.Libraries); installer.OpenInstaller(); @@ -124,6 +133,58 @@ describe( EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); table.ValidateDownloadNVerify("users_list.pdf"); + + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + deployMode.NavigateBacktoEditor(); + }); + + it("5. Verify using incompatible URL shows an error", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibraryViaURL( + "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css", + "", + false, + ); + agHelper.AssertText( + '[kind="error"] .header', + "text", + "Library is unsupported", + ); + }); + + it.skip("6. Verify export and import of app with custom library", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibraryViaURL( + "https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", + "swiper", + ); + agHelper.WaitUntilAllToastsDisappear(); + + AppSidebar.navigate(AppSidebarButton.Editor); + partialImportExport.OpenExportModal(); + + // Export Custom Library + partialImportExport.PartiallyExportFile( + 3, + partialImportExport.locators.export.modelContents.customJSLibsSection, + ["swiper"], + ); + + // Import to new app + homePage.NavigateToHome(); + homePage.CreateNewApplication(); + partialImportExport.OpenImportModal(); + partialImportExport.ImportPartiallyExportedFile( + "Library_Test.json", + "Libraries", + ["swiper"], + "downloads", + ); }); }, ); From 1e5d612f2e01a55fd5aaa322486eefaeacb588e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Sat, 7 Dec 2024 09:07:53 +0530 Subject: [PATCH 3/9] updated tests for custom lib --- .../JSLibrary/Library_Test_Git_spec.ts | 147 ++++++++++++++++++ app/client/cypress/limited-tests.txt | 1 + 2 files changed, 148 insertions(+) create mode 100644 app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts new file mode 100644 index 000000000000..4b960e40a854 --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts @@ -0,0 +1,147 @@ +import { + agHelper, + entityExplorer, + jsEditor, + deployMode, + installer, + draggableWidgets, + propPane, + locators, + apiPage, + table, + homePage, + gitSync, +} from "../../../../support/Objects/ObjectsCore"; +import EditorNavigation, { + AppSidebar, + AppSidebarButton, + EntityType, +} from "../../../../support/Pages/EditorNavigation"; + +describe( + "Tests JS Libraries for Git connected app", + { tags: ["@tag.excludeForAirgap", "@tag.JS", "@tag.Binding"] }, + () => { + before(() => { + gitSync.CreateNConnectToGit(); + gitSync.CreateGitBranch(); + + entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 500, 100); + entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 200, 200); + apiPage.CreateAndFillApi( + "http://host.docker.internal:5001/v1/mock-api?records=5", + ); + apiPage.RunAPI(); + EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); + propPane.EnterJSContext("tabledata", `{{Api1.data}}`, true, false); + }); + + it("1. Verify moment library", () => { + jsEditor.CreateJSObject(`showAlert(moment().daysInMonth().toString())`, { + paste: true, + completeReplace: false, + toRun: true, + shouldCreateNewJSObj: true, + prettify: true, + }); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + propPane.EnterJSContext( + "onClick", + `{{JSObject1.myFun1();}}`, + true, + false, + ); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.WaitUntilAllToastsDisappear(); + + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.WaitUntilAllToastsDisappear(); + deployMode.NavigateBacktoEditor(); + }); + + it("2. Verify install/uninstall of Library ", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibraryViaURL( + "https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", + "swiper", + ); + agHelper.WaitUntilAllToastsDisappear(); + installer.uninstallLibrary("swiper"); + installer.assertUnInstall("swiper"); + }); + + it("3. Verify jspdf library", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibrary("jspdf", "jspdf"); + jsEditor.CreateJSObject( + `export default { + genPDF: () => { + const doc = new jspdf.jsPDF(); + doc.text('Users', 20, 20); + doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); + download(doc.output(), 'users_list.pdf'); + } + }`, + { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + prettify: true, + }, + ); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + propPane.EnterJSContext( + "onClick", + `{{JSObject2.genPDF();}}`, + true, + false, + ); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + deployMode.NavigateBacktoEditor(); + }); + + it("4. Verify deleting jspdf library deletes all its references as well", () => { + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.uninstallLibrary("jspdf"); + installer.assertUnInstall("jspdf"); + + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + agHelper.ValidateToastMessage("jspdf is not defined"); + deployMode.NavigateBacktoEditor(); + // Install jspdf and verify references are working + AppSidebar.navigate(AppSidebarButton.Libraries); + installer.OpenInstaller(); + installer.InstallLibrary("jspdf", "jspdf"); + EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + + // Deploy + deployMode.DeployApp(); + agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); + table.ValidateDownloadNVerify("users_list.pdf"); + deployMode.NavigateBacktoEditor(); + }); + }, +); diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index a940f5675b5e..a85ac87b8dd0 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,5 +1,6 @@ # To run only limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts # For running all specs - uncomment below: #cypress/e2e/**/**/* From 30a14a85459bcbcda3366167ef52997211c64115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Mon, 9 Dec 2024 21:54:33 +0530 Subject: [PATCH 4/9] updated test wrt ee and ce repo --- .../ClientSide/JSLibrary/Custom_lib_spec.ts | 33 ++++++++++++------- .../JSLibrary/Library_Test_Git_spec.ts | 20 ++++++++--- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts index 21466b5fbd44..820bb972821e 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -17,6 +17,7 @@ import EditorNavigation, { AppSidebarButton, EntityType, } from "../../../../support/Pages/EditorNavigation"; +import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; describe( "Tests JS Libraries", @@ -77,13 +78,13 @@ describe( installer.InstallLibrary("jspdf", "jspdf"); jsEditor.CreateJSObject( `export default { - genPDF: () => { - const doc = new jspdf.jsPDF(); - doc.text('Users', 20, 20); - doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); - download(doc.output(), 'users_list.pdf'); - } - }`, + genPDF: () => { + const doc = new jspdf.jsPDF(); + doc.text('Users', 20, 20); + doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); + download(doc.output(), 'users_list.pdf'); + } + }`, { paste: true, completeReplace: true, @@ -117,14 +118,24 @@ describe( EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); + if (CURRENT_REPO === REPO.EE) { + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + } else { + agHelper.ValidateToastMessage("jspdf is not defined"); + } // Deploy deployMode.DeployApp(); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.ValidateToastMessage("jspdf is not defined"); + if (CURRENT_REPO === REPO.EE) { + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + } else { + agHelper.WaitUntilToastDisappear(""); + } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working AppSidebar.navigate(AppSidebarButton.Libraries); diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts index 4b960e40a854..a9da9c84cf12 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts @@ -17,6 +17,7 @@ import EditorNavigation, { AppSidebarButton, EntityType, } from "../../../../support/Pages/EditorNavigation"; +import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; describe( "Tests JS Libraries for Git connected app", @@ -120,14 +121,25 @@ describe( EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); + + if (CURRENT_REPO === REPO.EE) { + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + } else { + agHelper.ValidateToastMessage("jspdf is not defined"); + } // Deploy deployMode.DeployApp(); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.ValidateToastMessage("jspdf is not defined"); + if (CURRENT_REPO === REPO.EE) { + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); + } else { + agHelper.WaitUntilToastDisappear(""); + } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working AppSidebar.navigate(AppSidebarButton.Libraries); From 97f4e07b0bebd3ca7e93ce7324ecc85d2d1eff4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Mon, 9 Dec 2024 21:56:06 +0530 Subject: [PATCH 5/9] udpated test --- .../e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts | 2 +- .../Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts index 820bb972821e..e840f98ece44 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -134,7 +134,7 @@ describe( '"jspdf" is undefined . Please fix JSObject2.genPDF.', ); } else { - agHelper.WaitUntilToastDisappear(""); + agHelper.WaitUntilToastDisappear("jspdf is not defined"); } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts index a9da9c84cf12..92a07c82e8f4 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts @@ -138,7 +138,7 @@ describe( '"jspdf" is undefined . Please fix JSObject2.genPDF.', ); } else { - agHelper.WaitUntilToastDisappear(""); + agHelper.WaitUntilToastDisappear("jspdf is not defined"); } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working From 50e4aaa1eac84c20ba7626b97a0edb9ae2a5b40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Mon, 9 Dec 2024 22:32:06 +0530 Subject: [PATCH 6/9] updated tests --- .../e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts | 3 ++- .../Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts index e840f98ece44..fe4e4426a4b1 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -134,7 +134,7 @@ describe( '"jspdf" is undefined . Please fix JSObject2.genPDF.', ); } else { - agHelper.WaitUntilToastDisappear("jspdf is not defined"); + agHelper.WaitUntilToastDisappear(""); } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working @@ -167,6 +167,7 @@ describe( ); }); + // it.skip("6. Verify export and import of app with custom library", () => { AppSidebar.navigate(AppSidebarButton.Libraries); installer.OpenInstaller(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts index 92a07c82e8f4..a9da9c84cf12 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts @@ -138,7 +138,7 @@ describe( '"jspdf" is undefined . Please fix JSObject2.genPDF.', ); } else { - agHelper.WaitUntilToastDisappear("jspdf is not defined"); + agHelper.WaitUntilToastDisappear(""); } deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working From 5b6e15e99b6e87f6e9d27da196becf1468a93364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Mon, 9 Dec 2024 23:26:56 +0530 Subject: [PATCH 7/9] updated tests and removed redudant tests --- .../JSLibrary/Library_Test_Git_spec.ts | 159 ------------------ app/client/cypress/limited-tests.txt | 1 - 2 files changed, 160 deletions(-) delete mode 100644 app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts deleted file mode 100644 index a9da9c84cf12..000000000000 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { - agHelper, - entityExplorer, - jsEditor, - deployMode, - installer, - draggableWidgets, - propPane, - locators, - apiPage, - table, - homePage, - gitSync, -} from "../../../../support/Objects/ObjectsCore"; -import EditorNavigation, { - AppSidebar, - AppSidebarButton, - EntityType, -} from "../../../../support/Pages/EditorNavigation"; -import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; - -describe( - "Tests JS Libraries for Git connected app", - { tags: ["@tag.excludeForAirgap", "@tag.JS", "@tag.Binding"] }, - () => { - before(() => { - gitSync.CreateNConnectToGit(); - gitSync.CreateGitBranch(); - - entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 500, 100); - entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 200, 200); - apiPage.CreateAndFillApi( - "http://host.docker.internal:5001/v1/mock-api?records=5", - ); - apiPage.RunAPI(); - EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); - propPane.EnterJSContext("tabledata", `{{Api1.data}}`, true, false); - }); - - it("1. Verify moment library", () => { - jsEditor.CreateJSObject(`showAlert(moment().daysInMonth().toString())`, { - paste: true, - completeReplace: false, - toRun: true, - shouldCreateNewJSObj: true, - prettify: true, - }); - - EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - propPane.EnterJSContext( - "onClick", - `{{JSObject1.myFun1();}}`, - true, - false, - ); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.WaitUntilAllToastsDisappear(); - - // Deploy - deployMode.DeployApp(); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - agHelper.WaitUntilAllToastsDisappear(); - deployMode.NavigateBacktoEditor(); - }); - - it("2. Verify install/uninstall of Library ", () => { - AppSidebar.navigate(AppSidebarButton.Libraries); - installer.OpenInstaller(); - installer.InstallLibraryViaURL( - "https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", - "swiper", - ); - agHelper.WaitUntilAllToastsDisappear(); - installer.uninstallLibrary("swiper"); - installer.assertUnInstall("swiper"); - }); - - it("3. Verify jspdf library", () => { - AppSidebar.navigate(AppSidebarButton.Libraries); - installer.OpenInstaller(); - installer.InstallLibrary("jspdf", "jspdf"); - jsEditor.CreateJSObject( - `export default { - genPDF: () => { - const doc = new jspdf.jsPDF(); - doc.text('Users', 20, 20); - doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); - download(doc.output(), 'users_list.pdf'); - } - }`, - { - paste: true, - completeReplace: true, - toRun: false, - shouldCreateNewJSObj: true, - prettify: true, - }, - ); - - EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - propPane.EnterJSContext( - "onClick", - `{{JSObject2.genPDF();}}`, - true, - false, - ); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - table.ValidateDownloadNVerify("users_list.pdf"); - - // Deploy - deployMode.DeployApp(); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - table.ValidateDownloadNVerify("users_list.pdf"); - deployMode.NavigateBacktoEditor(); - }); - - it("4. Verify deleting jspdf library deletes all its references as well", () => { - AppSidebar.navigate(AppSidebarButton.Libraries); - installer.uninstallLibrary("jspdf"); - installer.assertUnInstall("jspdf"); - - EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - - if (CURRENT_REPO === REPO.EE) { - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); - } else { - agHelper.ValidateToastMessage("jspdf is not defined"); - } - - // Deploy - deployMode.DeployApp(); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - if (CURRENT_REPO === REPO.EE) { - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); - } else { - agHelper.WaitUntilToastDisappear(""); - } - deployMode.NavigateBacktoEditor(); - // Install jspdf and verify references are working - AppSidebar.navigate(AppSidebarButton.Libraries); - installer.OpenInstaller(); - installer.InstallLibrary("jspdf", "jspdf"); - EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - table.ValidateDownloadNVerify("users_list.pdf"); - - // Deploy - deployMode.DeployApp(); - agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - table.ValidateDownloadNVerify("users_list.pdf"); - deployMode.NavigateBacktoEditor(); - }); - }, -); diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index a85ac87b8dd0..a940f5675b5e 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,6 +1,5 @@ # To run only limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts -cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts # For running all specs - uncomment below: #cypress/e2e/**/**/* From 4f7f3d58f76e43b7a60a00366270edfda4eb78e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Mon, 9 Dec 2024 23:42:32 +0530 Subject: [PATCH 8/9] udpated assertion text --- .../ClientSide/JSLibrary/Custom_lib_spec.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts index fe4e4426a4b1..8332267941e3 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts @@ -118,24 +118,14 @@ describe( EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - if (CURRENT_REPO === REPO.EE) { - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); - } else { - agHelper.ValidateToastMessage("jspdf is not defined"); - } + agHelper.ValidateToastMessage( + '"jspdf" is undefined . Please fix JSObject2.genPDF.', + ); // Deploy deployMode.DeployApp(); agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); - if (CURRENT_REPO === REPO.EE) { - agHelper.ValidateToastMessage( - '"jspdf" is undefined . Please fix JSObject2.genPDF.', - ); - } else { - agHelper.WaitUntilToastDisappear(""); - } + agHelper.WaitUntilToastDisappear("jspdf is not defined"); deployMode.NavigateBacktoEditor(); // Install jspdf and verify references are working AppSidebar.navigate(AppSidebarButton.Libraries); From 3423a8306cf5a75845a315623da9afdb697b2139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Tue, 10 Dec 2024 09:22:46 +0530 Subject: [PATCH 9/9] reverted limited run file --- app/client/cypress/limited-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index a940f5675b5e..aa00835ffb0e 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,5 +1,5 @@ # To run only limited tests - give the spec names in below format: -cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts +cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js # For running all specs - uncomment below: #cypress/e2e/**/**/*