Skip to content

Commit 26212b6

Browse files
preparing release (#4279)
* preparing release * update changelog --------- Co-authored-by: kobenguyent <kobenguyent@gmail.com>
1 parent 64193b7 commit 26212b6

File tree

2 files changed

+144
-1
lines changed

2 files changed

+144
-1
lines changed

CHANGELOG.md

+143
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,146 @@
1+
## 3.6.0
2+
3+
🛩️ *Features*
4+
5+
* Introduced [healers](./heal) to improve stability of failed tests. Write functions that can perform actions to fix a failing test:
6+
7+
```js
8+
heal.addRecipe('reloadPageIfModalIsNotVisisble', {
9+
steps: [
10+
'click',
11+
],
12+
fn: async ({ error, step }) => {
13+
// this function will be executed only if test failed with
14+
// "model is not visible" message
15+
if (error.message.include('modal is not visible')) return;
16+
17+
// we return a function that will refresh a page
18+
// and tries to perform last step again
19+
return async ({ I }) => {
20+
I.reloadPage();
21+
I.wait(1);
22+
await step.run();
23+
};
24+
// if a function succeeds, test continues without an error
25+
},
26+
});
27+
```
28+
29+
* **Breaking Change** **AI** features refactored. Read updated [AI guide](./ai):
30+
* **removed dependency on `openai`**
31+
* added support for **Azure OpenAI**, **Claude**, **Mistal**, or any AI via custom request function
32+
* `--ai` option added to explicitly enable AI features
33+
* heal plugin decoupled from AI to run custom heal recipes
34+
* improved healing for async/await scenarios
35+
* token limits added
36+
* token calculation introduced
37+
* `OpenAI` helper renamed to `AI`
38+
39+
40+
* feat(puppeteer): network traffic manipulation. See #4263 by @KobeNguyenT
41+
* `startRecordingTraffic`
42+
* `grabRecordedNetworkTraffics`
43+
* `flushNetworkTraffics`
44+
* `stopRecordingTraffic`
45+
* `seeTraffic`
46+
* `dontSeeTraffic`
47+
48+
* feat(Puppeteer): recording WS messages. See #4264 by @KobeNguyenT
49+
50+
Recording WS messages:
51+
```
52+
I.startRecordingWebSocketMessages();
53+
I.amOnPage('https://websocketstest.com/');
54+
I.waitForText('Work for You!');
55+
const wsMessages = I.grabWebSocketMessages();
56+
expect(wsMessages.length).to.greaterThan(0);
57+
```
58+
59+
flushing WS messages:
60+
```
61+
I.startRecordingWebSocketMessages();
62+
I.amOnPage('https://websocketstest.com/');
63+
I.waitForText('Work for You!');
64+
I.flushWebSocketMessages();
65+
const wsMessages = I.grabWebSocketMessages();
66+
expect(wsMessages.length).to.equal(0);
67+
```
68+
69+
Examples:
70+
71+
```js
72+
// recording traffics and verify the traffic
73+
I.startRecordingTraffic();
74+
I.amOnPage('https://codecept.io/');
75+
I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' });
76+
```
77+
78+
```js
79+
// check the traffic with advanced params
80+
I.amOnPage('https://openai.com/blog/chatgpt');
81+
I.startRecordingTraffic();
82+
I.seeTraffic({
83+
name: 'sentry event',
84+
url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
85+
parameters: {
86+
width: '1919',
87+
height: '1138',
88+
},
89+
});
90+
```
91+
92+
* Introduce the playwright locator: `_react`, `_vue`, `data-testid` attribute. See #4255 by @KobeNguyenT
93+
94+
```
95+
Scenario('using playwright locator @Playwright', () => {
96+
I.amOnPage('https://codecept.io/test-react-calculator/');
97+
I.click('7');
98+
I.click({ pw: '_react=t[name = "="]' });
99+
I.seeElement({ pw: '_react=t[value = "7"]' });
100+
I.click({ pw: '_react=t[name = "+"]' });
101+
I.click({ pw: '_react=t[name = "3"]' });
102+
I.click({ pw: '_react=t[name = "="]' });
103+
I.seeElement({ pw: '_react=t[value = "10"]' });
104+
});
105+
```
106+
107+
```
108+
Scenario('using playwright data-testid attribute @Playwright', () => {
109+
I.amOnPage('/');
110+
const webElements = await I.grabWebElements({ pw: '[data-testid="welcome"]' });
111+
assert.equal(webElements[0]._selector, '[data-testid="welcome"] >> nth=0');
112+
assert.equal(webElements.length, 1);
113+
});
114+
```
115+
116+
* feat(puppeteer): mockRoute support. See #4262 by @KobeNguyenT
117+
118+
Network requests & responses can be mocked and modified. Use `mockRoute` which strictly follows [Puppeteer's setRequestInterception API](https://pptr.dev/next/api/puppeteer.page.setrequestinterception).
119+
120+
```
121+
I.mockRoute('https://reqres.in/api/comments/1', request => {
122+
request.respond({
123+
status: 200,
124+
headers: { 'Access-Control-Allow-Origin': '*' },
125+
contentType: 'application/json',
126+
body: '{"name": "this was mocked" }',
127+
});
128+
})
129+
```
130+
```
131+
I.mockRoute('**/*.{png,jpg,jpeg}', route => route.abort());
132+
133+
// To disable mocking for a route call `stopMockingRoute`
134+
// for previously mocked URL
135+
I.stopMockingRoute('**/*.{png,jpg,jpeg}');
136+
```
137+
To master request intercepting [use HTTPRequest object](https://pptr.dev/next/api/puppeteer.httprequest) passed into mock request handler.
138+
139+
🐛 *Bug Fixes*
140+
141+
* Fixed double help message #4278 by @masiuchi
142+
* waitNumberOfVisibleElements always failed when passing num as 0. See #4274 by @KobeNguyenT
143+
1144
## 3.5.15
2145

3146
❤️ Thanks all to those who contributed to make this release! ❤️

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeceptjs",
3-
"version": "3.5.15",
3+
"version": "3.6.0",
44
"description": "Supercharged End 2 End Testing Framework for NodeJS",
55
"keywords": [
66
"acceptance",

0 commit comments

Comments
 (0)