From c95f9987f0a04f6ae3ed53cfaf012f996aaeded5 Mon Sep 17 00:00:00 2001 From: Parthvi <80334441+Parthvi12@users.noreply.github.com> Date: Tue, 19 Sep 2023 19:10:45 +0530 Subject: [PATCH] test: Cypress - Fix flaky test (#27238) ## Description This PR fixes flaky tests: RepoLimit and ExportApplication ## Testing > #### How Has This Been Tested? locally #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --- .../RepoLimitExceededErrorModal_spec.js | 59 ++++++++++--------- .../OtherUIFeatures/ExportApplication_spec.js | 3 +- app/client/cypress/limited-tests.txt | 2 +- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/RepoLimitExceededErrorModal_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/RepoLimitExceededErrorModal_spec.js index 0b65860f6e..a8fd66da84 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/RepoLimitExceededErrorModal_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/RepoLimitExceededErrorModal_spec.js @@ -1,53 +1,54 @@ import gitSyncLocators from "../../../../../locators/gitSyncLocators"; -import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { + gitSync, + agHelper, + homePage, + onboarding, + locators, +} from "../../../../../support/Objects/ObjectsCore"; import { REPO, CURRENT_REPO } from "../../../../../fixtures/REPO"; let repoName1, repoName2, repoName3, repoName4, windowOpenSpy; describe("Repo Limit Exceeded Error Modal", function () { before(() => { - cy.generateUUID().then((uid) => { - cy.Signup(`${uid}@appsmithtest.com`, uid); - }); const uuid = require("uuid"); repoName1 = uuid.v4().split("-")[0]; repoName2 = uuid.v4().split("-")[0]; repoName3 = uuid.v4().split("-")[0]; repoName4 = uuid.v4().split("-")[0]; - _.agHelper.AssertElementVisibility(_.locators._sidebar); - _.onboarding.closeIntroModal(); + agHelper.AssertElementVisibility(locators._sidebar); + onboarding.closeIntroModal(); }); - it("1. Modal should be opened with proper components", function () { - _.homePage.NavigateToHome(); - _.homePage.CreateNewApplication(); - _.gitSync.CreateNConnectToGit(repoName1, true, true); + it("1. Verify Repo limit flow for CE instance", function () { + homePage.LogOutviaAPI(); + cy.generateUUID().then((uid) => { + cy.Signup(`${uid}@appsmithtest.com`, uid); + }); + homePage.NavigateToHome(); + homePage.CreateNewApplication(); + gitSync.CreateNConnectToGit(repoName1, true, true); cy.get("@gitRepoName").then((repName) => { repoName1 = repName; }); - _.homePage.NavigateToHome(); - _.homePage.CreateNewApplication(); - _.gitSync.CreateNConnectToGit(repoName2, true, true); + homePage.NavigateToHome(); + homePage.CreateNewApplication(); + gitSync.CreateNConnectToGit(repoName2, true, true); cy.get("@gitRepoName").then((repName) => { repoName2 = repName; }); - _.homePage.NavigateToHome(); - _.homePage.CreateNewApplication(); - _.gitSync.CreateNConnectToGit(repoName3, true, true); + homePage.NavigateToHome(); + homePage.CreateNewApplication(); + gitSync.CreateNConnectToGit(repoName3, true, true); cy.get("@gitRepoName").then((repName) => { repoName3 = repName; }); - _.homePage.NavigateToHome(); - _.homePage.CreateNewApplication(); - _.gitSync.CreateNConnectToGit(repoName4, false, true); + homePage.NavigateToHome(); + homePage.CreateNewApplication(); + gitSync.CreateNConnectToGit(repoName4, false, true); cy.get("@gitRepoName").then((repName) => { repoName4 = repName; }); - - // cy.createAppAndConnectGit(repoName1, false); - // cy.createAppAndConnectGit(repoName2, false); - // cy.createAppAndConnectGit(repoName3, false); - // cy.createAppAndConnectGit(repoName4, false, true); - if (CURRENT_REPO === REPO.CE) { cy.get(gitSyncLocators.repoLimitExceededErrorModal).should("exist"); @@ -110,9 +111,9 @@ describe("Repo Limit Exceeded Error Modal", function () { url: "api/v1/applications/" + repoName4, failOnStatusCode: false, }); - _.gitSync.DeleteTestGithubRepo(repoName1); - _.gitSync.DeleteTestGithubRepo(repoName2); - _.gitSync.DeleteTestGithubRepo(repoName3); - _.gitSync.DeleteTestGithubRepo(repoName4); + gitSync.DeleteTestGithubRepo(repoName1); + gitSync.DeleteTestGithubRepo(repoName2); + gitSync.DeleteTestGithubRepo(repoName3); + gitSync.DeleteTestGithubRepo(repoName4); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js index da5312774a..6ff422258a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js @@ -39,7 +39,8 @@ describe("Export application as a JSON file", function () { it("2. User with admin access,should be able to export the app", function () { if (CURRENT_REPO === REPO.CE) { - cy.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); + homePage.Signout(false); + homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); homePage.NavigateToHome(); agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index 4807f10528..ac052bf5d7 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -5,4 +5,4 @@ cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js # For running all specs - uncomment below: #cypress/e2e/**/**/* -#ci-test-limit uses this file to run minimum of specs. Do not run entire suite with this command. +#ci-test-limit uses this file to run minimum of specs. Do not run entire suite with this command. \ No newline at end of file