@serenity-js/assertions 3.10.1 → 3.10.3
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/README.md +28 -24
- package/package.json +4 -4
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.10.3](https://github.com/serenity-js/serenity-js/compare/v3.10.2...v3.10.3) (2023-09-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @serenity-js/assertions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.10.2](https://github.com/serenity-js/serenity-js/compare/v3.10.1...v3.10.2) (2023-09-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **core:** updated installation instruction in the README ([ec3f277](https://github.com/serenity-js/serenity-js/commit/ec3f2778334abbd7324497ceaa2df9f0560a103e)), closes [#1915](https://github.com/serenity-js/serenity-js/issues/1915)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.10.1](https://github.com/serenity-js/serenity-js/compare/v3.10.0...v3.10.1) (2023-09-01)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @serenity-js/assertions
|
package/README.md
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
of complex software systems faster, more collaborative and easier to scale.
|
|
10
10
|
|
|
11
11
|
⭐️ Get started with Serenity/JS!
|
|
12
|
-
- [Serenity/JS
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
12
|
+
- [Serenity/JS web testing tutorial](https://serenity-js.org/handbook/web-testing/your-first-web-scenario)
|
|
13
|
+
- [Serenity/JS Handbook](https://serenity-js.org/handbook) and [Getting Started guides](https://serenity-js.org/handbook/getting-started/)
|
|
14
|
+
- [API documentation](https://serenity-js.org/api/core)
|
|
15
|
+
- [Serenity/JS Project Templates on GitHub](https://serenity-js.org/handbook/getting-started#serenityjs-project-templates)
|
|
15
16
|
|
|
16
17
|
👋 Join the Serenity/JS Community!
|
|
17
18
|
- Meet other Serenity/JS developers and maintainers on the [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im),
|
|
@@ -26,16 +27,19 @@ of complex software systems faster, more collaborative and easier to scale.
|
|
|
26
27
|
### Installation
|
|
27
28
|
|
|
28
29
|
To install this module, run the following command in your computer terminal:
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install --save-dev @serenity-js/core @serenity-js/assertions
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
To learn more about Serenity/JS and how to use it on your project, follow the [Serenity/JS Getting Started guide](https://serenity-js.org/handbook/getting-started/).
|
|
36
|
+
|
|
33
37
|
### Performing verifications using `Ensure`
|
|
34
38
|
|
|
35
39
|
```typescript
|
|
36
|
-
import { Ensure, endsWith } from '@serenity-js/assertions'
|
|
37
|
-
import { actorCalled } from '@serenity-js/core'
|
|
38
|
-
import { Navigate, Page } from '@serenity-js/web'
|
|
40
|
+
import { Ensure, endsWith } from '@serenity-js/assertions'
|
|
41
|
+
import { actorCalled } from '@serenity-js/core'
|
|
42
|
+
import { Navigate, Page } from '@serenity-js/web'
|
|
39
43
|
|
|
40
44
|
await actorCalled('Erica').attemptsTo(
|
|
41
45
|
Navigate.to('https://serenity-js.org'),
|
|
@@ -43,55 +47,55 @@ await actorCalled('Erica').attemptsTo(
|
|
|
43
47
|
Page.current().title(),
|
|
44
48
|
endsWith('Serenity/JS')
|
|
45
49
|
),
|
|
46
|
-
)
|
|
50
|
+
)
|
|
47
51
|
```
|
|
48
52
|
|
|
49
53
|
### Controlling execution flow using `Check`
|
|
50
54
|
|
|
51
55
|
```typescript
|
|
52
|
-
import { actorCalled } from '@serenity-js/core'
|
|
53
|
-
import { Check } from '@serenity-js/assertions'
|
|
54
|
-
import { Click, isVisible } from '@serenity-js/protractor'
|
|
56
|
+
import { actorCalled } from '@serenity-js/core'
|
|
57
|
+
import { Check } from '@serenity-js/assertions'
|
|
58
|
+
import { Click, isVisible } from '@serenity-js/protractor'
|
|
55
59
|
|
|
56
60
|
await actorCalled('Erica').attemptsTo(
|
|
57
61
|
Check.whether(NewsletterModal, isVisible())
|
|
58
62
|
.andIfSo(Click.on(CloseModalButton)),
|
|
59
|
-
)
|
|
63
|
+
)
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
### Synchronising the test with the System Under Test using `Wait`
|
|
63
67
|
|
|
64
68
|
```typescript
|
|
65
|
-
import { actorCalled } from '@serenity-js/core'
|
|
66
|
-
import { Click, isVisible, Wait } from '@serenity-js/protractor'
|
|
69
|
+
import { actorCalled } from '@serenity-js/core'
|
|
70
|
+
import { Click, isVisible, Wait } from '@serenity-js/protractor'
|
|
67
71
|
|
|
68
72
|
await actorCalled('Erica').attemptsTo(
|
|
69
73
|
Wait.until(CloseModalButton, isVisible()),
|
|
70
74
|
Click.on(CloseModalButton)
|
|
71
|
-
)
|
|
75
|
+
)
|
|
72
76
|
```
|
|
73
77
|
|
|
74
78
|
### Defining custom expectations using `Expectation.thatActualShould`
|
|
75
79
|
|
|
76
80
|
```typescript
|
|
77
|
-
import { actorCalled } from '@serenity-js/core'
|
|
78
|
-
import { Expectation, Ensure } from '@serenity-js/assertions'
|
|
81
|
+
import { actorCalled } from '@serenity-js/core'
|
|
82
|
+
import { Expectation, Ensure } from '@serenity-js/assertions'
|
|
79
83
|
|
|
80
84
|
function isDivisibleBy(expected: Answerable<number>): Expectation<number> {
|
|
81
85
|
return Expectation.thatActualShould<number, number>('have value divisible by', expected)
|
|
82
|
-
.soThat((actualValue, expectedValue) => actualValue % expectedValue === 0)
|
|
86
|
+
.soThat((actualValue, expectedValue) => actualValue % expectedValue === 0)
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
await actorCalled('Erica').attemptsTo(
|
|
86
90
|
Ensure.that(4, isDivisibleBy(2)),
|
|
87
|
-
)
|
|
91
|
+
)
|
|
88
92
|
```
|
|
89
93
|
|
|
90
94
|
### Composing expectations using `Expectation.to`
|
|
91
95
|
|
|
92
96
|
```typescript
|
|
93
|
-
import { actorCalled } from '@serenity-js/core'
|
|
94
|
-
import { Expectation, Ensure, and, or, isGreaterThan, isLessThan, equals } from '@serenity-js/assertions'
|
|
97
|
+
import { actorCalled } from '@serenity-js/core'
|
|
98
|
+
import { Expectation, Ensure, and, or, isGreaterThan, isLessThan, equals } from '@serenity-js/assertions'
|
|
95
99
|
|
|
96
100
|
function isWithin(lowerBound: number, upperBound: number) {
|
|
97
101
|
return Expectation
|
|
@@ -99,12 +103,12 @@ function isWithin(lowerBound: number, upperBound: number) {
|
|
|
99
103
|
.soThatActual(and(
|
|
100
104
|
or(isGreaterThan(lowerBound), equals(lowerBound)),
|
|
101
105
|
or(isLessThan(upperBound), equals(upperBound)),
|
|
102
|
-
))
|
|
106
|
+
))
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
await actorCalled('Erica').attemptsTo(
|
|
106
110
|
Ensure.that(5, isWithin(3, 6)),
|
|
107
|
-
)
|
|
111
|
+
)
|
|
108
112
|
```
|
|
109
113
|
|
|
110
114
|
## 📣 Stay up to date
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/assertions",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.3",
|
|
4
4
|
"description": "Screenplay-style assertion library",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"node": "^16.13 || ^18.12 || ^20"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@serenity-js/core": "3.10.
|
|
46
|
+
"@serenity-js/core": "3.10.3",
|
|
47
47
|
"tiny-types": "^1.20.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@integration/testing-tools": "3.0.0",
|
|
51
|
-
"@types/chai": "^4.3.
|
|
51
|
+
"@types/chai": "^4.3.6",
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
53
|
"c8": "8.0.1",
|
|
54
54
|
"mocha": "^10.2.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"ts-node": "^10.9.1",
|
|
57
57
|
"typescript": "5.1.6"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "064edb63e8d4dee447feaab63cf61cbcf6414fdf"
|
|
60
60
|
}
|