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

codeceptjs

Package Overview
Dependencies
Maintainers
1
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
24

3.5.12-beta.1

Diff

thanh.nguyen
published 3.5.11 •

Changelog

Source

3.5.11

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

🛩️ Features

  • feat: other locators from playwright (#4090) - by @KobeNguyenT
    • CodeceptJS - Playwright now supports other locators like
      • React (https://playwright.dev/docs/other-locators#react-locator),
      • Vue (https://playwright.dev/docs/other-locators#vue-locator) Vue Locators Example

🐛 Bug Fixes

  • fix: step object is broken when step arg is a function (#4092) - by @KobeNguyenT
  • fix: step object is broken when step arg contains joi object (#4084) - by @KobeNguyenT
  • fix(expect helper): custom error message as optional param (#4082) - by @KobeNguyenT
  • fix(puppeteer): hide deprecation info (#4075) - by @KobeNguyenT
  • fix: seeattributesonelements throws error when attribute doesn't exist (#4073) - by @KobeNguyenT
  • fix: typo in agrs (#4077) - by @KobeNguyenT
  • fix: retryFailedStep is disabled for non tryTo steps (#4069) - by @KobeNguyenT
  • fix(typings): scrollintoview complains scrollintoviewoptions (#4067) - by @KobeNguyenT

📖 Documentation

  • fix(docs): some doc blocks are broken (#4076) - by @KobeNguyenT
  • fix(docs): expect docs (#4058) - by @KobeNguyenT
thanh.nguyen
published 3.5.10 •

Changelog

Source

3.5.10

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

🛩️ Features

  • feat: expose WebElement (#4043) - by @KobeNguyenT
Now we expose the WebElements that are returned by the WebHelper and you could make the subsequence actions on them.

// Playwright helper would return the Locator

I.amOnPage('/form/focus_blur_elements');
const webElements = await I.grabWebElements('#button');
webElements[0].click();
  • feat(playwright): support HAR replaying (#3990) - by @KobeNguyenT
Replaying from HAR

 // Replay API requests from HAR.
 // Either use a matching response from the HAR,
 // or abort the request if nothing matches.
   I.replayFromHar('./output/har/something.har', { url: "*/**/api/v1/fruits" });
   I.amOnPage('https://demo.playwright.dev/api-mocking');
   I.see('CodeceptJS');
[Parameters]
harFilePath [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) Path to recorded HAR file
opts [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? [Options for replaying from HAR](https://playwright.dev/docs/api/class-page#page-route-from-har)
  • feat(playwright): support HAR recording (#3986) - by @KobeNguyenT
A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded. 
It contains information about the request and response headers, cookies, content, timings, and more. 
You can use HAR files to mock network requests in your tests. HAR will be saved to output/har. 
More info could be found here https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har.

...
recordHar: {
    mode: 'minimal', // possible values: 'minimal'|'full'.
    content: 'embed' // possible values:  "omit"|"embed"|"attach".
}
...
  • improvement(playwright): support partial string for option (#4016) - by @KobeNguyenT
await I.amOnPage('/form/select');
await I.selectOption('Select your age', '21-');

🐛 Bug Fixes

  • fix(playwright): proceedSee could not find the element (#4006) - by @hatufacci
  • fix(appium): remove the vendor prefix of 'bstack:options' (#4053) - by @mojtabaalavi
  • fix(workers): event improvements (#3953) - by @KobeNguyenT
Emit the new event: event.workers.result.

CodeceptJS also exposes the env var `process.env.RUNS_WITH_WORKERS` when running tests with run-workers command so that you could handle the events better in your plugins/helpers.

const { event } = require('codeceptjs');

module.exports = function() {
    // this event would trigger the  `_publishResultsToTestrail` when running `run-workers` command
  event.dispatcher.on(event.workers.result, async () => {
    await _publishResultsToTestrail();
  });
  
  // this event would not trigger the  `_publishResultsToTestrail` multiple times when running `run-workers` command
  event.dispatcher.on(event.all.result, async () => {
      // when running `run` command, this env var is undefined
    if (!process.env.RUNS_WITH_WORKERS) await _publishResultsToTestrail();
  });
}
  • fix: ai html updates (#3962) - by @DavertMik
replaced minify library with a modern and more secure fork. Fixes html-minifier@4.0.0 Regular Expression Denial of Service vulnerability #3829
AI class is implemented as singleton
refactored heal.js plugin to work on edge cases
add configuration params on number of fixes performed by ay heal
improved recorder class to add more verbose log
improved recorder class to ignore some of errors
  • fix(appium): closeApp supports both Android/iOS (#4046) - by @KobeNguyenT
  • fix: some security vulnerability of some packages (#4045) - by @KobeNguyenT
  • fix: seeAttributesOnElements check condition (#4029) - by @KobeNguyenT
  • fix: waitForText locator issue (#4039) - by @KobeNguyenT
Fixed this error:

locator.isVisible: Unexpected token "s" while parsing selector ":has-text('Were you able to resolve the resident's issue?') >> nth=0"
      at Playwright.waitForText (node_modules\codeceptjs\lib\helper\Playwright.js:2584:79)
  • fix: move to sha256 (#4038) - by @KobeNguyenT
  • fix: respect retries from retryfailedstep plugin in helpers (#4028) - by @KobeNguyenT
Currently inside the _before() of helpers for example Playwright, the retries is set there, however, when retryFailedStep plugin is enabled, the retries of recorder is still using the value from _before() not the value from retryFailedStep plugin.

Fix:

- introduce the process.env.FAILED_STEP_RETIRES which could be access everywhere as the helper won't know anything about the plugin.
- set default retries of Playwright to 3 to be on the same page with Puppeteer.
  • fix: examples in test title (#4030) - by @KobeNguyenT
When test title doesn't have the data in examples:

Feature: Faker examples

  Scenario Outline: Below are the users
    Examples:
      | user   | role |
      | John  | admin |
      | Tim   | client  |

Faker examples --
    [1]  Starting recording promises
    Timeouts: 
  Below are the users {"user":"John","role":"admin"}
  ✔ OK in 4ms

  Below are the users {"user":"Tim","role":"client"}
  ✔ OK in 1ms

When test title includes the data in examples:


Feature: Faker examples

  Scenario Outline: Below are the users - <user> - <role>
    Examples:
      | user   | role |
      | John  | admin |
      | Tim   | client  |


Faker examples --
    [1]  Starting recording promises
    Timeouts: 
  Below are the users - John - admin 
  ✔ OK in 4ms

  Below are the users - Tim - client 
  ✔ OK in 1ms
  • fix: disable retryFailedStep when using with tryTo (#4022) - by @KobeNguyenT
  • fix: locator builder returns error when class name contains hyphen (#4024) - by @KobeNguyenT
  • fix: seeCssPropertiesOnElements failed when font-weight is a number (#4026) - by @KobeNguyenT
  • fix(appium): missing await on some steps of runOnIOS and runOnAndroid (#4018) - by @KobeNguyenT
  • fix(cli): no error of failed tests when using retry with scenario only (#4020) - by @KobeNguyenT
  • fix: set getPageTimeout to 30s (#4031) - by @KobeNguyenT
  • fix(appium): expose switchToContext (#4015) - by @KobeNguyenT
  • fix: promise issue (#4013) - by @KobeNguyenT
  • fix: seeCssPropertiesOnElements issue with improper condition (#4057) - by @KobeNguyenT

📖 Documentation

  • docs: Update clearCookie documentation for Playwright helper (#4005) - by @Hellosager
  • docs: improve the example code for autoLogin (#4019) - by @KobeNguyenT Screenshot 2023-11-22 at 14 40 11
thanh.nguyen
published 3.5.9-beta.2 •

thanh.nguyen
published 3.5.9-beta.1 •

thanh.nguyen
published 3.5.9 •

thanh.nguyen
published 3.5.8 •

Changelog

Source

3.5.8

Thanks all to those who contributed to make this release!

🐛 Bug Fixes fix(appium): type of setNetworkConnection() (#3994) - by @mirao fix: improve the way to show deprecated appium v1 message (#3992) - by @KobeNguyenT fix: missing exit condition of some wait functions - by @KobeNguyenT

thanh.nguyen
published 3.5.7 •

Changelog

Source

3.5.7

Thanks all to those who contributed to make this release!

🐛 Bug Fixes

  • Bump playwright to 1.39.0 - run npx playwright install to install the browsers as starting from 1.39.0 browsers are not installed automatically (#3924) - by @KobeNguyenT
  • fix(playwright): some wait functions draw error due to switchTo iframe (#3918) - by @KobeNguyenT
  • fix(appium): AppiumTestDistribution/appium-device-farm requires 'platformName' (#3950) - by @rock-tran
  • fix: autologin with empty fetch (#3947) - by @andonary
  • fix(cli): customLocator draws error in dry-mode (#3940) - by @KobeNguyenT
  • fix: ensure docs include @returns Promise<void> where appropriate (#3954) - by @fwouts
  • fix: long text in data table cuts off (#3936) - by @KobeNguyenT
Funktionalität: Faker examples

   Szenariogrundriss: Atualizar senha do usuário
        Angenommen que estou logado via REST com o usuário "<customer>"
          | protocol             | https:               |
          | hostname             | https://cucumber.io/docs/gherkin/languages/            |
          

Faker examples --
  Atualizar senha do usuário {"product":"{{vehicle.vehicle}}","customer":"Dr. {{name.findName}}","price":"{{commerce.price}}","cashier":"cashier 2"}
   On Angenommen: que estou logado via rest com o usuário "dr. {{name.find name}}" 
    protocol        | https:         
    hostname        | https://cucumber.io/docs/gherkin/languages/
    
Dr. {{name.findName}}
  ✔ OK in 13ms

  • fix(playwright): move to waitFor (#3933) - by @KobeNguyenT
  • fix: relax grabCookie type (#3919) - by @KobeNguyenT
  • fix: proceedSee error when being called inside within (#3939) - by @KobeNguyenT
  • fix: rename haveRequestHeaders of ppt and pw helpers (#3937) - by @KobeNguyenT
Renamed haveRequestHeaders of Puppeteer, Playwright helper so that it would not confuse the REST helper.
Puppeteer: setPuppeteerRequestHeaders
Playwright: setPlaywrightRequestHeaders
  • improvement: handle the way to load apifactory nicely (#3941) - by @KobeNguyenT
With this fix, we could now use the following syntax:

export = new Factory()
   .attr('name', () => faker.name.findName())
   .attr('job', () => 'leader');
   
export default new Factory()
   .attr('name', () => faker.name.findName())
   .attr('job', () => 'leader');
   
modules.export = new Factory()
   .attr('name', () => faker.name.findName())
   .attr('job', () => 'leader');

📖 Documentation

  • docs(appium): update to v2 (#3932) - by @KobeNguyenT
  • docs: improve BDD Gherkin docs (#3938) - by @KobeNguyenT
  • Other docs improvements

🛩️ Features

  • feat(puppeteer): support trace recording - by @KobeNguyenT
[Trace Recording Customization]
Trace recording provides complete information on test execution and includes screenshots, and network requests logged during run. Traces will be saved to output/trace

trace: enables trace recording for failed tests; trace are saved into output/trace folder
keepTraceForPassedTests: - save trace for passed tests
  • feat: expect helper (#3923) - by @KobeNguyenT
 * This helper allows performing assertions based on Chai.
 *
 * ### Examples
 *
 * Zero-configuration when paired with other helpers like REST, Playwright:
 *
 * ```js
 * // inside codecept.conf.js
 *{
 *   helpers: {
 *     Playwright: {...},
 *     ExpectHelper: {},
 *   }
 
  Expect Helper
    #expectEqual
    #expectNotEqual
    #expectContain
    #expectNotContain
    #expectStartsWith
    #expectNotStartsWith
    #expectEndsWith
    #expectNotEndsWith
    #expectJsonSchema
    #expectHasProperty
    #expectHasAProperty
    #expectToBeA
    #expectToBeAn
    #expectMatchRegex
    #expectLengthOf
    #expectTrue
    #expectEmpty
    #expectFalse
    #expectAbove
    #expectBelow
    #expectLengthAboveThan
    #expectLengthBelowThan
    #expectLengthBelowThan
    #expectDeepMembers
    #expectDeepIncludeMembers
    #expectDeepEqualExcluding
    #expectLengthBelowThan
  • feat: run-workers with multiple browsers output folders - by @KobeNguyenT
  • Screenshot 2023-11-04 at 10 49 56
  • Screenshot 2023-11-03 at 15 56 38
  • feat: introduce new Playwright methods - by @hatufacci
- grabCheckedElementStatus
- grabDisabledElementStatus
  • feat: gherkin supports i18n (#3934) - by @KobeNguyenT
#language: de
Funktionalität: Checkout-Prozess
  Um Produkte zu kaufen
  Als Kunde
  Möchte ich in der Lage sein, mehrere Produkte zu kaufen

  @i18n
  Szenariogrundriss: Bestellrabatt
    Angenommen ich habe ein Produkt mit einem Preis von <price>$ in meinem Warenkorb
    Und der Rabatt für Bestellungen über $20 beträgt 10 %
    Wenn ich zur Kasse gehe
    Dann sollte ich den Gesamtpreis von "<total>" $ sehen

    Beispiele:
      | price | total |
      | 10    | 10.0  |
  • feat(autoLogin): improve the check method (#3935) - by @KobeNguyenT
Instead of asserting on page elements for the current user in check, you can use the session you saved in fetch

autoLogin: {
  enabled: true,
  saveToFile: true,
  inject: 'login',
  users: {
    admin: {
      login: async (I) => {  // If you use async function in the autoLogin plugin
         const phrase = await I.grabTextFrom('#phrase')
         I.fillField('username', 'admin'),
         I.fillField('password', 'password')
         I.fillField('phrase', phrase)
      },
      check: (I, session) => {
         // Throwing an error in `check` will make CodeceptJS perform the login step for the user
         if (session.profile.email !== the.email.you.expect@some-mail.com) {
              throw new Error ('Wrong user signed in');
        }
      },
    }
  }
}
Scenario('login', async ( {I, login} ) => {
  await login('admin') // you should use `await`
})
davert
published 3.5.7-beta.1 •

thanh.nguyen
published 3.5.6 •

Changelog

Source

3.5.6

Thanks all to those who contributed to make this release!

🐛 Bug Fixes

  • fix: switchTo/within block doesn't switch to expected iframe (#3892) - by @KobeNguyenT
  • fix: highlight element doesn't work as expected (#3896) - by @KobeNguyenT
  verbose/ highlight	TRUE	TRUE -> highlight element
  verbose/ highlight	TRUE	FALSE -> no highlight element
  verbose/ highlight	FALSE	TRUE -> no highlight element
  verbose/ highlight	FALSE	FALSE -> no highlight element
  • fix: masked value issue in data table (#3885) - by @KobeNguyenT
const accounts = new DataTable(['role', 'username', 'password']);
accounts.add([
  'ROLE_A',
  process.env['FIRST_USERNAME'],
  secret(process.env['FIRST_PASSWORD']),
]);
accounts.add([
  'ROLE_B',
  process.env['SECOND_USERNAME'],
  secret(process.env['SECOND_PASSWORD']),
]);

Data(accounts)
  .Scenario(
    'ScenarioTitle',
    ({ I, pageObject, current }) => {
      I.say("Given I'am logged in");
      I.amOnPage('/');
      loginPage.**sendForm**(current.username, current.password);
  )
  
  
 // output
 The test feature --
  The scenario | {"username":"Username","password": ***}
      'The real password: theLoggedPasswordInCleartext'
      I.fillField('somePasswordLocator', '****')
  ✔ OK in 7ms

  The scenario | {"username":"theSecondUsername","password": ***}
      'The real password: theLoggedPasswordInCleartext'
      I.fillField('somePasswordLocator', '****')
  ✔ OK in 1ms
  • fix: debug info causes error (#3882) - by @KobeNguyenT

📖 Documentation

  • fix: get rid of complaining when using session without await and returning nothing. (#3899) - by @KobeNguyenT
  • fix(FileSystem): a typo in writeToFile() (#3897) - by @mirao

🛩️ Features

  • feat(translation): add more french keywords and fix deprecated waitForClickable (#3906) - by @andonary
- Add some french keywords for translation
- I.waitForClickable has the same "attends" than I.wait. Using "attends" leads to use the deprecated waitForClickable. Fix it by using different words.
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