test: Cypress | Flaky fixes (#24723)
- This PR fixes below flaky specs:
- GitDiscardChange/DiscardChanges_spec.js
- Socket closed before finished writing response fix
- Workspace/ShareAppTests_spec.js (NavigateBacktoEditor() fix)
- Script fix (non-breaking change which fixes an issue)
- [X] Cypress
- [X] Added `Test Plan Approved` label after changes are reviewed
(cherry picked from commit 6df0810cc9)
This commit is contained in:
parent
b8be6e4161
commit
d9af859d41
|
|
@ -11,7 +11,7 @@ describe("Validate Elasticsearch DS", () => {
|
||||||
containerName = "elasticsearch1";
|
containerName = "elasticsearch1";
|
||||||
|
|
||||||
before("Create a new ElasticSearch DS", () => {
|
before("Create a new ElasticSearch DS", () => {
|
||||||
dataSources.StartContainerNVerify("Elasticsearch", containerName);
|
dataSources.StartContainerNVerify("Elasticsearch", containerName, 40000);
|
||||||
dataSources.CreateDataSource("Elasticsearch");
|
dataSources.CreateDataSource("Elasticsearch");
|
||||||
cy.get("@dsName").then(($dsName) => {
|
cy.get("@dsName").then(($dsName) => {
|
||||||
dsName = $dsName;
|
dsName = $dsName;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ export class CommonLocators {
|
||||||
_visibleTextSpan = (spanText: string) => `//span[text()="` + spanText + `"]`;
|
_visibleTextSpan = (spanText: string) => `//span[text()="` + spanText + `"]`;
|
||||||
_openWidget = ".widgets .t--entity-add-btn";
|
_openWidget = ".widgets .t--entity-add-btn";
|
||||||
_dropHere = ".t--drop-target";
|
_dropHere = ".t--drop-target";
|
||||||
|
_editPage = "[data-testid=onboarding-tasks-datasource-text], .t--drop-target";
|
||||||
_crossBtn = "span.cancel-icon";
|
_crossBtn = "span.cancel-icon";
|
||||||
_createNew = ".t--entity-add-btn.group.files button";
|
_createNew = ".t--entity-add-btn.group.files button";
|
||||||
_uploadFiles = "div.uppy-Dashboard-AddFiles input";
|
_uploadFiles = "div.uppy-Dashboard-AddFiles input";
|
||||||
|
|
|
||||||
|
|
@ -1390,7 +1390,7 @@ export class DataSources {
|
||||||
public StartContainerNVerify(
|
public StartContainerNVerify(
|
||||||
containerType: "MsSql" | "Arango" | "Elasticsearch",
|
containerType: "MsSql" | "Arango" | "Elasticsearch",
|
||||||
containerName: string,
|
containerName: string,
|
||||||
timeout = 30000,
|
sleepTime = 30000,
|
||||||
) {
|
) {
|
||||||
let containerCommand = "";
|
let containerCommand = "";
|
||||||
switch (containerType) {
|
switch (containerType) {
|
||||||
|
|
@ -1414,7 +1414,7 @@ export class DataSources {
|
||||||
}).then((isReady) => {
|
}).then((isReady) => {
|
||||||
if (isReady) {
|
if (isReady) {
|
||||||
cy.log("Run id of started container is:" + result.stdout);
|
cy.log("Run id of started container is:" + result.stdout);
|
||||||
this.agHelper.Sleep(timeout); //allow some time for container to settle start for CI
|
this.agHelper.Sleep(sleepTime); //allow some time for container to settle start for CI
|
||||||
} else
|
} else
|
||||||
cy.log(
|
cy.log(
|
||||||
`Error from ${containerName} container start action:` +
|
`Error from ${containerName} container start action:` +
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ export class DeployMode {
|
||||||
); //Assert that is not error toast in Edit mode when navigating back from Deploy mode
|
); //Assert that is not error toast in Edit mode when navigating back from Deploy mode
|
||||||
this.assertHelper.AssertDocumentReady();
|
this.assertHelper.AssertDocumentReady();
|
||||||
this.assertHelper.AssertNetworkStatus("@getWorkspace");
|
this.assertHelper.AssertNetworkStatus("@getWorkspace");
|
||||||
this.agHelper.AssertElementVisible(this.locator._dropHere); //Assert if canvas is visible after Navigating back!
|
this.agHelper.AssertElementVisible(this.locator._editPage); //Assert if canvas is visible after Navigating back!
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavigateToHomeDirectly() {
|
public NavigateToHomeDirectly() {
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,8 @@ export class GitSync {
|
||||||
this.agHelper.AssertContains(
|
this.agHelper.AssertContains(
|
||||||
Cypress.env("MESSAGES").DISCARDING_AND_PULLING_CHANGES(),
|
Cypress.env("MESSAGES").DISCARDING_AND_PULLING_CHANGES(),
|
||||||
);
|
);
|
||||||
|
this.assertHelper.AssertNetworkStatus("@discardChanges");
|
||||||
|
this.assertHelper.AssertNetworkStatus("@gitStatus");
|
||||||
this.agHelper.AssertContains("Discarded changes successfully");
|
this.agHelper.AssertContains("Discarded changes successfully");
|
||||||
this.agHelper.AssertElementExist(this._bottomBarCommit, 0, 30000);
|
this.agHelper.AssertElementExist(this._bottomBarCommit, 0, 30000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1107,15 +1107,13 @@ Cypress.Commands.add("startServerAndRoutes", () => {
|
||||||
}).as("sucessSave");
|
}).as("sucessSave");
|
||||||
|
|
||||||
cy.intercept("POST", "https://api.segment.io/v1/b", (req) => {
|
cy.intercept("POST", "https://api.segment.io/v1/b", (req) => {
|
||||||
req.reply((res) => {
|
req.reply({
|
||||||
res.send({
|
statusCode: 200,
|
||||||
//status: 200,
|
|
||||||
body: {
|
body: {
|
||||||
success: true, //since anything can be faked!
|
success: false, //since anything can be faked!
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
cy.intercept("PUT", "/api/v1/admin/env", (req) => {
|
cy.intercept("PUT", "/api/v1/admin/env", (req) => {
|
||||||
req.headers["origin"] = "Cypress";
|
req.headers["origin"] = "Cypress";
|
||||||
|
|
@ -1126,6 +1124,7 @@ Cypress.Commands.add("startServerAndRoutes", () => {
|
||||||
cy.intercept("PUT", "/api/v1/tenants", (req) => {
|
cy.intercept("PUT", "/api/v1/tenants", (req) => {
|
||||||
req.headers["origin"] = "Cypress";
|
req.headers["origin"] = "Cypress";
|
||||||
}).as("postTenant");
|
}).as("postTenant");
|
||||||
|
cy.intercept("PUT", "/api/v1/git/discard/app/*").as("discardChanges");
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("startErrorRoutes", () => {
|
Cypress.Commands.add("startErrorRoutes", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user