@@ -6,66 +6,106 @@ import { loginPage } from '../../helpers/pages/loginPage.js';
6
6
import { readFileSync } from 'fs' ;
7
7
import { genericPage } from '../../helpers/pages/genericPage.js' ;
8
8
import { signupPage } from '../../helpers/pages/signupPage.js' ;
9
+ import { singleStepFormPage } from '../../helpers/pages/singleStepFormPage.js' ;
9
10
10
11
/**
11
12
* Tests for email autofill on ios tooltipHandler
12
13
*/
13
14
const test = testContext ( base ) ;
14
- const BASE_CONFIG_PATH = 'integration-test/tests/site-specific-feature/config-feature/ ' ;
15
+ const BASE_CONFIG_PATH = 'integration-test/tests/site-specific-feature/config-feature' ;
15
16
16
17
function loginToSignupConfig ( ) {
17
- return JSON . parse ( readFileSync ( `${ BASE_CONFIG_PATH } login-to-signup.json` , 'utf8' ) ) ;
18
+ return JSON . parse ( readFileSync ( `${ BASE_CONFIG_PATH } / login-to-signup.json` , 'utf8' ) ) ;
18
19
}
19
20
20
21
function signupToLoginConfig ( ) {
21
- return JSON . parse ( readFileSync ( `${ BASE_CONFIG_PATH } signup-to-login.json` , 'utf8' ) ) ;
22
+ return JSON . parse ( readFileSync ( `${ BASE_CONFIG_PATH } / signup-to-login.json` , 'utf8' ) ) ;
22
23
}
23
24
24
- test . describe ( 'site-specific-fixes on login form' , ( ) => {
25
- test ( 'login form can be forced to be a signup form' , async ( { page } ) => {
26
- // enable in-terminal exceptions
27
- await forwardConsoleMessages ( page ) ;
28
-
29
- await createWebkitMocks ( 'macos' )
30
- . withAvailableInputTypes ( { email : true } )
31
- . withPersonalEmail ( '0' )
32
- . withPrivateEmail ( '0' )
33
- . withContentScopeFeatures ( loginToSignupConfig ( ) . features )
34
- . applyTo ( page ) ;
35
-
36
- // Load the autofill.js script
37
- await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
38
- await page . pause ( ) ;
39
- const login = loginPage ( page ) ;
40
- await login . navigate ( ) ;
41
- await genericPage ( page ) . passwordFieldShowsGenKey ( ) ;
42
- await genericPage ( page ) . usernameFieldShowsDaxIcon ( '#email' ) ;
25
+ function formBoundaryConfig ( ) {
26
+ return JSON . parse ( readFileSync ( `${ BASE_CONFIG_PATH } /form-boundary.json` , 'utf8' ) ) ;
27
+ }
28
+
29
+ test . describe ( 'site-specific-fixes' , ( ) => {
30
+ test . describe ( 'formTypeSettings' , ( ) => {
31
+ test ( 'login form can be forced to be a signup form' , async ( { page } ) => {
32
+ // enable in-terminal exceptions
33
+ await forwardConsoleMessages ( page ) ;
34
+
35
+ await createWebkitMocks ( 'macos' )
36
+ . withAvailableInputTypes ( { email : true } )
37
+ . withPersonalEmail ( '0' )
38
+ . withPrivateEmail ( '0' )
39
+ . withContentScopeFeatures ( loginToSignupConfig ( ) . features )
40
+ . applyTo ( page ) ;
41
+
42
+ // Load the autofill.js script
43
+ await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
44
+ const login = loginPage ( page ) ;
45
+ await login . navigate ( ) ;
46
+ await genericPage ( page ) . passwordFieldShowsGenKey ( ) ;
47
+ await genericPage ( page ) . usernameFieldShowsDaxIcon ( '#email' ) ;
48
+ } ) ;
49
+
50
+ test ( 'signup form can be forced to be a login form' , async ( { page } ) => {
51
+ await forwardConsoleMessages ( page ) ;
52
+
53
+ await createWebkitMocks ( 'macos' )
54
+ . withCredentials ( {
55
+ id : 'test' ,
56
+
57
+ password : 'password' ,
58
+ } )
59
+ . withAvailableInputTypes ( {
60
+ credentials : {
61
+ username : true ,
62
+ password : true ,
63
+ } ,
64
+ } )
65
+ . withContentScopeFeatures ( signupToLoginConfig ( ) . features )
66
+ . applyTo ( page ) ;
67
+
68
+ // Load the autofill.js script
69
+ await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
70
+ const signup = signupPage ( page ) ;
71
+ await signup . navigate ( ) ;
72
+ await genericPage ( page ) . passwordFieldShowsFillKey ( '#password' ) ;
73
+ await genericPage ( page ) . usernameFieldShowsFillKey ( '#email' ) ;
74
+ } ) ;
43
75
} ) ;
44
76
45
- test ( 'signup form can be forced to be a login form' , async ( { page } ) => {
46
- await forwardConsoleMessages ( page ) ;
47
-
48
- await createWebkitMocks ( 'macos' )
49
- . withCredentials ( {
50
- id : 'test' ,
51
-
52
- password : 'password' ,
53
- } )
54
- . withAvailableInputTypes ( {
55
- credentials : {
56
- username : true ,
57
- password : true ,
58
- } ,
59
- } )
60
- . withContentScopeFeatures ( signupToLoginConfig ( ) . features )
61
- . applyTo ( page ) ;
62
-
63
- // Load the autofill.js script
64
- await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
65
- await page . pause ( ) ;
66
- const signup = signupPage ( page ) ;
67
- await signup . navigate ( ) ;
68
- await genericPage ( page ) . passwordFieldShowsFillKey ( '#password' ) ;
69
- await genericPage ( page ) . usernameFieldShowsFillKey ( '#email' ) ;
77
+ test . describe ( 'formBoundarySettings' , ( ) => {
78
+ test ( 'forcing form boundary for a single step form scores the field as a username field' , async ( { page } ) => {
79
+ // enable in-terminal exceptions
80
+ await forwardConsoleMessages ( page ) ;
81
+
82
+ await createWebkitMocks ( 'macos' )
83
+ . withPersonalEmail ( '0' )
84
+ . withAvailableInputTypes ( { email : true , credentials : { username : true , password : true } } )
85
+ . withContentScopeFeatures ( formBoundaryConfig ( ) . features )
86
+ . applyTo ( page ) ;
87
+
88
+ // Load the autofill.js script
89
+ await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
90
+ const singleStepForm = singleStepFormPage ( page ) ;
91
+ await singleStepForm . navigate ( ) ;
92
+ await singleStepForm . assertUsernameFieldHasFillKey ( '#email' ) ;
93
+ } ) ;
94
+
95
+ test ( 'single step form scores the field as an email field' , async ( { page } ) => {
96
+ // enable in-terminal exceptions
97
+ await forwardConsoleMessages ( page ) ;
98
+
99
+ await createWebkitMocks ( 'macos' )
100
+ . withPersonalEmail ( '0' )
101
+ . withAvailableInputTypes ( { email : true , credentials : { username : true , password : true } } )
102
+ . applyTo ( page ) ;
103
+
104
+ // Load the autofill.js script
105
+ await createAutofillScript ( ) . replaceAll ( macosContentScopeReplacements ( ) ) . platform ( 'macos' ) . applyTo ( page ) ;
106
+ const singleStepForm = singleStepFormPage ( page ) ;
107
+ await singleStepForm . navigate ( ) ;
108
+ await singleStepForm . assertUsernameFieldHasDaxIcon ( '#email' ) ;
109
+ } ) ;
70
110
} ) ;
71
111
} ) ;
0 commit comments