@serenity-js/web 3.16.2 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/lib/screenplay/questions/Attribute.d.ts +6 -2
- package/lib/screenplay/questions/Attribute.d.ts.map +1 -1
- package/lib/screenplay/questions/Attribute.js +9 -0
- package/lib/screenplay/questions/Attribute.js.map +1 -1
- package/package.json +5 -5
- package/src/screenplay/questions/Attribute.ts +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.18.0](https://github.com/serenity-js/serenity-js/compare/v3.17.0...v3.18.0) (2024-02-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** actors can now check if an HTML element attribute is present ([3ce115a](https://github.com/serenity-js/serenity-js/commit/3ce115ab5c27b05b970f529ee0e97c89d46bbde4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.17.0](https://github.com/serenity-js/serenity-js/compare/v3.16.2...v3.17.0) (2024-02-10)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @serenity-js/web
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.16.2](https://github.com/serenity-js/serenity-js/compare/v3.16.1...v3.16.2) (2024-02-05)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @serenity-js/web
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Answerable, AnswersQuestions, MetaQuestion, MetaQuestionAdapter, QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
1
|
+
import type { Answerable, AnswersQuestions, MetaQuestion, MetaQuestionAdapter, Optional, QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { Question } from '@serenity-js/core';
|
|
3
3
|
import { PageElement } from '../models';
|
|
4
4
|
/**
|
|
@@ -93,7 +93,7 @@ import { PageElement } from '../models';
|
|
|
93
93
|
*
|
|
94
94
|
* @group Questions
|
|
95
95
|
*/
|
|
96
|
-
export declare class Attribute<Native_Element_Type> extends Question<Promise<string>> implements MetaQuestion<PageElement<Native_Element_Type>, Question<Promise<string
|
|
96
|
+
export declare class Attribute<Native_Element_Type> extends Question<Promise<string>> implements MetaQuestion<PageElement<Native_Element_Type>, Question<Promise<string>>>, Optional {
|
|
97
97
|
private readonly name;
|
|
98
98
|
private readonly element?;
|
|
99
99
|
private subject;
|
|
@@ -120,6 +120,10 @@ export declare class Attribute<Native_Element_Type> extends Question<Promise<str
|
|
|
120
120
|
* @inheritDoc
|
|
121
121
|
*/
|
|
122
122
|
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
123
|
+
/**
|
|
124
|
+
* @inheritDoc
|
|
125
|
+
*/
|
|
126
|
+
isPresent(): QuestionAdapter<boolean>;
|
|
123
127
|
/**
|
|
124
128
|
* @inheritDoc
|
|
125
129
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attribute.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Attribute.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnJ,OAAO,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAA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142
|
const element = await actor.answer(this.element);
|
|
143
143
|
return element.attribute(name);
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* @inheritDoc
|
|
147
|
+
*/
|
|
148
|
+
isPresent() {
|
|
149
|
+
return core_1.Question.about(this.subject, async (actor) => {
|
|
150
|
+
const attribute = await this.answeredBy(actor);
|
|
151
|
+
return attribute !== null && attribute !== undefined;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
145
154
|
/**
|
|
146
155
|
* @inheritDoc
|
|
147
156
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attribute.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":";;;AACA,4CAA4D;AAE5D,sCAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,MAAa,SACT,SAAQ,eAAyB;IAkBZ;IACA;IAhBb,OAAO,CAAS;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAY,IAAwB;QAC7C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,YACqB,IAAwB,EACxB,OAAoD;QAErE,KAAK,EAAE,CAAC;QAHS,SAAI,GAAJ,IAAI,CAAoB;QACxB,YAAO,GAAP,OAAO,CAA6C;QAGrE,IAAI,CAAC,OAAO,GAAG,OAAO;YAClB,CAAC,CAAC,IAAA,QAAC,EAAA,GAAI,IAAK,iBAAkB,OAAQ,EAAE;YACxC,CAAC,CAAC,IAAA,QAAC,EAAA,GAAI,IAAK,YAAY,CAAA;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,EAAE,CAAC,WAAiG;QAChG,OAAO,eAAQ,CAAC,aAAa,CACzB,IAAI,SAAS,CACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO;YACR,CAAC,CAAC,oBAAW,CAA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,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AAtFD,8BAsFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"description": "Serenity/JS Screenplay Pattern APIs for the Web",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"node": "^16.13 || ^18.12 || ^20"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@serenity-js/assertions": "3.
|
|
49
|
-
"@serenity-js/core": "3.
|
|
48
|
+
"@serenity-js/assertions": "3.18.0",
|
|
49
|
+
"@serenity-js/core": "3.18.0",
|
|
50
50
|
"tiny-types": "1.21.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@types/chai": "4.3.11",
|
|
55
55
|
"@types/mocha": "10.0.6",
|
|
56
56
|
"c8": "9.1.0",
|
|
57
|
-
"mocha": "10.
|
|
57
|
+
"mocha": "10.3.0",
|
|
58
58
|
"mocha-multi": "1.1.7",
|
|
59
59
|
"ts-node": "10.9.2",
|
|
60
60
|
"typescript": "5.2.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c4f12cc2dd366788b88fd06b4452084a6b36b5fe"
|
|
63
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Answerable, AnswersQuestions, MetaQuestion, MetaQuestionAdapter,QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
1
|
+
import type { Answerable, AnswersQuestions, MetaQuestion, MetaQuestionAdapter, Optional, QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { d, LogicError, Question } from '@serenity-js/core';
|
|
3
3
|
|
|
4
4
|
import { PageElement } from '../models';
|
|
@@ -97,7 +97,7 @@ import { PageElement } from '../models';
|
|
|
97
97
|
*/
|
|
98
98
|
export class Attribute<Native_Element_Type>
|
|
99
99
|
extends Question<Promise<string>>
|
|
100
|
-
implements MetaQuestion<PageElement<Native_Element_Type>, Question<Promise<string
|
|
100
|
+
implements MetaQuestion<PageElement<Native_Element_Type>, Question<Promise<string>>>, Optional
|
|
101
101
|
{
|
|
102
102
|
private subject: string;
|
|
103
103
|
|
|
@@ -157,6 +157,16 @@ export class Attribute<Native_Element_Type>
|
|
|
157
157
|
return element.attribute(name);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @inheritDoc
|
|
162
|
+
*/
|
|
163
|
+
isPresent(): QuestionAdapter<boolean> {
|
|
164
|
+
return Question.about(this.subject, async actor => {
|
|
165
|
+
const attribute = await this.answeredBy(actor);
|
|
166
|
+
return attribute !== null && attribute !== undefined;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
160
170
|
/**
|
|
161
171
|
* @inheritDoc
|
|
162
172
|
*/
|