Cheatography
https://cheatography.com
Some useful tips for selenium with codeception
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Codeception usage
vendor/bin/codecept run
|
running all tests |
|
show all steps of the tests |
...run tests/acceptance/xxx.php
|
launch a unique test suite |
Initialisation
|
what the test is gonna do |
|
what we're trying to do |
|
where we want to go |
these are basics content the we want to see in all tests.
Assertion
|
Search a text on the page |
$I->canSeeElement($element)
|
search an element on the page |
$I->canSeeInTitle($text)
|
search a text in the title of the page |
|
search if text can't be found in the page |
There is a lot of others assertions. For checking the others assertions, just use the autocompletion of your IDE with $I->can...
Misc
$I->makeScreenshot($name)
|
take a screenshot and save it. |
|
Move back in the history |
|
Move forward in the history |
$I->pressKey($element, $key)
|
Press the key
on the selected element |
|
Reload page |
|
|
DOM Manipulation
|
Simulate the click on an element |
$I->fillField($element, $value)
|
Fill a field with a value |
$I->selectOption($element, $value)
|
Select an element in a select |
$I->dragAndDrop($element1, $element2)
|
Drag an element on an other |
$I->scrollTo($element, $x, $y)
|
Scroll to the middle of an element, with an offset of x - y |
Wait
|
Wait X seconds |
$I->waitForElementVisible($element, $timeout)
|
Wait until the element is visible |
$I->waitForElementNotVisible($element, $timeout)
|
Wait until the element is no longer visible |
$I->waitForJS($javascript; $timeout)
|
Wait until the Js return true
|
$I->waitForText($text; $timeout)
|
Wait until the text is found on the page |
These function can be use for waiting a Ajax call for example or where the application is still loading.
|