Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -20,7 +20,7 @@ describe(
cy.url().then((url) => {
const forkableAppUrl = url;
cy.LogOut();
cy.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe(
{ tags: ["@tag.Fork"] },
function () {
it("1. Mark application as forkable", () => {
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) adminSettings.EnableGAC(false, true);

homePage.CreateNewApplication();
Expand All @@ -50,7 +50,7 @@ describe(
cy.url().then((url) => {
forkableAppUrl = url;
cy.LogOut();
homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand All @@ -60,7 +60,7 @@ describe(
});

it("2. Check if the forked application has the same dsl as the original", function () {
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
const workspaceName = fakerHelper.GetRandomNumber() + "workspace";

homePage.CreateNewWorkspace(workspaceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe(
);
cy.LogOut();

cy.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand All @@ -52,7 +52,7 @@ describe(
});

it("2. User with developer access,should not be able to export the app", function () {
cy.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) adminSettings.EnableGAC(false, true);
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
Expand All @@ -68,7 +68,7 @@ describe(

cy.LogOut();

cy.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand All @@ -90,7 +90,7 @@ describe(
});

it("3. User with viewer access,should not be able to export the app", function () {
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) adminSettings.EnableGAC(false, true);
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
Expand All @@ -106,7 +106,7 @@ describe(
);
cy.LogOut();

cy.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("Private embed in-app ramp", { tags: ["@tag.Settings"] }, () => {
);
_.inviteModal.CloseModal();
_.homePage.Signout(false);
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ describe(
false,
);
homePage.LogOutviaAPI();
homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"App Viewer",
);
homePage.OpenWorkspaceOptions(newWorkspaceName);
agHelper.AssertContains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ describe(
);
homePage.LogOutviaAPI();

homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"App Viewer",
);
agHelper.AssertContains(newWorkspaceName);
homePage.SelectWorkspace(newWorkspaceName, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe(
});

it("2. Login as Administrator and search for users using search bar", () => {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.agHelper.GetNClick(_.homePage._shareWorkspace(workspaceId));
Expand All @@ -46,10 +46,9 @@ describe(
});

it("3. Login as Invited user and validate Viewer role", function () {
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"App Viewer",
);
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
Expand All @@ -69,7 +68,7 @@ describe(
});

it("4. Login as Workspace owner and Update the Invited user role to Developer", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
Expand All @@ -81,10 +80,9 @@ describe(
});

it("5. Login as Invited user and validate Developer role", function () {
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"Developer",
);
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
Expand Down Expand Up @@ -113,7 +111,7 @@ describe(
});

it("6. Login as Workspace owner and Update the Invited user role to Administrator", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
Expand All @@ -125,10 +123,9 @@ describe(
});

it("7. Login as Invited user and validate Administrator role", function () {
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"Administrator",
);
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
Expand Down Expand Up @@ -167,7 +164,7 @@ describe(
});

it("8. Login as Workspace owner and verify all 3 users are present", function () {
_.homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
if (CURRENT_REPO === REPO.EE) _.adminSettings.EnableGAC(false, true);
_.homePage.SelectWorkspace(workspaceId);
_.homePage.UpdateUserRoleInWorkspace(
Expand All @@ -189,7 +186,7 @@ describe(
});

it("9. Login as Developer, Verify leave workspace flow", () => {
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
Expand All @@ -199,10 +196,9 @@ describe(
});

it("10. Login as App Viewer, Verify leave workspace flow", () => {
_.homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME2"),
Cypress.env("TESTPASSWORD2"),
"App Viewer",
);
if (CURRENT_REPO === REPO.EE)
_.adminSettings.EnableGAC(false, true, "home");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ describe(
});

it("2. login as Invited user and then validate viewer privilage", function () {
homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
"App Viewer",
);
if (CURRENT_REPO == REPO.EE) adminSettings.EnableGAC(false, true, "home");

Expand All @@ -61,7 +60,7 @@ describe(
});

it("3. Enable public access to Application", function () {
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
homePage.FilterApplication(appid);
homePage.EditAppFromAppHover();
agHelper.AssertElementAbsence(locators._loading);
Expand Down Expand Up @@ -90,7 +89,7 @@ describe(
});

it("5. login as uninvited user and then validate public access of Application", function () {
homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME2"),
Cypress.env("TESTPASSWORD2"),
);
Expand All @@ -105,7 +104,7 @@ describe(
});

it("6. login as Owner and disable public access", function () {
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
homePage.FilterApplication(appid);
agHelper
.GetElement(homePage._applicationCard)
Expand All @@ -120,7 +119,7 @@ describe(
});

it("7. login as uninvited user, validate public access disable feature ", function () {
homePage.LogintoApp(
cy.LoginFromAPI(
Cypress.env("TESTUSERNAME2"),
Cypress.env("TESTPASSWORD2"),
);
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Cypress.Commands.add("LogintoApp", (uname, pword) => {
});

Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
homePageTS.LogOutviaAPI();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper error handling for the logout operation.

Consider adding error handling around homePageTS.LogOutviaAPI() to manage cases where the logout fails, which could impact the subsequent login process.


Refactor to improve logout reliability before login.

- homePageTS.LogOutviaAPI();
+ if (CURRENT_REPO === REPO.EE) {
+   homePageTS.LogOutviaAPI();
+ }

This change ensures that the logout via API is only called in the Enterprise Edition, which might have specific requirements or configurations that differ from the Community Edition.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
homePageTS.LogOutviaAPI();
if (CURRENT_REPO === REPO.EE) {
homePageTS.LogOutviaAPI();
}

Consider improving the login check logic for better reliability.

- cy.location().should((loc) => {
-   expect(loc.href).to.eq(loc.origin + "/applications");
- });
+ cy.location('pathname').should('eq', '/applications');

This change uses Cypress's built-in command for pathname comparison, which is less error-prone and more readable.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
homePageTS.LogOutviaAPI();
homePageTS.LogOutviaAPI();
cy.location('pathname').should('eq', '/applications');

let baseURL = Cypress.config().baseUrl;
baseURL = baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL;

Expand Down