Skip to content

Commit 0262c4d

Browse files
committed
WIP - focus test on messaging, grant perms out-of-band, record video of test
1 parent 88616ba commit 0262c4d

File tree

4 files changed

+55
-22
lines changed

4 files changed

+55
-22
lines changed

.github/workflows/tests_e2e_ios.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ jobs:
171171
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
172172
echo "...javascript bundle ready"
173173
174+
- name: Record App Video
175+
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
176+
continue-on-error: true
177+
run: nohup sh -c "sleep 30 && xcrun simctl io booted recordVideo --codec=h264 -f simulator.mp4 2>&1 &"
178+
174179
- name: Create Simulator Log
175180
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
176181
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
@@ -179,7 +184,22 @@ jobs:
179184

180185
- name: Detox Test
181186
timeout-minutes: 50
182-
run: yarn tests:ios:test-cover
187+
# The ps command will just give us a hint on what Simulator is running
188+
run: |
189+
ps -ef | grep -i backboard
190+
yarn tests:ios:test-cover
191+
192+
- name: Stop App Video
193+
if: always()
194+
run: killall -INT simctl
195+
196+
- name: Upload App Video
197+
uses: actions/upload-artifact@v4
198+
continue-on-error: true
199+
if: always()
200+
with:
201+
name: simulator_video
202+
path: simulator.mp4
183203

184204
- name: Upload Simulator Log
185205
uses: actions/upload-artifact@v4

packages/messaging/e2e/messaging.e2e.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ async function isAPNSCapableSimulator() {
3939
describe('messaging()', function () {
4040
before(async function () {
4141
// our device registration tests require permissions. Set them up
42-
await firebase.messaging().requestPermission({
42+
const perms = await firebase.messaging().requestPermission({
4343
alert: true,
4444
badge: true,
4545
sound: true,
4646
provisional: true,
4747
});
48+
console.warn('requestPermission got perms ' + perms);
4849
});
4950

5051
describe('firebase v8 compatibility', function () {
@@ -133,8 +134,12 @@ describe('messaging()', function () {
133134
// our default resolve on android is "authorized"
134135
should.equal(await firebase.messaging().requestPermission({ provisional: true }), 1);
135136
} else {
136-
// our default request on iOS results in "provisional"
137-
should.equal(await firebase.messaging().requestPermission({ provisional: true }), 2);
137+
// our default request on iOS results in "provisional" == 2
138+
// but we may have granted perms by any outside method == 1
139+
should.equal(
140+
(await firebase.messaging().requestPermission({ provisional: true })) >= 1,
141+
true,
142+
);
138143
}
139144
});
140145
});
@@ -601,8 +606,9 @@ describe('messaging()', function () {
601606
if (device.getPlatform() === 'android') {
602607
should.equal(await requestPermission(getMessaging()), 1);
603608
} else {
604-
// ... and iOS should always be 2 (provisional)
605-
should.equal(await requestPermission(getMessaging(), { provisional: true }), 2);
609+
// our default request on iOS results in "provisional" == 2
610+
// but we may have granted perms by any outside method == 1
611+
should.equal((await requestPermission(getMessaging(), { provisional: true })) >= 1, true);
606612
}
607613
});
608614
});

tests/e2e/.mocharc.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ module.exports = {
1010
exit: true,
1111
require: 'node_modules/jet/platform/node',
1212
spec: [
13-
'../packages/app/e2e/**/*.e2e.js',
14-
'../packages/app-check/e2e/**/*.e2e.js',
15-
'../packages/app-distribution/e2e/**/*.e2e.js',
16-
'../packages/analytics/e2e/**/*.e2e.js',
17-
'../packages/auth/e2e/**/*.e2e.js',
18-
'../packages/crashlytics/e2e/**/*.e2e.js',
19-
'../packages/database/e2e/**/*.e2e.js',
20-
'../packages/dynamic-links/e2e/**/*.e2e.js',
21-
'../packages/firestore/e2e/**/*.e2e.js',
22-
'../packages/functions/e2e/**/*.e2e.js',
23-
'../packages/perf/e2e/**/*.e2e.js',
13+
// '../packages/app/e2e/**/*.e2e.js',
14+
// '../packages/app-check/e2e/**/*.e2e.js',
15+
// '../packages/app-distribution/e2e/**/*.e2e.js',
16+
// '../packages/analytics/e2e/**/*.e2e.js',
17+
// '../packages/auth/e2e/**/*.e2e.js',
18+
// '../packages/crashlytics/e2e/**/*.e2e.js',
19+
// '../packages/database/e2e/**/*.e2e.js',
20+
// '../packages/dynamic-links/e2e/**/*.e2e.js',
21+
// '../packages/firestore/e2e/**/*.e2e.js',
22+
// '../packages/functions/e2e/**/*.e2e.js',
23+
// '../packages/perf/e2e/**/*.e2e.js',
2424
'../packages/messaging/e2e/**/*.e2e.js',
25-
'../packages/ml/e2e/**/*.e2e.js',
26-
'../packages/in-app-messaging/e2e/**/*.e2e.js',
27-
'../packages/installations/e2e/**/*.e2e.js',
28-
'../packages/remote-config/e2e/**/*.e2e.js',
29-
'../packages/storage/e2e/**/*.e2e.js',
25+
// '../packages/ml/e2e/**/*.e2e.js',
26+
// '../packages/in-app-messaging/e2e/**/*.e2e.js',
27+
// '../packages/installations/e2e/**/*.e2e.js',
28+
// '../packages/remote-config/e2e/**/*.e2e.js',
29+
// '../packages/storage/e2e/**/*.e2e.js',
3030
],
3131
};

tests/e2e/init.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ config.configurations['android.emu.debug'].device.avdName =
2929
before(async function () {
3030
await detox.init(config);
3131
await device.launchApp();
32+
33+
// our messaging tests require notification permission now
34+
execSync(
35+
`applesimutils --booted --setPermissions notifications=YES --bundle io.invertase.testing`,
36+
);
37+
// after setting perms you have to launch the app again
38+
await device.launchApp();
3239
await jet.init();
3340
});
3441

0 commit comments

Comments
 (0)