ToolJet/cypress-tests/cypress/e2e/happyPath/platform/firstUser/firstUserOnboarding.cy.js

305 lines
9.4 KiB
JavaScript
Raw Normal View History

2025-11-11 12:07:53 +00:00
import { commonSelectors } from "Selectors/common";
import { onboardingSelectors } from "Selectors/onboarding";
import { logout } from "Support/utils/common";
import {
bannerElementsVerification,
onboardingStepOne,
onboardingStepThree,
onboardingStepTwo,
} from "Support/utils/onboarding";
import { commonText } from "Texts/common";
import { onboardingText } from "Texts/onboarding";
Feature/draft versioning support (#14284) * added app_versions fields * added data migration for backward compatibility * added ce specific logic * fixed ce migration (need to dev-test) * moved to data migration * migration changes * added endpoint to create draft version * backend changes * added draft to app_import scenario * added version description * minor changes (needs improvement) * fixed breaking dropdown in editor * updated submodule commits * revert package.json * revert ui not used changes * submodule changes * reverting non used files * ui changes * ui changes * ui changes * ui changes * ui changes * copywriting changes * ui changes * ui changes * edit version modal changes * ui integration changes * added button solid and removed unused css * removed commented code from create version modal * updated button size to use large * ui changes * draft version modal changes * added sub-module commits to main * draft version endpoint changes * ui changes for draft version modal * fix breaking ui * ui changes for banner * minor ui changes * remove scss changes from themes file * removed unused components (cleanup) * removed unused components (pr cleanup) * draft version changes * create version modal changes * canvas banner fixes * comment creation logic * refactor: version dropdown * update endpoint changes * fix: promote logic * update submodule * fix: released version and create version modal * fix draft version creation * minor ui changes * minor backend fixes * tooltip changes * added all components in same folder * added minor comments * import fixes * refactor files * fix: overlay issues * fix: on version creation * fix ce bugs * bug fixes * bug fixes * bug fixes * bug fixes * base merge * feat: draft versioning support with UI enhancements and backend adjustments - Updated AppCanvas to conditionally render AppCanvasBanner based on edit mode. - Enhanced CreateDraftVersionModal to handle version selection and creation logic. - Modified CreateVersionModal to streamline version creation process and handle commits. - Improved ReleaseConfirmation to include development versions in release context. - Refactored CreateDraftButton and VersionDropdownItem for better UI consistency and dark mode support. - Updated VersionManagerDropdown to manage draft versions and improve version selection logic. - Enhanced version switcher and promote/release buttons with dark mode styling. - Adjusted server-side features and constants to support new draft versioning capabilities. - Updated styles across components for better visual consistency and responsiveness. * minor fixes * rebase * merge base * update submodule * Add data-cy attribute for draft version components * Update cypress test cases for draft version feature * Update failing test cases * Update draft version test cases * Skip older flow * migration changes * migration fixes * Update the failed test cases * removed multiple api calls * fix: version set on draft creation * fixes * fix: version update on save version * fixes * name fix * fix version lock banner styling * bump version to 3.20.50-lts across all components --------- Co-authored-by: Vijaykant Yadav <[email protected]> Co-authored-by: ajith-k-v <[email protected]> Co-authored-by: gsmithun4 <[email protected]>
2025-12-05 16:43:00 +00:00
import { multiEnvSelector } from "Selectors/eeCommon";
describe("Self host onboarding", () => {
const envVar = Cypress.env("environment");
beforeEach(() => {
cy.visit("/setup");
cy.intercept("GET", "/api/data-queries/**").as("getDataQueries");
2025-11-14 09:04:07 +00:00
cy.intercept("GET", "/assets/translations/en.json").as("translations");
});
2024-12-10 05:26:33 +00:00
afterEach(() => {
// Check if the user exists in the database
cy.runSqlQuery(`SELECT id FROM users WHERE email='[email protected]';`).then(
(resp) => {
// If user doesn't exist in DB, create it
if (!resp.rows || resp.rows.length === 0) {
cy.request({
method: "POST",
url: `${Cypress.env("server_host")}/api/onboarding/setup-super-admin`,
headers: {
"Content-Type": "application/json",
},
body: {
companyName: "ToolJet",
name: "The Developer",
workspaceName: "My workspace",
email: "[email protected]",
password: "password",
},
failOnStatusCode: false,
});
}
}
);
});
it("verify elements on self host onboarding page", () => {
cy.ifEnv("Enterprise", () => {
cy.get(commonSelectors.HostBanner).should("be.visible");
cy.get(commonSelectors.pageLogo).should("be.visible");
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.welcomeHeader).verifyVisibleElement(
"have.text",
"Welcome to ToolJet!"
);
cy.get(onboardingSelectors.pageDescription).verifyVisibleElement(
"have.text",
"Let's set up your admin account and workspace to get started!"
);
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.setUpToolJetButton).verifyVisibleElement(
"have.text",
"Set up ToolJet"
);
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.setUpToolJetButton).click();
});
const commonElements = [
{ selector: commonSelectors.HostBanner },
{ selector: commonSelectors.pageLogo },
{ selector: commonSelectors.signupTerms },
{ selector: commonSelectors.nameInputField },
{ selector: onboardingSelectors.emailInput },
{ selector: onboardingSelectors.passwordInput },
];
commonElements.forEach((element) => {
cy.get(element.selector).should("be.visible");
});
const labelChecks = [
{
selector: commonSelectors.adminSetup,
text: "Set up your admin account",
},
{
selector: commonSelectors.userNameInputLabel,
text: commonText.userNameInputLabel,
},
{
selector: commonSelectors.emailInputLabel,
text: commonText.emailInputLabel,
},
{
selector: commonSelectors.passwordLabel,
text: commonText.passwordLabel,
},
// {
// selector: commonSelectors.passwordHelperTextSignup,
// text: commonText.passwordHelperText,
// },
];
labelChecks.forEach((check) => {
cy.get(check.selector).verifyVisibleElement("have.text", check.text);
});
cy.get(commonSelectors.signUpTermsHelperText).should(($el) => {
expect($el.contents().first().text().trim()).to.eq(
"By signing up you are agreeing to the"
);
});
const links = [
{
selector: commonSelectors.termsOfServiceLink,
text: commonText.termsOfServiceLink,
href: "https://www.tooljet.com/terms",
},
{
selector: commonSelectors.privacyPolicyLink,
text: commonText.privacyPolicyLink,
href: "https://www.tooljet.com/privacy",
},
];
links.forEach((link) => {
cy.get(link.selector)
.verifyVisibleElement("have.text", link.text)
.and("have.attr", "href")
.and("equal", link.href);
});
cy.get(commonSelectors.nameInputField).type("The Developer");
cy.get(onboardingSelectors.emailInput).type("[email protected]");
cy.get(onboardingSelectors.passwordInput).type("password");
cy.get(commonSelectors.signUpButton).click();
cy.ifEnv("Enterprise", () => {
bannerElementsVerification();
onboardingStepOne();
});
bannerElementsVerification();
onboardingStepTwo();
cy.ifEnv("Enterprise", () => {
bannerElementsVerification();
const trialPageTexts = [
{
selector: onboardingSelectors.beforeDiveInHeader,
text: onboardingText.freeTrialHeaderText,
},
{
selector: onboardingSelectors.infoDescription,
text: onboardingText.infoDescriptionText,
},
{
selector: onboardingSelectors.noCreditCardBanner,
text: onboardingText.noCreditCardText,
},
{
selector: onboardingSelectors.trialButton,
text: "Start your 14-day trial",
},
{ selector: onboardingSelectors.declineButton, text: "No, thanks" },
];
trialPageTexts.forEach((item) => {
cy.get(item.selector).should("be.visible").and("have.text", item.text);
});
2025-09-22 07:25:16 +00:00
cy.get(onboardingSelectors.comparePlansTitle).verifyVisibleElement(
"have.text",
onboardingText.comparePlansText
);
cy.get(onboardingSelectors.comparePlanDescription)
.invoke("text")
.then((text) => {
const normalizedText = text.replace(/\s+/g, " ").trim();
expect(normalizedText).to.equal(
"The plan reflects the features available in the latest version of ToolJet and some feature may not be available in your version. Click here to check out the details plan comparison & prices on our website."
);
});
cy.get(onboardingSelectors.onPremiseLink)
.verifyVisibleElement("have.text", "Click here")
.and("have.attr", "href")
2025-11-24 09:25:49 +00:00
.and("equal", "https://tooljet.com/pricing?payment=onpremise");
2025-09-22 07:25:16 +00:00
const planTitles = [
{
selector: onboardingSelectors.basicPlanTitle,
text: onboardingText.basicPlanText,
},
{
selector: onboardingSelectors.flexibleTitle,
text: onboardingText.flexibleText,
},
{
selector: onboardingSelectors.businessTitle,
text: onboardingText.businessText,
},
];
planTitles.forEach((item) => {
cy.get(item.selector).should("be.visible").and("have.text", item.text);
});
const prices = [
{ selector: `${onboardingSelectors.planPrice}:eq(0)`, text: "$0" },
{
2025-11-07 07:31:27 +00:00
selector: `${onboardingSelectors.proPlanPrice}:eq(0)`,
2025-09-22 07:25:16 +00:00
text: "$79/monthper builder",
},
{
2025-11-07 07:31:27 +00:00
selector: `${onboardingSelectors.proPlanPrice}:eq(1)`,
2025-09-22 07:25:16 +00:00
text: "$199/monthper builder",
},
{
selector: `${onboardingSelectors.planToggleLabel}:eq(0)`,
text: "Yearly20% off",
},
{
selector: `${onboardingSelectors.planToggleLabel}:eq(1)`,
text: "Yearly20% off",
},
];
prices.forEach((item) => {
cy.get(item.selector).should("be.visible").and("have.text", item.text);
});
cy.get(onboardingSelectors.planToggleInput).eq(0).should("be.visible");
cy.get(onboardingSelectors.planToggleInput).eq(1).should("be.visible");
cy.get(onboardingSelectors.pricingPlanToggle)
.eq(0)
.uncheck({ force: true });
cy.get(onboardingSelectors.planToggleLabel)
.eq(0)
.verifyVisibleElement("have.text", "Monthly20% off");
cy.get(onboardingSelectors.discountDetails)
.should("have.css", "text-decoration")
.and("include", "line-through");
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.proPlanPrice)
2025-09-22 07:25:16 +00:00
.eq(0)
.verifyVisibleElement("have.text", "$99/monthper builder");
cy.get(onboardingSelectors.pricingPlanToggle)
.eq(1)
.uncheck({ force: true });
cy.get(onboardingSelectors.planToggleLabel)
.eq(1)
.verifyVisibleElement("have.text", "Monthly20% off");
cy.get(onboardingSelectors.discountDetails)
.should("have.css", "text-decoration")
.and("include", "line-through");
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.proPlanPrice)
2025-09-22 07:25:16 +00:00
.eq(1)
.verifyVisibleElement("have.text", "$249/monthper builder");
cy.get(onboardingSelectors.enterpriseTitle).verifyVisibleElement(
"have.text",
"Enterprise"
);
cy.get(onboardingSelectors.customPricingHeader).verifyVisibleElement(
"have.text",
"Custom pricing"
);
2025-11-07 07:31:27 +00:00
cy.get(onboardingSelectors.scheduleACallButton).verifyVisibleElement(
2025-09-22 07:25:16 +00:00
"have.text",
"Schedule a call"
);
cy.get(onboardingSelectors.declineButton).click();
bannerElementsVerification();
onboardingStepThree();
});
cy.wait("@getDataQueries");
cy.wait(2000);
Feature/draft versioning support (#14284) * added app_versions fields * added data migration for backward compatibility * added ce specific logic * fixed ce migration (need to dev-test) * moved to data migration * migration changes * added endpoint to create draft version * backend changes * added draft to app_import scenario * added version description * minor changes (needs improvement) * fixed breaking dropdown in editor * updated submodule commits * revert package.json * revert ui not used changes * submodule changes * reverting non used files * ui changes * ui changes * ui changes * ui changes * ui changes * copywriting changes * ui changes * ui changes * edit version modal changes * ui integration changes * added button solid and removed unused css * removed commented code from create version modal * updated button size to use large * ui changes * draft version modal changes * added sub-module commits to main * draft version endpoint changes * ui changes for draft version modal * fix breaking ui * ui changes for banner * minor ui changes * remove scss changes from themes file * removed unused components (cleanup) * removed unused components (pr cleanup) * draft version changes * create version modal changes * canvas banner fixes * comment creation logic * refactor: version dropdown * update endpoint changes * fix: promote logic * update submodule * fix: released version and create version modal * fix draft version creation * minor ui changes * minor backend fixes * tooltip changes * added all components in same folder * added minor comments * import fixes * refactor files * fix: overlay issues * fix: on version creation * fix ce bugs * bug fixes * bug fixes * bug fixes * bug fixes * base merge * feat: draft versioning support with UI enhancements and backend adjustments - Updated AppCanvas to conditionally render AppCanvasBanner based on edit mode. - Enhanced CreateDraftVersionModal to handle version selection and creation logic. - Modified CreateVersionModal to streamline version creation process and handle commits. - Improved ReleaseConfirmation to include development versions in release context. - Refactored CreateDraftButton and VersionDropdownItem for better UI consistency and dark mode support. - Updated VersionManagerDropdown to manage draft versions and improve version selection logic. - Enhanced version switcher and promote/release buttons with dark mode styling. - Adjusted server-side features and constants to support new draft versioning capabilities. - Updated styles across components for better visual consistency and responsiveness. * minor fixes * rebase * merge base * update submodule * Add data-cy attribute for draft version components * Update cypress test cases for draft version feature * Update failing test cases * Update draft version test cases * Skip older flow * migration changes * migration fixes * Update the failed test cases * removed multiple api calls * fix: version set on draft creation * fixes * fix: version update on save version * fixes * name fix * fix version lock banner styling * bump version to 3.20.50-lts across all components --------- Co-authored-by: Vijaykant Yadav <[email protected]> Co-authored-by: ajith-k-v <[email protected]> Co-authored-by: gsmithun4 <[email protected]>
2025-12-05 16:43:00 +00:00
cy.get(multiEnvSelector.environmentsTag("development"), {
timeout: 20000,
}).should("be.visible", { timeout: 20000 });
cy.apiLogout();
cy.visit("/my-workspace");
2025-11-14 09:04:07 +00:00
cy.wait("@translations");
2025-11-14 18:44:21 +00:00
cy.waitForElement(onboardingSelectors.loginPasswordInput);
cy.wait(1000);
cy.appUILogin();
cy.get(commonSelectors.workspaceName)
.should("be.visible")
.and("have.text", "My workspace");
});
});