Skip to content

Commit 259d733

Browse files
committed
First set of E2E tests on iOS
1 parent 10ba438 commit 259d733

File tree

8 files changed

+47
-38
lines changed

8 files changed

+47
-38
lines changed

.github/workflows/nightly-tests-mobile.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,18 @@ jobs:
4747
project-name: 'Thunderbird Appointment'
4848
build-name: 'TB Appointment Nightly Tests (Mobile): BUILD_INFO'
4949

50-
- name: Run E2E Tests on Production on Browserstack (Mobile)
50+
- name: Prod E2E Tests on Android Chrome
5151
# don't send GHA failure email if any of the E2E tests fail, can be annoying (I check the jobs each day in BrowserStack)
5252
continue-on-error: true
5353
run: |
5454
cd ./test/e2e
5555
cp .env.prod.example .env
5656
npm run prod-nightly-tests-mobile-browserstack-android-chrome
57+
58+
- name: Prod E2E Tests on iOS Safari
59+
# don't send GHA failure email if any of the E2E tests fail, can be annoying (I check the jobs each day in BrowserStack)
60+
continue-on-error: true
61+
run: |
62+
cd ./test/e2e
63+
cp .env.prod.example .env
64+
npm run prod-nightly-tests-mobile-browserstack-ios-safari

backend/test/unit/test_schedule_availability.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class TestScheduleAvailability:
7-
87
def test_empty_availability_is_valid(self):
98
# Test empty availability is valid
109
schedule = schemas.ScheduleValidationIn(
@@ -17,7 +16,6 @@ def test_empty_availability_is_valid(self):
1716
)
1817
assert all_availability_is_valid(schedule)
1918

20-
2119
def test_all_availability_is_valid(self):
2220
# Test already sorted availabilities
2321
schedule = schemas.ScheduleValidationIn(
@@ -37,7 +35,7 @@ def test_all_availability_is_valid(self):
3735
schemas.AvailabilityValidationIn(
3836
schedule_id=1, day_of_week=2, start_time=time(9, 0), end_time=time(10, 0)
3937
),
40-
]
38+
],
4139
)
4240
assert all_availability_is_valid(schedule)
4341

@@ -49,16 +47,13 @@ def test_all_availability_is_valid(self):
4947
schemas.AvailabilityValidationIn(
5048
schedule_id=1, day_of_week=1, start_time=time(10, 0), end_time=time(11, 0)
5149
),
52-
schemas.AvailabilityValidationIn(
53-
schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(10, 0)
54-
),
50+
schemas.AvailabilityValidationIn(schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(10, 0)),
5551
schemas.AvailabilityValidationIn(
5652
schedule_id=1, day_of_week=1, start_time=time(17, 0), end_time=time(18, 0)
5753
),
5854
]
5955
assert all_availability_is_valid(schedule)
6056

61-
6257
def test_all_availability_is_invalid(self):
6358
# Test overlapping end-start times
6459
schedule = schemas.ScheduleValidationIn(
@@ -75,15 +70,13 @@ def test_all_availability_is_invalid(self):
7570
schemas.AvailabilityValidationIn(
7671
schedule_id=1, day_of_week=1, start_time=time(10, 0), end_time=time(12, 0)
7772
),
78-
]
73+
],
7974
)
8075
assert not all_availability_is_valid(schedule)
8176

8277
# Test completely overlapping slots
8378
schedule.availabilities = [
84-
schemas.AvailabilityValidationIn(
85-
schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(12, 0)
86-
),
79+
schemas.AvailabilityValidationIn(schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(12, 0)),
8780
schemas.AvailabilityValidationIn(
8881
schedule_id=1, day_of_week=1, start_time=time(10, 0), end_time=time(11, 0)
8982
),
@@ -92,9 +85,7 @@ def test_all_availability_is_invalid(self):
9285

9386
# Test slots with invalid start/end time
9487
schedule.availabilities = [
95-
schemas.AvailabilityValidationIn(
96-
schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(12, 0)
97-
),
88+
schemas.AvailabilityValidationIn(schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(12, 0)),
9889
schemas.AvailabilityValidationIn(
9990
schedule_id=1, day_of_week=1, start_time=time(14, 0), end_time=time(13, 0)
10091
),
@@ -103,8 +94,6 @@ def test_all_availability_is_invalid(self):
10394

10495
# Test slots that are too small for the defined duration
10596
schedule.availabilities = [
106-
schemas.AvailabilityValidationIn(
107-
schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(9, 15)
108-
),
97+
schemas.AvailabilityValidationIn(schedule_id=1, day_of_week=1, start_time=time(9, 0), end_time=time(9, 15)),
10998
]
11099
assert not all_availability_is_valid(schedule)

test/e2e/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,28 @@ export BROWSERSTACK_USERNAME=<your-browserstack-user-name>
175175
export BROWSERSTACK_ACCESS_KEY=<your-browserstack-access-key>
176176
```
177177

178-
To run the E2E tests on BrowserStack (still in `test/e2e`):
178+
To run the E2E tests on Firefox Desktop on BrowserStack (still in `test/e2e`):
179179

180180
```bash
181-
npm run e2e-test-browserstack
181+
npm run e2e-test-browserstack-firefox
182182
```
183183

184-
To run the production sanity test on BrowserStack (still in `test/e2e`):
184+
To run the production sanity test on Firefox Desktop on BrowserStack (still in `test/e2e`):
185185

186186
```bash
187-
npm run prod-sanity-test-browserstack
187+
npm run prod-sanity-test-browserstack-firefox
188188
```
189189

190-
To run the E2E tests on mobile devices on BrowserStack (still in `test/e2e`):
190+
To run the E2E tests on Android Chrome on a real Google Pixel device on BrowserStack (still in `test/e2e`):
191191

192192
```bash
193-
npm run e2e-test-mobile-browserstack
193+
npm run e2e-tests-mobile-browserstack-android-chrome
194194
```
195195

196-
To run the nightly test suite on real mobile devices in BrowserStack (still in `test/e2e`):
196+
To run the E2E tests on iOS Safari on a real iPhone device on BrowserStack (still in `test/e2e`):
197197

198198
```bash
199-
npm run prod-nightly-tests-mobile-browserstack-gha
199+
npm run e2e-tests-mobile-browserstack-ios-safari
200200
```
201201

202202
After the tests finish in your local console you'll see a link to the BrowserStack test session; when signed into your BrowserStack account you'll be able to use that link to see the test session results including video playback.

test/e2e/browserstack-mobile-nightly.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ platforms:
3737
profile:
3838
password_manager_enabled: false
3939

40+
- browserName: safari
41+
osVersion: 26
42+
deviceName: iPhone 17
43+
playwrightConfigOptions:
44+
name: Safari-iPhone17
45+
4046
# =======================
4147
# Parallels per Platform
4248
# =======================

test/e2e/browserstack-mobile.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ platforms:
3737
profile:
3838
password_manager_enabled: false
3939

40+
- browserName: safari
41+
osVersion: 26
42+
deviceName: iPhone 17
43+
playwrightConfigOptions:
44+
name: Safari-iPhone17
45+
4046
# =======================
4147
# Parallels per Platform
4248
# =======================

test/e2e/package-lock.json

Lines changed: 8 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
"e2e-test": "npx playwright test --grep e2e-suite --project=firefox",
77
"e2e-test-headed": "npx playwright test --grep e2e-suite --project=firefox --headed",
88
"e2e-test-browserstack-firefox": "npx browserstack-node-sdk playwright test --grep e2e-suite --project=Firefox-OSX --browserstack.buildName 'Appointment E2E Tests Firefox Desktop' --browserstack.config 'browserstack-desktop.yml'",
9+
"e2e-tests-mobile-browserstack-android-chrome": "npx browserstack-node-sdk playwright test --grep e2e-mobile-suite --project=Chrome-GooglePixel10 --browserstack.buildName 'Appointment E2E Tests Android Chrome' --browserstack.config 'browserstack-mobile.yml'",
10+
"e2e-tests-mobile-browserstack-ios-safari": "npx browserstack-node-sdk playwright test --grep e2e-mobile-suite --project=Safari-iPhone17 --browserstack.buildName 'Appointment E2E Tests iOS Chrome' --browserstack.config 'browserstack-mobile.yml'",
911
"prod-sanity-test": "npx playwright test --grep prod-sanity --project=firefox",
1012
"prod-sanity-test-headed": "npx playwright test --grep prod-sanity --project=firefox --headed",
1113
"prod-sanity-test-browserstack-firefox": "npx browserstack-node-sdk playwright test --grep prod-sanity --project=Firefox-OSX --browserstack.buildName 'Appointment Production Sanity Test Firefox Desktop' --browserstack.config 'browserstack-desktop.yml'",
1214
"prod-nightly-tests-browserstack-firefox": "npx browserstack-node-sdk playwright test --grep prod-nightly --project=Firefox-OSX --browserstack.buildName 'Appointment Nightly Tests Firefox Desktop' --browserstack.config 'browserstack-desktop-nightly.yml'",
1315
"prod-nightly-tests-browserstack-safari": "npx browserstack-node-sdk playwright test --grep prod-nightly --project=Safari-OSX --browserstack.buildName 'Appointment Nightly Tests Safari Desktop' --browserstack.config 'browserstack-desktop-nightly.yml'",
1416
"prod-nightly-tests-browserstack-chromium": "npx browserstack-node-sdk playwright test --grep prod-nightly --project=Chromium-Win11 --browserstack.buildName 'Appointment Nightly Tests Chromium Desktop' --browserstack.config 'browserstack-desktop-nightly.yml'",
1517
"prod-nightly-tests-mobile-browserstack-android-chrome": "npx browserstack-node-sdk playwright test --grep prod-mobile-nightly --project=Chrome-GooglePixel10 --browserstack.buildName 'Appointment Nightly Tests Android Chrome' --browserstack.config 'browserstack-mobile-nightly.yml'",
18+
"prod-nightly-tests-mobile-browserstack-ios-safari": "npx browserstack-node-sdk playwright test --grep prod-mobile-nightly --project=Safari-iPhone17 --browserstack.buildName 'Appointment Nightly Tests iOS Chrome' --browserstack.config 'browserstack-mobile-nightly.yml'",
1619
"postinstall": "npm update browserstack-node-sdk"
1720
},
1821
"keywords": [],

test/e2e/pages/tb-accts-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class TBAcctsPage {
3737
await this.passwordInput.fill(String(TB_ACCTS_PWORD));
3838
await this.page.waitForTimeout(TIMEOUT_1_SECOND);
3939
await this.page.waitForTimeout(TIMEOUT_1_SECOND);
40+
// 'force' is needed for android
4041
await this.signInButton.click({ force: true });
4142
await this.page.waitForTimeout(TIMEOUT_10_SECONDS);
4243
}

0 commit comments

Comments
 (0)