@@ -21,25 +21,19 @@ Unlike merging, the parent test (or action group) will still exist after the tes
21
21
22
22
<!-- {% raw %} -->
23
23
24
- __ Use case__ : Create two similar tests with different ` url ` ( ` "{{AdminCategoryPage.url}}" ` and ` "{{OtherCategoryPage.url}}" ` ) in a test step .
24
+ __ Use case__ : Create two similar tests with a different action group reference by overwriting a ` stepKey ` .
25
25
26
26
> Test with "extends":
27
27
28
28
``` xml
29
29
<tests >
30
- <test name =" AdminCategoryTest" >
31
- <annotations >
32
- ...
33
- </annotations >
34
- ...(several steps)
35
- <amOnPage url =" {{AdminCategoryPage.url}}" stepKey =" navigateToAdminCategory" />
36
- ...(several steps)
30
+ <test name =" AdminLoginSuccessfulTest" >
31
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
32
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
33
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
37
34
</test >
38
- <test name =" OtherCategoryTest" extends =" AdminCategoryTest" >
39
- <annotations >
40
- ...
41
- </annotations >
42
- <amOnPage url =" {{OtherCategoryPage.url}}" stepKey =" navigateToAdminCategory" />
35
+ <test name =" AdminLoginAsOtherUserSuccessfulTest" extends =" AdminLoginSuccessfulTest" >
36
+ <actionGroup ref =" AdminLoginAsOtherUserActionGroup" stepKey =" loginAsAdmin" />
43
37
</test >
44
38
</tests >
45
39
```
@@ -48,46 +42,35 @@ __Use case__: Create two similar tests with different `url` (`"{{AdminCategoryPa
48
42
49
43
``` xml
50
44
<tests >
51
- <test name =" AdminCategoryTest" >
52
- <annotations >
53
- ...
54
- </annotations >
55
- ...(several steps)
56
- <amOnPage url =" {{AdminCategoryPage.url}}" stepKey =" navigateToAdminCategory" />
57
- ...(several steps)
45
+ <test name =" AdminLoginSuccessfulTest" >
46
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
47
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
48
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
58
49
</test >
59
- <test name =" OtherCategoryTest" >
60
- <annotations >
61
- ...
62
- </annotations >
63
- ...(several steps)
64
- <amOnPage url =" {{OtherCategoryPage.url}}" stepKey =" navigateToAdminCategory" />
65
- ...(several steps)
50
+ <test name =" AdminLoginAsOtherUserSuccessfulTest" >
51
+ <actionGroup ref =" AdminLoginAsOtherUserActionGroup" stepKey =" loginAsAdmin" />
52
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
53
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
66
54
</test >
67
55
</tests >
68
56
```
69
57
70
58
### Add a test step
71
59
72
- __ Use case__ : Create two similar tests where the second test contains two additional steps:
73
-
74
- * ` checkOption ` before ` click ` (` stepKey="clickLogin" ` )
75
- * ` seeInCurrentUrl ` after ` click ` in the ` LogInAsAdminTest ` test (in the ` .../Backend/Test/LogInAsAdminTest.xml ` file)
60
+ __ Use case__ : Create two similar tests where the second test contains two additional steps specified to occur ` before ` or ` after ` other ` stepKeys ` .
76
61
77
62
> Tests with "extends":
78
63
79
64
``` xml
80
65
<tests >
81
- <test name =" LogInAsAdminTest" >
82
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
83
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
84
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
85
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
86
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
66
+ <test name =" AdminLoginSuccessfulTest" >
67
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
68
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
69
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
87
70
</test >
88
- <test name =" AlternativeLogInAsAdminTest " extends =" LogInAsAdminTest " >
89
- <checkOption selector = " {{AdminLoginFormSection.rememberMe}} " stepKey =" checkRememberMe" before = " clickLogin " />
90
- <seeInCurrentUrl url = " admin/admin/dashboard/ " stepKey =" seeAdminUrl " after = " clickLogin " />
71
+ <test name =" AdminLoginCheckRememberMeSuccessfulTest " extends =" AdminLoginSuccessfulTest " >
72
+ <actionGroup ref = " AdminCheckRememberMeActionGroup " stepKey =" checkRememberMe" after = " loginAsAdmin " />
73
+ <actionGroup ref = " AssertAdminRememberMeActionGroup " stepKey =" assertRememberMe " before = " logoutFromAdmin " />
91
74
</test >
92
75
</tests >
93
76
```
@@ -96,49 +79,39 @@ __Use case__: Create two similar tests where the second test contains two additi
96
79
97
80
``` xml
98
81
<tests >
99
- <test name =" LogInAsAdminTest" >
100
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
101
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
102
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
103
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
104
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
82
+ <test name =" AdminLoginSuccessfulTest" >
83
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
84
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
85
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
105
86
</test >
106
- <test name =" AlternativeLogInAsAdminTest" >
107
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
108
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
109
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
110
- <checkOption selector =" {{AdminLoginFormSection.rememberMe}}" stepKey =" checkRememberMe" />
111
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
112
- <seeInCurrentUrl url =" admin/admin/dashboard/" stepKey =" seeAdminUrl" />
113
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
87
+ <test name =" AdminLoginCheckRememberMeSuccessfulTest" >
88
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
89
+ <actionGroup ref =" AdminCheckRememberMeActionGroup" stepKey =" checkRememberMe" />
90
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
91
+ <actionGroup ref =" AssertAdminRememberMeActionGroup" stepKey =" assertRememberMe" />
92
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
114
93
</test >
115
94
</tests >
116
95
```
117
96
118
97
### Update a test before hook
119
98
120
- __ Use case__ : Create two similar tests where the second one contains two additional actions in the ` before ` hook:
121
-
122
- * ` checkOption ` before ` click ` (` stepKey="clickLogin" ` )
123
- * ` seeInCurrentUrl ` after ` click ` in the ` LogInAsAdminTest ` test (in the ` .../Backend/Test/LogInAsAdminTest.xml ` file)
99
+ __ Use case__ : Create two similar tests where the second test contains an additional action in the ` before ` hook.
124
100
125
101
> Tests with "extends":
126
102
127
103
``` xml
128
104
<tests >
129
- <test name =" LogInAsAdminTest " >
105
+ <test name =" AdminLoginSuccessfulTest " >
130
106
<before >
131
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
132
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
133
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
134
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
107
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
135
108
</before >
136
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
109
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
110
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
137
111
</test >
138
- <test name =" AlternativeLogInAsAdminTest " extends =" LogInAsAdminTest " >
112
+ <test name =" AdminLoginCheckRememberMeSuccessfulTest " extends =" AdminLoginSuccessfulTest " >
139
113
<before >
140
- <checkOption selector =" {{AdminLoginFormSection.rememberMe}}" stepKey =" checkRememberMe" before =" clickLogin" />
141
- <seeInCurrentUrl url =" admin/admin/dashboard/" stepKey =" seeAdminUrl" after =" clickLogin" />
114
+ <actionGroup ref =" AdminCheckRememberMeActionGroup" stepKey =" checkRememberMe" after =" loginAsAdmin" />
142
115
</before >
143
116
</test >
144
117
</tests >
@@ -148,25 +121,20 @@ __Use case__: Create two similar tests where the second one contains two additio
148
121
149
122
``` xml
150
123
<tests >
151
- <test name =" LogInAsAdminTest " >
124
+ <test name =" AdminLoginSuccessfulTest " >
152
125
<before >
153
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
154
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
155
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
156
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
126
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
157
127
</before >
158
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
128
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
129
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
159
130
</test >
160
- <test name =" AlternativeLogInAsAdminTest " >
131
+ <test name =" AdminLoginCheckRememberMeSuccessfulTest " >
161
132
<before >
162
- <amOnPage url =" {{AdminLoginPage}}" stepKey =" navigateToAdmin" />
163
- <fillField selector =" {{AdminLoginFormSection.username}}" userInput =" admin" stepKey =" fillUsername" />
164
- <fillField selector =" {{AdminLoginFormSection.password}}" userInput =" password" stepKey =" fillPassword" />
165
- <checkOption selector =" {{AdminLoginFormSection.rememberMe}}" stepKey =" checkRememberMe" />
166
- <click selector =" {{AdminLoginFormSection.signIn}}" stepKey =" clickLogin" />
167
- <seeInCurrentUrl url =" admin/admin/dashboard/" stepKey =" seeAdminUrl" />
133
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
134
+ <actionGroup ref =" AdminCheckRememberMeActionGroup" stepKey =" checkRememberMe" />
168
135
</before >
169
- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
136
+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
137
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
170
138
</test >
171
139
</tests >
172
140
```
0 commit comments