PromucFlow_constructor/app/client/cypress/support/AdminSettingsCommands.js
Aishwarya-U-R 178f8f16f5
test: Cypress | (DI) S3 added validations (Cont.,) + CI Stabilize (#26486)
## Description
**- This PR includes below:**
- NavigateBacktoEditor() improved
- Flaky fixed - ClientSide/EmbedSettings/EmbedSettings_spec.js- 1st test
- ServerSide/QueryPane/S3_1_spec.js - 1st test - handling added error
message
- Sanity/Datasources/Arango_Basic_Spec.ts - 3rd test - schema pop-up
handle
- ClientSide/FormLogin/EnableFormLogin_spec.js - server restart fix
- Moved AssertNetworkExecutionSuccess to AssertHelper
- GetNAssertContains() simplified
- Widgets/ListV2/DataIdentifierProperty_spec.ts - 7th case flaky fix
- /Widgets/Checkbox/CheckboxGroup2_spec.js - flaky fix
- BugTests/AllWidgets_Reset_Spec.ts - script improved
- /Widgets/Radio/Radio_spec.js - script improved
- AssertExistingCheckedState() improved to validate attribute & checked
state
- ClickButton() improved
- AssertElementEnabledDisabled() improved
- UpdateInput(), replaced with TypeText()
**- New scripting for:**
- S3 - Deploy mode validations added
- S3 - Edit File validation added from Deploy page
- S3 - Upon file upload, validating button changes
- S3 - Verify max number of files upload
- S3 - File name Prefix search & Delete improved
- S3_2_spec from js to ts helpers
- Tc # 2439 scripted

#### 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-08-21 13:19:28 +05:30

87 lines
3.2 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: 210000 }).should("not.exist");
cy.window().then((win) => {
win.location.reload();
});
agHelper.AssertElementVisibility(adminSettings.saveButton, true, 0, 30000);
});