Skip to content

fix: improve error message in add location#12154

Merged
PeerRich merged 8 commits intomainfrom
fix/location-improvements
Nov 3, 2023
Merged

fix: improve error message in add location#12154
PeerRich merged 8 commits intomainfrom
fix/location-improvements

Conversation

@Udit-takkar
Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar commented Oct 30, 2023

Fixes:

  1. Add Placeholder
Screenshot 2023-10-30 at 8 51 17 PM
  1. Better Error message Hint
Screenshot 2023-10-30 at 8 51 32 PM

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 2, 2023 9:15pm
dev ❌ Failed (Inspect) Nov 2, 2023 9:15pm
qa 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 2, 2023 9:15pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Nov 2, 2023 9:15pm
cal ⬜️ Ignored (Inspect) Visit Preview Nov 2, 2023 9:15pm
cal-demo ⬜️ Ignored (Inspect) Visit Preview Nov 2, 2023 9:15pm
ui ⬜️ Ignored (Inspect) Visit Preview Nov 2, 2023 9:15pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 30, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes!

@zomars zomars added the core area: core, team members only label Oct 30, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 30, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Oct 30, 2023

Current Playwright Test Results Summary

✅ 240 Passing - ⚠️ 21 Flaky

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 Details

Running Workflow PR Update on Github Actions

Commit: e7818a9

Started: 11/02/2023 09:11:00pm UTC

⚠️ Flakes

📄   apps/web/playwright/booking/longTextQuestion.e2e.ts • 1 Flake

Test Case Results

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 1Initial Attempt
0% (0) 0 / 240 runs
failed over last 7 days
0.42% (1) 1 / 240 run
flaked over last 7 days

📄   apps/web/playwright/locale.e2e.ts • 13 Flakes

Top 1 Common Error Messages

null

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 1Initial Attempt
-13.99% (-40) -40 / 286 runs
failed over last 7 days
13.99% (40) 40 / 286 runs
flaked over last 7 days
unauthorized user sees correct translations (ar) should use correct translations and html attributes
Retry 1Initial Attempt
-13.99% (-40) -40 / 286 runs
failed over last 7 days
13.99% (40) 40 / 286 runs
flaked over last 7 days
unauthorized user sees correct translations (zh) should use correct translations and html attributes
Retry 1Initial Attempt
-13.99% (-40) -40 / 286 runs
failed over last 7 days
13.99% (40) 40 / 286 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-CN) should use correct translations and html attributes
Retry 1Initial Attempt
-13.99% (-40) -40 / 286 runs
failed over last 7 days
13.99% (40) 40 / 286 runs
flaked over last 7 days
unauthorized user sees correct translations (zh-TW) should use correct translations and html attributes
Retry 1Initial Attempt
-13.64% (-39) -39 / 286 runs
failed over last 7 days
13.99% (40) 40 / 286 runs
flaked over last 7 days
unauthorized user sees correct translations (pt) should use correct translations and html attributes
Retry 1Initial Attempt
-14.04% (-40) -40 / 285 runs
failed over last 7 days
14.04% (40) 40 / 285 runs
flaked over last 7 days
unauthorized user sees correct translations (pt-br) should use correct translations and html attributes
Retry 1Initial Attempt
-14.04% (-40) -40 / 285 runs
failed over last 7 days
14.04% (40) 40 / 285 runs
flaked over last 7 days
unauthorized user sees correct translations (es-419) should use correct translations and html attributes
Retry 1Initial Attempt
-13.68% (-39) -39 / 285 runs
failed over last 7 days
14.04% (40) 40 / 285 runs
flaked over last 7 days
authorized user sees correct translations (de) should return correct translations and html attributes
Retry 1Initial Attempt
-11.62% (-33) -33 / 284 runs
failed over last 7 days
14.08% (40) 40 / 284 runs
flaked over last 7 days
authorized user sees correct translations (pt-br) should return correct translations and html attributes
Retry 1Initial Attempt
-12.27% (-34) -34 / 277 runs
failed over last 7 days
14.44% (40) 40 / 277 runs
flaked over last 7 days
authorized user sees correct translations (ar) should return correct translations and html attributes
Retry 1Initial Attempt
-14.02% (-38) -38 / 271 runs
failed over last 7 days
14.76% (40) 40 / 271 runs
flaked over last 7 days
authorized user sees changed translations (de->ar) should return correct translations and html attributes
Retry 1Initial Attempt
-10.04% (-27) -27 / 269 runs
failed over last 7 days
14.13% (38) 38 / 269 runs
flaked over last 7 days
authorized user sees changed translations (de->pt-BR) [locale1] should return correct translations and html attributes
Retry 1Initial Attempt
-10.08% (-26) -26 / 258 runs
failed over last 7 days
13.57% (35) 35 / 258 runs
flaked 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 2Retry 1Initial Attempt
0% (0) 0 / 235 runs
failed over last 7 days
1.28% (3) 3 / 235 runs
flaked 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 1Initial Attempt
0.35% (1) 1 / 284 run
failed over last 7 days
32.39% (92) 92 / 284 runs
flaked over last 7 days

📄   apps/web/playwright/webhook.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

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 1Initial Attempt
0% (0) 0 / 276 runs
failed over last 7 days
0.36% (1) 1 / 276 run
flaked over last 7 days
FORM_SUBMITTED on submitting user form, triggers user webhook
Retry 1Initial Attempt
0% (0) 0 / 276 runs
failed over last 7 days
2.54% (7) 7 / 276 runs
flaked over last 7 days

📄   apps/web/playwright/teams.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

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 1Initial Attempt
0% (0) 0 / 201 runs
failed over last 7 days
29.85% (60) 60 / 201 runs
flaked over last 7 days
Teams - Org Can create teams via Wizard
Retry 1Initial Attempt
2.49% (5) 5 / 201 runs
failed over last 7 days
9.95% (20) 20 / 201 runs
flaked 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 2Retry 1Initial Attempt
20.07% (60) 60 / 299 runs
failed over last 7 days
76.92% (230) 230 / 299 runs
flaked over last 7 days

View Detailed Build Results


sean-brydon
sean-brydon previously approved these changes Oct 31, 2023
Copy link
Copy Markdown
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Udit-takkar
Copy link
Copy Markdown
Contributor Author

@sean-brydon done

Copy link
Copy Markdown
Member

@PeerRich PeerRich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Comment on lines +325 to +365
.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;
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what all of this is? looks pretty funky

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we wanna extract this into a helper function if we use it in two places?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is this the code we removed but are re-adding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we are ok merging this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Copy link
Copy Markdown
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally - works well. Nice job!

@PeerRich PeerRich merged commit 14c3028 into main Nov 3, 2023
@PeerRich PeerRich deleted the fix/location-improvements branch November 3, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only Medium priority Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants