Skip to content

Commit 67f7749

Browse files
authored
Add E2E tests for settings (#897)
* Add E2E tests for settings * Post-review improvements
1 parent 87f7163 commit 67f7749

15 files changed

+804
-147
lines changed

frontend/src/components/CalendarManagement.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const filteredCalendars = computed(() => props.calendars.filter((calendar: Calen
3636
:disabled="loading"
3737
@click="emit('sync')"
3838
:title="t('label.sync')"
39+
data-testid="calendar-settings-sync-calendars-button"
3940
>
4041
<span class="mr-2 inline-block">
4142
{{ t('label.syncCalendars') }}

frontend/src/components/SettingsCalendar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ onMounted(async () => {
429429
v-model="calendarInput.data.title"
430430
type="text"
431431
class="w-full max-w-sm rounded-md"
432+
data-testid="settings-calendar-title-input"
432433
/>
433434
</label>
434435
<label v-if="isCalDav || editMode" class="flex items-center pl-4">
@@ -439,7 +440,7 @@ onMounted(async () => {
439440
{{ color }}
440441
</option>
441442
</select>
442-
<input v-else type="text" v-model="calendarInput.data.color" class="w-full rounded-md" />
443+
<input v-else type="text" data-testid="settings-calendar-color-input" v-model="calendarInput.data.color" class="w-full rounded-md" />
443444
<div class="size-8 shrink-0 rounded-full" :style="{ backgroundColor: calendarInput.data.color }"></div>
444445
</div>
445446
</label>

frontend/src/components/SettingsConnections.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,15 @@ const editProfile = async () => {
135135
v-if="!connection[0]"
136136
:label="t('label.connect')"
137137
class="btn-connect"
138+
:data-testid="'connected-accounts-settings-' + t(provider) + '-connect-btn'"
138139
@click="() => connectAccount(providers[provider])"
139140
:title="t('label.connect')"
140141
/>
141142
<caution-button
142143
v-if="connection[0]"
143144
:label="t('label.disconnect')"
144145
class="btn-disconnect"
146+
:data-testid="'connected-accounts-settings-' + t(provider) + '-disconnect-btn'"
145147
@click="() => displayModal(providers[provider], connection[0].type_id)"
146148
:title="t('label.disconnect')"
147149
/>

test/e2e/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The tests expect that the default Appointment application settings haven't been
2929
- The user scheduling availability hasn't been changed from the default settings;
3030
- In the dashboard the default calendar view is the current month view; this is important so that the tests can find an available booking slot, etc.
3131
- In `Booking Settings`, the `Booking Confirmation` option is enabled, so that requested appointments generate HOLD appointments that need to be confirmed
32+
- The timezone is set to the default of `America/Toronto`
3233

3334
## Running the E2E tests against your local dev environment
3435

test/e2e/const/constants.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ export const APPT_URL = String(process.env.APPT_URL);
66
export const APPT_MY_SHARE_LINK = String(process.env.APPT_MY_SHARE_LINK);
77
export const APPT_SHORT_SHARE_LINK_PREFIX = String(process.env.APPT_SHORT_SHARE_LINK_PREFIX);
88
export const APPT_LONG_SHARE_LINK_PREFIX = String(process.env.APPT_LONG_SHARE_LINK_PREFIX);
9-
export const APPT_PENDING_BOOKINGS_PAGE = `${process.env.APPT_URL}bookings/pending`;
10-
export const APPT_BOOKED_BOOKINGS_PAGE = `${process.env.APPT_URL}bookings/booked`;
9+
export const APPT_PENDING_BOOKINGS_PAGE = String(`${process.env.APPT_URL}bookings/pending`);
10+
export const APPT_BOOKED_BOOKINGS_PAGE = String(`${process.env.APPT_URL}bookings/booked`);
11+
export const APPT_MAIN_SETTINGS_PAGE = String(`${process.env.APPT_URL}settings`);
12+
export const APPT_GENERAL_SETTINGS_PAGE = String(`${process.env.APPT_URL}settings/general`);
13+
export const APPT_CALENDAR_SETTINGS_PAGE = String(`${process.env.APPT_URL}settings/calendar`);
14+
export const APPT_ACCOUNT_SETTINGS_PAGE = String(`${process.env.APPT_URL}settings/account`);
15+
export const APPT_CONNECTED_SETTINGS_PAGE = String(`${process.env.APPT_URL}settings/connectedAccounts`);
16+
export const APPT_DASHBOARD_MONTH_PAGE = String(`${process.env.APPT_URL}dashboard#month`);
1117

1218
// page titles
1319
export const APPT_PAGE_TITLE = 'Thunderbird Appointment';
@@ -27,3 +33,28 @@ export const APPT_BOOKEE_EMAIL = String(process.env.APPT_BOOKEE_EMAIL);
2733
// playwright test tags
2834
export const PLAYWRIGHT_TAG_PROD_SANITY = '@prod-sanity';
2935
export const PLAYWRIGHT_TAG_E2E_SUITE = '@e2e-suite';
36+
37+
// general settings options
38+
export const APPT_LANGUAGE_SETTING_EN = 'EN — English';
39+
export const APPT_LANGUAGE_SETTING_DE = 'DE — German';
40+
export const APPT_THEME_SETTING_LIGHT = 'Light';
41+
export const APPT_THEME_SETTING_DARK = 'Dark';
42+
export const APPT_TIMEZONE_SETTING_TORONTO = 'America/Toronto';
43+
export const APPT_TIMEZONE_SETTING_HALIFAX = 'America/Halifax';
44+
45+
// local browser store values
46+
export const APPT_BROWSER_STORE_LANGUAGE_EN = 'en';
47+
export const APPT_BROWSER_STORE_LANGUAGE_DE = 'de';
48+
export const APPT_BROWSER_STORE_THEME_LIGHT = 'light';
49+
export const APPT_BROWSER_STORE_THEME_DARK = 'dark';
50+
export const APPT_BROWSER_STORE_12HR_TIME = 12;
51+
export const APPT_BROWSER_STORE_24HR_TIME = 24;
52+
53+
// html class attribute value when dark mode is enabled
54+
export const APPT_HTML_DARK_MODE_CLASS = 'dark';
55+
56+
// timeouts
57+
export const TIMEOUT_2_SECONDS = 2_000;
58+
export const TIMEOUT_3_SECONDS = 3_000;
59+
export const TIMEOUT_30_SECONDS = 30_000;
60+
export const TIMEOUT_60_SECONDS = 60_000;

0 commit comments

Comments
 (0)