Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Future Limit - Toggle to exclude unavailable days #14915

Merged
merged 35 commits into from
May 20, 2024
Merged

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented May 7, 2024

What does this PR do?

Fixes CAL-3482

Loom Demo

Additional things:

  • Re-enabled a skipped minimumBookingNotice test
  • Added tests for ROLLING periodLimit
  • Added tests for newly added ROLLING_WINDOW periodLimit.
  • Added test to verify 'Booking in the past' assertion
  • Refactored getSchedule.test.ts to allow adding it's tests in separate files that could be tested with different timezones.
  • bookingScenario is now enforced to be imported at the top right after mocks so that it mocks prisma before the actual prisma is imported. This has caused certain files to have just reordering of imoorts.

I am still working on adding more tests to get more stability and surety but the functionality is complete

Important Points

  • There is a maximum window of 61(30+31=2 months) enforced because that duration is what we need to compute the availability for. The window seems practically fair and user would most probably not need to exceed it.
  • During actual booking(after the confirm button is clicked), we aren't checking ROLLING_WINDOW limit but it would be done later. This is done to reduce the scope of the PR. It is not an immediate issue because frontend won't allow unavailable date to be selected.

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

See the loom

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Copy link

vercel bot commented May 7, 2024

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

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 0:07am
cal ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 0:07am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 0:07am

Copy link
Contributor

github-actions bot commented May 7, 2024

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

@github-actions github-actions bot added the ❗️ migrations contains migration files label May 7, 2024
@keithwillcode keithwillcode added consumer core area: core, team members only labels May 7, 2024
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @hariombalhara and the rest of your teammates on Graphite Graphite

@hariombalhara hariombalhara changed the title wip feature: Future Limit - Toggle to exclude unavailable days May 7, 2024
Copy link

linear bot commented May 7, 2024

Copy link
Contributor

github-actions bot commented May 7, 2024

📦 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! 🙌

Copy link

deploysentinel bot commented May 7, 2024

Current Playwright Test Results Summary

✅ 321 Passing - ⚠️ 19 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 05/20/2024 12:20:01pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: d73de6f

Started: 05/20/2024 12:17:23pm UTC

⚠️ Flakes

📄   apps/web/playwright/event-types.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
Event Types tests -- future user Different Locations Tests Can add Link Meeting as location and book with it
Retry 1Initial Attempt
0.42% (1) 1 / 238 run
failed over last 7 days
13.45% (32) 32 / 238 runs
flaked over last 7 days
Event Types tests -- legacy user Different Locations Tests can add Attendee Phone Number location and book with it
Retry 1Initial Attempt
0% (0) 0 / 235 runs
failed over last 7 days
5.11% (12) 12 / 235 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 9 Flakes

Top 1 Common Error Messages

null

9 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
2.16% (5) 5 / 232 runs
failed over last 7 days
60.78% (141) 141 / 232 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-163.95% (-141) -141 / 86 runs
failed over last 7 days
163.95% (141) 141 / 86 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-161.63% (-139) -139 / 86 runs
failed over last 7 days
161.63% (139) 139 / 86 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1Initial Attempt
-158.82% (-135) -135 / 85 runs
failed over last 7 days
158.82% (135) 135 / 85 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
-156.98% (-135) -135 / 86 runs
failed over last 7 days
158.14% (136) 136 / 86 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-158.82% (-135) -135 / 85 runs
failed over last 7 days
158.82% (135) 135 / 85 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-158.82% (-135) -135 / 85 runs
failed over last 7 days
158.82% (135) 135 / 85 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-158.82% (-135) -135 / 85 runs
failed over last 7 days
158.82% (135) 135 / 85 runs
flaked over last 7 days
Popup Tests should open on clicking child element
Retry 1Initial Attempt
-158.33% (-133) -133 / 84 runs
failed over last 7 days
158.33% (133) 133 / 84 runs
flaked over last 7 days

📄   apps/web/playwright/managedBooking/advancedOptions.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Check advanced options in a managed team event type Check advanced options in a managed team event type without offer seats
Retry 1Initial Attempt
0.44% (1) 1 / 229 run
failed over last 7 days
48.91% (112) 112 / 229 runs
flaked over last 7 days

📄   apps/web/playwright/hash-my-url.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
hash my url generate url hash
Retry 1Initial Attempt
6.58% (15) 15 / 228 runs
failed over last 7 days
28.07% (64) 64 / 228 runs
flaked over last 7 days

📄   apps/web/playwright/webhook.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
MEETING_ENDED, MEETING_STARTED should create/remove scheduledWebhookTriggers for existing bookings
Retry 1Initial Attempt
4.48% (10) 10 / 223 runs
failed over last 7 days
32.29% (72) 72 / 223 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/namespacing.e2e.ts • 4 Flakes

Top 1 Common Error Messages

null

4 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Namespacing Inline Embed Add inline embed using a namespace without reload
Retry 1Initial Attempt
0.44% (1) 1 / 229 run
failed over last 7 days
62.88% (144) 144 / 229 runs
flaked over last 7 days
Namespacing Different namespaces can have different init configs
Retry 1Initial Attempt
0% (0) 0 / 227 runs
failed over last 7 days
62.56% (142) 142 / 227 runs
flaked over last 7 days
Namespacing Inline Embed Double install Embed Snippet with inline embed using a namespace
Retry 1Initial Attempt
0.44% (1) 1 / 229 run
failed over last 7 days
62.45% (143) 143 / 229 runs
flaked over last 7 days
Namespacing Inline Embed Double install Embed Snippet with inline embed without a namespace(i.e. default namespace)
Retry 1Initial Attempt
0% (0) 0 / 229 runs
failed over last 7 days
65.07% (149) 149 / 229 runs
flaked over last 7 days

📄   apps/web/playwright/teams.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Teams - NonOrg -- legacy Can create a booking for Round Robin EventType
Retry 1Initial Attempt
7.82% (19) 19 / 243 runs
failed over last 7 days
29.22% (71) 71 / 243 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Member

@zomars zomars left a comment

Choose a reason for hiding this comment

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

I'm getting some local testing errors. Is this timezone dependent?

image

I've ran the tests by doing

TZ=UTC yarn test

Copy link
Member Author

I'm getting some local testing errors. Is this timezone dependent?

image

I've ran the tests by doing

TZ=UTC yarn test

That is weird. It is passing for me.

Passing in CI(not sure what timezone that is) as well

image.png

@Udit-takkar
Copy link
Contributor

Udit-takkar commented May 17, 2024

That is weird. It is passing for me.

Passing in CI(not sure what timezone that is) as well

Unit tests are failing in CI
Screenshot 2024-05-17 at 4 35 20 PM

@zomars
Copy link
Member

zomars commented May 17, 2024

That is weird. It is passing for me.
Passing in CI(not sure what timezone that is) as well

Unit tests are failing in CI Screenshot 2024-05-17 at 4 35 20 PM

This is the same error I'm getting locally. handleNewBooking is letting the booking through instead of rejecting according to the test.

@hariombalhara is there a way I can help you getting this through?

Signed-off-by: zomars <zomars@me.com>
@hariombalhara
Copy link
Member Author

@Udit-takkar Unit tests are passing now https://github.com/calcom/cal.com/actions/runs/9138139614/job/25128953848?pr=14915

They started failing after a change was pushed that changed the order of imports in tests. With this branch, bookingScenario must be imported ASAP and prettier ensures that but one needs to restart their IDE otherwise prettier config doesn't update and it reverts the import reordering as soon as file is saved.

So, while testing locally this should be done. cc @zomars I think this is the issue happening while you are testing locally.

  1. Pull the latest changes
  2. Restart your IDE

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Nice work! Approved 🙏

@emrysal emrysal merged commit 56022a1 into main May 20, 2024
40 of 42 checks passed
@emrysal emrysal deleted the future-limit branch May 20, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only event-types area: event types, event-types ✨ feature New feature or request High priority Created by Linear-GitHub Sync high-risk Requires approval by Foundation team ❗️ migrations contains migration files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants