Repository: appsmithorg/appsmith
File: app/client/cypress/e2e/Regression/ClientSide/FormLogin/EnableFormLogin_spec.ts (TypeScript)

Code before:

        agHelper.AssertContains(
          "Signup is restricted on this instance of Appsmith",
          "exist",
          ".ads-v2-callout__children",
        );

        // Cleanup: Restore form signup to enabled state
        cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
        objectsCoreAdminSettings.NavigateToAuthenticationSettings();
        objectsCoreAdminSettings.toggleFormSignupLoginAndSave(true, "signup");
      });
    },
  );

  it(
    "2. Go to admin settings and disable Form Login",
    { tags: ["@tag.excludeForAirgap"] },
    function () {
      objectsCoreAdminSettings.NavigateToAuthenticationSettings();
      objectsCoreAdminSettings.verifyFormLogin();

      // enable github login
      agHelper.GetNClick(adminSettings.githubButton);
      agHelper.WaitForCondition(() =>
        agHelper.AssertContains("GitHub authentication", "exist"),
      );
      objectsCoreAdminSettings.fillSaveAndAssertGithubForm();

      // Disable form login
      objectsCoreAdminSettings.NavigateToAuthenticationSettings();
      objectsCoreAdminSettings.verifyFormLogin();
      objectsCoreAdminSettings.toggleFormSignupLoginAndSave(false, "login");
      objectsCoreAdminSettings.logoutFromApp();

      // validate login is disabled
      agHelper.AssertElementAbsence(loginPage.loginForm);
      agHelper.AssertElementAbsence(loginPage.signupLink);

      // restore settings
      cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));

      agHelper.AssertElementVisibility(homePage.homeIcon);
      agHelper.GetNClick(homePage.homeIcon, 0, true, 2500);
      objectsCoreAdminSettings.NavigateToAuthenticationSettings(false);
      objectsCoreAdminSettings.toggleFormSignupLoginAndSave(true, "login");
      agHelper.AssertElementVisibility(homePage.homeIcon);
      agHelper.GetNClick(homePage.homeIcon, 0, true, 2500);
      objectsCoreAdminSettings.NavigateToAuthenticationSettings(false);
      agHelper.GetNClick(adminSettings.githubButton);
      agHelper.GetNClick(adminSettings.disconnectBtn);

Review comment (suggestion):
Please add the section under comment `// validating form signup is disabled` from the original file. That cross checks this setting change to true now allows signups without any callout.

Code after:
        agHelper.AssertContains(
          "Signup is restricted on this instance of Appsmith",
          "exist",
          ".ads-v2-callout__children",
        );

        // Cleanup: Restore form signup to enabled state
        cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
        objectsCoreAdminSettings.NavigateToAuthenticationSettings();
        objectsCoreAdminSettings.toggleFormSignupLoginAndSave(true, "signup");
        objectsCoreAdminSettings.logoutFromApp();

        agHelper.GetNClick(loginPage.signupLink);
        agHelper.GenerateUUID();
        agHelper.GetElement("@guid").then((uid) => {
          const email = uid.toString() + "@appsmith.com";
          const password = uid.toString();

          agHelper.TypeText("[type='email']", email);
          agHelper.TypeText("[type='password']", password);
          agHelper.GetNClick("[type='submit']");

          agHelper.AssertElementAbsence(".ads-v2-callout__children");
        });
      });
    },
  );

  it(
    "2. Go to admin settings and disable Form Login",
    { tags: ["@tag.excludeForAirgap"] },
    function () {
      cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
      // agHelper.Sleep(10000);
      objectsCoreAdminSettings.NavigateToAuthenticationSettings(false);
      objectsCoreAdminSettings.verifyFormLogin();

      // enable github login
      agHelper.GetNClick(adminSettings.githubButton);
      agHelper.WaitForCondition(() =>
        agHelper.AssertContains("GitHub authentication", "exist"),
      );
      objectsCoreAdminSettings.fillSaveAndAssertGithubForm();

      // Disable form login
      objectsCoreAdminSettings.NavigateToAuthenticationSettings();
      objectsCoreAdminSettings.verifyFormLogin();
      objectsCoreAdminSettings.toggleFormSignupLoginAndSave(false, "login");
      objectsCoreAdminSettings.logoutFromApp();

      // validate login is disabled