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 * 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);
});
});

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 () {
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) => {

View File

@ -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.