fix: improve error message in add location#12154
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 240 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 11/02/2023 09:14:53pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: e7818a9 Started: 11/02/2023 09:11:00pm UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Booking With Long Text Question and Each Other Question Booking With Long Text Question and checkbox Question Long Text required and checkbox not required
Retry 1 • Initial Attempt |
0% (0)0 / 240 runsfailed over last 7 days |
0.42% (1)1 / 240 runflaked over last 7 days |
📄 apps/web/playwright/locale.e2e.ts • 13 Flakes
Top 1 Common Error Messages
|
|
13 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
unauthorized user sees correct translations (de) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.99% (-40)-40 / 286 runsfailed over last 7 days |
13.99% (40)40 / 286 runsflaked over last 7 days |
|
unauthorized user sees correct translations (ar) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.99% (-40)-40 / 286 runsfailed over last 7 days |
13.99% (40)40 / 286 runsflaked over last 7 days |
|
unauthorized user sees correct translations (zh) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.99% (-40)-40 / 286 runsfailed over last 7 days |
13.99% (40)40 / 286 runsflaked over last 7 days |
|
unauthorized user sees correct translations (zh-CN) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.99% (-40)-40 / 286 runsfailed over last 7 days |
13.99% (40)40 / 286 runsflaked over last 7 days |
|
unauthorized user sees correct translations (zh-TW) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.64% (-39)-39 / 286 runsfailed over last 7 days |
13.99% (40)40 / 286 runsflaked over last 7 days |
|
unauthorized user sees correct translations (pt) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-14.04% (-40)-40 / 285 runsfailed over last 7 days |
14.04% (40)40 / 285 runsflaked over last 7 days |
|
unauthorized user sees correct translations (pt-br) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-14.04% (-40)-40 / 285 runsfailed over last 7 days |
14.04% (40)40 / 285 runsflaked over last 7 days |
|
unauthorized user sees correct translations (es-419) should use correct translations and html attributes
Retry 1 • Initial Attempt |
-13.68% (-39)-39 / 285 runsfailed over last 7 days |
14.04% (40)40 / 285 runsflaked over last 7 days |
|
authorized user sees correct translations (de) should return correct translations and html attributes
Retry 1 • Initial Attempt |
-11.62% (-33)-33 / 284 runsfailed over last 7 days |
14.08% (40)40 / 284 runsflaked over last 7 days |
|
authorized user sees correct translations (pt-br) should return correct translations and html attributes
Retry 1 • Initial Attempt |
-12.27% (-34)-34 / 277 runsfailed over last 7 days |
14.44% (40)40 / 277 runsflaked over last 7 days |
|
authorized user sees correct translations (ar) should return correct translations and html attributes
Retry 1 • Initial Attempt |
-14.02% (-38)-38 / 271 runsfailed over last 7 days |
14.76% (40)40 / 271 runsflaked over last 7 days |
|
authorized user sees changed translations (de->ar) should return correct translations and html attributes
Retry 1 • Initial Attempt |
-10.04% (-27)-27 / 269 runsfailed over last 7 days |
14.13% (38)38 / 269 runsflaked over last 7 days |
|
authorized user sees changed translations (de->pt-BR) [locale1] should return correct translations and html attributes
Retry 1 • Initial Attempt |
-10.08% (-26)-26 / 258 runsfailed over last 7 days |
13.57% (35)35 / 258 runsflaked over last 7 days |
📄 apps/web/playwright/booking/phoneQuestion.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Booking With Phone Question and Each Other Question Booking With Phone Question and Address Question Booking With Phone Question and Multi email Question Phone required and Multi email not required
Retry 2 • Retry 1 • Initial Attempt |
0% (0)0 / 235 runsfailed over last 7 days |
1.28% (3)3 / 235 runsflaked over last 7 days |
📄 apps/web/playwright/login.2fa.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
2FA Tests should allow a user to enable 2FA and login using 2FA
Retry 1 • Initial Attempt |
0.35% (1)1 / 284 runfailed over last 7 days |
32.39% (92)92 / 284 runsflaked over last 7 days |
📄 apps/web/playwright/webhook.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
BOOKING_CREATED add webhook & test that creating an event triggers a webhook call
Retry 1 • Initial Attempt |
0% (0)0 / 276 runsfailed over last 7 days |
0.36% (1)1 / 276 runflaked over last 7 days |
|
FORM_SUBMITTED on submitting user form, triggers user webhook
Retry 1 • Initial Attempt |
0% (0)0 / 276 runsfailed over last 7 days |
2.54% (7)7 / 276 runsflaked over last 7 days |
📄 apps/web/playwright/teams.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Teams - NonOrg Non admin team members cannot create team in org
Retry 1 • Initial Attempt |
0% (0)0 / 201 runsfailed over last 7 days |
29.85% (60)60 / 201 runsflaked over last 7 days |
|
Teams - Org Can create teams via Wizard
Retry 1 • Initial Attempt |
2.49% (5)5 / 201 runsfailed over last 7 days |
9.95% (20)20 / 201 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Popup Tests should be able to reschedule
Retry 2 • Retry 1 • Initial Attempt |
20.07% (60)60 / 299 runsfailed over last 7 days |
76.92% (230)230 / 299 runsflaked over last 7 days |
sean-brydon
left a comment
There was a problem hiding this comment.
Nice job - tested and works well.
NIT: we could add i18n to the error but i dont mind this being in a follow up as its not too common we do it with error messages
|
@sean-brydon done |
| .superRefine((val, ctx) => { | ||
| if (val?.link) { | ||
| const link = val.link; | ||
| const eventLocationType = getEventLocationType(val.type); | ||
| if ( | ||
| eventLocationType && | ||
| !eventLocationType.default && | ||
| eventLocationType.linkType === "static" && | ||
| eventLocationType.urlRegExp | ||
| ) { | ||
| const valid = z | ||
| .string() | ||
| .regex(new RegExp(eventLocationType.urlRegExp)) | ||
| .safeParse(link).success; | ||
|
|
||
| if (!valid) { | ||
| const sampleUrl = eventLocationType.organizerInputPlaceholder; | ||
| ctx.addIssue({ | ||
| code: z.ZodIssueCode.custom, | ||
| path: [eventLocationType?.defaultValueVariable ?? "link"], | ||
| message: t("invalid_url_error_message", { | ||
| label: eventLocationType.label, | ||
| sampleUrl: sampleUrl ?? "https://cal.com", | ||
| }), | ||
| }); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| const valid = z.string().url().optional().safeParse(link).success; | ||
|
|
||
| if (!valid) { | ||
| ctx.addIssue({ | ||
| code: z.ZodIssueCode.custom, | ||
| path: [eventLocationType?.defaultValueVariable ?? "link"], | ||
| message: `Invalid URL`, | ||
| }); | ||
| } | ||
| } | ||
| return; | ||
| }) |
There was a problem hiding this comment.
can you explain what all of this is? looks pretty funky
There was a problem hiding this comment.
@PeerRich this code is from editLocationDialog.tsx. we are just validating the url here . We already have regex of some location options that vaildates if url is valid and if it not then displaying error message with the sampleUrl that we are expecting
There was a problem hiding this comment.
do we wanna extract this into a helper function if we use it in two places?
There was a problem hiding this comment.
or is this the code we removed but are re-adding?
There was a problem hiding this comment.
actually There are some differences like this line isn't required in EditLocationDialog
const eventLocationType = getEventLocationType(val.type);
and path ( path: [eventLocationType?.defaultValueVariable ?? "link"]) is also not required in EditLocationDialog.
sean-brydon
left a comment
There was a problem hiding this comment.
Tested locally - works well. Nice job!
Fixes: