PromucFlow_constructor/app/client/cypress/support/AdminSettingsCommands.js
Ankita Kinger e3476450c2
fix: Adding a fix for copy clipboard URL not working on HTTP domain (#21313)
## Description

> Adding a fix for copy clipboard URL not working on HTTP domain.
> Adding Javascript origin and redirect URLs on the google auth settings
page for better UX.
> Removing the upgrade button on the Appsmith watermark setting.
> Updating the placeholder for search input on members page.

Fixes #20574 #21170 

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- Chore (housekeeping or task changes that don't impact user perception)

## How Has This Been Tested?
> Tested all the above points manually and it all works fine.

- Manual

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### 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
2023-03-14 11:41:52 +05:30

75 lines
2.7 KiB
JavaScript

/* eslint-disable cypress/no-unnecessary-waiting */
/* eslint-disable cypress/no-assigning-return-values */
require("cy-verify-downloads").addCustomCommand();
require("cypress-file-upload");
const googleForm = require("../locators/GoogleForm.json");
const googleData = require("../fixtures/googleSource.json");
const githubForm = require("../locators/GithubForm.json");
const adminSettings = require("../locators/AdminsSettings");
const BASE_URL = Cypress.config().baseUrl;
Cypress.Commands.add("fillGoogleFormPartly", () => {
cy.get(googleForm.googleClientId).type(
Cypress.env("APPSMITH_OAUTH2_GOOGLE_CLIENT_ID"),
);
cy.get(googleForm.googleAllowedDomains).type(googleData.googleAllowedDomains);
cy.get(googleForm.saveBtn).click({ force: true });
});
Cypress.Commands.add("fillGoogleForm", () => {
const baseUrl = BASE_URL.endsWith("/") ? BASE_URL.slice(0, -1) : BASE_URL;
cy.get(googleForm.googleJSOriginUrl).should("have.value", `${baseUrl}`);
cy.get(googleForm.googleRedirectUrl).should(
"have.value",
`${baseUrl}/login/oauth2/code/google`,
);
cy.get(googleForm.googleClientId).type(
Cypress.env("APPSMITH_OAUTH2_GOOGLE_CLIENT_ID"),
);
cy.get(googleForm.googleClientSecret).type(
Cypress.env("APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET"),
);
cy.get(googleForm.googleAllowedDomains).type(googleData.googleAllowedDomains);
cy.get(googleForm.saveBtn).click({ force: true });
});
Cypress.Commands.add("fillGithubFormPartly", () => {
cy.get(githubForm.githubClientId).type(
Cypress.env("APPSMITH_OAUTH2_GITHUB_CLIENT_ID"),
);
cy.get(githubForm.saveBtn).click({ force: true });
});
Cypress.Commands.add("fillGithubForm", () => {
cy.get(githubForm.githubClientId).type(
Cypress.env("APPSMITH_OAUTH2_GITHUB_CLIENT_ID"),
);
cy.get(githubForm.githubClientSecret).type(
Cypress.env("APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET"),
);
cy.get(githubForm.saveBtn).click({ force: true });
});
// open authentication page
Cypress.Commands.add("openAuthentication", () => {
cy.get(".admin-settings-menu-option").should("be.visible");
cy.get(".admin-settings-menu-option").click();
cy.url().should("contain", "/settings/general");
// click authentication tab
cy.get(adminSettings.authenticationTab).click();
cy.url().should("contain", "/settings/authentication");
});
Cypress.Commands.add("waitForServerRestart", () => {
cy.get(adminSettings.restartNotice).should("be.visible");
// Wait for restart notice to not be visible with a timeout
// Cannot use cy.get as mentioned in https://github.com/NoriSte/cypress-wait-until/issues/75#issuecomment-572685623
cy.waitUntil(() => !Cypress.$(adminSettings.restartNotice).length, {
timeout: 120000,
});
cy.get(adminSettings.saveButton).should("be.visible");
});