Skip to content

Commit

Permalink
chore(authenticator): added missing widget keys (#4171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Equartey authored Nov 22, 2023
1 parent ddafa9a commit 5820011
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ void main() {
]),
);

// When I select my country code with status "FORCE_CHANGE_PASSWORD"
await po.selectCountryCode();

// And I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
// When I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
await po.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -95,10 +92,7 @@ void main() {
]),
);

// When I select my country code with status "FORCE_CHANGE_PASSWORD"
await po.selectCountryCode();

// And I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
// When I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
await po.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -148,10 +142,7 @@ void main() {
]),
);

// When I select my country code with status "FORCE_CHANGE_PASSWORD"
await po.selectCountryCode();

// And I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
// When I type my "phone number" with status "FORCE_CHANGE_PASSWORD"
await po.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ void main() {

signInPage.expectUsername(label: 'Phone Number');

// When I select my country code
await signInPage.selectCountryCode();

// And I type my "phone number" with status "CONFIRMED"
// When I type my "phone number" with status "CONFIRMED"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -95,10 +92,7 @@ void main() {

signInPage.expectUsername(label: 'Phone Number');

// When I select my country code
await signInPage.selectCountryCode();

// And I type my "phone number" with status "CONFIRMED"
// When I type my "phone number" with status "CONFIRMED"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -134,10 +128,7 @@ void main() {

signInPage.expectUsername(label: 'Phone Number');

// When I select my country code
await signInPage.selectCountryCode();

// And I type my "phone number" with status "CONFIRMED"
// When I type my "phone number" with status "CONFIRMED"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -174,10 +165,7 @@ void main() {

final signInPage = SignInPage(tester: tester);

// When I select my country code
await signInPage.selectCountryCode();

// And I type my "phone number" with status "UNKNOWN"
// When I type my "phone number" with status "UNKNOWN"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ void main() {

final signInPage = SignInPage(tester: tester);

// When I select my country code
await signInPage.selectCountryCode();

// And I type my "phone number" with status "UNKNOWN"
// When I type my "phone number" with status "UNKNOWN"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down Expand Up @@ -92,9 +89,6 @@ void main() {

signInPage.expectUsername(label: 'Phone Number');

// When I select my country code
await signInPage.selectCountryCode();

// When I type my "username" with status "unconfirmed"
await signInPage.enterUsername(phoneNumber.withOutCountryCode());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ void main() {
final password = generatePassword();
final email = generateEmail();

// When I select my country code
await signUpPage.selectCountryCode();
// When I enter my phone number
await signUpPage.enterUsername(phoneNumber.withOutCountryCode());

// And I type my password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ mixin AuthenticatorPhoneFieldMixin<FieldType extends Enum,
child: SearchAnchor(
// Always use full screen at small break point. Otherwise use default
// behavior.
key: keySelectCountryCode,
isFullScreen: Breakpoint.of(context) == Breakpoint.small ? true : null,
viewHintText: _dialCodeResolver.resolve(
context,
Expand All @@ -93,6 +94,17 @@ mixin AuthenticatorPhoneFieldMixin<FieldType extends Enum,
minWidth: 360,
maxHeight: 300,
),
// Custom suggestion list widget. This displays the output of `suggestionsBuilder`
viewBuilder: (suggestions) {
return ListView.builder(
key: keyCountryDialog,
itemCount: suggestions.length,
itemBuilder: (BuildContext context, int index) {
return suggestions.elementAt(index);
},
);
},
// Custom suggestion item widgets
suggestionsBuilder: ((context, SearchController controller) {
final textStyle = Theme.of(context).listTileTheme.titleTextStyle ??
const TextStyle(fontSize: 15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ abstract class AuthenticatorPage {
await tester.tap(countrySelectField);
await tester.pumpAndSettle();
expect(countrySelectDialog, findsOneWidget);
expect(countrySearchField, findsOneWidget);
await tester.enterText(countrySearchField, countryName);
await tester.pumpAndSettle();
final dialCode = find.descendant(
of: find.byKey(keyCountryDialog),
matching: find.textContaining('($countryCode)'),
matching: find.textContaining(countryCode),
);
await tester.dragUntilVisible(
dialCode,
countrySelectDialog,
const Offset(0, -250),
maxIteration: 100, // delta to move
);
await tester.pumpAndSettle();
expect(dialCode, findsOneWidget);
await tester.tap(dialCode);
}
Expand Down

0 comments on commit 5820011

Please sign in to comment.