## Description This includes > Building a new image for airgapped instances > Running ci-tests on airgapped image > Running cypress tests selectively ignoring non supported features for airgap like Templates, Custom JS lib and also alternating test behaviours for some tests like tests using mock db, since it doesn't work on airgap we have to create a ds. So this selective testing was done using cypress-tags > Having a new client build for airgapped images which bundles all the assets. > And changes in the workflow files to account for all the above. With airgap, we can ignore certain tests and also need to account for tests using mock datasources and such by creating new datasources instead of mock datasources. Since those are blocked. So to perform a selective testing we are using a plugin called `cypress-tags` and to perform conditional testing when required we use the `AIRGAPPED` cypress env. This PR introduces both and also modified the codebase to support this new way of running cypress. Since we can't trigger `/ok-to-test` on this because ci-test needs the CYPRESS_EXCLUDE_TAGS and slash command doesn't dispatch from current branch, I manually triggered the `TBP` workflow to run ci-test on this branch. And the new `TBP airgap` workflow to run ci-test on airgapped docker image on this branch. Here is the link to the run https://github.com/appsmithorg/appsmith/actions/runs/4882041416 Fixes #22007 Fixes #22814 ## Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? - Manual - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] 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 - [x] 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
75 lines
2.7 KiB
JavaScript
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");
|
|
import adminSettings from "../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");
|
|
});
|