Skip to content

Commit

Permalink
chore: Improve code (#38622)
Browse files Browse the repository at this point in the history
## Description
Minor improvement.


Fixes #
https://app.zenhub.com/workspaces/qa-63316faf86bb2e170ed2e46b/issues/gh/appsmithorg/appsmith/38320

## Automation

/ok-to-test tags="@tag.Settings"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12745102566>
> Commit: 6fd0683
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12745102566&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Settings`
> Spec:
> <hr>Mon, 13 Jan 2025 10:43:28 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
	- Enhanced Cypress end-to-end tests for Admin settings page
	- Added improved loading state and document readiness assertions
- Increased test robustness by ensuring stable application state before
interactions

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
sagar-qa007 authored Jan 15, 2025
1 parent b496e4a commit 71ff3ee
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
agHelper,
adminSettings as adminSettingsHelper,
homePage,
locators,
assertHelper,
} from "../../../../support/Objects/ObjectsCore";

const {
Expand All @@ -25,6 +27,9 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
it("1. Should test that settings page is accessible to super user", () => {
cy.LogOut();
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
agHelper.AssertElementAbsence(locators._loading);
assertHelper.AssertDocumentReady();
agHelper.WaitUntilEleAppear(adminSettingsHelper._adminSettingsBtn);
agHelper.GetNClick(adminSettingsHelper._adminSettingsBtn);
agHelper.AssertURL(adminSettingsHelper.routes.GENERAL);
cy.wait("@getEnvVariables");
Expand All @@ -33,6 +38,8 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {

it("2. Should test that settings page is not accessible to normal users", () => {
cy.LoginFromAPI(Cypress.env("TESTUSERNAME3"), Cypress.env("TESTPASSWORD3"));
agHelper.AssertElementAbsence(locators._loading);
assertHelper.AssertDocumentReady();
agHelper.AssertElementAbsence(adminSettingsHelper._adminSettingsBtn);
agHelper.VisitNAssert(adminSettingsHelper.routes.GENERAL);
// non super users are redirected to home page
Expand All @@ -54,7 +61,9 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
() => {
cy.visit("/applications", { timeout: 60000 });
if (!Cypress.env("AIRGAPPED")) cy.wait("@getAllWorkspaces");

agHelper.AssertElementAbsence(locators._loading);
assertHelper.AssertDocumentReady();
agHelper.WaitUntilEleAppear(adminSettingsHelper._adminSettingsBtn);
agHelper.GetNClick(adminSettingsHelper._adminSettingsBtn);
cy.wait("@getEnvVariables");
agHelper.GetNClick(adminsSettings.generalTab);
Expand Down Expand Up @@ -199,6 +208,9 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
it("10. Verify default instance name", () => {
cy.LogOut();
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
agHelper.AssertElementAbsence(locators._loading);
assertHelper.AssertDocumentReady();
agHelper.WaitUntilEleAppear(adminSettingsHelper._adminSettingsBtn);
agHelper.GetNClick(adminSettingsHelper._adminSettingsBtn);
agHelper.AssertURL(adminSettingsHelper.routes.GENERAL);
cy.wait("@getEnvVariables");
Expand All @@ -213,6 +225,9 @@ describe("Admin settings page", { tags: ["@tag.Settings"] }, function () {
() => {
homePage.LogOutviaAPI();
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
agHelper.AssertElementAbsence(locators._loading);
assertHelper.AssertDocumentReady();
agHelper.WaitUntilEleAppear(adminSettingsHelper._adminSettingsBtn);
agHelper.VisitNAssert("/applications", "getAllWorkspaces");
agHelper.GetNClick(adminSettingsHelper._adminSettingsBtn);
cy.wait("@getEnvVariables");
Expand Down

0 comments on commit 71ff3ee

Please sign in to comment.