@@ -22,9 +22,9 @@ For information on how to debug PEQL expressions, see the [debugging guide](/han
22
22
23
23
## Working with individual page elements
24
24
25
- To show you how to work with ** individual page elements** ,
25
+ To show you how to work with ** individual page elements** ,
26
26
I'll use an example shopping basket widget and demonstrate locating its various parts.
27
- The widget is simple enough to help us focus on the important aspects of PEQL,
27
+ The widget is simple enough to help us focus on the important aspects of PEQL,
28
28
yet sophisticated enough to be representative of other widgets you're likely to come across in the wild:
29
29
30
30
``` html
@@ -97,7 +97,7 @@ and others.
97
97
98
98
### Using selector aliases
99
99
100
- In scenarios where elements use a consistent pattern allowing them to be easily identified,
100
+ In scenarios where elements use a consistent pattern allowing them to be easily identified,
101
101
such as a ` data-test-it ` , or a ` role ` attribute, you might want to implement custom selector aliases
102
102
to avoid code duplication.
103
103
@@ -355,7 +355,7 @@ const lastItem = () =>
355
355
.last ()
356
356
```
357
357
358
- The above APIs are particularly useful when you need to retrieve elements from a sorted collection,
358
+ The above APIs are particularly useful when you need to retrieve elements from a sorted collection,
359
359
such as the most recent comment under an article, the last customer order in a CRM system,
360
360
nth position from a league table, and so on.
361
361
@@ -426,7 +426,7 @@ so questions that can be composed with other questions and answered in their con
426
426
In short, any Serenity/JS question that has a [ ` question.of(anotherQuestion) ` ] ( /api/core/interface/MetaQuestion/#of ) API is
427
427
a meta-question.
428
428
429
- Conveniently, [ ` PageElement ` ] ( /api/web/class/PageElement/ ) is a meta-question that can be
429
+ Conveniently, [ ` PageElement ` ] ( /api/web/class/PageElement/ ) is a meta-question that can be
430
430
composed with another ` PageElement ` using a declarative [ ` childElement.of(parentElement) ` ] ( /api/web/class/PageElement/#of ) API
431
431
to dynamically model a descendant/ancestor (a.k.a. child/parent) relationship between the elements.
432
432
@@ -488,8 +488,8 @@ await actorCalled('Alice').attemptsTo(
488
488
```
489
489
490
490
Serenity/JS lets you compose not just the page elements, but also their ** descriptions** .
491
- In our example, the description of ` Text.of(itemName().of(basketItem())) ` will be ** derived from individual descriptions** of
492
- questions in the chain and reported as ` text of name of basket item ` .
491
+ In our example, the description of ` Text.of(itemName().of(basketItem())) ` will be ** derived from individual descriptions** of
492
+ questions in the chain and reported as ` text of name of basket item ` .
493
493
Of course, you can set your own description if you prefer using ` .describedAs() ` , too.
494
494
495
495
You might have also noticed that the [ ` childElement.of(parentElement) ` ] ( /api/web/class/PageElement/#of ) API
@@ -528,7 +528,7 @@ await actorCalled('Alice').attemptsTo(
528
528
)
529
529
```
530
530
531
- you could also use it to extract the text value of each element in a collection:
531
+ you could also use it to extract the text value of each element in a collection:
532
532
533
533
``` typescript
534
534
import { actorCalled } from ' @serenity-js/core'
@@ -590,11 +590,11 @@ await actorCalled('Alice').attemptsTo(
590
590
591
591
### Creating custom meta-questions
592
592
593
- Serenity/JS provides a number of meta-questions, like [ ` Text ` ] ( /api/web/class/Text ) ,
594
- [ ` CssClasses ` ] ( /api/web/class/CssClasses ) , or [ ` Attribute ` ] ( /api/web/class/Attribute ) ,
593
+ Serenity/JS provides a number of meta-questions, like [ ` Text ` ] ( /api/web/class/Text ) ,
594
+ [ ` CssClasses ` ] ( /api/web/class/CssClasses ) , or [ ` Attribute ` ] ( /api/web/class/Attribute ) ,
595
595
and you can always write your own if needed.
596
596
597
- For example, if you're dealing with a web interface that presents tabular data,
597
+ For example, if you're dealing with a web interface that presents tabular data,
598
598
you might want to fetch a table row, perform some transformation on each cell,
599
599
then return the result as a JSON object so that it's easier to work with.
600
600
@@ -652,7 +652,7 @@ await actorCalled('Alice').attemptsTo(
652
652
653
653
Alternatively, when you want to create a question that returns a JSON object, instead of using [ ` Question.about ` ] ( /api/core/class/Question/#about )
654
654
you can also use [ ` Question.fromObject ` ] ( /api/core/class/Question/#fromObject ) , which will make your implementation
655
- more concise:
655
+ more concise:
656
656
657
657
``` typescript
658
658
const BasketItemDetails: MetaQuestion <PageElement , Question <Promise <{ name: string , price: number }>>> = {
@@ -736,7 +736,7 @@ const destroyButton = () => // Destroy button
736
736
### Filtering page elements
737
737
738
738
Serenity/JS [ ` PageElements ` ] ( /api/web/class/PageElements/ ) are a [ ` List ` ] ( /api/core/class/List/ ) , which means they offer a filtering API
739
- ([ ` list.where(metaQuestion, expectation) ` ] ( /api/core/class/List/#where ) ) and methods like
739
+ ([ ` list.where(metaQuestion, expectation) ` ] ( /api/core/class/List/#where ) ) and methods like
740
740
[ ` first() ` ] ( /api/web/class/PageElements/#first ) ,
741
741
[ ` last() ` ] ( /api/web/class/PageElements/#last ) ,
742
742
or [ ` count() ` ] ( /api/web/class/PageElements/#count ) .
@@ -757,7 +757,7 @@ await actorCalled('Alice').attemptsTo(
757
757
)
758
758
```
759
759
760
- Furthermore, you can compose the result of your query with another question, like ` label().of(...) ` :
760
+ Furthermore, you can compose the result of your query with another question, like ` label().of(...) ` :
761
761
762
762
``` typescript
763
763
import { actorCalled } from ' @serenity-js/core'
0 commit comments