codeceptjs
Advanced tools
Changelog
1.3.2
pause()
next
command for step-by-step debug when using pause()
.After(pause);
in a to start interactive console after last step.waitForRequest
to wait for network request.waitForResponse
to wait for network response../
by @BenoitZugmeyerChangelog
1.3.1
getPageTimeout
set 0 seconds.restart:false
mode for multi-session mode.grabPopupText
to not throw error popup is not opened.Changelog
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
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.
--steps
flag.--debug
._init()
extra method. Try updated generators and see updated guide.load
event on page load. This strategy can be changed in config:
waitForNavigation
config option introduced. Possible options: load
, domcontentloaded
, networkidle0
, networkidle2
. See Puppeteer APIgetPageTimeout
config option to set maximum navigation time in milliseconds. Default is 30 seconds.waitForNavigation
method added. Explicitly waits for navigation to be finished.grabTextFrom
unified. Return a text for single matched element and an array of texts for multiple elements.resizeWindow
by @sergejkaravajnijwaitForFunction
added. Waits for client-side JavaScript function to return true by @GREENpoint.waitUntil
deprecated in favor of waitForFunction
.filter
function to DataTable.waitUntil
timeout accepts time in seconds (as all other wait* functions). Fix by @truesrc.grabNumberOfVisibleElements
to work similarly to seeElement
. Thx to @stefanschenk and Jinbo Jinboson.Changelog
1.2.1
I.retry()
on multiple steps.grabNumberOfVisibleElements
to return 0
instead of throwing error if no elements are found.Changelog
1.2.0
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');
event.test.finished
which fires synchronously for both failed and passed tests.fullPageScreenshots: true
, however they may work unstable in Selenium.within
blocks can return values. See updated documentation._init
in helpers. Fixes issue #1036Feature('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);
Changelog
1.1.8
codeceptjs def
.-c
option.Changelog
1.1.7
/codecept
insde container/tests
codeceptjs
global runner added (symlink to /codecept/bin/codecept.js
)_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
grabPageScrollPosition
(new)seeNumberOfVisibleElements
waitToHide
grabPageScrollPosition
(new)grabPageScrollPosition
(new)sec
parameter.seeAttributesOnElements
and seeCssPropertiesOnElement
were incorrectly passing when the attributes/properties did not match by @reubenmillerconfig.test
/ Codecept.loadTests
by @sveneisenschmidtconfig.tests
for run-multiple
by @sveneisenschmidtChangelog
1.1.6
async I =>
functions syntax in Scenario by @APshenkinwaitForInvisible
waits for element to hide or to be removed from page. By @reubenmillergrabCurrentUrl
function. By @reubenmillergrabBrowserUrl
deprecated in favor of grabCurrentUrl
to unify the API.waitForEnabled
, waitForValue
and waitNumberOfVisibleElements
methods by @reubenmillergrabNumberOfVisibleElements
to return 0 when no visible elements are on page. By @michaltrunek_passed
hook runs after a test passed successfully_failed
hook runs on a failed testevent.all.before
- executed before all testsevent.all.after
- executed after all testsevent.multiple.before
- executed before all processes in run-multipleevent.multiple.after
- executed after all processes in run-multipleAfterSuite
and After
test hooks to be defined after the first Scenario. By @reubenmillerI.amOnpage
navigation if the browser is already at the given urlbootstrapAll
and teardownAll
hooks to be executed before and after all processescodeceptjs def
command accepts --config
option. By @reubenmillerChangelog
1.1.5
// 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');
Scenario().injectDependencies
added to dynamically add objects into DI container by @Apshenkin. See Dependency Injection section in PageObjects.within
waitUntilExists
deprecated in favor of waitForElement
waitForStalenessOf
deprecated in favor of waitForDetached
waitForDetached
addedI.seeNumberOfElements()
by @pmoncadaislagrabNumberOfTabs
function by @reubenmillerChangelog
1.1.4
yarn
call in package.jsonconsole.log
in Puppeteer by @othreerunOnAndroid
and runOnIOS
can receive a function to check capabilities dynamically:I.runOnAndroid(caps => caps.platformVersion >= 7, () => {
// run code only on Android 7+
});