Repository navigation
fix(bookings): visitor timezone setting overrides the bookings setting #665
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c575b9c
fix(bookings): visitor timezone setting overrides the bookings setting
camreeves 302a5cb
Merge remote-tracking branch 'origin/develop' into fix/visitor-buildi…
camreeves a02aae8
fix(bookings): visitor forms fall back to bookings timezone after a b…
MrYuion 867ed6f
test(e2e): use template literal titles in the use_building_timezone l…
MrYuion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 46 additions & 19 deletions
65
apps/workplace/e2e/settings/bookings/bookings.use-building-timezone.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,53 @@ | ||
|
|
||
| import type { Page } from '@playwright/test'; | ||
| import { expect } from '../../../../../e2e/support/fixtures'; | ||
| import { type Debug, test, timezoneBuildings, untouchedVisitor, visitor } from '../support/settings-harness'; | ||
|
|
||
| test.use({ readOnlyTimezone: 'Etc/UTC' }); | ||
|
|
||
| for (const enabled of [false, true]) { | ||
| test('bookings.use_building_timezone ' + enabled + ' gates the visitor secondary timezone label', | ||
| async ({ staffPage, audit }) => { | ||
| await timezoneBuildings(staffPage, audit); | ||
| const form = await visitor(staffPage, audit, { | ||
| 'app.bookings.use_building_timezone': enabled, 'app.visitors.use_building_timezone': false, | ||
| }); | ||
| expect(audit.fixtures['timezone buildings'] ?? 0).toBeGreaterThan(0); | ||
| const field = form.root.locator('a-time-field[name="time"]'); | ||
| await expect(field.locator('button[time-field]')).toBeVisible(); | ||
| await expect.poll(() => field.evaluate((element) => { | ||
| const c = (window as Debug).ng?.getComponent(element) as { timezone(): string } | undefined; | ||
| return c?.timezone(); | ||
| })).toBe(enabled ? 'Pacific/Honolulu' : ''); | ||
| const secondary = field.locator('button[time-field] div.truncate.text-xs'); | ||
| await expect(secondary).toHaveCount(enabled ? 1 : 0); | ||
| if (enabled) await expect(secondary).toBeVisible(); | ||
| await untouchedVisitor(form); | ||
| /** The effective value of a setting, as the app reads it (unset is null). */ | ||
| const effective = (page: Page, key: string) => | ||
| page.evaluate((name) => (window as Debug).setting?.(name) ?? null, key); | ||
|
|
||
| // Settings: bookings.use_building_timezone and visitors.use_building_timezone | ||
| // on the visitor invite form. InviteVisitorForm uses the building timezone when | ||
| // visitors.use_building_timezone ?? bookings.use_building_timezone is true | ||
| // (invite-visitor-form.component.ts), so an explicit visitors value overrides | ||
| // bookings and an unset visitors value falls back to it. | ||
| const SCENARIOS = [ | ||
| { label: 'bookings.use_building_timezone true gates the visitor secondary timezone label', bookings: true, visitors: null, shown: true }, | ||
| { label: 'bookings.use_building_timezone false gates the visitor secondary timezone label', bookings: false, visitors: null, shown: false }, | ||
| { label: 'visitors.use_building_timezone true gates the visitor secondary timezone label', bookings: false, visitors: true, shown: true }, | ||
| { | ||
| label: 'visitors.use_building_timezone false overrides bookings.use_building_timezone true and hides the visitor secondary timezone label', | ||
| bookings: true, | ||
| visitors: false, | ||
| shown: false, | ||
| }, | ||
| ]; | ||
|
|
||
| for (const scenario of SCENARIOS) { | ||
| test(`${scenario.label}`, async ({ staffPage, audit }) => { | ||
| await timezoneBuildings(staffPage, audit); | ||
| const form = await visitor(staffPage, audit, { | ||
| 'app.bookings.use_building_timezone': scenario.bookings, | ||
| 'app.visitors.use_building_timezone': scenario.visitors, | ||
| }); | ||
| expect(audit.fixtures['timezone buildings'] ?? 0).toBeGreaterThan(0); | ||
| const field = form.root.locator('a-time-field[name="time"]'); | ||
| await expect(field.locator('button[time-field]')).toBeVisible(); | ||
| await expect | ||
| .poll(() => effective(staffPage, 'app.bookings.use_building_timezone')) | ||
| .toBe(scenario.bookings); | ||
| await expect | ||
| .poll(() => effective(staffPage, 'app.visitors.use_building_timezone')) | ||
| .toBe(scenario.visitors); | ||
| await expect.poll(() => field.evaluate((element) => { | ||
| const c = (window as Debug).ng?.getComponent(element) as { timezone(): string } | undefined; | ||
| return c?.timezone(); | ||
| })).toBe(scenario.shown ? 'Pacific/Honolulu' : ''); | ||
| const secondary = field.locator('button[time-field] div.truncate.text-xs'); | ||
| await expect(secondary).toHaveCount(scenario.shown ? 1 : 0); | ||
| if (scenario.shown) await expect(secondary).toBeVisible(); | ||
| await untouchedVisitor(form); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo
This row went from 2 to 4, but the totals above it did not change. The
### visitor-invite (13 specs, 16 Settings, 29 scenarios)rows (line 310) now add up to 31. The summary row still says 445 scenarios, butbookings.use-building-timezone.spec.tsnow has 4 tests instead of 2. The doc says its counts match--list, so the header and summary need +2.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo
Fixed in a02aae8. I checked the counts with
--list(449 tests, including the 2 preflight tests):settingsproject row: 409 → 411 tests. This row was also out of date.