From c3d546d4349544397931fe61db4569d7aa32633e Mon Sep 17 00:00:00 2001 From: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:45:21 +0530 Subject: [PATCH] test: Cypress | App level Import test (non-Gsheet) + CI Stabilize (#27683) ## Description - This PR includes script for App level import for ds - MySql (non Gsheet) - Fixes flaky Replay_Editor_spec.js #### Type of change - Script update (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed --- .github/workflows/ci-test.yml | 4 +- .../Fork/ForkAppWithMultipleDS_Spec.ts | 1 - .../OtherUIFeatures/Replay_Editor_spec.js | 1 + .../AppLevelImport/AppImportwithDS_Spec.ts | 37 +++++++++++++++++++ .../ServerSide/Datasources/Oracle_Spec.ts | 2 +- .../ServerSide/QueryPane/GoogleSheets_spec.ts | 3 +- .../support/Pages/AppSettings/AppSettings.ts | 5 +++ .../Pages/AppSettings/EmbedSettings.ts | 1 - .../cypress/support/Pages/DataSources.ts | 10 ++--- app/client/cypress/support/Pages/HomePage.ts | 22 +++++++---- 10 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 app/client/cypress/e2e/Regression/ServerSide/AppLevelImport/AppImportwithDS_Spec.ts diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index f5fae52337..49982f7c81 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] + job: [0] # Service containers to run with this job. Required for running tests services: @@ -315,7 +315,7 @@ jobs: if [[ ${{ inputs.pr }} -ne 0 ]]; then echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV else - if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then + if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV else echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV diff --git a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkAppWithMultipleDS_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkAppWithMultipleDS_Spec.ts index 62a72547ce..27802f3c71 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkAppWithMultipleDS_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkAppWithMultipleDS_Spec.ts @@ -3,7 +3,6 @@ import { dataSources, homePage, } from "../../../../support/Objects/ObjectsCore"; -import reconnectDSLocator from "../../../../locators/ReconnectLocators.js"; let workspaceId: string; diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Replay_Editor_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Replay_Editor_spec.js index 47b6f9531b..c566047417 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Replay_Editor_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Replay_Editor_spec.js @@ -154,6 +154,7 @@ describe("Undo/Redo functionality", function () { cy.get("body").click(0, 0); cy.get("body").type(`{${modifierKey}}z`); cy.get("input[name='url']").should("have.value", ""); + cy.get("body").type(`{${modifierKey}}z`); cy.get("input[name='headers[0].key']").should("have.value", ""); cy.get("body").click(0, 0); cy.get("body").type(`{${modifierKey}}{shift}z`); diff --git a/app/client/cypress/e2e/Regression/ServerSide/AppLevelImport/AppImportwithDS_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/AppLevelImport/AppImportwithDS_Spec.ts new file mode 100644 index 0000000000..c7e3a6c4fc --- /dev/null +++ b/app/client/cypress/e2e/Regression/ServerSide/AppLevelImport/AppImportwithDS_Spec.ts @@ -0,0 +1,37 @@ +import { + agHelper, + appSettings, + homePage, + dataSources, + jsEditor, + deployMode, + locators, + draggableWidgets, +} from "../../../../support/Objects/ObjectsCore"; + +describe("App level import with Datasource", () => { + before(() => { + homePage.CreateNewWorkspace("AppLevelImport", true); + homePage.CreateAppInWorkspace("AppLevelImport"); + }); + + //this tests coveres Applevel import for MySql, Gsheet is covered in Gsheet folder + it("1. Bug #26024 - Import an app at App Level with Datasource - MySql", () => { + appSettings.OpenAppSettings(); + appSettings.GoToImport(); + agHelper.ClickButton("Import"); + homePage.ImportApp("ImportApps/JSOnLoadImport.json", "JSOnLoadTest", true); + cy.wait("@importNewApplication").then(() => { + agHelper.Sleep(); + dataSources.ReconnectSingleDSNAssert("MySQL-Ds", "MySQL"); + }); + jsEditor.ConfirmationClick("Yes"); + agHelper.ClickButton("Got it"); + deployMode.DeployApp(); + jsEditor.ConfirmationClick("Yes"); + agHelper.AssertElementLength( + locators._widgetInDeployed(draggableWidgets.IMAGE), + 10, + ); + }); +}); diff --git a/app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts index 65e9252418..ae79c8e4f0 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts @@ -195,7 +195,7 @@ describe("Validate Oracle DS", () => { TO_DATE('2020-01-15', 'YYYY-MM-DD'), TO_DATE('{{DatePicker1.formattedDate}}', 'YYYY-MM-DD'), 'This aircraft is used for domestic flights.')`; - entityExplorer.ActionTemplateMenuByEntityName(guid.toUpperCase(), "SELECT"); + entityExplorer.ActionTemplateMenuByEntityName(guid.toUpperCase(), "Select"); dataSources.RunQuery(); agHelper .GetText(dataSources._noRecordFound) diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts index c053cadba3..1b576e4e8c 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts @@ -14,7 +14,8 @@ describe( let placeholderText = '{\n "name": {{nameInput.text}},\n "dob": {{dobPicker.formattedDate}},\n "gender": {{genderSelect.selectedOptionValue}} \n}'; - //Skiiping due to open bug #18035: Should the Save button be renamed as "Save and Authorise" in case of Google sheets for datasource discard popup? + //Skiiping due to open bug #18035: Should the Save button be renamed as "Save and Authorise" in case of Google sheets for datasource discard popup? - + //Bug #18035: Bug is to be taken in ds experience activation phase it.skip("1. Bug: 16391 - Google Sheets DS, placeholder objects keys should have quotes", function () { // create new Google Sheets datasource dataSources.NavigateToDSCreateNew(); diff --git a/app/client/cypress/support/Pages/AppSettings/AppSettings.ts b/app/client/cypress/support/Pages/AppSettings/AppSettings.ts index 5b3550e282..b62dfbe915 100644 --- a/app/client/cypress/support/Pages/AppSettings/AppSettings.ts +++ b/app/client/cypress/support/Pages/AppSettings/AppSettings.ts @@ -10,6 +10,7 @@ export class AppSettings { _generalSettingsHeader: "#t--general-settings-header", _embedSettingsHeader: "#t--share-embed-settings", _navigationSettingsTab: "#t--navigation-settings-header", + _importHeader: "#t--update-via-import", _navigationSettings: { _showNavbar: "#t--navigation-settings-show-navbar", _showSignIn: "#t--navigation-settings-show-sign-in", @@ -87,6 +88,10 @@ export class AppSettings { this.agHelper.GetNClick(this.locators._embedSettingsHeader); } + public GoToImport() { + this.agHelper.GetNClick(this.locators._importHeader); + } + public GoToPageSettings(pageName: string) { this.agHelper.GetNClick(this.locators._getPageSettingsHeader(pageName)); } diff --git a/app/client/cypress/support/Pages/AppSettings/EmbedSettings.ts b/app/client/cypress/support/Pages/AppSettings/EmbedSettings.ts index a468eb286f..2e5ce8708e 100644 --- a/app/client/cypress/support/Pages/AppSettings/EmbedSettings.ts +++ b/app/client/cypress/support/Pages/AppSettings/EmbedSettings.ts @@ -1,4 +1,3 @@ -import { propPane } from "../../Objects/ObjectsCore"; import { ObjectsRegistry } from "../../Objects/Registry"; export class EmbedSettings { diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 0daa344b0f..7cf8ffd27b 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -796,9 +796,9 @@ export class DataSources { ); } - public TestSaveDatasource(expectedRes = true, isForkModal = false) { + public TestSaveDatasource(expectedRes = true, isReconnectModal = false) { this.TestDatasource(expectedRes); - this.SaveDatasource(isForkModal); + this.SaveDatasource(isReconnectModal); } public TestDatasource(expectedRes = true) { @@ -810,10 +810,10 @@ export class DataSources { } } - public SaveDatasource(isForkModal = false, isSavingEnvInOldDS = false) { + public SaveDatasource(isReconnectModal = false, isSavingEnvInOldDS = false) { this.agHelper.Sleep(500); //bit of time for CI! this.agHelper.GetNClick(this._saveDs); - if (!isForkModal) { + if (!isReconnectModal) { this.assertHelper.AssertNetworkStatus("@saveDatasource", 201); if (!isSavingEnvInOldDS) this.agHelper.AssertContains("datasource created"); @@ -1096,7 +1096,7 @@ export class DataSources { if (dsName == "PostgreSQL") this.FillPostgresDSForm(); else if (dsName == "MySQL") this.FillMySqlDSForm(); else if (dsName == "MongoDB") this.FillMongoDSForm(); - this.SaveDatasource(true); + this.TestSaveDatasource(true, true); this.assertHelper.AssertNetworkStatus("@getPage", 200); this.assertHelper.AssertNetworkStatus("getWorkspace"); } diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts index ed2fafa388..317d4d1046 100644 --- a/app/client/cypress/support/Pages/HomePage.ts +++ b/app/client/cypress/support/Pages/HomePage.ts @@ -491,13 +491,21 @@ export class HomePage { this.NavigateToHome(); } - public ImportApp(fixtureJson: string, intoWorkspaceName = "") { - cy.get(this._homeIcon).click({ force: true }); - if (intoWorkspaceName) - this.agHelper.GetNClick(this._optionsIconInWorkspace(intoWorkspaceName)); - else this.agHelper.GetNClick(this._optionsIcon); - this.agHelper.GetNClick(this._workspaceImport, 0, true); - this.agHelper.AssertElementVisibility(this._workspaceImportAppModal); + public ImportApp( + fixtureJson: string, + intoWorkspaceName = "", + onlyImport = false, + ) { + if (onlyImport === false) { + cy.get(this._homeIcon).click({ force: true }); + if (intoWorkspaceName) + this.agHelper.GetNClick( + this._optionsIconInWorkspace(intoWorkspaceName), + ); + else this.agHelper.GetNClick(this._optionsIcon); + this.agHelper.GetNClick(this._workspaceImport, 0, true); + this.agHelper.AssertElementVisibility(this._workspaceImportAppModal); + } cy.xpath(this._uploadFile).selectFile("cypress/fixtures/" + fixtureJson, { force: true, });