test: Fix flaky git cypress tests (#21282)

Sometimes the git tests fail because of reaching repo limit for the
workspace, this PR adds new workspace flow before connecting to git
which will make sure test doesnt fail because of reaching repo limit.

---------

Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
This commit is contained in:
Parthvi 2023-03-09 19:30:22 +05:30 committed by GitHub
parent 4c676cc0d0
commit 2b54648694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 7 deletions

View File

@ -7,6 +7,19 @@ describe("Git import empty repository", function() {
const assertConnectFailure = true;
const failureMessage =
"git import failed. \nDetails: Cannot import app from an empty repo";
before(() => {
cy.NavigateToHome();
cy.createWorkspace();
cy.wait("@createWorkspace").then((interception) => {
const newWorkspaceName = interception.response.body.data.name;
cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName);
});
cy.generateUUID().then((uid) => {
repoName = uid;
_.gitSync.CreateTestGiteaRepo(repoName);
//cy.createTestGithubRepo(repoName);
});
});
it("Bug #12749 Git Import - Empty Repo NullPointerException", () => {
cy.get(homePage.homeIcon).click();

View File

@ -8,12 +8,19 @@ let repoName;
describe("Tests JS Library with Git", () => {
before(() => {
cy.NavigateToHome();
cy.createWorkspace();
cy.wait("@createWorkspace").then((interception) => {
const newWorkspaceName = interception.response.body.data.name;
cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName);
});
// connect app to git
_.gitSync.CreateNConnectToGit(repoName);
cy.get("@gitRepoName").then((repName) => {
repoName = repName;
});
});
it("1. Install JS Library and commit changes, create branch and verify JS library changes are present on new branch ", () => {
_.entityExplorer.ExpandCollapseEntity("Libraries");
_.installer.openInstaller();

View File

@ -2,7 +2,7 @@ import template from "../../../../locators/TemplatesLocators.json";
import gitSyncLocators from "../../../../locators/gitSyncLocators";
import widgetLocators from "../../../../locators/Widgets.json";
let repoName;
let appId;
let newWorkspaceName;
let branchName = "test/template";
const jsObject = "Utils";
const homePage = require("../../../../locators/HomePage");
@ -11,10 +11,10 @@ import * as _ from "../../../../support/Objects/ObjectsCore";
describe("Fork a template to the current app", () => {
before(() => {
cy.NavigateToHome();
cy.generateUUID().then((id) => {
appId = id;
cy.CreateAppInFirstListedWorkspace(id);
localStorage.setItem("AppName", appId);
cy.createWorkspace();
cy.wait("@createWorkspace").then((interception) => {
newWorkspaceName = interception.response.body.data.name;
cy.CreateAppForWorkspace(newWorkspaceName, newWorkspaceName);
});
_.gitSync.CreateNConnectToGit(repoName);
cy.get("@gitRepoName").then((repName) => {
@ -90,7 +90,7 @@ describe("Fork a template to the current app", () => {
cy.NavigateToHome();
cy.get(homePage.searchInput)
.clear()
.type(appId);
.type(newWorkspaceName);
cy.wait(2000);
cy.get(homePage.applicationCard)
.first()

View File

@ -1,5 +1,5 @@
import { ObjectsRegistry } from "../../../../../support/Objects/Registry";
import { encodedWordDoc, encodedXlsxDoc } from "./exampleEncodedDocs";
import { encodedWordDoc, encodedXlsxDoc } from "../../../../../fixtures/exampleEncodedDocs";
const ee = ObjectsRegistry.EntityExplorer,
locator = ObjectsRegistry.CommonLocators,
deployMode = ObjectsRegistry.DeployMode,