From 5ff52e1239b86f6ae14ed0f2c978ee31cfe63075 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 1 Oct 2024 04:34:20 -0400 Subject: [PATCH] chore: add saml signup test / improve signup e2e test (#16849) * add comment to signup-view * add a basic test for saml button in signup * add a test for cookie consent checkbox * refactor and remove duplicates * rename data-testid for saml button * add test for saml * remove code not needed * better naming * improve * address code nit * skip saml test when needed * fix flag * improve * improve more * refactor * refactor * refactor * fix and add 1 more test * remove tag * remove unneeded code * fix * fix test * it needs to be parallel mode * reduce code * simplify * fix * fix flake * fix another flake * add comments + refactor --------- Co-authored-by: unknown Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- apps/web/modules/signup-view.tsx | 13 ++- apps/web/playwright/saml.e2e.ts | 68 ++++++++++++++- apps/web/playwright/signup.e2e.ts | 137 ++++++++++++++++++++---------- 3 files changed, 167 insertions(+), 51 deletions(-) diff --git a/apps/web/modules/signup-view.tsx b/apps/web/modules/signup-view.tsx index 2fe486863b..d37d4677ec 100644 --- a/apps/web/modules/signup-view.tsx +++ b/apps/web/modules/signup-view.tsx @@ -206,10 +206,10 @@ export default function Signup({ } }, [redirectUrl]); - const [COOKIE_CONSENT, setCOOKIE_CONSENT] = useState(false); + const [userConsentToCookie, setUserConsentToCookie] = useState(false); // No need to be checked for user to proceed function handleConsentChange(consent: boolean) { - setCOOKIE_CONSENT(!consent); + setUserConsentToCookie(!consent); } const loadingSubmitState = isSubmitSuccessful || isSubmitting; @@ -297,7 +297,7 @@ export default function Signup({ return ( <> - {IS_CALCOM && (!IS_EUROPE || COOKIE_CONSENT) ? ( + {IS_CALCOM && (!IS_EUROPE || userConsentToCookie) ? ( <> {process.env.NEXT_PUBLIC_GTM_ID && ( <> @@ -342,6 +342,7 @@ export default function Signup({ color="minimal" className="hover:bg-subtle todesktop:mt-10 mb-6 flex h-6 max-h-6 w-full items-center rounded-md px-3 py-2" StartIcon="arrow-left" + data-testid="signup-back-button" onClick={() => { setDisplayEmailForm(false); setIsSamlSignup(false); @@ -432,7 +433,8 @@ export default function Signup({ ) : null} handleConsentChange(COOKIE_CONSENT)} + data-testid="signup-cookie-content-checkbox" + onChange={() => handleConsentChange(userConsentToCookie)} description={t("cookie_consent_checkbox")} /> {errors.apiError && ( @@ -445,6 +447,7 @@ export default function Signup({ )} {isSamlSignup ? ( {isSAMLLoginEnabled && (