Skip to content

Commit 8679b17

Browse files
committed
test(admob, e2e): disable ad loading on android in E2E
It requires so many things to be loaded (WebView, dynamic ad libraries...) while at the same time all the emulators in CI are "fresh" and so trying to do initial install in the background etc that it ANRs the test app and kills the E2E run
1 parent f4c2fa6 commit 8679b17

File tree

3 files changed

+85
-17
lines changed

3 files changed

+85
-17
lines changed

packages/admob/e2e/interstitial.e2e.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ describe('admob() InterstitialAd', function () {
2323
});
2424

2525
describe('createForAdRequest', function () {
26-
// has own tests
27-
2826
it('loads with requestOptions', async function () {
27+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
28+
if (device.getPlatform() === 'android' && global.isCI == true) {
29+
return;
30+
}
31+
2932
const spy = sinon.spy();
3033

3134
const i = InterstitialAd.createForAdRequest(firebase.admob.TestIds.INTERSTITIAL, {
@@ -52,6 +55,11 @@ describe('admob() InterstitialAd', function () {
5255

5356
describe('onAdEvent', function () {
5457
it('unsubscribe should prevent events', async function () {
58+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
59+
if (device.getPlatform() === 'android' && global.isCI == true) {
60+
return;
61+
}
62+
5563
const spy = sinon.spy();
5664
const i = InterstitialAd.createForAdRequest('abc');
5765
const unsub = i.onAdEvent(spy);
@@ -62,6 +70,11 @@ describe('admob() InterstitialAd', function () {
6270
});
6371

6472
it('loads with a valid ad unit id', async function () {
73+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
74+
if (device.getPlatform() === 'android' && global.isCI == true) {
75+
return;
76+
}
77+
6578
const spy = sinon.spy();
6679

6780
const i = InterstitialAd.createForAdRequest(firebase.admob.TestIds.INTERSTITIAL);
@@ -75,6 +88,11 @@ describe('admob() InterstitialAd', function () {
7588
});
7689

7790
it('errors with an invalid ad unit id', async function () {
91+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
92+
if (device.getPlatform() === 'android' && global.isCI == true) {
93+
return;
94+
}
95+
7896
const spy = sinon.spy();
7997

8098
const i = InterstitialAd.createForAdRequest('123');

packages/admob/e2e/rewarded.e2e.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ describe('admob() RewardedAd', function () {
2424

2525
describe('createForAdRequest', function () {
2626
it('throws if adUnitId is invalid', function () {
27+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
28+
if (device.getPlatform() === 'android' && global.isCI == true) {
29+
return;
30+
}
31+
2732
try {
2833
RewardedAd.createForAdRequest(123);
2934
return Promise.reject(new Error('Did not throw Error.'));
@@ -35,6 +40,11 @@ describe('admob() RewardedAd', function () {
3540

3641
// has own tests
3742
it('throws if requestOptions are invalid', function () {
43+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
44+
if (device.getPlatform() === 'android' && global.isCI == true) {
45+
return;
46+
}
47+
3848
try {
3949
RewardedAd.createForAdRequest('123', 123);
4050
return Promise.reject(new Error('Did not throw Error.'));
@@ -44,13 +54,23 @@ describe('admob() RewardedAd', function () {
4454
});
4555

4656
it('returns a new instance', function () {
57+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
58+
if (device.getPlatform() === 'android' && global.isCI == true) {
59+
return;
60+
}
61+
4762
const i = RewardedAd.createForAdRequest('abc');
4863
i.constructor.name.should.eql('RewardedAd');
4964
i.adUnitId.should.eql('abc');
5065
i.loaded.should.eql(false);
5166
});
5267

5368
it('loads with requestOptions', async function () {
69+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
70+
if (device.getPlatform() === 'android' && global.isCI == true) {
71+
return;
72+
}
73+
5474
if (device.getPlatform() === 'ios') {
5575
// Flaky on local iOS
5676
return;
@@ -81,6 +101,11 @@ describe('admob() RewardedAd', function () {
81101

82102
describe('show', function () {
83103
it('throws if showing before loaded', function () {
104+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
105+
if (device.getPlatform() === 'android' && global.isCI == true) {
106+
return;
107+
}
108+
84109
const i = RewardedAd.createForAdRequest('abc');
85110

86111
try {
@@ -97,6 +122,11 @@ describe('admob() RewardedAd', function () {
97122

98123
describe('onAdEvent', function () {
99124
it('throws if handler is not a function', function () {
125+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
126+
if (device.getPlatform() === 'android' && global.isCI == true) {
127+
return;
128+
}
129+
100130
const i = RewardedAd.createForAdRequest('abc');
101131

102132
try {
@@ -109,13 +139,23 @@ describe('admob() RewardedAd', function () {
109139
});
110140

111141
it('returns an unsubscriber function', function () {
142+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
143+
if (device.getPlatform() === 'android' && global.isCI == true) {
144+
return;
145+
}
146+
112147
const i = RewardedAd.createForAdRequest('abc');
113148
const unsub = i.onAdEvent(() => {});
114149
unsub.should.be.Function();
115150
unsub();
116151
});
117152

118153
it('unsubscribe should prevent events', async function () {
154+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
155+
if (device.getPlatform() === 'android' && global.isCI == true) {
156+
return;
157+
}
158+
119159
if (device.getPlatform() === 'ios') {
120160
// Flaky on local iOS
121161
return;
@@ -130,6 +170,11 @@ describe('admob() RewardedAd', function () {
130170
});
131171

132172
it('loads with a valid ad unit id', async function () {
173+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
174+
if (device.getPlatform() === 'android' && global.isCI == true) {
175+
return;
176+
}
177+
133178
if (device.getPlatform() === 'ios') {
134179
// Flaky on local iOS
135180
return;
@@ -153,6 +198,11 @@ describe('admob() RewardedAd', function () {
153198
});
154199

155200
it('errors with an invalid ad unit id', async function () {
201+
// Ads on Android in CI load a webview and a bunch of other things so slowly the app ANRs.
202+
if (device.getPlatform() === 'android' && global.isCI == true) {
203+
return;
204+
}
205+
156206
const spy = sinon.spy();
157207

158208
const i = RewardedAd.createForAdRequest('123');

tests/e2e/.mocharc.js

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

0 commit comments

Comments
 (0)