# Releases

# 3.3.4

  • Added support for masking fields in objects via secret function:
I.sendPostRequest('/auth', secret({ name: 'jon', password: '123456' }, 'password'));
plugins: {
 customLocator: {
   enabled: true,
   prefix: '$',
   attribute: ['data-qa', 'data-test'],
 }
}
// response.data == [
//   { user: { name: 'jon', email: '[email protected]' } },
//   { user: { name: 'matt', email: '[email protected]' } },
//]

I.seeResponseContainsKeys(['user']);
I.seeResponseContainsJson({ user: { email: '[email protected]' } });
I.seeResponseContainsJson({ user: { email: '[email protected]' } });
I.dontSeeResponseContainsJson({ user: 2 });

# 3.3.3

  • Fixed DataCloneError: () => could not be cloned when running data tests in run-workers
  • πŸ‡ΊπŸ‡¦ Added #StandWithUkraine notice to CLI

# 3.3.2

# 3.3.1

πŸ›©οΈ Features:

npx codeceptjs run test-dir/*"
  • [Playwright] Possible breaking change. By default timeout is changed to 5000ms. The value set in 3.3.0 was too low. Please set timeout explicitly to not depend on release values.
  • [Playwright] Added for color scheme option by PeterNgTr (opens new window)
 helpers: {
  Playwright : {
    url: "http://localhost",
    colorScheme: "dark",
  }
 }

πŸ› Bugfixes:

πŸ“– Documentation

# 3.3.0

πŸ›©οΈ Features:

  • API Testing introduced
    • Introduced JSONResponse helper which connects to REST, GraphQL or Playwright helper
    • [REST] Added amBearerAuthenticated method
    • [REST] Added haveRequestHeaders method
    • Added dependency on joi and chai
  • [Playwright] Added timeout option to set timeout (opens new window) for all Playwright actions. If an action fails, Playwright keeps retrying it for a time set by timeout.
  • [Playwright] Possible breaking change. By default timeout is set to 1000ms. Previous default was set by Playwright internally to 30s. This was causing contradiction to CodeceptJS retries, so triggered up to 3 retries for 30s of time. This timeout option was lowered so retryFailedStep plugin would not cause long delays.
  • [Playwright] Updated restart config option to include 3 restart strategies:
    • 'context' or false - restarts browser context (opens new window) but keeps running browser. Recommended by Playwright team to keep tests isolated.
    • 'browser' or true - closes browser and opens it again between tests.
    • 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with keepCookies and keepBrowserState options. This behavior was default prior CodeceptJS 3.1
  • [Playwright] Extended methods to provide more options from engine. These methods were updated so additional options can be be passed as the last argument:
// use Playwright click options as 3rd argument
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
// check option also has options
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
  • eachElement plugin introduced. It allows you to iterate over elements and perform some action on them using direct engines API
await eachElement('click all links in .list', '.list a', (el) => {
  await el.click();
})

πŸ› Bugfixes:

πŸ“– Documentation

# 3.2.3

# 3.2.2

# 3.2.1

♻️ This release fixes hanging of tests by reducing timeouts for automatic retries on failures.

  • [retryFailedStep plugin] New Defaults: retries steps up to 3 times with factor of 1.5 (previously 5 with factor 2)
  • [Playwright] - disabled retry on failed context actions (not needed anymore)
  • [Puppeteer] - reduced retries on context failures to 3 times.
  • [Playwright] Handling crash event to automatically close crashed pages.

# 3.2.0

πŸ›©οΈ Features:

Timeouts (opens new window) implemented

  • global timeouts (via timeout config option).
    • Breaking change: timeout option expects timeout in seconds, not in milliseconds as it was previously.
  • test timeouts (via Scenario and Feature options)
    • Breaking change: Feature().timeout() and Scenario().timeout() calls has no effect and are deprecated
// set timeout for every test in suite to 10 secs
Feature('tests with timeout', { timeout: 10 });

// set timeout for this test to 20 secs
Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {});
// set step timeout to 5 secs
I.limitTime(5).click('Link');

retryTo plugin introduced to rerun a set of steps on failure:

// editing in text in iframe
// if iframe was not loaded - retry 5 times
await retryTo(() => {
  I.switchTo('#editor frame');
  I.fillField('textarea', 'value');
}, 5);
  • [Playwright] added locale configuration
  • [WebDriver] upgraded to webdriverio v7

πŸ› Bugfixes:

# 3.1.3

πŸ›©οΈ Features:

  • BDD Improvement. Added DataTableArgument class to work with table data structures.
const { DataTableArgument } = require('codeceptjs');
//...
Given('I have an employee card', (table) => {
  const dataTableArgument = new DataTableArgument(table);
  const hashes = dataTableArgument.hashes(); 
  // hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }];
  const rows = dataTableArgument.rows();
  // rows = [['Harry', 'Potter', Seeker]];
  }

See updated BDD section (opens new window) for more API options. Thanks to EgorBodnar (opens new window)

πŸ› Bugfixes:

πŸ“– Documentation:

# 3.1.2

πŸ›©οΈ Features:

exports.config = {
  tests: ['./*_test.js','./sampleTest.js'],
  // ... 
}

πŸ› Bugfixes:

🎱 Other:

  • Deprecated puppeteerCoverage plugin in favor of coverage plugin.

# 3.1.1

  • [Appium] Fixed #2759 (opens new window) grabNumberOfVisibleElements, grabAttributeFrom, grabAttributeFromAll to allow id locators.

# 3.1.0

  • [Plawyright] Updated to Playwright 1.13
  • [Playwright] Possible breaking change: BrowserContext is initialized before each test and closed after. This behavior matches recommendation from Playwright team to use different contexts for tests.
  • [Puppeteer] Updated to Puppeteer 10.2.
  • [Protractor] Helper deprecated

πŸ›©οΈ Features:

πŸ› Bugfixes:

# 3.0.7

πŸ“– Documentation fixes:

πŸ›©οΈ Features:

npx codeceptjs shell -c foo.conf.js

Bug fixes:

# 3.0.6

"features": [
  "./features/*.feature",
  "./features/api_features/*.feature"
],
Scenario Outline: ...
  Given ...
  When ...
  Then ...

  Examples:
  | productName          | customer              | email              | anythingMore |
  | {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData   |

# 3.0.5

Features:

I.sendPatchRequest('/api/users.json', secret({ "email": "[email protected]" }));

See #2786 (opens new window) by PeterNgTr (opens new window)

Bug fixes:

Documentation fixes:

Library updates:

# 3.0.4

# 3.0.3

# 3.0.2

Bug Fixes:

# 3.0.1

♨️ Hot fix:

πŸ› Bug Fix:

  • Fixed error handling in Scenario.js. See #2607 (opens new window) by haveac1gar

  • Changing type definition in order to allow the use of functions with any number of any arguments. See #2616 (opens new window) by akoltun

  • Some updates/changes on documentations

# 3.0.0

πŸ‘Œ LEARN HOW TO UPGRADE TO CODECEPTJS 3 ➑ (opens new window)

  • Playwright set to be a default engine.
  • NodeJS 12+ required
  • BREAKING CHANGE: Syntax for tests has changed.
// Previous
Scenario('title', (I, loginPage) => {});

// Current
Scenario('title', ({ I, loginPage }) => {});
npx create-codeceptjs .

Read changelog to learn more about version πŸ‘‡

# 3.0.0-rc

# 3.0.0-beta.4

πŸ› Bug Fix:

  • PageObject was broken when using "this" inside a simple object.
  • The typings for all WebDriver methods work correctly.
  • The typings for "this.helper" and helper constructor work correctly, too.

🧀 Internal:

  • Our TS Typings will be tested now! We strarted using dtslint (opens new window) to check all typings and all rules for linter. Example:
const psp = wd.grabPageScrollPosition() // $ExpectType Promise<PageScrollPosition>
psp.then(
  result => {
    result.x // $ExpectType number
    result.y // $ExpectType number
  }
)
  • And last: Reducing package size from 3.3Mb to 2.0Mb

# 3.0.0-beta-3

  • BREAKING Replaced bootstrap/teardown scripts to accept only functions or async functions. Async function with callback (with done parameter) should be replaced with async/await. See our upgrde guide (opens new window).
  • Test artifacts introduced. Each test object has artifacts property, to keep attachment files. For instance, a screenshot of a failed test is attached to a test as artifact.
  • Improved output for test execution
    • Changed colors for steps output, simplified
    • Added stack trace for test failures
    • Removed Event emitted from log in --verbose mode
    • List artifacts of a failed tests

// TEST:
MyPage.hasFiles('first arg', 'second arg');

// OUTPUT:
MyPage: hasFile "First arg", "Second arg"
  I see file "codecept.json"
  I see file "codecept.po.json"

# 3.0.0-beta

  • NodeJS 12+ required
  • BREAKING CHANGE: Syntax for tests has changed.
// Previous
Scenario('title', (I, loginPage) => {});

// Current
Scenario('title', ({ I, loginPage }) => {});
  • BREAKING CHANGE: [WebDriver][Protractor][Puppeteer][Playwright][Nightmare] grab* functions unified:

    • grab*From => returns single value from element or throws error when no matchng elements found
    • grab*FromAll => returns array of values, or empty array when no matching elements
  • Public API for workers introduced by koushikmohan1996 (opens new window). Customize parallel execution (opens new window) with workers by building custom scripts.

  • [Playwright] Added usePlaywrightTo method to access Playwright API in tests directly:

I.usePlaywrightTo('do something special', async ({ page }) => {
  // use page or browser objects here
});
  • [Puppeteer] Introduced usePuppeteerTo method to access Puppeteer API:
I.usePuppeteerTo('do something special', async ({ page, browser }) => {
  // use page or browser objects here
});
  • [WebDriver] Introduced useWebDriverTo method to access webdriverio API:
I.useWebDriverTo('do something special', async ({ browser }) => {
  // use browser object here
});
  • [Protractor] Introduced useProtractorTo method to access protractor API
  • tryTo plugin introduced. Allows conditional action execution:
const isSeen = await tryTo(() => {
  I.see('Some text');
});
// we are not sure if cookie bar is displayed, but if so - accept cookies
tryTo(() => I.click('Accept', '.cookies'));
  • Possible breaking change In semantic locators [ char indicates CSS selector.

# 2.6.11

# 2.6.10

# 2.6.9

# 2.6.8

# 2.6.7

# 2.6.6

# 2.6.5

# 2.6.4

# 2.6.3

# 2.6.2

# 2.6.1

  • [screenshotOnFail plugin] Fixed saving screenshot of active session.
  • [screenshotOnFail plugin] Fix issue #2301 (opens new window) when having the flag uniqueScreenshotNames=true results in undefined in screenshot file name by PeterNgTr (opens new window)
  • [WebDriver] Fixed waitForElement not applying the optional second argument to override the default timeout in webdriverio 6. Fix by Mooksc (opens new window)
  • [WebDriver] Updated waitUntil method which is used by all of the wait* functions. This updates the waitForElement by the same convention used to update waitForVisible and waitInUrl to be compatible with both WebDriverIO v5 & v6. See #2313 (opens new window) by Mooksc (opens new window)

# 2.6.0

Upgrade playwright to ^0.12:

npm i [email protected]^0.12 --save

Notable changes (opens new window):

  • Fixed opening two browsers on start
  • executeScript - passed function now accepts only one argument. Pass in objects or arrays if you need multtple arguments:
// Old style, does not work anymore:
I.executeScript((x, y) => x + y, x, y);
// New style, passing an object:
I.executeScript(({x, y}) => x + y, {x, y});
  • click - automatically waits for element to become clickable (visible, not animated) and waits for navigation.
  • clickLink - deprecated
  • waitForClickable - deprecated
  • forceClick - added
  • Added support for custom locators. See #2277 (opens new window)
  • Introduced device emulation:
    • globally via emulate config option
    • per session

[WebDriver] Updated to webdriverio v6 by PeterNgTr (opens new window).

Read release notes (opens new window), then upgrade webdriverio to ^6.0:

npm i [email protected]^6.0 --save

(webdriverio v5 support is deprecated and will be removed in CodeceptJS 3.0) [WebDriver] Introduced Shadow DOM support by gkushang (opens new window)

I.click({ shadow: ['my-app', 'recipe-hello', 'button'] });
npx codecept run-workers 2 --profile firefox

Value is available at process.env.profile (previously process.profile). See #2302 (opens new window). Fixes #1968 (opens new window) #1315 (opens new window)

__`Given`;
I.amOnPage('/profile')

__`When`;
I.click('Logout');

__`Then`;
I.see('You are logged out');

# 2.5.0

Playwright (opens new window) is an alternative to Puppeteer which works very similarly to it but adds cross-browser support with Firefox and Webkit. Until v1.0 Playwright API is not stable but we introduce it to CodeceptJS so you could try it.

# 2.4.3

  • Hotfix for interactive pause

# 2.4.2

# 2.4.1

  • [Hotfix] - Add missing lib that prevents codeceptjs from initializing.

# 2.4.0

# 2.3.6

// Example:
exports.config = {
  tests: '{./workers/base_test.workers.js,./workers/test_grep.workers.js}',
}

# 2.3.5

  • Set "parse-function" dependency to "5.2.11" to avoid further installation errors.

# 2.3.4

# 2.3.3

// when data-test-id is a special test attribute
// enable and configure plugin to replace this
I.click({ css: '[data-test-id=register_button]');
// with this
I.click('$register_button');
  • [Puppeteer][WebDriver] pressKey improvements by martomo (opens new window): Changed pressKey method to resolve issues and extend functionality.
    • Did not properly recognize 'Meta' (or 'Command') as modifier key.
    • Right modifier keys did not work in WebDriver using JsonWireProtocol.
    • 'Shift' + 'key' combination would not reflect actual keyboard behavior.
    • Respect sequence with multiple modifier keys passed to pressKey.
    • Added support to automatic change operation modifier key based on operating system.
  • [Puppeteer][WebDriver] Added pressKeyUp and pressKeyDown to press and release modifier keys like Control or Shift. By martomo (opens new window).
  • [Puppeteer][WebDriver] Added grabElementBoundingRect by PeterNgTr (opens new window).
  • [Puppeteer] Fixed speed degradation introduced in #1306 (opens new window) with accessibility locators support. See #1953 (opens new window).
  • Added Config.addHook to add a function that will update configuration on load.
  • Started @codeceptjs/configure (opens new window) package with a collection of common configuration patterns.
  • [TestCafe] port's management removed (left on TestCafe itself) by orihomie (opens new window). Fixes #1934 (opens new window).
  • [REST] Headers are no more declared as singleton variable. Fixes #1959 (opens new window)
  • Updated Docker image to include run tests in workers with NUMBER_OF_WORKERS env variable. By PeterNgTr (opens new window).

# 2.3.2

# 2.3.1

# 2.3.0

# run all tests in parallel using 3 workers
npx codeceptjs run-workers 3
npx codeceptjs dry-run

# 2.2.1

# 2.2.0

// use Polly & Puppeteer helpers
I.mockRequest('GET', '/api/users', 200);
I.mockRequest('POST', '/users', { user: { name: 'fake' }});

# 2.1.5

# 2.1.4

# 2.1.3

# 2.1.2

  • Fixed inject to load objects recursively.
  • Fixed TypeScript definitions for locators by LukoyanovE (opens new window)
  • EXPERIMENTAL [WebDriver] ReactJS locators support with webdriverio v5.8+:
// locating React element by name, prop, state
I.click({ react: 'component-name', props: {}, state: {} });
I.seeElement({ react: 'component-name', props: {}, state: {} });

# 2.1.1

# 2.1.0

  • Added global inject() function to require actor and page objects using dependency injection. Recommended to use in page objects, step definition files, support objects:
// old way
const I = actor();
const myPage = require('../page/myPage');

// new way
const { I, myPage } = inject();
I.fillField('password', secret('123456'));

This release was partly sponsored by GSasu (opens new window). Thanks for the support! Do you want to improve this project? [Learn more about sponsorin CodeceptJS

# 2.0.8

Use it with FileSystem helper to test availability of a file:

  const fileName = await I.downloadFile('a.file-link');
  I.amInPath('output');
  I.seeFile(fileName);

Actions amInPath and seeFile are taken from FileSystem (opens new window) helper

# 2.0.7

# 2.0.6

# 2.0.5

[Broken Release]

# 2.0.4

# 2.0.3

  • autoLogin plugin (opens new window) added. Allows to log in once and reuse browser session. When session expires - automatically logs in again. Can persist session between runs by saving cookies to file.
  • Fixed Maximum stack trace issue in retryFailedStep plugin.
  • Added locate() function into the interactive shell.
  • [WebDriver] Disabled smartWait for interactive shell.
  • [Appium] Updated methods to use for mobile locators
    • waitForElement
    • waitForVisible
    • waitForInvisible
  • Helper and page object generators no longer update config automatically. Please add your page objects and helpers manually.

# 2.0.2

  • [Puppeteer] Improved handling of connection with remote browser using Puppeteer by martomo (opens new window)
  • [WebDriver] Updated to webdriverio 5.2.2 by martomo (opens new window)
  • Interactive pause improvements by davertmik (opens new window)
    • Disable retryFailedStep plugin in in interactive mode
    • Removes Interface: parseInput while in interactive pause
  • [ApiDataFactory] Improvements
    • added fetchId config option to override id retrieval from payload
    • added onRequest config option to update request in realtime
    • added returnId config option to return ids of created items instead of items themvelves
    • added headers config option to override default headers.
    • added a new chapter into DataManagement (opens new window)
  • [REST] Added onRequest config option

# 2.0.1

  • Fixed creating project with codecept init.
  • Fixed error while installing [email protected]
  • Added code beautifier for generated configs.
  • [WebDriver] Updated to webdriverio 5.1.0

# 2.0.0

  • [WebDriver] Breaking Change. Updated to webdriverio v5. New helper WebDriver helper introduced.

    • Upgrade plan:

      1. Install latest webdriverio
      npm install [email protected] --save
      
      1. Replace WebDriverIO => WebDriver helper name in config.
      2. Read webdriverio changelog (opens new window). If you were using webdriver API in your helpers, upgrade accordingly.
      3. We made WebDriver helper to be compatible with old API so no additional changes required.

      If you face issues using webdriverio v5 you can still use webdriverio 4.x and WebDriverIO helper. Make sure you have webdriverio: ^4.0 installed.

    • Known issues: attachFile doesn't work with proxy server.

  • [Appium] Breaking Change. Updated to use webdriverio v5 as well. See upgrade plan ↑

  • [REST] Breaking Change. Replaced unirest library with axios.

    • Upgrade plan:

      1. Refer to axios API (opens new window).
      2. If you were using unirest requests/responses in your tests change them to axios format.
  • Breaking Change. Generators support in tests removed. Use async/await in your tests

  • Using codecept.conf.js as default configuration format

  • Fixed "enametoolong" error when saving screenshots for data driven tests by PeterNgTr (opens new window)

  • Updated NodeJS to 10 in Docker image

  • [Pupeteer] Add support to use WSEndpoint. Allows to execute tests remotely. [See #1350 (opens new window)] by gabrielcaires (opens new window) (https://github.com/codeceptjs/CodeceptJS/pull/1350)

  • In interactive shell [Enter] goes to next step. Improvement by PeterNgTr (opens new window).

  • I.say accepts second parameter as color to print colorful comments. Improvement by PeterNgTr (opens new window).

I.say('This is red', 'red'); //red is used
I.say('This is blue', 'blue'); //blue is used
I.say('This is by default'); //cyan is used

# 1.4.6

# 1.4.5

  • Add require param to main config. Allows to require Node modules before executing tests. By LukoyanovE (opens new window). For example:
    • Use ts-node/register to register TypeScript parser
    • Use should to register should-style assertions
"require": ["ts-node/register", "should"]

# 1.4.4

# 1.4.3

  • Groups renamed to Tags for compatibility with BDD layer
  • Test and suite objects to contain tags property which can be accessed from internal API
  • Fixed adding tags for Scenario Outline in BDD
  • Added tag() method to ScenarioConfig and FeatureConfig:
Scenario('update user profile', () => {
  // test goes here
}).tag('@slow');

# 1.4.2

# 1.4.1

# 1.4.0

# 1.3.3

# 1.3.2

  • Interactve Shell improvements for pause()
    • Added next command for step-by-step debug when using pause().
    • Use After(pause); in a to start interactive console after last step.
  • [Puppeteer] Updated to Puppeteer 1.6.0
    • Added waitForRequest to wait for network request.
    • Added waitForResponse to wait for network response.
  • Improved TypeScript definitions to support custom steps and page objects. By xt1 (opens new window)
  • Fixed XPath detection to accept XPath which starts with ./ by BenoitZugmeyer (opens new window)

# 1.3.1

  • BDD-Gherkin: Fixed running async steps.
  • [Puppeteer] Fixed process hanging for 30 seconds. Page loading timeout default via getPageTimeout set 0 seconds.
  • [Puppeteer] Improved displaying client-side console messages in debug mode.
  • [Puppeteer] Fixed closing sessions in restart:false mode for multi-session mode.
  • [Protractor] Fixed grabPopupText to not throw error popup is not opened.
  • [Protractor] Added info on using 'direct' Protractor driver to helper documentation by xt1 (opens new window).
  • [WebDriverIO] Added a list of all special keys to WebDriverIO helper by davertmik (opens new window) and xt1 (opens new window).
  • Improved TypeScript definitions generator by xt1 (opens new window)

# 1.3.0

Basic feature file:

Feature: Business rules
  In order to achieve my goals
  As a persona
  I want to be able to interact with a system

  Scenario: do anything in my life
    Given I need to open Google

Step definition:

const I = actor();

Given('I need to open Google', () => {
  I.amOnPage('https://google.com');
});

Run it with --features --steps flag:

codeceptjs run --steps --features

  • Brekaing Chnage run command now uses relative path + test name to run exactly one test file.

Previous behavior (removed):

codeceptjs run basic_test.js

Current behavior (relative path to config + a test name)

codeceptjs run tests/basic_test.js

This change allows using auto-completion when running a specific test.


  • Nested steps output enabled for page objects.
    • to see high-level steps only run tests with --steps flag.
    • to see PageObjects implementation run tests with --debug.
  • PageObjects simplified to remove _init() extra method. Try updated generators and see updated guide (opens new window).
  • [Puppeteer] Multiple sessions (opens new window) enabled. Requires Puppeteer >= 1.5
  • [Puppeteer] Stability improvement. Waits for for load event on page load. This strategy can be changed in config:
    • waitForNavigation config option introduced. Possible options: load, domcontentloaded, networkidle0, networkidle2. See Puppeteer API (opens new window)
    • getPageTimeout config option to set maximum navigation time in milliseconds. Default is 30 seconds.
    • waitForNavigation method added. Explicitly waits for navigation to be finished.
  • [WebDriverIO][Protractor][Puppeteer][Nightmare] Possible BC grabTextFrom unified. Return a text for single matched element and an array of texts for multiple elements.
  • [Puppeteer]Fixed resizeWindow by sergejkaravajnij (opens new window)
  • [WebDriverIO][Protractor][Puppeteer][Nightmare] waitForFunction added. Waits for client-side JavaScript function to return true by GREENpoint (opens new window).
  • [Puppeteer] waitUntil deprecated in favor of waitForFunction.
  • Added filter function to DataTable.
  • Send non-nested array of files to custom parallel execution chunking by mikecbrant (opens new window).
  • Fixed invalid output directory path for run-multiple by mikecbrant (opens new window).
  • [WebDriverIO] waitUntil timeout accepts time in seconds (as all other wait* functions). Fix by truesrc (opens new window).
  • [Nightmare] Fixed grabNumberOfVisibleElements to work similarly to seeElement. Thx to stefanschenk (opens new window) and Jinbo Jinboson.
  • [Protractor] Fixed alert handling error with message 'no such alert' by truesrc (opens new window).

# 1.2.1

  • Fixed running I.retry() on multiple steps.
  • Fixed parallel execution wih chunks.
  • [Puppeteer] Fixed grabNumberOfVisibleElements to return 0 instead of throwing error if no elements are found.

# 1.2.0

  • [WebDriverIO][Protractor]Multiple Sessions (opens new window). Run several browser sessions in one test. Introduced session command, which opens additional browser window and closes it after a test.
Scenario('run in different browsers', (I) => {
  I.amOnPage('/hello');
  I.see('Hello!');
  session('john', () => {
    I.amOnPage('/bye');
    I.dontSee('Hello');
    I.see('Bye');
  });
  I.see('Hello');
});
"multiple": {
  "parallel": {
    // run in 2 processes
    "chunks": 2,
    // run all tests in chrome
    "browsers": ["chrome"]
  },
}
// select 'Edit' link inside 2nd row of a table
locate('//table')
  .find('tr')
  .at(2)
  .find('a')
  .withText('Edit');
Feature('checkout')
  .timeout(3000)
  .retry(2);

Scenario('user can order in firefox', (I) => {
  // see dynamic configuration
}).config({ browser: 'firefox' })
  .timeout(20000);

Scenario('this test should throw error', (I) => {
  // I.amOnPage
}).throws(new Error);

# 1.1.8

# 1.1.7

  • Docker Image updateed. See updated reference (opens new window):
    • codeceptjs package is mounted as /codecept insde container
    • tests directory is expected to be mounted as /tests
    • codeceptjs global runner added (symlink to /codecept/bin/codecept.js)
  • [Protractor] Functions added by reubenmiller (opens new window):
    • _locateCheckable (only available from other helpers)
    • _locateClickable (only available from other helpers)
    • _locateFields (only available from other helpers)
    • acceptPopup
    • cancelPopup
    • dragAndDrop
    • grabBrowserLogs
    • grabCssPropertyFrom
    • grabHTMLFrom
    • grabNumberOfVisibleElements
    • grabPageScrollPosition (new)
    • rightClick
    • scrollPageToBottom
    • scrollPageToTop
    • scrollTo
    • seeAttributesOnElements
    • seeCssPropertiesOnElements
    • seeInPopup
    • seeNumberOfVisibleElements
    • switchTo
    • waitForEnabled
    • waitForValue
    • waitInUrl
    • waitNumberOfVisibleElements
    • waitToHide
    • waitUntil
    • waitUrlEquals
  • [Nightmare] added:
    • grabPageScrollPosition (new)
    • seeNumberOfVisibleElements
    • waitToHide
  • [Puppeteer] added:
    • grabPageScrollPosition (new)
  • [WebDriverIO] added"
    • grabPageScrollPosition (new)
  • [Puppeteer] Fixed running wait* functions without setting sec parameter.
  • [Puppeteer][Protractor] Fixed bug with I.click when using an object selector with the xpath property. By reubenmiller (opens new window)
  • [WebDriverIO][Protractor][Nightmare][Puppeteer] Fixed I.switchTo(0) and I.scrollTo(100, 100) api inconsistencies between helpers.
  • [Protractor] Fixing bug when seeAttributesOnElements and seeCssPropertiesOnElement were incorrectly passing when the attributes/properties did not match by reubenmiller (opens new window)
  • [WebDriverIO] Use inbuilt dragAndDrop function (still doesn't work in Firefox). By reubenmiller (opens new window)
  • Support for Nightmare 3.0
  • Enable glob patterns in config.test / Codecept.loadTests by sveneisenschmidt (opens new window)
  • Enable overriding of config.tests for run-multiple by sveneisenschmidt (opens new window)

# 1.1.6

  • Added support for async I => functions syntax in Scenario by APshenkin (opens new window)
  • [WebDriverIO][Protractor][Puppeteer][Nightmare] waitForInvisible waits for element to hide or to be removed from page. By reubenmiller (opens new window)
  • [Protractor][Puppeteer][Nightmare] Added grabCurrentUrl function. By reubenmiller (opens new window)
  • [WebDriverIO] grabBrowserUrl deprecated in favor of grabCurrentUrl to unify the API.
  • [Nightmare] Improved element visibility detection by reubenmiller (opens new window)
  • [Puppeteer] Fixing function calls when clearing the cookies and localstorage. By reubenmiller (opens new window)
  • [Puppeteer] Added waitForEnabled, waitForValue and waitNumberOfVisibleElements methods by reubenmiller (opens new window)
  • [WebDriverIO] Fixed grabNumberOfVisibleElements to return 0 when no visible elements are on page. By michaltrunek (opens new window)
  • Helpers API improvements (by reubenmiller (opens new window))
    • _passed hook runs after a test passed successfully
    • _failed hook runs on a failed test
  • Hooks API. New events added by reubenmiller (opens new window):
    • event.all.before - executed before all tests
    • event.all.after - executed after all tests
    • event.multiple.before - executed before all processes in run-multiple
    • event.multiple.after - executed after all processes in run-multiple
  • Multiple execution
  • Allow AfterSuite and After test hooks to be defined after the first Scenario. By reubenmiller (opens new window)
  • [Nightmare] Prevent I.amOnpage navigation if the browser is already at the given url
  • Multiple-Run: Added new bootstrapAll and teardownAll hooks to be executed before and after all processes
  • codeceptjs def command accepts --config option. By reubenmiller (opens new window)

# 1.1.5

  • [Puppeteer] Rerun steps failed due to "Cannot find context with specified id" Error.
  • Added syntax to retry a single step:
// retry action once on failure
I.retry().see('Hello');

// retry action 3 times on failure
I.retry(3).see('Hello');

// retry action 3 times waiting for 0.1 second before next try
I.retry({ retries: 3, minTimeout: 100 }).see('Hello');

// retry action 3 times waiting no more than 3 seconds for last retry
I.retry({ retries: 3, maxTimeout: 3000 }).see('Hello');

// retry 2 times if error with message 'Node not visible' happens
I.retry({
  retries: 2,
  when: err => err.message === 'Node not visible'
}).seeElement('#user');

# 1.1.4

  • Removed yarn call in package.json
  • Fixed console.log in Puppeteer by othree (opens new window)
  • [Appium] runOnAndroid and runOnIOS can receive a function to check capabilities dynamically:
I.runOnAndroid(caps => caps.platformVersion >= 7, () => {
  // run code only on Android 7+
});

# 1.1.3

  • [Puppeteer] +25 Functions added by reubenmiller (opens new window)
    • _locateCheckable
    • _locateClickable
    • _locateFields
    • closeOtherTabs
    • dragAndDrop
    • grabBrowserLogs
    • grabCssPropertyFrom
    • grabHTMLFrom
    • grabNumberOfVisibleElements
    • grabSource
    • rightClick
    • scrollPageToBottom
    • scrollPageToTop
    • scrollTo
    • seeAttributesOnElements
    • seeCssPropertiesOnElements
    • seeInField
    • seeNumberOfElements
    • seeNumberOfVisibleElements
    • seeTextEquals
    • seeTitleEquals
    • switchTo
    • waitForInvisible
    • waitInUrl
    • waitUrlEquals
  • [Protractor] +8 functions added by reubenmiller (opens new window)
    • closeCurrentTab
    • grabSource
    • openNewTab
    • seeNumberOfElements
    • seeTextEquals
    • seeTitleEquals
    • switchToNextTab
    • switchToPreviousTab
  • [Nightmare] waitForInvisible added by reubenmiller (opens new window)
  • [Puppeteer] Printing console.log information in debug mode.
  • [Nightmare] Integrated with nightmare-har-plugin by mingfang. Added enableHAR option. Added HAR functions:
    • grabHAR
    • saveHAR
    • resetHAR
  • [WebDriverIO] Fixed execution stability for parallel requests with Chromedriver
  • [WebDriverIO] Fixed resizeWindow when resizing to 'maximize' by reubenmiller (opens new window)
  • [WebDriverIO] Fixing resizing window to full screen when taking a screenshot by reubenmiller (opens new window)

# 1.1.2

# 1.1.1

# 1.1.0

Major update to CodeceptJS. NodeJS v 8.9.1 is now minimal Node version required. This brings native async-await support to CodeceptJS. It is recommended to start using await for tests instead of generators:

async () => {
  I.amOnPage('/page');
  const url = await I.grabTextFrom('.nextPage');
  I.amOnPage(url);
}

Thanks to @Apshenkin (opens new window) for implementation. Also, most helpers were refactored to use async-await. This made our code simpler. We hope that this encourages more users to send pull requests!

We also introduced strict ESLint policies for our codebase. Thanks to @Galkin (opens new window) for that.

within({frame: ['#wrapperId', '[name=content]']}, () => {
  I.click('Sign in!');
  I.see('Email Address');
});
I.see('Nested Iframe test');
I.dontSee('Email Address');
});
  • [WebDriverIO] Support for ~ locator to find elements by aria-label. This behavior is similar as it is in Appium and helps testing cross-platform React apps. Example:
<Text accessibilityLabel="foobar">
    CodeceptJS is awesome
</Text>

↑ This element can be located with ~foobar in WebDriverIO and Appium helpers. Thanks to flyskywhy (opens new window)

# 1.0.3

# 1.0.2

  • Introduced generators support in scenario hooks for BeforeSuite/Before/AfterSuite/After
  • [ApiDataFactory] Fixed loading helper; requireg package included.
  • Fix #485 (opens new window)run-multiple: the first browser-resolution combination was be used in all configurations
  • Fixed unique test names:
    • Fixed #447 (opens new window) tests failed silently if they have the same name as other tests.
    • Use uuid in screenshot names when uniqueScreenshotNames: true
  • [Protractor] Fixed testing non-angular application. amOutsideAngularApp is executed before each step. Fixes #458 (opens new window)* Added output for steps in hooks when they fail

# 1.0.1

  • Reporters improvements:
  • [WebDriverIO] improved click on context to match clickable element with a text inside. Fixes #647 (opens new window)* [Nightmare] Added refresh function by awhanks (opens new window)
  • fixed Unhandled promise rejection (rejection id: 1): Error: Unknown wait type: pageLoad
  • support for tests with retries in html report
  • be sure that change window size and timeouts completes before test
  • [Nightmare] Fixed [Wrapped Error] "codeceptjs is not defined"; Reinjectiing client scripts to a webpage on changes.
  • [Nightmare] Added more detailed error messages for Wait* methods
  • [Nightmare] Fixed adding screenshots to Mochawesome
  • [Nightmare] Fix unique screenshots names in Nightmare
  • Fixed CodeceptJS work with hooks in helpers to finish codeceptJS correctly if errors appears in helpers hooks
  • Create a new session for next test If selenium grid error received
  • Create screenshots for failed hooks from a Feature file
  • Fixed retries option

# 1.0

CodeceptJS hits first stable release. CodeceptJS provides a unified API for web testing for Webdriverio (opens new window), Protractor (opens new window), and NightmareJS (opens new window). Since 1.0 you can also test mobile applications in the similar manner with Appium.

Sample test:

I.seeAppIsInstalled("io.super.app");
I.click('~startUserRegistrationCD');
I.fillField('~email of the customer', 'Nothing special'));
I.see('[email protected]', '~email of the customer'));
I.clearField('~email of the customer'));
I.dontSee('Nothing special', '~email of the customer'));

We also introduced two new helpers for data management. Using them you can easily prepare and cleanup data for your tests using public REST API.

Sample test

// create a user using data factories and REST API
I.have('user', { name: 'davert', password: '123456' });
// use it to login
I.amOnPage('/login');
I.fillField('login', 'davert');
I.fillField('password', '123456');
I.click('Login');
I.see('Hello, davert');
// user will be removed after the test

Next notable feature is SmartWait (opens new window) for WebDriverIO, Protractor, SeleniumWebdriver. When smartwait option is set, script will wait for extra milliseconds to locate an element before failing. This feature uses implicit waits of Selenium but turns them on only in applicable pieces. For instance, implicit waits are enabled for seeElement but disabled for dontSeeElement

# Changelog

Special thanks to Andrey Pshenkin for his work on this release and the major improvements.

# 0.6.3

  • Errors are printed in non-verbose mode. Shows "Selenium not started" and other important errors.
  • Allowed to set custom test options:
Scenario('My scenario', { build_id: 123, type: 'slow' }, function (I)

those options can be accessed as opts property inside a test object. Can be used in custom listeners.

# 0.6.2

const actor = require('codeceptjs').actor;
  • Added example for creating custom runner (opens new window) with public API.
  • run command to create output directory if it doesn't exist
  • [Protractor] fixed loading globally installed Protractor
  • run-multiple command improvements:
    • create output directories for each process
    • print process ids in output

# 0.6.1

  • Fixed loading hooks

# 0.6.0

Major release with extension API and parallel execution.

  • Breaking Removed path argument from run. To specify path other than current directory use --config or -c option:

Instead of: codeceptjs run tests use:

# load config and run from tests directory
codeceptjs run -c tests/

# or load codecept.json from tests directory
codeceptjs run -c tests/codecept.json

# run users_test.js inside tests directory
codeceptjs run users_test.js -c tests

# 0.5.1

# 0.5.0

# 0.4.16

  • Fixed steps output synchronization (regression since 0.4.14).
  • [WebDriverIO][Protractor][SeleniumWebdriver][Nightmare] added keepCookies option to keep cookies between tests with restart: false.
  • [Protractor] added waitForTimeout config option to set default waiting time for all wait* functions.
  • Fixed _test hook for helpers by cjhille (opens new window).

# 0.4.15

  • Fixed regression in recorder sessions: oldpromise is not defined.

# 0.4.14

  • _beforeStep and _afterStep hooks in helpers are synchronized. Allows to perform additional actions between steps.

Example: fail if JS error occur in custom helper using WebdriverIO:

_before() {
  this.err = null;
  this.helpers['WebDriverIO'].browser.on('error', (e) => this.err = e);
}

_afterStep() {
 if (this.err) throw new Error('Browser JS error '+this.err);
}

Example: fail if JS error occur in custom helper using Nightmare:

_before() {
  this.err = null;
  this.helpers['Nightmare'].browser.on('page', (type, message, stack) => {
    this.err = `${message} ${stack}`;
  });
}

_afterStep() {
 if (this.err) throw new Error('Browser JS error '+this.err);
}
  • Fixed codecept list and codecept def commands.
  • Added I.say method to print arbitrary comments.
I.say('I am going to publish post');
I.say('I enter title and body');
I.say('I expect post is visible on site');
  • [Nightmare] restart option added. restart: false allows to run all tests in a single window, disabled by default. By nairvijays99 (opens new window)
  • [Nightmare] Fixed resizeWindow command.
  • [Protractor][SeleniumWebdriver] added windowSize config option to resize window on start.
  • Fixed "Scenario.skip causes 'Cannot read property retries of undefined'" by MasterOfPoppets (opens new window)
  • Fixed providing absolute paths for tests in config by lennym (opens new window)

# 0.4.13

  • Added retries option Feature and Scenario to rerun fragile tests:
Feature('Complex JS Stuff', {retries: 3});

Scenario('Not that complex', {retries: 1}, (I) => {
  // test goes here
});
  • Added timeout option Feature and Scenario to specify timeout.
Feature('Complex JS Stuff', {timeout: 5000});

Scenario('Not that complex', {timeout: 1000}, (I) => {
  // test goes here
});

# 0.4.12

  • Bootstrap / Teardown improved with Hooks (opens new window). Various options for setup/teardown provided.
  • Added --override or -o option for runner to dynamically override configs. Valid JSON should be passed:
codeceptjs run -o '{ "bootstrap": "bootstrap.js"}'
codeceptjs run -o '{ "helpers": {"WebDriverIO": {"browser": "chrome"}}}'

# 0.4.11

# 0.4.10

module.exports = function(done) {
  // async instructions
  // call done() to continue execution
  // otherwise call done('error description')
}

# 0.4.9

  • [SeleniumWebdriver][Protractor][WebDriverIO][Nightmare] fixed executeScript, executeAsyncScript to work and return values.
  • [Protractor][SeleniumWebdriver][WebDriverIO] Added waitForInvisible and waitForStalenessOf methods by Nighthawk14 (opens new window).
  • Added --config option to codeceptjs run to manually specify config file by cnworks (opens new window)
  • [Protractor] Simplified behavior of amOutsideAngularApp by using ignoreSynchronization. Fixes #278 (opens new window)
  • Set exit code to 1 when test fails at Before/After hooks. Fixes #279 (opens new window)

# 0.4.8

# 0.4.7

  • Improved docs for BeforeSuite; fixed its usage with restart: false option by APshenkin (opens new window).
  • Added Nightmare to list of available helpers on init.
  • [Nightmare] Removed double resizeWindow implementation.

# 0.4.6

# 0.4.5

# 0.4.4

  • Interactive shell fixed. Start it by running codeceptjs shell
  • Added --profile option to shell command to use dynamic configuration.
  • Added --verbose option to shell command for most complete output.

# 0.4.3

  • [Protractor] Regression fixed to ^4.0.0 support
  • Translations included into package.
  • teardown option added to config (opposite to bootstrap), expects a JS file to be executed after tests stop.
  • Configuration (opens new window) can be set via JavaScript file codecept.conf.js instead of codecept.json. It should export config object:
// inside codecept.conf.js
exports.config = {
  // contents of codecept.json
}

# 0.4.2

  • Added ability to localize tests with translation #189 (opens new window). Thanks to abner (opens new window)
    • [Translation] ru-RU translation added.
    • [Translation] pt-BR translation added.
  • [Protractor] Protractor 4.0.4 compatibility.
  • [WebDriverIO][SeleniumWebdriver][Protractor] Fixed single browser session mode for restart: false
  • Fixed using of 3rd party reporters (xunit, mocha-junit-reporter, mochawesome). Added guide.
  • Documentation for Translation (opens new window) added.
  • Documentation for Reports (opens new window) added.

# 0.4.1

# 0.4.0

  • Nightmare (opens new window) Helper added for faster web testing.
  • [Protractor][SeleniumWebdriver][WebDriverIO] added restart: false option to reuse one browser between tests (improves speed).
  • Protractor 4.0 compatibility. Please upgrade Protractor library.
  • Added --verbose option for run command to log and print global promise and events.
  • Fixed errors with shutting down and cleanup.
  • Fixed starting interactive shell with codeceptjs shell.
  • Fixed handling of failures inside within block

# 0.3.5

  • Introduced IDE autocompletion support for Visual Studio Code and others. Added command for generating TypeScript definitions for I object. Use it as
codeceptjs def

to generate steps definition file and include it into tests by reference. By kaflan (opens new window)

# 0.3.4

# 0.3.3

Fixed global installation. CodeceptJS can now locate globally located modules. CodeceptJS is also recommended for local installation. Depending on installation type additional modules (webdriverio, protractor, ...) will be loaded either from local or from global path.

# 0.3.2

  • Added codeceptjs list command which shows all available methods of I object.
  • [Protractor][SeleniumWebdriver] fixed closing browser instances
  • [Protractor][SeleniumWebdriver] doubleClick method added
  • [WebDriverIO][Protractor][SeleniumWebdriver] doubleClick method to locate clickable elements by text, context option added.
  • Fixed using assert in generator without yields #89 (opens new window)

# 0.3.1

  • Fixed init command

# 0.3.0

Breaking Change: webdriverio package removed from dependencies list. You will need to install it manually after the upgrade. Starting from 0.3.0 webdriverio is not the only backend for running selenium tests, so you are free to choose between Protractor, SeleniumWebdriver, and webdriverio and install them.

  • [Protractor] helper added. Now you can test AngularJS applications by using its official library within the unigied CodeceptJS API!
  • [SeleniumWebdriver] helper added. You can switch to official JS bindings for Selenium.
  • [WebDriverIO] updated to webdriverio v 4.0
  • [WebDriverIO] clearField method added by fabioel (opens new window)
  • [WebDriverIO] added dragAndDrop by fabioel (opens new window)
  • [WebDriverIO] fixed scrollTo method by sensone (opens new window)
  • [WebDriverIO] fixed windowSize: maximize option in config
  • [WebDriverIO] seeElement and dontSeeElement check element for visibility by fabioel (opens new window) and davertmik (opens new window)
  • [WebDriverIO] seeElementInDOM, dontSeeElementInDOM added to check element exists on page.
  • [WebDriverIO] fixed saving screenshots on failure. Fixes #70 (opens new window)
  • fixed within block doesn't end in output not #79 (opens new window)

# 0.2.8

# 0.2.7

# 0.2.6

  • Fixed done() was called multiple times
  • [WebDriverIO] added waitToHide method by fabioel (opens new window)
  • Added global Helper (alias codecept_helper), object use for writing custom Helpers. Generator updated. Changes to #48 (opens new window)

# 0.2.5

# 0.2.4

# 0.2.3

  • [WebDriverIO] fixed seeInField to work with single value elements like: input[type=text], textareas, and multiple: select, input[type=radio], input[type=checkbox]
  • [WebDriverIO] fixed pressKey, key modifeiers (Control, Command, Alt, Shift) are released after the action

# 0.2.2

Fixed generation of custom steps file and page objects. Please replace require('codeceptjs/actor') to actor in your custom_steps.js. Whenever you need to create I object (in page objects, custom steps, but not in tests) just call actor();

# 0.2.0

  • within context hook added
  • --reporter option supported
  • [WebDriverIO] added features and methods:
    • elements: seeElement, ...
    • popups: acceptPopup, cancelPopup, seeInPopup,...
    • navigation: moveCursorTo, scrollTo
    • saving screenshots on failure; saveScreenshot
    • cookies: setCookie, seeCookie, ...
    • source: seeInSource
    • form: seeCheckboxIsChecked, selectOption to support multiple selects
    • keyboard: appendField, pressKey
    • mouse: rightClick
  • tests added
  • [WebDriverIO] proxy configuration added by petehouston (opens new window)
  • [WebDriverIO] fixed waitForText method by roadhump (opens new window). Fixes #11 (opens new window)
  • Fixed creating output dir when it already exists on init by alfirin (opens new window)
  • Fixed loading of custom helpers