Releases: codeceptjs/CodeceptJS
3.6.6
What's Changed
3.6.6
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat(locator): add withAttrEndsWith, withAttrStartsWith, withAttrContains (#4334) - by @Maksym-Artemenko
- feat: soft assert (#4473) - by @kobenguyent
- Soft assert
Zero-configuration when paired with other helpers like REST, Playwright:
// inside codecept.conf.js
{
helpers: {
Playwright: {...},
SoftExpectHelper: {},
}
}
// in scenario
I.softExpectEqual('a', 'b')
I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
- feat(cli): print failed hooks (#4476) - by @kobenguyent
🐛 Bug Fixes
- fix(AI): minor AI improvements - by @DavertMik
- fix(AI): add missing await in AI.js (#4486) - by @tomaculum
- fix(playwright): no async save video page (#4472) - by @kobenguyent
- fix(rest): httpAgent condition (#4484) - by @kobenguyent
- fix: DataCloneError error when
I.executeScript
command is used withrun-workers
(#4483) - by @code4muktesh - fix: no error thrown from rerun script (#4494) - by @lin-brian-l
// fix the validation of httpAgent config. we could now pass ca, instead of key/cert.
{
helpers: {
REST: {
endpoint: 'http://site.com/api',
prettyPrintJson: true,
httpAgent: {
ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
rejectUnauthorized: false,
keepAlive: true
}
}
}
}
📖 Documentation
- doc(AI): minor AI improvements - by @DavertMik
New Contributors
- @Maksym-Artemenko made their first contribution in #4334
- @code4muktesh made their first contribution in #4483
- @tomaculum made their first contribution in #4486
- @lin-brian-l made their first contribution in #4494
Full Changelog: 3.6.5...3.6.6
3.6.5
3.6.5
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat(helper): playwright > wait for disabled (#4412) - by @kobenguyent
it('should wait for input text field to be disabled', () =>
I.amOnPage('/form/wait_disabled').then(() => I.waitForDisabled('#text', 1)))
it('should wait for input text field to be enabled by xpath', () =>
I.amOnPage('/form/wait_disabled').then(() => I.waitForDisabled("//*[@name = 'test']", 1)))
it('should wait for a button to be disabled', () =>
I.amOnPage('/form/wait_disabled').then(() => I.waitForDisabled('#text', 1)))
Waits for element to become disabled (by default waits for 1sec).
Element can be located by CSS or XPath.
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
@param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
@returns {void} automatically synchronized promise through #recorder
🐛 Bug Fixes
- fix(AI): AI is not triggered (#4422) - by @kobenguyent
- fix(plugin): stepByStep > report doesn't sync properly (#4413) - by @kobenguyent
- fix: Locator > Unsupported pseudo selector 'has' (#4448) - by @anils92
📖 Documentation
- docs: setup azure open ai using bearer token (#4434) - by @kobenguyent
Full Changelog: 3.6.4...3.6.5
3.6.4
What's Changed
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat(rest): print curl (#4396) - by @kobenguyent
Config:
...
REST: {
...
printCurl: true,
...
}
...
› [CURL Request] curl --location --request POST https://httpbin.org/post -H ...
- feat(AI): Generate PageObject, added types, shell improvement (#4319) - by @DavertMik
- added
askForPageObject
method to generate PageObjects on the fly - improved AI types
- interactive shell improved to restore history
- added
🐛 Bug Fixes
- fix(heal): wrong priority (#4394) - by @kobenguyent
📖 Documentation
- AI docs improvements
Full Changelog: 3.6.3...3.6.4
3.6.3
What's Changed
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat(plugin): coverage with WebDriver - devtools (#4349) - by @kobenguyent
🐛 Bug Fixes
- fix(cli): stale process (#4367) - by @Horsty80 @kobenguyent
- fix(runner): screenshot error in beforeSuite/AfterSuite (#4385) - by @kobenguyent
- fix(cli): gherkin command init with TypeScript (#4366) - by @andonary
- fix(webApi): error message of dontSeeCookie (#4357) - by @a-stankevich
📖 Documentation
- fix(doc): Expect helper is not described correctly (#4370) - by @kobenguyent
- fix(docs): some strange characters (#4387) - by @kobenguyent
- fix: Puppeteer helper doc typo (#4369) - by @yoannfleurydev
New Contributors
- @yoannfleurydev made their first contribution in #4369
Full Changelog: 3.6.2...3.6.3
3.6.2
What's Changed
- fix(playwright): set the record video resolution by @kobenguyent in #4311
- chore: disable redundant ppt tests by @kobenguyent in #4312
- chore(deps-dev): bump playwright from 1.43.0 to 1.43.1 by @dependabot in #4301
- chore(deps): bump joi from 17.12.2 to 17.12.3 by @dependabot in #4299
- chore(deps): bump mocha from 10.3.0 to 10.4.0 by @dependabot in #4298
- chore(deps): bump pactum from 3.6.6 to 3.6.7 by @dependabot in #4316
- fix(docs): wrong method is mentioned by @kobenguyent in #4320
- feat: locate element with withClassAttr by @kobenguyent in #4321
- chore(deps-dev): bump electron from 28.2.1 to 30.0.1 by @dependabot in #4324
- chore(deps-dev): bump webdriverio from 8.35.1 to 8.36.1 by @dependabot in #4325
- chore(deps): bump joi from 17.12.3 to 17.13.0 by @dependabot in #4326
- Update README.md by @kobenguyent in #4329
- fix: wrong format docs by @kobenguyent in #4330
- chore(deps-dev): bump @wdio/utils from 8.33.1 to 8.36.1 by @dependabot in #4327
- feat(wd): screenshots for sessions by @kobenguyent in #4322
- fix: several issues of stepByStep report by @kobenguyent in #4331
- feat(REST): support httpAgent conf by @kobenguyent in #4328
- release 3.6.2 by @kobenguyent in #4332
Full Changelog: 3.6.1...3.6.2
3.6.1
Fixed regression in interactive pause.
3.6.0
3.6.0
🛩️ Features
- Introduced healers to improve stability of failed tests. Write functions that can perform actions to fix a failing test:
heal.addRecipe('reloadPageIfModalIsNotVisisble', {
steps: [
'click',
],
fn: async ({ error, step }) => {
// this function will be executed only if test failed with
// "model is not visible" message
if (error.message.include('modal is not visible')) return;
// we return a function that will refresh a page
// and tries to perform last step again
return async ({ I }) => {
I.reloadPage();
I.wait(1);
await step.run();
};
// if a function succeeds, test continues without an error
},
});
-
Breaking Change AI features refactored. Read updated AI guide:
- removed dependency on
openai
- added support for Azure OpenAI, Claude, Mistal, or any AI via custom request function
--ai
option added to explicitly enable AI features- heal plugin decoupled from AI to run custom heal recipes
- improved healing for async/await scenarios
- token limits added
- token calculation introduced
OpenAI
helper renamed toAI
- removed dependency on
-
feat(puppeteer): network traffic manipulation. See #4263 by @kobenguyent
startRecordingTraffic
grabRecordedNetworkTraffics
flushNetworkTraffics
stopRecordingTraffic
seeTraffic
dontSeeTraffic
-
feat(Puppeteer): recording WS messages. See #4264 by @kobenguyent
Recording WS messages:
I.startRecordingWebSocketMessages();
I.amOnPage('https://websocketstest.com/');
I.waitForText('Work for You!');
const wsMessages = I.grabWebSocketMessages();
expect(wsMessages.length).to.greaterThan(0);
flushing WS messages:
I.startRecordingWebSocketMessages();
I.amOnPage('https://websocketstest.com/');
I.waitForText('Work for You!');
I.flushWebSocketMessages();
const wsMessages = I.grabWebSocketMessages();
expect(wsMessages.length).to.equal(0);
Examples:
// recording traffics and verify the traffic
I.startRecordingTraffic();
I.amOnPage('https://codecept.io/');
I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' });
// check the traffic with advanced params
I.amOnPage('https://openai.com/blog/chatgpt');
I.startRecordingTraffic();
I.seeTraffic({
name: 'sentry event',
url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
parameters: {
width: '1919',
height: '1138',
},
});
- Introduce the playwright locator:
_react
,_vue
,data-testid
attribute. See #4255 by @kobenguyent
Scenario('using playwright locator @Playwright', () => {
I.amOnPage('https://codecept.io/test-react-calculator/');
I.click('7');
I.click({ pw: '_react=t[name = "="]' });
I.seeElement({ pw: '_react=t[value = "7"]' });
I.click({ pw: '_react=t[name = "+"]' });
I.click({ pw: '_react=t[name = "3"]' });
I.click({ pw: '_react=t[name = "="]' });
I.seeElement({ pw: '_react=t[value = "10"]' });
});
Scenario('using playwright data-testid attribute @Playwright', () => {
I.amOnPage('/');
const webElements = await I.grabWebElements({ pw: '[data-testid="welcome"]' });
assert.equal(webElements[0]._selector, '[data-testid="welcome"] >> nth=0');
assert.equal(webElements.length, 1);
});
- feat(puppeteer): mockRoute support. See #4262 by @kobenguyent
Network requests & responses can be mocked and modified. Use mockRoute
which strictly follows Puppeteer's setRequestInterception API.
I.mockRoute('https://reqres.in/api/comments/1', request => {
request.respond({
status: 200,
headers: { 'Access-Control-Allow-Origin': '*' },
contentType: 'application/json',
body: '{"name": "this was mocked" }',
});
})
I.mockRoute('**/*.{png,jpg,jpeg}', route => route.abort());
// To disable mocking for a route call `stopMockingRoute`
// for previously mocked URL
I.stopMockingRoute('**/*.{png,jpg,jpeg}');
To master request intercepting use HTTPRequest object passed into mock request handler.
🐛 Bug Fixes
- Fixed double help message #4278 by @masiuchi
- waitNumberOfVisibleElements always failed when passing num as 0. See #4274 by @kobenguyent
New Contributors
Full Changelog: 3.5.15...3.6.0
3.5.15
3.5.15
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat: improve code coverage plugin (#4252) - by KobeNguyenT
We revamp the coverage plugin to make it easier to use
Once all the tests are completed, codecept
will create and store coverage in output/coverage
folder, as shown below.
Open index.html
in your browser to view the full interactive coverage report.
🐛 Bug Fixes
- fix: bump puppeteer to v22.x (#4249) - by KobeNguyenT
- fix: improve dry-run command (#4225) - by KobeNguyenT
dry-run command now supports test level grep.
Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo:@jaja
GET tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/GET_test.ts -- 4 tests
☐ Verify getting a single user **[jaja](https://github.com/jaja)**
☐ Verify getting list of users **[jaja](https://github.com/jaja)**
PUT tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/PUT_test.ts -- 4 tests
☐ Verify creating new user **[Jaja](https://github.com/Jaja)**
Total: 2 suites | 3 tests
--- DRY MODE: No tests were executed ---
➜ codeceptjs-rest-demo git:(master) ✗ npx codeceptjs dry-run
Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo:
DELETE tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/DELETE_test.ts -- 4 tests
☐ Verify deleting a user
GET tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/GET_test.ts -- 4 tests
☐ Verify a successful call
☐ Verify a not found call
☐ Verify getting a single user **[jaja](https://github.com/jaja)**
☐ Verify getting list of users **[jaja](https://github.com/jaja)**
POST tests -- /Users/tDesktop/projects/codeceptjs-rest-demo/src/POST_test.ts -- 4 tests
☐ Verify creating new user
☐ Verify uploading a file
PUT tests -- /Users/tDesktop/projects/codeceptjs-rest-demo/src/PUT_test.ts -- 4 tests
☐ Verify creating new user **[Jaja](https://github.com/Jaja)**
Total: 4 suites | 8 tests
--- DRY MODE: No tests were executed ---
- Several internal fixes and improvements for github workflows
Full Changelog: 3.5.14...3.5.15
3.5.14
3.5.13
3.5.13
❤️ Thanks all to those who contributed to make this release! ❤️
🛩️ Features
- feat: mock server helper (#4155) - by @kobenguyent
- feat(webdriver): network traffics manipulation (#4166) - by @kobenguyent
[Webdriver] Added commands to check network traffics - supported only with devtoolsProtocolstartRecordingTraffic
grabRecordedNetworkTraffics
flushNetworkTraffics
stopRecordingTraffic
seeTraffic
dontSeeTraffic
Examples:
// recording traffics and verify the traffic
I.startRecordingTraffic();
I.amOnPage('https://codecept.io/');
I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' });
// check the traffic with advanced params
I.amOnPage('https://openai.com/blog/chatgpt');
I.startRecordingTraffic();
I.seeTraffic({
name: 'sentry event',
url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
parameters: {
width: '1919',
height: '1138',
},
});
- feat(webapi): add waitForCookie (#4169) - by @kobenguyent
Waits for the specified cookie in the cookies.
I.waitForCookie("token");
🐛 Bug Fixes
- fix(appium): update performSwipe with w3c protocol v2 (#4181) - by @MykaLev
- fix(webapi): selectOption method (#4157) - by @dyaroman
- fix: waitForText doesnt throw error when text doesnt exist (#4195) - by @kobenguyent
- fix: use this.options instead of this.config (#4186) - by @kobenguyent
- fix: config path without selenium (#4184) - by @kobenguyent
- fix: bring to front condition in _setPage (#4173) - by @kobenguyent
- fix: complicated locator (#4170) - by @kobenguyent
Adding of':nth-child'
into the array
const limitation = [':nth-of-type', ':first-of-type', ':last-of-type', ':nth-last-child', ':nth-last-of-type', ':checked', ':disabled', ':enabled', ':required', ':lang'];
fixes the issue. Then an old conversion way over css-to-xpath
is used.
📖 Documentation
- fix(docs): missing docs for codecept UI (#4175) - by @kobenguyent
- fix(docs): Appium documentation sidebar menu links (#4188) - by @mirao
🛩️ Several bugfixes and improvements for Codecept-UI
- Several internal improvements
- fix: title is not showing when visiting a test
- fix: handle erros nicely
New Contributors
Full Changelog: 3.5.12...3.5.13