From f4d89121d1f8c88a3a1f93c1ca23d1b4637e80b1 Mon Sep 17 00:00:00 2001 From: alex-minaiev-frontegg Date: Wed, 11 Dec 2024 18:49:06 +0200 Subject: [PATCH] FR-18979: Added login via Apple --- .../src/login_via_google_test.dart | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 example/integration_test/src/login_via_google_test.dart diff --git a/example/integration_test/src/login_via_google_test.dart b/example/integration_test/src/login_via_google_test.dart new file mode 100644 index 0000000..cc08648 --- /dev/null +++ b/example/integration_test/src/login_via_google_test.dart @@ -0,0 +1,41 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:frontegg_flutter_example/main.dart'; +import 'package:patrol/patrol.dart'; + +void main() { + const googleButtonLabel = "continue with google"; + late final String email; + patrolSetUp(() { + email = const String.fromEnvironment('GOOGLE_EMAIL'); + + assert(email.isNotEmpty); + }); + + patrolTest( + 'Success Login via Google Provider', + ($) async { + await $.pumpWidget(const MyApp()); + await $.pumpAndSettle(); + + await $.tap(find.byKey(const ValueKey("LoginButton"))); + await Future.delayed(const Duration(seconds: 5)); + + await $.native.tap(Selector(text: googleButtonLabel)); + await Future.delayed(const Duration(seconds: 5)); + if (Platform.isIOS) { + await $.native.tap(Selector(text: "Continue")); + await Future.delayed(const Duration(seconds: 7)); + } + await $.native.tap(Selector(text: email)); + + await $.waitUntilVisible(find.text("Logout"), timeout: const Duration(seconds: 15),); + + await $.tap(find.byKey(const ValueKey("LogoutButton"))); + await $.pumpAndSettle(); + await $.waitUntilVisible(find.text("Not Authenticated")); + }, + ); +}