@@ -21,25 +21,19 @@ Unlike merging, the parent test (or action group) will still exist after the tes
2121
2222<!-- {% raw %} -->
2323
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 ` .
2525
2626> Test with "extends":
2727
2828``` xml
2929<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" />
3734 </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" />
4337 </test >
4438</tests >
4539```
@@ -48,46 +42,35 @@ __Use case__: Create two similar tests with different `url` (`"{{AdminCategoryPa
4842
4943``` xml
5044<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" />
5849 </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" />
6654 </test >
6755</tests >
6856```
6957
7058### Add a test step
7159
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 ` .
7661
7762> Tests with "extends":
7863
7964``` xml
8065<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" />
8770 </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 " />
9174 </test >
9275</tests >
9376```
@@ -96,49 +79,39 @@ __Use case__: Create two similar tests where the second test contains two additi
9679
9780``` xml
9881<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" />
10586 </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" />
11493 </test >
11594</tests >
11695```
11796
11897### Update a test before hook
11998
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.
124100
125101> Tests with "extends":
126102
127103``` xml
128104<tests >
129- <test name =" LogInAsAdminTest " >
105+ <test name =" AdminLoginSuccessfulTest " >
130106 <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" />
135108 </before >
136- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
109+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
110+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
137111 </test >
138- <test name =" AlternativeLogInAsAdminTest " extends =" LogInAsAdminTest " >
112+ <test name =" AdminLoginCheckRememberMeSuccessfulTest " extends =" AdminLoginSuccessfulTest " >
139113 <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" />
142115 </before >
143116 </test >
144117</tests >
@@ -148,25 +121,20 @@ __Use case__: Create two similar tests where the second one contains two additio
148121
149122``` xml
150123<tests >
151- <test name =" LogInAsAdminTest " >
124+ <test name =" AdminLoginSuccessfulTest " >
152125 <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" />
157127 </before >
158- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
128+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
129+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
159130 </test >
160- <test name =" AlternativeLogInAsAdminTest " >
131+ <test name =" AdminLoginCheckRememberMeSuccessfulTest " >
161132 <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" />
168135 </before >
169- <see userInput =" Lifetime Sales" stepKey =" seeLifetimeSales" />
136+ <actionGroup ref =" AssertAdminSuccessLoginActionGroup" stepKey =" assertLoggedIn" />
137+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logoutFromAdmin" />
170138 </test >
171139</tests >
172140```
0 commit comments