Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Cypress | Helpers improved + Flaky fixes #30735

Merged
merged 66 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
91731a8
RenameApplication & Signup improved
Aishwarya-U-R Jan 29, 2024
6b37139
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 30, 2024
c5cd8f6
run all
Aishwarya-U-R Jan 30, 2024
a751d91
MemberRoles_Spec fix
Aishwarya-U-R Jan 30, 2024
8730712
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 30, 2024
3365f71
fix
Aishwarya-U-R Jan 30, 2024
e2b75fb
fix
Aishwarya-U-R Jan 30, 2024
91f6d31
fix
Aishwarya-U-R Jan 30, 2024
86af661
EnableGAC improve
Aishwarya-U-R Jan 30, 2024
fdc51d7
Signout improve
Aishwarya-U-R Jan 30, 2024
9f56bc4
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 30, 2024
757b04f
homePage.LeaveWorkspace() updated
Aishwarya-U-R Jan 30, 2024
1c42038
AssertViewPageLoad() added
Aishwarya-U-R Jan 30, 2024
e4f36ce
LogintoApp improve
Aishwarya-U-R Jan 30, 2024
2a946de
fix
Aishwarya-U-R Jan 30, 2024
f7099e5
fix
Aishwarya-U-R Jan 30, 2024
aa14eb4
fix
Aishwarya-U-R Jan 30, 2024
7cf06a7
fix
Aishwarya-U-R Jan 30, 2024
44d7f4a
fix
Aishwarya-U-R Jan 30, 2024
bc71064
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 30, 2024
c69c6b0
removed comment
Aishwarya-U-R Jan 30, 2024
c5ebd5d
trial
Aishwarya-U-R Jan 30, 2024
569ee35
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 30, 2024
0b743d6
run all
Aishwarya-U-R Jan 30, 2024
cc66105
fix
Aishwarya-U-R Jan 30, 2024
f03f3c5
Shareapp fix
Aishwarya-U-R Jan 30, 2024
f863e68
remove comment
Aishwarya-U-R Jan 30, 2024
2a56b3b
SetProperty/WidgetPropertySetters2_spec.ts flaky fix
Aishwarya-U-R Jan 30, 2024
a472636
run only
Aishwarya-U-R Jan 30, 2024
445b5c5
Fork_Template_Existing_app_spec fix
Aishwarya-U-R Jan 30, 2024
9591d16
run limit
Aishwarya-U-R Jan 30, 2024
8cae8a1
OtherUIFeatures/ApplicationURL_spec.js flaky fix
Aishwarya-U-R Jan 30, 2024
6db463a
run limit
Aishwarya-U-R Jan 30, 2024
a61464c
RenameApplication fixes for js
Aishwarya-U-R Jan 30, 2024
feac2b5
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
88d8cd1
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
81d3f83
fix
Aishwarya-U-R Jan 31, 2024
abddb62
fix
Aishwarya-U-R Jan 31, 2024
752ba99
fix
Aishwarya-U-R Jan 31, 2024
2f31407
moved getConsolidatedData to commands.js
Aishwarya-U-R Jan 31, 2024
c3ba626
more checkss
Aishwarya-U-R Jan 31, 2024
cfd12c7
trial fix
Aishwarya-U-R Jan 31, 2024
b08169f
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
ecb21cb
adding back
Aishwarya-U-R Jan 31, 2024
8e9ddb5
run all
Aishwarya-U-R Jan 31, 2024
6206909
fix
Aishwarya-U-R Jan 31, 2024
614d353
OpenMembersPageForWorkspace imprpved
Aishwarya-U-R Jan 31, 2024
1c96648
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
2315e0a
more fixes
Aishwarya-U-R Jan 31, 2024
13a2947
Shareapp fix
Aishwarya-U-R Jan 31, 2024
59f689a
fix
Aishwarya-U-R Jan 31, 2024
a858b6c
fix
Aishwarya-U-R Jan 31, 2024
cad4c3a
ru only
Aishwarya-U-R Jan 31, 2024
abb5062
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
6a9e348
fix
Aishwarya-U-R Jan 31, 2024
f1fe61b
Fork_Template_Existing_app_spec fix
Aishwarya-U-R Jan 31, 2024
9541d03
fork template existing app fix
Aishwarya-U-R Jan 31, 2024
0a2363c
Application url spex fix
Aishwarya-U-R Jan 31, 2024
5bc8b0f
trial Application spec fix
Aishwarya-U-R Jan 31, 2024
d22c7f0
run all
Aishwarya-U-R Jan 31, 2024
00b6048
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Jan 31, 2024
0ad2199
remove comments
Aishwarya-U-R Jan 31, 2024
8169919
Merge branch 'release' into test/renameappflakyfix
Aishwarya-U-R Feb 1, 2024
6c44ef8
revert
Aishwarya-U-R Feb 1, 2024
9fe9af1
running fixed tests
Aishwarya-U-R Feb 1, 2024
0e2f658
Revert "running fixed tests"
Aishwarya-U-R Feb 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe("Slug URLs", () => {
cy.generateUUID().then((appName) => {
applicationName = appName;
homePage.RenameApplication(applicationName);
assertHelper.AssertNetworkStatus("updateApplication");
cy.location("pathname").then((pathname) => {
const pageId = pathname.split("/")[3]?.split("-").pop();
expect(pathname).to.be.equal(`/app/${appName}/page1-${pageId}/edit`);
Expand Down Expand Up @@ -84,21 +83,23 @@ describe("Slug URLs", () => {
});
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT);

cy.updateCodeInput(
".t--property-control-text",
`{{appsmith.URL.pathname}}`,
propPane.UpdatePropertyFieldValue(
"Text",
"{{appsmith.URL.pathname}}",
);

cy.get(".t--draggable-textwidget .bp3-ui-text").should(
"contain.text",
`/applications/${application.id}/pages/${currentPageId}/edit`,
);

cy.get(".t--upgrade").click({ force: true });
agHelper.GetNClick(".t--upgrade");

cy.get(".t--upgrade-confirm").click({ force: true });
agHelper.ClickButton("Update");

cy.wait("@getConsolidatedData").then((intercept) => {
assertHelper.AssertNetworkStatus("getConsolidatedData");

cy.get("@getConsolidatedData").then((intercept) => {
const { application, pages } =
intercept.response.body.data.pages.data;

Expand All @@ -109,7 +110,9 @@ describe("Slug URLs", () => {
`/app/${application.slug}/${currentPage.slug}-${currentPage.id}`,
);
});

agHelper.AssertElementVisibility(
locators._widgetInCanvas(draggableWidgets.TEXT),
);
cy.get(".t--draggable-textwidget .bp3-ui-text").should(
"contain.text",
`/app/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
Expand All @@ -124,6 +127,9 @@ describe("Slug URLs", () => {
`/app/${application.slug}/${currentPage.slug}-${currentPage.id}/edit`,
);
});
agHelper.AssertElementVisibility(
locators._widgetInCanvas(draggableWidgets.TEXT),
);
});
});
});
Expand All @@ -133,7 +139,7 @@ describe("Slug URLs", () => {
it("4. Checks redirect url", () => {
cy.url().then((url) => {
homePage.Signout(true);
agHelper.VisitNAssert(url + "?embed=true&a=b", "getConsolidatedData");
agHelper.VisitNAssert(url + "?embed=true&a=b"); //removing 'getConsolidatedData' api check due to its flakyness
agHelper.AssertURL(
`?redirectUrl=${encodeURIComponent(url + "?embed=true&a=b")}`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ describe(
false,
);
jsEditor.EnableDisableAsyncFuncSettings("myFun1", true, false);
deployMode.DeployApp();
agHelper.AssertElementVisibility(
locators._widgetInDeployed(draggableWidgets.BUTTON), //Asserting before setTimeout JS function execution, button is visible
);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON)); //Asserting before setTimeout JS function execution, button is visible
agHelper.Sleep(2000); //waiting for settimeout to execute
agHelper.AssertElementAbsence(
locators._widgetInDeployed(draggableWidgets.BUTTON),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import widgetLocators from "../../../../locators/Widgets.json";
import template from "../../../../locators/TemplatesLocators.json";
import { agHelper, templates } from "../../../../support/Objects/ObjectsCore";
import {
agHelper,
assertHelper,
locators,
templates,
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
} from "../../../../support/Pages/EditorNavigation";
Expand All @@ -23,13 +28,15 @@ describe(
it("1. Fork template from page section", () => {
//Fork template button to be visible always
PageList.AddNewPage("Add page from template");
agHelper.Sleep(5000);
agHelper.AssertElementExist(template.templateDialogBox);
agHelper.AssertElementVisibility(template.templateDialogBox);
agHelper.AssertElementVisibility(templates.locators._templateCard);
agHelper.Sleep(4000);
agHelper.AssertElementVisibility(template.vehicleMaintenenceApp);
agHelper.GetNClick(template.vehicleMaintenenceApp);
agHelper.WaitUntilEleDisappear("//*[text()='Loading template details']");
agHelper.Sleep();
agHelper.AssertElementAbsence(
"//*[text()='Loading template details']",
Cypress.config().pageLoadTimeout,
);
agHelper.FailIfErrorToast(
"Internal server error while processing request",
);
Expand All @@ -40,60 +47,46 @@ describe(
}
}
});
cy.get(widgetLocators.toastAction).should(
"contain",
"template added successfully",
agHelper.AssertElementAbsence(
locators._visibleTextSpan("Setting up the template"),
Cypress.config().pageLoadTimeout,
);
agHelper.ValidateToastMessage("template added successfully");
agHelper.AssertElementVisibility(locators._itemContainerWidget);
agHelper.WaitUntilAllToastsDisappear();
});

it("2. Add selected page of template from page section", () => {
PageList.AddNewPage("Add page from template");
agHelper.AssertElementVisibility(template.templateDialogBox);
agHelper.AssertElementVisibility(
templates.locators._templateCard,
true,
0,
30000,
);
agHelper.AssertElementVisibility(templates.locators._templateCard);
agHelper.AssertElementVisibility(template.vehicleMaintenenceApp);
agHelper.GetNClick(template.vehicleMaintenenceApp);
//agHelper.WaitUntilEleDisappear("//*[text()='Loading template details']");
cy.wait("@getTemplatePages").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
agHelper.AssertElementAbsence(
"//*[text()='Loading template details']",
Cypress.config().pageLoadTimeout,
);

//cy.xpath(template.selectAllPages).next().click();
// cy.xpath("//span[text()='CALENDAR MOBILE']").parent().next().click();
agHelper.GetNClick(template.templateViewForkButton);
cy.wait("@fetchTemplate").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
assertHelper.AssertNetworkStatus("getTemplatePages");
agHelper.CheckUncheck(template.selectAllPages, false);
agHelper.CheckUncheck(
"div:has(> span:contains('New vehicle')) + label input[type='checkbox']",
);
agHelper.GetNAssertElementText(
widgetLocators.toastAction,
"template added successfully",
"contain.text",
agHelper.GetNClick(template.templateViewForkButton);
agHelper.AssertElementAbsence(
locators._visibleTextSpan("Setting up the template"),
Cypress.config().pageLoadTimeout,
);
assertHelper.AssertNetworkStatus("fetchTemplate");
agHelper.WaitUntilToastDisappear("template added successfully");
agHelper.AssertElementVisibility(locators._itemContainerWidget);
});

it("3. Templates card should take user to 'select pages from template' page", () => {
//agHelper.RefreshPage();

PageList.AddNewPage("Add page from template");
agHelper.AssertElementVisibility(
templates.locators._templateCard,
true,
0,
30000,
);
agHelper.AssertElementVisibility(templates.locators._templateCard);
agHelper.GetNClick(templates.locators._templateCard);
agHelper.Sleep(2000);
agHelper.AssertElementVisibility(template.templateViewForkButton);
agHelper.Sleep(2000);
agHelper.GetNClick(templates.locators._closeTemplateDialogBoxBtn);
agHelper.Sleep();

//Similar templates add icon should take user to 'select pages from template'
//agHelper.RefreshPage();
Expand All @@ -102,9 +95,7 @@ describe(
agHelper.GetNClick(templates.locators._templateCard);
// Here we are on template detail page, with similar templates at the bottom
agHelper.GetNClick(templates.locators._templateCard);
agHelper.Sleep(2000);
agHelper.AssertElementVisibility(template.templateViewForkButton);
agHelper.Sleep(2000);
agHelper.GetNClick(templates.locators._closeTemplateDialogBoxBtn);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
//Renaming imported app!
const uuid = () => Cypress._.random(0, 1e4);
const name = uuid();
cy.wait(2000);
cy.AppSetupForRename();
cy.get(homePage.applicationName).type(`app${name}`);
homePageHelpers.RenameApplication(`app${name}`);
cy.wrap(`app${name}`).as("appname");
cy.wait(2000);

// Validating data binding for the imported application - Page1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ describe(
{ tags: ["@tag.Workspace"] },
() => {
it("1. Create new Workspace, Share with a user from UI & verify", () => {
_.adminSettings.EnableGAC(true, true);
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(true, false);
_.agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
workspaceId = uid;
appid = uid;
_.homePage.CreateNewWorkspace(workspaceId);
_.homePage.CreateNewWorkspace(workspaceId, true);
_.homePage.CheckWorkspaceShareUsersCount(workspaceId, 1);
_.homePage.InviteUserToWorkspaceErrorMessage(workspaceId, "abcdef");
cy.visit("/applications", { timeout: 60000 });
Expand All @@ -27,12 +27,11 @@ describe(
_.homePage.CheckWorkspaceShareUsersCount(workspaceId, 2);
_.homePage.CreateAppInWorkspace(workspaceId, appid);
});
_.homePage.LogOutviaAPI();
});

it("2. Login as Administrator and search for users using search bar", () => {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.adminSettings.EnableGAC(false, true);
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.agHelper.GetNClick(_.homePage._shareWorkspace(workspaceId));
_.agHelper.GetNClick(_.homePage._visibleTextSpan("Manage users"));
Expand All @@ -44,7 +43,6 @@ describe(
cy.get(".search-highlight")
.should("exist")
.contains(Cypress.env("TESTUSERNAME1"));
_.homePage.Signout();
});

it("3. Login as Invited user and validate Viewer role", function () {
Expand All @@ -53,8 +51,8 @@ describe(
Cypress.env("TESTPASSWORD1"),
"App Viewer",
);
_.adminSettings.EnableGAC(false, true, "home");
_.agHelper.RefreshPage();
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
_.homePage.SelectWorkspace(workspaceId);
cy.get(_.homePage._applicationCard).first().trigger("mouseover");
cy.get(_.homePage._appHoverIcon("edit")).should("not.exist");
Expand All @@ -67,22 +65,19 @@ describe(
.should("have.length", 1)
.and("contain.text", `App Viewer`);
_.agHelper.GetNClick(HomePage.closeBtn);
_.homePage.LaunchAppFromAppHover();
//_.deployMode.NavigateToHomeDirectly();
_.homePage.Signout(false);
_.homePage.LaunchAppFromAppHover(_.locators._emptyPageTxt);
});

it("4. Login as Workspace owner and Update the Invited user role to Developer", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.adminSettings.EnableGAC(false, true);
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
workspaceId,
Cypress.env("TESTUSERNAME1"),
"App Viewer",
"Developer",
);
_.homePage.Signout();
});

it("5. Login as Invited user and validate Developer role", function () {
Expand All @@ -91,7 +86,8 @@ describe(
Cypress.env("TESTPASSWORD1"),
"Developer",
);
_.adminSettings.EnableGAC(false, true, "home");
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
_.homePage.SelectWorkspace(workspaceId);
cy.get(_.homePage._applicationCard).first().trigger("mouseover");
_.agHelper.AssertElementExist(_.homePage._appHoverIcon("edit"));
Expand All @@ -114,21 +110,18 @@ describe(

_.agHelper.GetNClick(HomePage.closeBtn);
_.agHelper.GetNClick(_.homePage._appHoverIcon("edit"));

_.homePage.Signout();
});

it("6. Login as Workspace owner and Update the Invited user role to Administrator", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.adminSettings.EnableGAC(false, true);
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
workspaceId,
Cypress.env("TESTUSERNAME1"),
"Developer",
"Administrator",
);
_.homePage.Signout();
});

it("7. Login as Invited user and validate Administrator role", function () {
Expand All @@ -137,11 +130,13 @@ describe(
Cypress.env("TESTPASSWORD1"),
"Administrator",
);
_.adminSettings.EnableGAC(false, true, "home");
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
_.homePage.InviteUserToWorkspace(
workspaceId,
Cypress.env("TESTUSERNAME2"),
"App Viewer",
false,
);
_.agHelper.GetNClick(HomePage.closeBtn);
_.agHelper.Sleep();
Expand Down Expand Up @@ -169,13 +164,11 @@ describe(
cy.get(".rc-select-item-option").should("contain.text", `Administrator`);
_.agHelper.GetNClick(HomePage.closeBtn);
_.agHelper.GetNClick(_.homePage._appHoverIcon("edit"));

_.homePage.Signout();
});

it("8. Login as Workspace owner and verify all 3 users are present", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.adminSettings.EnableGAC(false, true);
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
workspaceId,
Expand All @@ -200,9 +193,9 @@ describe(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
_.adminSettings.EnableGAC(false, true, "home");
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
_.homePage.LeaveWorkspace(workspaceId);
_.homePage.Signout();
});

it("10. Login as App Viewer, Verify leave workspace flow", () => {
Expand All @@ -211,10 +204,10 @@ describe(
Cypress.env("TESTPASSWORD2"),
"App Viewer",
);
_.adminSettings.EnableGAC(false, true, "home");
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
_.homePage.SelectWorkspace(workspaceId);
_.homePage.LeaveWorkspace(workspaceId);
_.homePage.LogOutviaAPI();
});
},
);
Loading
Loading