Skip to content

Releases: codeceptjs/CodeceptJS

3.6.10

11 Dec 09:50
5abda10
Compare
Choose a tag to compare

What's Changed

  • fix(cli): missing failure counts when there is failedHooks by @kobenguyent in #4633

Full Changelog: 3.6.9...3.6.10

3.6.9

10 Dec 13:52
Compare
Choose a tag to compare

What's Changed

3.6.8

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

🛩️ Features

export const config: CodeceptJS.MainConfig = {
  tests:  '**/*.e2e.test.ts',
  retry: 4,
  output: './output',
  maskSensitiveData: true,
  emptyOutputFolder: true,
...

    I login {"username":"helloworld@test.com","password": "****"}
      I send post request "https://localhost:8000/login", {"username":"helloworld@test.com","password": "****"}
      › [Request] {"baseURL":"https://localhost:8000/login","method":"POST","data":{"username":"helloworld@test.com","password": "****"},"headers":{}}
      › [Response] {"access-token": "****"}
I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });

🐛 Bug Fixes

  • fix(playwright): Different behavior of see* and waitFor* when used in within (#4557) - by @kobenguyent
  • fix(cli): dry run returns no tests when using a regex grep (#4608) - by @kobenguyent
> codeceptjs dry-run --steps --grep "(?=.*Checkout process)"
  • fix: Replace deprecated faker.name with faker.person (#4581) - by @thomashohn
  • fix(wdio): Remove dependency to devtools (#4563) - by @thomashohn
  • fix(typings): wrong defineParameterType (#4548) - by @kobenguyent
  • fix(typing): Locator.build complains the empty locator (#4543) - by @kobenguyent
  • fix: add hint to I.seeEmailAttachment treats parameter as regular expression (#4629) - by @ngraf
Add hint to "I.seeEmailAttachment" that under the hood parameter is treated as RegExp. 
When you don't know it, it can cause a lot of pain, wondering why your test fails with I.seeEmailAttachment('Attachment(1).pdf') although it looks just fine, but actually I.seeEmailAttachment('Attachment\\(1\\).pdf is required to make the test green, in case the attachment is called "Attachment(1).pdf" with special character in it.

📖 Documentation

New Contributors

Full Changelog: 3.6.6...3.6.9

3.6.8

10 Dec 12:56
ec40b1e
Compare
Choose a tag to compare

What's Changed

3.6.8

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

🛩️ Features

export const config: CodeceptJS.MainConfig = {
  tests:  '**/*.e2e.test.ts',
  retry: 4,
  output: './output',
  maskSensitiveData: true,
  emptyOutputFolder: true,
...

    I login {"username":"helloworld@test.com","password": "****"}
      I send post request "https://localhost:8000/login", {"username":"helloworld@test.com","password": "****"}
      › [Request] {"baseURL":"https://localhost:8000/login","method":"POST","data":{"username":"helloworld@test.com","password": "****"},"headers":{}}
      › [Response] {"access-token": "****"}
I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });

🐛 Bug Fixes

  • fix(playwright): Different behavior of see* and waitFor* when used in within (#4557) - by @kobenguyent
  • fix(cli): dry run returns no tests when using a regex grep (#4608) - by @kobenguyent
> codeceptjs dry-run --steps --grep "(?=.*Checkout process)"
  • fix: Replace deprecated faker.name with faker.person (#4581) - by @thomashohn
  • fix(wdio): Remove dependency to devtools (#4563) - by @thomashohn
  • fix(typings): wrong defineParameterType (#4548) - by @kobenguyent
  • fix(typing): Locator.build complains the empty locator (#4543) - by @kobenguyent
  • fix: add hint to I.seeEmailAttachment treats parameter as regular expression (#4629) - by @ngraf
Add hint to "I.seeEmailAttachment" that under the hood parameter is treated as RegExp. 
When you don't know it, it can cause a lot of pain, wondering why your test fails with I.seeEmailAttachment('Attachment(1).pdf') although it looks just fine, but actually I.seeEmailAttachment('Attachment\\(1\\).pdf is required to make the test green, in case the attachment is called "Attachment(1).pdf" with special character in it.

📖 Documentation

New Contributors

Full Changelog: 3.6.6...3.6.8

3.6.6

17 Sep 14:54
63b1d50
Compare
Choose a tag to compare

What's Changed

3.6.6

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

🛩️ Features

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
    • run command
      Screenshot 2024-09-02 at 15 25 20

    • run workers command
      Screenshot 2024-09-02 at 15 24 53

🐛 Bug Fixes

// 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

New Contributors

Full Changelog: 3.6.5...3.6.6

3.6.5

31 Jul 10:06
dd826d0
Compare
Choose a tag to compare

3.6.5

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

🛩️ Features

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

📖 Documentation

Full Changelog: 3.6.4...3.6.5

3.6.4

19 Jun 08:11
cac208c
Compare
Choose a tag to compare

What's Changed

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

🛩️ Features

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

Screenshot from 2024-06-17 02-47-37

🐛 Bug Fixes

📖 Documentation

  • AI docs improvements

Full Changelog: 3.6.3...3.6.4

3.6.3

10 Jun 07:56
26dccb3
Compare
Choose a tag to compare

What's Changed

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

🛩️ Features

🐛 Bug Fixes

📖 Documentation

New Contributors

Full Changelog: 3.6.2...3.6.3

3.6.2

12 May 17:33
418245a
Compare
Choose a tag to compare

What's Changed

Full Changelog: 3.6.1...3.6.2

3.6.1

18 Apr 08:28
73f38dc
Compare
Choose a tag to compare

Fixed regression in interactive pause.

3.6.0

11 Apr 09:11
3989763
Compare
Choose a tag to compare

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 to AI
  • 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);
});

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

New Contributors

Full Changelog: 3.5.15...3.6.0