@@ -3,6 +3,7 @@ import 'dart:async';
33import 'package:checks/checks.dart' ;
44import 'package:flutter/material.dart' ;
55import 'package:flutter/services.dart' ;
6+ import 'package:flutter_checks/flutter_checks.dart' ;
67import 'package:flutter_test/flutter_test.dart' ;
78import 'package:http/http.dart' as http;
89import 'package:zulip/api/core.dart' ;
@@ -356,6 +357,56 @@ void main() {
356357 // TODO test _inProgress logic
357358 });
358359
360+ group ('email auth disabled' , () {
361+ testWidgets ('hides username/password fields and login button' , (tester) async {
362+ final serverSettings = eg.serverSettings (emailAuthEnabled: false );
363+ await prepare (tester, serverSettings);
364+ check (findUsernameInput).findsNothing ();
365+ check (findPasswordInput).findsNothing ();
366+ check (findSubmitButton).findsNothing ();
367+ });
368+
369+ testWidgets ('shows external auth methods without divider' , (tester) async {
370+ final method = ExternalAuthenticationMethod (
371+ name: 'google' ,
372+ displayName: 'Google' ,
373+ displayIcon: null ,
374+ loginUrl: '/accounts/login/social/google' ,
375+ signupUrl: '/accounts/register/social/google' ,
376+ );
377+ final serverSettings = eg.serverSettings (
378+ emailAuthEnabled: false ,
379+ externalAuthenticationMethods: [method]);
380+ await prepare (tester, serverSettings);
381+ check (findUsernameInput).findsNothing ();
382+ check (findPasswordInput).findsNothing ();
383+ check (findSubmitButton).findsNothing ();
384+ check (find.textContaining ('Google' )).findsOne ();
385+ final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
386+ check (find.text (zulipLocalizations.loginMethodDivider)).findsNothing ();
387+ });
388+
389+ testWidgets ('shows divider when email auth enabled with external methods' , (tester) async {
390+ final method = ExternalAuthenticationMethod (
391+ name: 'google' ,
392+ displayName: 'Google' ,
393+ displayIcon: null ,
394+ loginUrl: '/accounts/login/social/google' ,
395+ signupUrl: '/accounts/register/social/google' ,
396+ );
397+ final serverSettings = eg.serverSettings (
398+ emailAuthEnabled: true ,
399+ externalAuthenticationMethods: [method]);
400+ await prepare (tester, serverSettings);
401+ check (findUsernameInput).findsOne ();
402+ check (findPasswordInput).findsOne ();
403+ check (findSubmitButton).findsOne ();
404+ check (find.textContaining ('Google' )).findsOne ();
405+ final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
406+ check (find.text (zulipLocalizations.loginMethodDivider)).findsOne ();
407+ });
408+ });
409+
359410 group ('web auth' , () {
360411 testWidgets ('basic happy case' , (tester) async {
361412 final method = ExternalAuthenticationMethod (
0 commit comments