| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:cake_wallet/src/screens/auth/auth_page.dart'; |
| 3 | import 'package:flutter/widgets.dart'; |
| 4 | import 'package:flutter_test/flutter_test.dart'; |
| 5 | |
| 6 | import '../components/common_test_cases.dart'; |
| 7 | import 'pin_code_widget_robot.dart'; |
| 8 | |
| 9 | class AuthPageRobot extends PinCodeWidgetRobot { |
| 10 | AuthPageRobot(this.tester) |
| 11 | : commonTestCases = CommonTestCases(tester), |
| 12 | super(tester); |
| 13 | |
| 14 | final WidgetTester tester; |
| 15 | late CommonTestCases commonTestCases; |
| 16 | |
| 17 | bool onAuthPage() { |
| 18 | final hasPinButtons = find.byKey(ValueKey('pin_code_button_3_key')); |
| 19 | final hasPin = hasPinButtons.tryEvaluate(); |
| 20 | return hasPin; |
| 21 | } |
| 22 | |
| 23 | bool onAuthPageDesktop() { |
| 24 | final hasWalletPasswordInput = find.byKey(ValueKey('enter_wallet_password')); |
| 25 | return hasWalletPasswordInput.tryEvaluate(); |
| 26 | } |
| 27 | |
| 28 | Future<void> isAuthPage() async { |
| 29 | await commonTestCases.isSpecificPage<AuthPage>(); |
| 30 | await commonTestCases.takeScreenshots('auth_page'); |
| 31 | } |
| 32 | |
| 33 | void hasTitle() { |
| 34 | commonTestCases.hasText(S.current.setup_pin); |
| 35 | } |
| 36 | } |