Skip to content

test: Bring back broken out-of-office tests, prevent modal button clickable before flicker, and fix timezone issue#16001

Merged
PeerRich merged 23 commits intocalcom:mainfrom
ImBIOS:test/bring-back-out-of-office-e2e
Aug 13, 2024
Merged

test: Bring back broken out-of-office tests, prevent modal button clickable before flicker, and fix timezone issue#16001
PeerRich merged 23 commits intocalcom:mainfrom
ImBIOS:test/bring-back-out-of-office-e2e

Conversation

@ImBIOS
Copy link
Copy Markdown
Contributor

@ImBIOS ImBIOS commented Jul 31, 2024

What does this PR do?

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set? none
  • What are the minimal test data to have? none
  • What is expected (happy path) to have (input and output)? i don't have idea what is it
  • Any other important info that could help to test that PR:
yarn e2e out-of-office.e2e.ts

image
image
image
image

Message

Hey everyone! 👋

I'm working on addressing the issue [CAL-3337] to bring back the broken out-of-office tests. Here's the lowdown on what's happening and how we can fix it! 🚀

Cause:

  • There's a full page flicker during the hydration period, which causes the Modal state to reset. 😵‍💫
  • Our e2e test, Playwright, is opening the modal at superhuman speed, but while waiting for the dropdown data to load, the modal gets reset by the flicker. This results in an error when the element isn't found. 😓

Known:

Potential Solutions:

  1. Change the test:
    • Wait for certain text (like the title) to load, indicating the hydration is done and the flicker has passed. ⏳
  2. Change the code:
    • Fix the flicker cause: If we can identify and resolve the root cause of the flicker, the problem will be solved! 🛠️
    • Change add button with loading skeleton until flicker passes: This ensures the UX isn't affected by the modal closing unexpectedly and prevents Playwright from picking the modal before flickering. ✨

Let's tackle this issue and make the tests robust again! 💪💻

If you have any ideas or insights on why the flicker happens, feel free to share! Collaboration is key! 🤝🔧

Note: I'm not using this, because it will require the component to become async, which makes me want to write a new component inside this file for this button, but I'm not doing it, I don't know why:

  const data = await utils.viewer.outOfOfficeEntriesList.ensureData();

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 31, 2024

@ImBIOS is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app Bot requested a review from a team July 31, 2024 12:31
@graphite-app graphite-app Bot added the community Created by Linear-GitHub Sync label Jul 31, 2024
@github-actions github-actions Bot added automated-tests area: unit tests, e2e tests, playwright consumer Medium priority Created by Linear-GitHub Sync 🐛 bug Something isn't working labels Jul 31, 2024
@dosubot dosubot Bot added the ui area: UI, frontend, button, form, input label Jul 31, 2024
@dosubot dosubot Bot added this to the v4.5 milestone Jul 31, 2024
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Jul 31, 2024

Graphite Automations

"Add community label" took an action on this PR • (07/31/24)

1 label was added to this PR based on Keith Williams's automation.

"Add consumer team as reviewer" took an action on this PR • (07/31/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Comment thread apps/web/pages/settings/my-account/out-of-office/index.tsx Outdated
Comment thread apps/web/pages/settings/my-account/out-of-office/index.tsx Outdated
Comment thread apps/web/pages/settings/my-account/out-of-office/index.tsx Outdated
@anikdhabal anikdhabal changed the title test: prevent modal button clickable before flicker test: Bring back broken out-of-office tests and prevent modal button clickable before flicker Jul 31, 2024
@ImBIOS ImBIOS changed the title test: Bring back broken out-of-office tests and prevent modal button clickable before flicker test: bring back broken out-of-office tests and prevent modal button clickable before flicker Jul 31, 2024
@ImBIOS ImBIOS changed the title test: bring back broken out-of-office tests and prevent modal button clickable before flicker test: Bring back broken out-of-office tests and prevent modal button clickable before flicker Jul 31, 2024
Comment thread apps/web/pages/settings/my-account/out-of-office/index.tsx Outdated
ImBIOS added 2 commits August 1, 2024 09:28
Refactor the OutOfOfficePage component to improve the loading experience by using the `isPending` property from the `trpc.viewer.outOfOfficeReasonList.useQuery()` hook. This workaorund eliminates the full page flicker issue and provides a better user experience. The "Add" button now shows a loading state when the query is pending.
@ImBIOS ImBIOS requested a review from anikdhabal August 1, 2024 03:28
Copy link
Copy Markdown
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

Hey @ImBIOS ooo e2e test is still failing, can you figure it out and make the final thing

@ImBIOS
Copy link
Copy Markdown
Contributor Author

ImBIOS commented Aug 1, 2024

Hey @ImBIOS ooo e2e test is still failing, can you figure it out and make the final thing

I'm on it 🏃

@ImBIOS
Copy link
Copy Markdown
Contributor Author

ImBIOS commented Aug 1, 2024

found the culprit, it's another problem but I'm looking into it:

    throw new TRPCError({ code: "BAD_REQUEST", message: "start_date_must_be_in_the_future" });

image

the UI shows it's already in the future, but the data behind it seems not match.

@ImBIOS ImBIOS requested a review from anikdhabal August 1, 2024 06:00
Comment thread packages/trpc/server/routers/loggedInViewer/outOfOffice.handler.ts Outdated
Comment thread packages/trpc/server/routers/loggedInViewer/outOfOffice.handler.ts Outdated
@ImBIOS ImBIOS requested a review from anikdhabal August 2, 2024 02:42
@ImBIOS ImBIOS changed the title test: Bring back broken out-of-office tests and prevent modal button clickable before flicker test: Bring back broken out-of-office tests, prevent modal button clickable before flicker, and fix timezone issue Aug 3, 2024
This commit updates the TimeZoneEnum in the types.ts file to include additional time zones. The new time zones added are:
- ID: Asia/Jakarta (UTC+7)
- SAMOA: Etc/GMT+12 (UTC-12)
- AMERICAN_SAMOA: Pacific/Pago_Pago (UTC-11)
- HAWAII: Pacific/Honolulu (UTC-10)
- ALASKA: America/Anchorage (UTC-9)
- PACIFIC_USA: America/Los_Angeles (UTC-8)
- CENTRAL_USA: America/Chicago (UTC-6)
- EASTERN_USA: America/New_York (UTC-5)
- VENEZUELA: America/Caracas (UTC-4)
- ARGENTINA: America/Buenos_Aires (UTC-3)
- BRAZIL: America/Noronha (UTC-2)
- AZORES: Atlantic/Azores (UTC-1)
- FRANCE: Europe/Paris (UTC+1)
- GREECE: Europe/Athens (UTC+2)
- RUSSIA: Europe/Moscow (UTC+3)
- UAE: Asia/Dubai (UTC+4)
- PAKISTAN: Asia/Karachi (UTC+5)
- BANGLADESH: Asia/Dhaka (UTC+6)
- SINGAPORE: Asia/Singapore (UTC+8)
- JAPAN: Asia/Tokyo (UTC+9)
- AUSTRALIA: Australia/Sydney (UTC+10)
- SOLOMON_ISLANDS: Pacific/Guadalcanal (UTC+11)
- NEW_ZEALAND: Pacific/Auckland (UTC+12)

The purpose of this update is to provide a comprehensive list of time zones for users to choose from when setting their time zone in the out-of-office feature.
Comment thread apps/web/playwright/fixtures/types.ts
@ImBIOS
Copy link
Copy Markdown
Contributor Author

ImBIOS commented Aug 7, 2024

@anikdhabal any update on review?

Copy link
Copy Markdown
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

LGTM!!

@PeerRich PeerRich merged commit dc40cc6 into calcom:main Aug 13, 2024
zomars pushed a commit that referenced this pull request Aug 13, 2024
…ckable before flicker, and fix timezone issue (#16001)

* test: prevent modal button clickable before flicker

* chore: add note to migrate to appDir to solve full page flicker issue

* chore: Improve OutOfOfficePage loading experience

Refactor the OutOfOfficePage component to improve the loading experience by using the `isPending` property from the `trpc.viewer.outOfOfficeReasonList.useQuery()` hook. This workaorund eliminates the full page flicker issue and provides a better user experience. The "Add" button now shows a loading state when the query is pending.

* Update index.tsx

* chore: Update outOfOffice.handler.ts to use input.offset instead of calculating offset

* fix e2e

* Update

* revert

* chore: Fix offset calculation for out of office bookings

* chore: Update date range calculation for out-of-office modal

* chore: Remove console.log statement in out-of-office modal

* chore: Update TimeZoneEnum with additional time zones

This commit updates the TimeZoneEnum in the types.ts file to include additional time zones. The new time zones added are:
- ID: Asia/Jakarta (UTC+7)
- SAMOA: Etc/GMT+12 (UTC-12)
- AMERICAN_SAMOA: Pacific/Pago_Pago (UTC-11)
- HAWAII: Pacific/Honolulu (UTC-10)
- ALASKA: America/Anchorage (UTC-9)
- PACIFIC_USA: America/Los_Angeles (UTC-8)
- CENTRAL_USA: America/Chicago (UTC-6)
- EASTERN_USA: America/New_York (UTC-5)
- VENEZUELA: America/Caracas (UTC-4)
- ARGENTINA: America/Buenos_Aires (UTC-3)
- BRAZIL: America/Noronha (UTC-2)
- AZORES: Atlantic/Azores (UTC-1)
- FRANCE: Europe/Paris (UTC+1)
- GREECE: Europe/Athens (UTC+2)
- RUSSIA: Europe/Moscow (UTC+3)
- UAE: Asia/Dubai (UTC+4)
- PAKISTAN: Asia/Karachi (UTC+5)
- BANGLADESH: Asia/Dhaka (UTC+6)
- SINGAPORE: Asia/Singapore (UTC+8)
- JAPAN: Asia/Tokyo (UTC+9)
- AUSTRALIA: Australia/Sydney (UTC+10)
- SOLOMON_ISLANDS: Pacific/Guadalcanal (UTC+11)
- NEW_ZEALAND: Pacific/Auckland (UTC+12)

The purpose of this update is to provide a comprehensive list of time zones for users to choose from when setting their time zone in the out-of-office feature.

* update

* fix

* remove comment

---------

Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: unknown <adhabal2002@gmail.com>
@ImBIOS ImBIOS deleted the test/bring-back-out-of-office-e2e branch August 13, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-tests area: unit tests, e2e tests, playwright 🐛 bug Something isn't working community Created by Linear-GitHub Sync consumer Medium priority Created by Linear-GitHub Sync ready-for-e2e ui area: UI, frontend, button, form, input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-3337] Bring back broken out-of-office tests as per @ #14286

3 participants