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";
|
||||
|
||||
before("Create a new ElasticSearch DS", () => {
|
||||
dataSources.StartContainerNVerify("Elasticsearch", containerName);
|
||||
dataSources.StartContainerNVerify("Elasticsearch", containerName, 40000);
|
||||
dataSources.CreateDataSource("Elasticsearch");
|
||||
cy.get("@dsName").then(($dsName) => {
|
||||
dsName = $dsName;
|
||||
|
|
|
|||
|
|
@ -58,13 +58,14 @@ export class CommonLocators {
|
|||
item +
|
||||
"']/parent::div[@role='menuitem'] | //div[text()='" +
|
||||
item +
|
||||
"']/ancestor::div[@role='menuitem']| //span[text()='" +
|
||||
"']/ancestor::div[@role='menuitem'] | //span[text()='" +
|
||||
item +
|
||||
"']/ancestor::div[@role='menuitem']";
|
||||
_visibleTextDiv = (divText: string) => "//div[text()='" + divText + "']";
|
||||
_visibleTextSpan = (spanText: string) => `//span[text()="` + spanText + `"]`;
|
||||
_openWidget = ".widgets .t--entity-add-btn";
|
||||
_dropHere = ".t--drop-target";
|
||||
_editPage = "[data-testid=onboarding-tasks-datasource-text], .t--drop-target";
|
||||
_crossBtn = "span.cancel-icon";
|
||||
_createNew = ".t--entity-add-btn.group.files button";
|
||||
_uploadFiles = "div.uppy-Dashboard-AddFiles input";
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ export class DataSources {
|
|||
public StartContainerNVerify(
|
||||
containerType: "MsSql" | "Arango" | "Elasticsearch",
|
||||
containerName: string,
|
||||
timeout = 30000,
|
||||
sleepTime = 30000,
|
||||
) {
|
||||
let containerCommand = "";
|
||||
switch (containerType) {
|
||||
|
|
@ -1414,7 +1414,7 @@ export class DataSources {
|
|||
}).then((isReady) => {
|
||||
if (isReady) {
|
||||
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
|
||||
cy.log(
|
||||
`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
|
||||
this.assertHelper.AssertDocumentReady();
|
||||
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() {
|
||||
|
|
|
|||
|
|
@ -238,6 +238,8 @@ export class GitSync {
|
|||
this.agHelper.AssertContains(
|
||||
Cypress.env("MESSAGES").DISCARDING_AND_PULLING_CHANGES(),
|
||||
);
|
||||
this.assertHelper.AssertNetworkStatus("@discardChanges");
|
||||
this.assertHelper.AssertNetworkStatus("@gitStatus");
|
||||
this.agHelper.AssertContains("Discarded changes successfully");
|
||||
this.agHelper.AssertElementExist(this._bottomBarCommit, 0, 30000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1107,13 +1107,11 @@ Cypress.Commands.add("startServerAndRoutes", () => {
|
|||
}).as("sucessSave");
|
||||
|
||||
cy.intercept("POST", "https://api.segment.io/v1/b", (req) => {
|
||||
req.reply((res) => {
|
||||
res.send({
|
||||
//status: 200,
|
||||
body: {
|
||||
success: true, //since anything can be faked!
|
||||
},
|
||||
});
|
||||
req.reply({
|
||||
statusCode: 200,
|
||||
body: {
|
||||
success: false, //since anything can be faked!
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1126,6 +1124,7 @@ Cypress.Commands.add("startServerAndRoutes", () => {
|
|||
cy.intercept("PUT", "/api/v1/tenants", (req) => {
|
||||
req.headers["origin"] = "Cypress";
|
||||
}).as("postTenant");
|
||||
cy.intercept("PUT", "/api/v1/git/discard/app/*").as("discardChanges");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("startErrorRoutes", () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user