diff --git a/tests/integration_test/firebase_messaging/firebase_messaging_e2e_test.dart b/tests/integration_test/firebase_messaging/firebase_messaging_e2e_test.dart index 318fcdbafdfc..ab524d97f9b9 100644 --- a/tests/integration_test/firebase_messaging/firebase_messaging_e2e_test.dart +++ b/tests/integration_test/firebase_messaging/firebase_messaging_e2e_test.dart @@ -12,7 +12,7 @@ import 'package:integration_test/integration_test.dart'; import 'package:tests/firebase_options.dart'; // ignore: do_not_use_environment -const bool skipManualTests = bool.fromEnvironment('CI'); +const bool skipTestsOnCI = bool.fromEnvironment('CI'); void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); @@ -110,7 +110,8 @@ void main() { AuthorizationStatus.notDetermined, ); }, - skip: !kIsWeb, + // This requires interaction with the browser's permission dialog, it no longer returns `notDetermined` on web + skip: true, ); }); @@ -146,7 +147,7 @@ void main() { expect(result, isA()); }); }, - skip: skipManualTests, + skip: skipTestsOnCI, ); // only run for manual testing group('deleteToken()', () { @@ -162,7 +163,7 @@ void main() { expect(token2, isA()); expect(token1, isNot(token2)); }, - skip: skipManualTests, + skip: skipTestsOnCI, ); // only run for manual testing }); diff --git a/tests/web/firebase-messaging-sw.js b/tests/web/firebase-messaging-sw.js new file mode 100644 index 000000000000..0c6917843fbd --- /dev/null +++ b/tests/web/firebase-messaging-sw.js @@ -0,0 +1,21 @@ +importScripts("https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js"); +importScripts("https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js"); + +firebase.initializeApp({ + apiKey: 'AIzaSyB7wZb2tO1-Fs6GbDADUSTs2Qs3w08Hovw', + appId: '1:406099696497:web:87e25e51afe982cd3574d0', + messagingSenderId: '406099696497', + projectId: 'flutterfire-e2e-tests', + authDomain: 'flutterfire-e2e-tests.firebaseapp.com', + databaseURL: + 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + storageBucket: 'flutterfire-e2e-tests.appspot.com', + measurementId: 'G-JN95N1JV2E', +}); +// Necessary to receive background messages: +const messaging = firebase.messaging(); + +// Optional: +messaging.onBackgroundMessage((m) => { + console.log("onBackgroundMessage", m); +}); diff --git a/tests/web/index.html b/tests/web/index.html index ea29a2f8f13a..0446b3238de2 100644 --- a/tests/web/index.html +++ b/tests/web/index.html @@ -33,32 +33,33 @@ - -