Skip to content

Commit bede92f

Browse files
Added examples and modified url links
1 parent b2a23dc commit bede92f

File tree

2 files changed

+158
-4
lines changed

2 files changed

+158
-4
lines changed

docs/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Allure annotations provide metadata for reporting.
8787
`<before>` may contain these child elements:
8888

8989
* Any [Action][actions]
90-
* [`<actionGroup>`]s
90+
* [`<actionGroup>`]
9191

9292
### after {#after-tag}
9393

docs/test/assertions.md

Lines changed: 157 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ The following example shows a common test that gets text from a page and asserts
5151

5252
### assertElementContainsAttribute
5353

54+
The `<assertElementContainsAttribute>` asserts that the selected html element contains and matches the expected value for the given attribute.
55+
5456
Example:
5557

5658
```xml
@@ -92,7 +94,8 @@ It must be in typical array format like `[1,2,3,4,5]` or `[alpha, brontosaurus,
9294
See [assertArrayHasKey docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertArrayHasKey)
9395

9496
Attribute|Type|Use|Description
95-
---|---|---|---`message`|string|optional|Text of informational message about a cause of failure.
97+
---|---|---|---
98+
`message`|string|optional|Text of informational message about a cause of failure.
9699
`stepKey`|string|required| A unique identifier of the text step.
97100
`before`|string|optional| `stepKey` of action that must be executed next.
98101
`after`|string|optional| `stepKey` of the preceding action.
@@ -123,6 +126,15 @@ Attribute|Type|Use|Description
123126

124127
See [assertStringContainsString docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringContainsString).
125128

129+
Example:
130+
131+
```xml
132+
<assertStringContainsString stepKey="assertDropDownTierPriceTextProduct1">
133+
<expectedResult type="string">Buy 5 for $5.00 each and save 50%</expectedResult>
134+
<actualResult type="variable">DropDownTierPriceTextProduct1</actualResult>
135+
</assertStringContainsString>
136+
```
137+
126138
Attribute|Type|Use|Description
127139
---|---|---|---
128140
`message`|string|optional|Text describing the cause of the failure.
@@ -134,6 +146,15 @@ Attribute|Type|Use|Description
134146

135147
See [assertStringContainsStringIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringContainsStringIgnoringCase).
136148

149+
Example:
150+
151+
```xml
152+
<assertStringContainsStringIgnoringCase stepKey="verifyContentType">
153+
<actualResult type="variable">grabContentType</actualResult>
154+
<expectedResult type="string">{{image.extension}}</expectedResult>
155+
</assertStringContainsStringIgnoringCase>
156+
```
157+
137158
Attribute|Type|Use|Description
138159
---|---|---|---
139160
`message`|string|optional|Message describing the cause of failure.
@@ -156,6 +177,14 @@ Attribute|Type|Use|Description
156177

157178
See [assertEmpty docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEmpty).
158179

180+
Example:
181+
182+
```xml
183+
<assertEmpty stepKey="assertSearchButtonEnabled">
184+
<actualResult type="string">$grabSearchButtonAttribute</actualResult>
185+
</assertEmpty>
186+
```
187+
159188
Attribute|Type|Use|Description
160189
---|---|---|---
161190
`message`|string|optional|Text of informational message about a cause of failure.
@@ -167,6 +196,15 @@ Attribute|Type|Use|Description
167196

168197
See [assertEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertEquals).
169198

199+
Example:
200+
201+
```xml
202+
<assertEquals message="ExpectedPrice" stepKey="assertBundleProductPrice">
203+
<actualResult type="variable">grabProductPrice</actualResult>
204+
<expectedResult type="string">$75.00</expectedResult>
205+
</assertEquals>
206+
```
207+
170208
Attribute|Type|Use|Description
171209
---|---|---|---
172210
`message`|string|optional|Text of informational message about a cause of failure.
@@ -245,6 +283,15 @@ Attribute|Type|Use|Description
245283

246284
See [assertGreaterOrEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertGreaterOrEquals).
247285

286+
Example:
287+
288+
```xml
289+
<assertGreaterOrEquals stepKey="checkStatusSortOrderAsc" after="getOrderStatusSecondRow">
290+
<actualResult type="const">$getOrderStatusSecondRow</actualResult>
291+
<expectedResult type="const">$getOrderStatusFirstRow</expectedResult>
292+
</assertGreaterOrEquals>
293+
```
294+
248295
Attribute|Type|Use|Description
249296
---|---|---|---
250297
`message`|string|optional|Text of informational message about a cause of failure.
@@ -256,6 +303,15 @@ Attribute|Type|Use|Description
256303

257304
See [assertGreaterThan docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertGreaterThan).
258305

306+
Example:
307+
308+
```xml
309+
<assertGreaterThan stepKey="checkQuantityWasChanged">
310+
<actualResult type="const">$grabEndQuantity</actualResult>
311+
<expectedResult type="const">$grabStartQuantity</expectedResult>
312+
</assertGreaterThan>
313+
```
314+
259315
Attribute|Type|Use|Description
260316
---|---|---|---
261317
`message`|string|optional|Text of informational message about a cause of failure.
@@ -267,6 +323,15 @@ Attribute|Type|Use|Description
267323

268324
See [assertGreaterThanOrEqual docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertGreaterThanOrEqual).
269325

326+
Example:
327+
328+
```xml
329+
<assertGreaterThanOrEqual stepKey="checkStatusSortOrderAsc" after="getOrderStatusSecondRow">
330+
<actualResult type="const">$getOrderStatusSecondRow</actualResult>
331+
<expectedResult type="const">$getOrderStatusFirstRow</expectedResult>
332+
</assertGreaterThanOrEqual>
333+
```
334+
270335
Attribute|Type|Use|Description
271336
---|---|---|---
272337
`message`|string|optional|Text of informational message about a cause of failure.
@@ -300,6 +365,15 @@ Attribute|Type|Use|Description
300365

301366
See [assertLessOrEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertLessOrEquals).
302367

368+
Example:
369+
370+
```xml
371+
<assertLessOrEquals stepKey="checkHeightIsCorrect">
372+
<actualResult type="variable">getImageHeight</actualResult>
373+
<expectedResult type="variable">getSectionHeight</expectedResult>
374+
</assertLessOrEquals>
375+
```
376+
303377
Attribute|Type|Use|Description
304378
---|---|---|---
305379
`message`|string|optional|Text of informational message about a cause of failure.
@@ -311,6 +385,15 @@ Attribute|Type|Use|Description
311385

312386
See [assertLessThan docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertLessThan).
313387

388+
Example:
389+
390+
```xml
391+
<assertLessThan stepKey="assertLessImages">
392+
<expectedResult type="variable">initialImages</expectedResult>
393+
<actualResult type="variable">newImages</actualResult>
394+
</assertLessThan>
395+
```
396+
314397
Attribute|Type|Use|Description
315398
---|---|---|---
316399
`message`|string|optional|Text of informational message about a cause of failure.
@@ -322,6 +405,15 @@ Attribute|Type|Use|Description
322405

323406
See [assertLessThanOrEqual docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertLessThanOrEqual).
324407

408+
Example:
409+
410+
```xml
411+
<assertLessThanOrEqual stepKey="checkHeightIsCorrect">
412+
<actualResult type="variable">getImageHeight</actualResult>
413+
<expectedResult type="variable">getSectionHeight</expectedResult>
414+
</assertLessThanOrEqual>
415+
```
416+
325417
Attribute|Type|Use|Description
326418
---|---|---|---
327419
`message`|string|optional|Text of informational message about a cause of failure.
@@ -333,6 +425,15 @@ Attribute|Type|Use|Description
333425

334426
See [assertNotContains docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotContains).
335427

428+
Example:
429+
430+
```xml
431+
<assertNotContains stepKey="assertCustomerGroupNotInOptions">
432+
<actualResult type="variable">customerGroups</actualResult>
433+
<expectedResult type="string">{{customerGroup.code}}</expectedResult>
434+
</assertNotContains>
435+
```
436+
336437
Attribute|Type|Use|Description
337438
---|---|---|---
338439
`message`|string|optional|Text of informational message about a cause of failure.
@@ -344,6 +445,15 @@ Attribute|Type|Use|Description
344445

345446
See [assertStringNotContainsString docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringNotContainsString).
346447

448+
Example:
449+
450+
```xml
451+
<assertStringNotContainsString stepKey="checkoutAsGuest">
452+
<expectedResult type="string">{{CaptchaData.checkoutAsGuest}}</expectedResult>
453+
<actualResult type="variable">$formItems</actualResult>
454+
</assertStringNotContainsString>
455+
```
456+
347457
Attribute|Type|Use|Description
348458
---|---|---|---
349459
`message`|string|optional|Text of informational message about a cause of failure.
@@ -355,6 +465,15 @@ Attribute|Type|Use|Description
355465

356466
See [assertStringNotContainsStringIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringNotContainsStringIgnoringCase).
357467

468+
Example:
469+
470+
```xml
471+
<assertStringContainsStringIgnoringCase stepKey="verifyContentType">
472+
<actualResult type="variable">grabContentType</actualResult>
473+
<expectedResult type="string">{{image.extension}}</expectedResult>
474+
</assertStringContainsStringIgnoringCase>
475+
```
476+
358477
Attribute|Type|Use|Description
359478
---|---|---|---
360479
`message`|string|optional|Text of informational message about a cause of failure.
@@ -366,6 +485,14 @@ Attribute|Type|Use|Description
366485

367486
See [assertNotEmpty docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEmpty).
368487

488+
Example:
489+
490+
```xml
491+
<assertNotEmpty stepKey="checkSwatchFieldForAdmin">
492+
<actualResult type="const">$grabSwatchForAdmin</actualResult>
493+
</assertNotEmpty>
494+
```
495+
369496
Attribute|Type|Use|Description
370497
---|---|---|---
371498
`message`|string|optional|Text of informational message about a cause of failure.
@@ -377,6 +504,15 @@ Attribute|Type|Use|Description
377504

378505
See [assertNotEquals docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEquals).
379506

507+
Example:
508+
509+
```xml
510+
<assertNotEquals stepKey="assertNotEquals">
511+
<actualResult type="string">{$grabTotalAfter}</actualResult>
512+
<expectedResult type="string">{$grabTotalBefore}</expectedResult>
513+
</assertNotEquals>
514+
```
515+
380516
Attribute|Type|Use|Description
381517
---|---|---|---
382518
`message`|string|optional|Text of informational message about a cause of failure.
@@ -444,6 +580,15 @@ Attribute|Type|Use|Description
444580

445581
See [assertNotRegExp docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotRegExp).
446582

583+
Example:
584+
585+
```xml
586+
<assertNotRegExp stepKey="simpleThumbnailIsNotDefault">
587+
<actualResult type="const">$getSimpleProductThumbnail</actualResult>
588+
<expectedResult type="const">'/placeholder\/thumbnail\.jpg/'</expectedResult>
589+
</assertNotRegExp>
590+
```
591+
447592
Attribute|Type|Use|Description
448593
---|---|---|---
449594
`message`|string|optional|Text of informational message about a cause of failure.
@@ -477,6 +622,15 @@ Attribute|Type|Use|Description
477622

478623
See [assertRegExp docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertRegExp).
479624

625+
Example:
626+
627+
```xml
628+
<assertRegExp message="adminAnalyticsMetadata object is invalid" stepKey="validateadminAnalyticsMetadata">
629+
<expectedResult type="string">#var\s+adminAnalyticsMetadata\s+=\s+{\s+("[\w_]+":\s+"[^"]*?",\s+)*?("[\w_]+":\s+"[^"]*?"\s+)};#s</expectedResult>
630+
<actualResult type="variable">$pageSource</actualResult>
631+
</assertRegExp>
632+
```
633+
480634
Attribute|Type|Use|Description
481635
---|---|---|---
482636
`message`|string|optional|Text of informational message about a cause of failure.
@@ -530,7 +684,7 @@ Attribute|Type|Use|Description
530684

531685
### expectException
532686

533-
See [expectException docs on codeception.com](http://codeception.com/docs/modules/WebDriver#expectException).
687+
See [expectException docs on codeception.com](https://codeception.com/docs/modules/Asserts#expectException).
534688

535689
Attribute|Type|Use|Description
536690
---|---|---|---
@@ -540,7 +694,7 @@ Attribute|Type|Use|Description
540694

541695
### fail
542696

543-
See [fail docs on codeception.com](http://codeception.com/docs/modules/WebDriver#fail).
697+
See [fail docs on codeception.com](https://codeception.com/docs/modules/Asserts#fail).
544698

545699
Attribute|Type|Use|Description
546700
---|---|---|---

0 commit comments

Comments
 (0)