Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codeceptjs

Package Overview
Dependencies
Maintainers
3
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codeceptjs - npm Package Versions

1
23

3.6.4-beta.1

Diff

thanh.nguyen
published 3.6.3 •

Changelog

Source

3.6.3

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

🛩️ Features

  • feat(plugin): coverage with WebDriver - devtools (#4349) - by @KobeNguyent Screenshot 2024-05-16 at 16 49 20

🐛 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
thanh.nguyen
published 3.6.3-beta.3 •

thanh.nguyen
published 3.6.3-beta.2 •

thanh.nguyen
published 3.6.2 •

Changelog

Source

3.6.2

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

🛩️ Features

  • feat(REST): support httpAgent conf (#4328) - by @KobeNguyent

Support the httpAgent conf to create the TSL connection via REST helper

{
  helpers: {
    REST: {
      endpoint: 'http://site.com/api',
      prettyPrintJson: true,
      httpAgent: {
         key: fs.readFileSync(__dirname + '/path/to/keyfile.key'),
         cert: fs.readFileSync(__dirname + '/path/to/certfile.cert'),
         rejectUnauthorized: false,
         keepAlive: true
      }
    }
  }
}
  • feat(wd): screenshots for sessions (#4322) - by @KobeNguyent

Currently only screenshot of the active session is saved, this PR aims to save the screenshot of every session for easy debugging

Scenario('should save screenshot for sessions @WebDriverIO @Puppeteer @Playwright', async ({ I }) => {
  await I.amOnPage('/form/bug1467');
  await I.saveScreenshot('original.png');
  await I.amOnPage('/');
  await I.saveScreenshot('main_session.png');
  session('john', async () => {
    await I.amOnPage('/form/bug1467');
    event.dispatcher.emit(event.test.failed, this);
  });

  const fileName = clearString('should save screenshot for active session @WebDriverIO @Puppeteer @Playwright');
  const [original, failed] = await I.getSHA256Digests([
    `${output_dir}/original.png`,
    `${output_dir}/john_${fileName}.failed.png`,
  ]);

  // Assert that screenshots of same page in same session are equal
  await I.expectEqual(original, failed);

  // Assert that screenshots of sessions are created
  const [main_original, session_failed] = await I.getSHA256Digests([
    `${output_dir}/main_session.png`,
    `${output_dir}/john_${fileName}.failed.png`,
  ]);
  await I.expectNotEqual(main_original, session_failed);
});

Screenshot 2024-04-29 at 11 07 47

  • feat: locate element with withClassAttr (#4321) - by @KobeNguyent

Find an element with class attribute

// find div with class contains 'form'
locate('div').withClassAttr('text');
  • fix(playwright): set the record video resolution (#4311) - by @KobeNguyent You could now set the recording video resolution
  url: siteUrl,
  windowSize: '300x500',
  show: false,
  restart: true,
  browser: 'chromium',
  trace: true,
  video: true,
  recordVideo: {
    size: {
      width: 400,
      height: 600,
    },
  },

🐛 Bug Fixes

  • fix: several issues of stepByStep report (#4331) - by @KobeNguyent

📖 Documentation

  • fix: wrong format docs (#4330) - by @KobeNguyent
  • fix(docs): wrong method is mentioned (#4320) - by @KobeNguyent
  • fix: ChatGPT docs - by @davert
thanh.nguyen
published 3.6.2-beta.2 •

thanh.nguyen
published 3.6.2-beta.1 •

davert
published 3.6.1 •

Changelog

Source

3.6.1

  • Fixed regression in interactive pause.
thanh.nguyen
published 3.6.0 •

Changelog

Source

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);
});
  • 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
davert
published 3.6.0-beta.1.ai-healers •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc