PromucFlow_constructor/app/client/cypress/support/AdminSettingsCommands.js
Aishwarya-U-R 6fcf9b48c4
test: Cypess | Oracle DS validations added (Part 2) + CI Stabilize (#27282)
## Description
- This PR adds Oracle validations
- 'Add more' validated from Oracle Ds page
- Tc's automated Tc
[#2204](https://github.com/appsmithorg/TestSmith/issues/2204)
- Added a bit of sleep for keyboard actions (Enter, Escape, Delete)
- Added default param for datasources._host
- Oracle documentation verification added
- get cypress url dashboard url - step commented in ymls, as its no more
used
- Updating Slack message to also display the failing specs in notif
- ElasticSearch spec - update to check hosted run
- ServerSide/GenerateCRUD/MySQL2_Spec.ts - EntityExplore ds name miss
fix
- Update waitForServerRestart() timeout

#### Type of change
- Script fix (non-breaking change which fixes an issue)

## Testing

#### How Has This Been Tested?
- [X] Cypress CI runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-09-14 16:53:42 +05:30

92 lines
3.4 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");
import adminSettings from "../locators/AdminsSettings";
import { ObjectsRegistry } from "./Objects/Registry";
let agHelper = ObjectsRegistry.AggregateHelper;
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", () => {
const baseUrl = BASE_URL.endsWith("/") ? BASE_URL.slice(0, -1) : BASE_URL;
cy.get(githubForm.githubHomepageUrl).should("have.value", `${baseUrl}`);
cy.get(githubForm.githubCallbackUrl).should(
"have.value",
`${baseUrl}/login/oauth2/code/github`,
);
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: 180000,
// });
cy.get(adminSettings.restartNotice, { timeout: 300000 }).should("not.exist");
cy.get(adminSettings.appsmithStarting, { timeout: 300000 }).should(
"not.exist",
);
cy.window().then((win) => {
win.location.reload();
});
agHelper.AssertElementVisibility(adminSettings.saveButton, true, 0, 30000);
agHelper.AssertElementAbsence(adminSettings.restartNotice, 30000);
});