test: Cypress - Fix Flaky Tests (#26694)

## Description

**Fixed below flaky tests**
- Widget_property_navigation_spec.ts
- PropertyControl_spec.ts
- Fork_Template_To_App_spec.js
- Video2_Spec.ts
 
## Type of change

- Flaky test fix

## How Has This Been Tested?
- Cypress test runs

## Checklist:
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test

---------

Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
This commit is contained in:
Vijetha-Kaja 2023-08-28 21:53:25 +05:30 committed by GitHub
parent ce9c32cb92
commit 63c86d9393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 110 deletions

View File

@ -143,7 +143,7 @@ describe("excludeForAirgap", "Widget property navigation", () => {
_.agHelper.Sleep(3000); //for tables to populate for CI runs
_.agHelper.GetNClick(OneClickBindingLocator.tableOrSpreadsheetDropdown);
_.agHelper.GetNClick(
OneClickBindingLocator.tableOrSpreadsheetDropdownOption(),
OneClickBindingLocator.tableOrSpreadsheetDropdownOption("movies"),
);
_.agHelper.GetNClick(OneClickBindingLocator.searchableColumn);
_.agHelper.GetNClick(

View File

@ -1,16 +1,19 @@
import widgetLocators from "../../../../locators/Widgets.json";
import template from "../../../../locators/TemplatesLocators.json";
import * as _ from "../../../../support/Objects/ObjectsCore";
let appId, newWorkspaceName;
import {
agHelper,
assertHelper,
deployMode,
entityExplorer,
} from "../../../../support/Objects/ObjectsCore";
describe("excludeForAirgap", "Fork a template to the current app", () => {
afterEach(() => {
_.agHelper.SaveLocalStorageCache();
agHelper.SaveLocalStorageCache();
});
beforeEach(() => {
_.agHelper.RestoreLocalStorageCache();
agHelper.RestoreLocalStorageCache();
// Closes template dialog if it is already open - useful for retry
cy.get("body").then(($ele) => {
if ($ele.find(template.templateDialogBox).length) {
@ -25,7 +28,7 @@ describe("excludeForAirgap", "Fork a template to the current app", () => {
it("1. Fork a template to the current app + Bug 17477", () => {
cy.wait(3000);
_.entityExplorer.AddNewPage("Add page from template");
entityExplorer.AddNewPage("Add page from template");
// Commented out below code as fetch template call is not going through when template dialog is closed
// cy.wait("@fetchTemplate").should(
// "have.nested.property",
@ -38,7 +41,7 @@ describe("excludeForAirgap", "Fork a template to the current app", () => {
.scrollIntoView()
.wait(500)
.click();
_.agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR");
agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR");
cy.wait(6000);
cy.get("body").then(($ele) => {
if ($ele.find(widgetLocators.toastAction).length <= 0) {
@ -51,14 +54,14 @@ describe("excludeForAirgap", "Fork a template to the current app", () => {
"contain",
"template added successfully",
);
_.assertHelper.AssertNetworkStatus("updateLayout");
assertHelper.AssertNetworkStatus("updateLayout");
// [Bug]: Getting 'Resource not found' error on deploying template #17477
_.deployMode.DeployApp();
deployMode.DeployApp();
cy.get(".t--page-switch-tab")
.contains("1 Track Applications")
.click({ force: true });
cy.wait(4000);
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
cy.wait(2000);
});
@ -79,7 +82,7 @@ describe("excludeForAirgap", "Fork a template to the current app", () => {
cy.wait(5000);
cy.get(template.templateDialogBox).should("be.visible");
cy.xpath("//h1[text()='Applicant Tracker-test']").click();
_.agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR");
agHelper.CheckForErrorToast("INTERNAL_SERVER_ERROR");
cy.wait("@getTemplatePages").should(
"have.nested.property",
"response.body.responseMeta.status",
@ -95,10 +98,10 @@ describe("excludeForAirgap", "Fork a template to the current app", () => {
"response.body.responseMeta.status",
200,
);
cy.get(widgetLocators.toastAction, { timeout: 40000 }).should(
cy.get(widgetLocators.toastAction, { timeout: 50000 }).should(
"contain",
"template added successfully",
);
_.assertHelper.AssertNetworkStatus("updateLayout");
assertHelper.AssertNetworkStatus("updateLayout");
});
});

View File

@ -156,107 +156,107 @@ describe("Camera widget - Video test", () => {
//Tests to Validate camera to video widget binding
//Skipping below tests due to issue - https://github.com/appsmithorg/appsmith/issues/26166
it.skip("7. Video Recording test - Disabled Camera but Enabled Microphone", () => {
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("Camera1");
agHelper.GetNClick(propPane._mode("Video"), 1);
entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
// it("7. Video Recording test - Disabled Camera but Enabled Microphone", () => {
// deployMode.NavigateBacktoEditor();
// entityExplorer.SelectEntityByName("Camera1");
// agHelper.GetNClick(propPane._mode("Video"), 1);
// entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
// propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
agHelper.GetNClick(widgetLocators.cameraVideoOnOffBtn);
agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
agHelper.Sleep(3000);
agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
agHelper.GetNClick(widgetLocators.cameraSaveBtn);
agHelper.GetNClick(draggableWidgets.VIDEO);
agHelper.Sleep(5000);
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitAudioDecodedByteCount;
// deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
// agHelper.GetNClick(widgetLocators.cameraVideoOnOffBtn);
// agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
// agHelper.Sleep(3000);
// agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
// agHelper.GetNClick(widgetLocators.cameraSaveBtn);
// agHelper.GetNClick(draggableWidgets.VIDEO);
// agHelper.Sleep(5000);
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitAudioDecodedByteCount;
//Threshold greater than 30000 shows that the audio is playing
expect(attrValue).be.greaterThan(30000);
});
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitVideoDecodedByteCount;
// //Threshold greater than 30000 shows that the audio is playing
// expect(attrValue).be.greaterThan(30000);
// });
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitVideoDecodedByteCount;
//Threshold less than 10000 shows that the video is not playing
expect(attrValue).be.lessThan(10000);
});
});
// //Threshold less than 10000 shows that the video is not playing
// expect(attrValue).be.lessThan(10000);
// });
// });
it.skip("8. Video Recording test - Enabled Camera but Disabled Microphone", () => {
entityExplorer.SelectEntityByName("Camera1");
agHelper.GetNClick(propPane._mode("Video"), 1);
entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
// it("8. Video Recording test - Enabled Camera but Disabled Microphone", () => {
// entityExplorer.SelectEntityByName("Camera1");
// agHelper.GetNClick(propPane._mode("Video"), 1);
// entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
// propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
agHelper.GetNClick(widgetLocators.cameraVideoOnOffBtn);
agHelper.GetNClick(widgetLocators.cameraMicrophoneBtn);
agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
agHelper.Sleep(3000);
agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
agHelper.GetNClick(widgetLocators.cameraSaveBtn);
agHelper.GetNClick(draggableWidgets.VIDEO);
agHelper.Sleep(5000);
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitAudioDecodedByteCount;
// deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
// agHelper.GetNClick(widgetLocators.cameraVideoOnOffBtn);
// agHelper.GetNClick(widgetLocators.cameraMicrophoneBtn);
// agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
// agHelper.Sleep(3000);
// agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
// agHelper.GetNClick(widgetLocators.cameraSaveBtn);
// agHelper.GetNClick(draggableWidgets.VIDEO);
// agHelper.Sleep(5000);
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitAudioDecodedByteCount;
//Threshold less than 1000 shows that the audio is not playing
expect(attrValue).be.lessThan(1000);
});
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitVideoDecodedByteCount;
// //Threshold less than 1000 shows that the audio is not playing
// expect(attrValue).be.lessThan(1000);
// });
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitVideoDecodedByteCount;
//Threshold greater than 30000 shows that the video is playing
expect(attrValue).be.greaterThan(30000);
});
});
// //Threshold greater than 30000 shows that the video is playing
// expect(attrValue).be.greaterThan(30000);
// });
// });
it.skip("9. Video Recording test - Enabled Camera but Enabled Microphone", () => {
entityExplorer.SelectEntityByName("Camera1");
agHelper.GetNClick(propPane._mode("Video"), 1);
entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
// it("9. Video Recording test - Enabled Camera but Enabled Microphone", () => {
// entityExplorer.SelectEntityByName("Camera1");
// agHelper.GetNClick(propPane._mode("Video"), 1);
// entityExplorer.DragNDropWidget(draggableWidgets.VIDEO);
// propPane.TypeTextIntoField("URL", "{{Camera1.videoBlobURL}}");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
agHelper.GetNClick(widgetLocators.cameraMicrophoneBtn);
agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
agHelper.Sleep(3000);
agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
agHelper.GetNClick(widgetLocators.cameraSaveBtn);
agHelper.GetNClick(draggableWidgets.VIDEO);
agHelper.Sleep(5000);
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitAudioDecodedByteCount;
// deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.CAMERA));
// agHelper.GetNClick(widgetLocators.cameraMicrophoneBtn);
// agHelper.GetNClick(widgetLocators.cameraCaptureBtn);
// agHelper.Sleep(3000);
// agHelper.GetNClick(widgetLocators.cameraStopRecordingBtn);
// agHelper.GetNClick(widgetLocators.cameraSaveBtn);
// agHelper.GetNClick(draggableWidgets.VIDEO);
// agHelper.Sleep(5000);
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitAudioDecodedByteCount;
//Threshold greater than 30000 shows that the audio is playing
expect(attrValue).be.greaterThan(30000);
});
agHelper
.GetElement(widgetLocators.cameraVideo)
.eq(1)
.should(($el) => {
const attrValue = $el[0].webkitVideoDecodedByteCount;
// //Threshold greater than 30000 shows that the audio is playing
// expect(attrValue).be.greaterThan(30000);
// });
// agHelper
// .GetElement(widgetLocators.cameraVideo)
// .eq(1)
// .should(($el) => {
// const attrValue = $el[0].webkitVideoDecodedByteCount;
//Threshold greater than 30000 shows that the video is playing
expect(attrValue).be.greaterThan(30000);
});
});
// //Threshold greater than 30000 shows that the video is playing
// expect(attrValue).be.greaterThan(30000);
// });
// });
});

View File

@ -186,7 +186,7 @@ describe("Video widget tests", function () {
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("Video1", "Widgets");
propPane.MoveToTab("Style");
propPane.SelectColorFromColorPicker("backgroundcolor", 14);
propPane.SelectColorFromColorPicker("backgroundcolor", 9);
agHelper.ContainsNClick("Medium");
propPane.EnterJSContext("Border radius", "1.5rem");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.VIDEO));

View File

@ -27,9 +27,7 @@ export default {
tableOrSpreadsheetDropdown:
'[data-testid="t--one-click-binding-table-selector"] .rc-select-selector',
tableOrSpreadsheetDropdownOption: (table?: string) =>
`[data-testId='t--one-click-binding-table-selector--table']${
table ? `:contains(${table})` : ""
}`,
`//div[@data-testId='t--one-click-binding-table-selector--table']//div[text()='${table}']`,
tableOrSpreadsheetSelectedOption: (table?: string) =>
`[data-testid="t--one-click-binding-table-selector"] .rc-select-selection-item${
table ? `:contains(${table})` : ""