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
This commit is contained in:
Parthvi 2023-09-19 19:10:45 +05:30 committed by GitHub
parent fd5d3a47b5
commit c95f9987f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 31 deletions

View File

@ -1,53 +1,54 @@
import gitSyncLocators from "../../../../../locators/gitSyncLocators"; 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"; import { REPO, CURRENT_REPO } from "../../../../../fixtures/REPO";
let repoName1, repoName2, repoName3, repoName4, windowOpenSpy; let repoName1, repoName2, repoName3, repoName4, windowOpenSpy;
describe("Repo Limit Exceeded Error Modal", function () { describe("Repo Limit Exceeded Error Modal", function () {
before(() => { before(() => {
cy.generateUUID().then((uid) => {
cy.Signup(`${uid}@appsmithtest.com`, uid);
});
const uuid = require("uuid"); const uuid = require("uuid");
repoName1 = uuid.v4().split("-")[0]; repoName1 = uuid.v4().split("-")[0];
repoName2 = uuid.v4().split("-")[0]; repoName2 = uuid.v4().split("-")[0];
repoName3 = uuid.v4().split("-")[0]; repoName3 = uuid.v4().split("-")[0];
repoName4 = uuid.v4().split("-")[0]; repoName4 = uuid.v4().split("-")[0];
_.agHelper.AssertElementVisibility(_.locators._sidebar); agHelper.AssertElementVisibility(locators._sidebar);
_.onboarding.closeIntroModal(); onboarding.closeIntroModal();
}); });
it("1. Modal should be opened with proper components", function () { it("1. Verify Repo limit flow for CE instance", function () {
_.homePage.NavigateToHome(); homePage.LogOutviaAPI();
_.homePage.CreateNewApplication(); cy.generateUUID().then((uid) => {
_.gitSync.CreateNConnectToGit(repoName1, true, true); cy.Signup(`${uid}@appsmithtest.com`, uid);
});
homePage.NavigateToHome();
homePage.CreateNewApplication();
gitSync.CreateNConnectToGit(repoName1, true, true);
cy.get("@gitRepoName").then((repName) => { cy.get("@gitRepoName").then((repName) => {
repoName1 = repName; repoName1 = repName;
}); });
_.homePage.NavigateToHome(); homePage.NavigateToHome();
_.homePage.CreateNewApplication(); homePage.CreateNewApplication();
_.gitSync.CreateNConnectToGit(repoName2, true, true); gitSync.CreateNConnectToGit(repoName2, true, true);
cy.get("@gitRepoName").then((repName) => { cy.get("@gitRepoName").then((repName) => {
repoName2 = repName; repoName2 = repName;
}); });
_.homePage.NavigateToHome(); homePage.NavigateToHome();
_.homePage.CreateNewApplication(); homePage.CreateNewApplication();
_.gitSync.CreateNConnectToGit(repoName3, true, true); gitSync.CreateNConnectToGit(repoName3, true, true);
cy.get("@gitRepoName").then((repName) => { cy.get("@gitRepoName").then((repName) => {
repoName3 = repName; repoName3 = repName;
}); });
_.homePage.NavigateToHome(); homePage.NavigateToHome();
_.homePage.CreateNewApplication(); homePage.CreateNewApplication();
_.gitSync.CreateNConnectToGit(repoName4, false, true); gitSync.CreateNConnectToGit(repoName4, false, true);
cy.get("@gitRepoName").then((repName) => { cy.get("@gitRepoName").then((repName) => {
repoName4 = 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) { if (CURRENT_REPO === REPO.CE) {
cy.get(gitSyncLocators.repoLimitExceededErrorModal).should("exist"); cy.get(gitSyncLocators.repoLimitExceededErrorModal).should("exist");
@ -110,9 +111,9 @@ describe("Repo Limit Exceeded Error Modal", function () {
url: "api/v1/applications/" + repoName4, url: "api/v1/applications/" + repoName4,
failOnStatusCode: false, failOnStatusCode: false,
}); });
_.gitSync.DeleteTestGithubRepo(repoName1); gitSync.DeleteTestGithubRepo(repoName1);
_.gitSync.DeleteTestGithubRepo(repoName2); gitSync.DeleteTestGithubRepo(repoName2);
_.gitSync.DeleteTestGithubRepo(repoName3); gitSync.DeleteTestGithubRepo(repoName3);
_.gitSync.DeleteTestGithubRepo(repoName4); gitSync.DeleteTestGithubRepo(repoName4);
}); });
}); });

View File

@ -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 () { it("2. User with admin access,should be able to export the app", function () {
if (CURRENT_REPO === REPO.CE) { 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(); homePage.NavigateToHome();
agHelper.GenerateUUID(); agHelper.GenerateUUID();
cy.get("@guid").then((uid) => { cy.get("@guid").then((uid) => {