You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](http://codeception.com/images/recorder.gif))
71
71
Activated only for suites with WebDriver module enabled.
@@ -91,6 +91,7 @@ extensions:
91
91
* `failure_color` (default: danger) - bootstrap values to be used for color representation for failed tests
92
92
* `error_color` (default: dark) - bootstrap values to be used for color representation for scenarios where there's an issue occurred while generating a recording
93
93
* `delete_orphaned` (default: false) - delete recording folders created via previous runs
94
+
* `include_microseconds` (default: false) - enable microsecond precision for recorded step time details
94
95
95
96
#### Examples:
96
97
@@ -123,7 +124,7 @@ public function testLogin(AcceptanceTester $I)
Copy file name to clipboardExpand all lines: changelog.markdown
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,32 @@ title: Codeception Changelog
7
7
8
8
# Changelog
9
9
10
+
#### 3.0.0
11
+
12
+
***BREAKING** Modules removed:
13
+
* Yii1
14
+
* XMLRPC
15
+
* AngularJS
16
+
* Silex
17
+
* Facebook
18
+
* ZF1
19
+
***POSSIBLE BREAKING** PHPUnit 8.x support.
20
+
> Upgrade Notice: If you face issues with conflicting PHPUnit classes or difference in method signatures, lock version for PHPUnit in composer.json: “phpunit/phpunit”:”^7.0.0”
21
+
* **BREAKING** Multi-session testing disabled by default. Add `use \Codeception\Lib\Actor\Shared\Friend;` to enable `$I->haveFriend`.
22
+
* **BREAKING** **[WebDriver]** `pauseExecution` removed in favor of `$I->pause()`
23
+
* [Interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) inside tests with `$I->pause();` command in debug mode added. Allows to write and debug test in realtime.
24
+
* Introduced [Step Decorators](https://codeception.com/docs/08-Customization#Step-Decorators) - auto-generated actions around module and helper methods. As part of this feature implemented
***[REST]** Short API responses in debug mode with `shortDebugResponse` config option. See [#5455](https://github.com/Codeception/Codeception/issues/5455) by **[sebastianneubert](https://github.com/sebastianneubert)**
30
+
***[WebDriver]**`switchToIFrame` allow to locate iframe by CSS/XPath.
31
+
*[PhpBrowser][Frameworks] clickButton throws exception if button is outside form by **[Naktibalda](https://github.com/Naktibalda)**.
32
+
* Updated to PHP 7.3 in Docker container by **[OneEyedSpaceFish](https://github.com/OneEyedSpaceFish)**
33
+
* Recorder Extension: Added timestamp information with `include_microseconds` config option. By **[OneEyedSpaceFish](https://github.com/OneEyedSpaceFish)**.
34
+
***[REST]** Fixed sending request with duplicated slash with endpoint + URL. By **[nicholascus](https://github.com/nicholascus)**
35
+
***[Db]** Remove generateWhereClause method from SqlSrv to be compatible with other drivers. By **[Naktibalda](https://github.com/Naktibalda)**
10
36
#### 2.5.6
11
37
12
38
***[WebDriver]** Fixed `loadSessionSnapshot` with php-webdriver 1.1.3 by **[Naktibalda](https://github.com/Naktibalda)**.
Each failed assertion will be shown in the test results, but it won't stop the test.
314
313
314
+
Conditional assertions are disabled in bootstrap setup. To enable them you should add corresponding step decorators to suite config:
315
+
316
+
> If you started project as `codecept init acceptance` they should be already enabled in config
317
+
318
+
{% highlight yaml %}
319
+
320
+
# in acceptance.suite.yml
321
+
# or in codeception.yml inside suites section
322
+
step_drcorators:
323
+
- \Codeception\Step\ConditionalAssertion
324
+
325
+
{% endhighlight %}
326
+
327
+
Then rebuild actors with `codecept build` command.
328
+
315
329
#### Comments
316
330
317
331
Within a long scenario, you should describe what actions you are going to perform and what results should be achieved.
@@ -508,8 +522,6 @@ $I->wait(3); // wait for 3 secs
508
522
509
523
#### SmartWait
510
524
511
-
*since 2.3.4 version*
512
-
513
525
It is possible to wait for elements pragmatically.
514
526
If a test uses element which is not on a page yet, Codeception will wait for few extra seconds before failing.
515
527
This feature is based on [Implicit Wait](http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#implicit-waits) of Selenium.
@@ -558,6 +570,64 @@ $I->seeNumberOfElements(['css' => 'button.link'], 5); // DISABLED, can wait only
558
570
559
571
{% endhighlight %}
560
572
573
+
#### Retry
574
+
575
+
When it's hard to define condition to wait for, we can retry a command few times until it succeeds.
576
+
For instance, if you try to click while it's animating you can try to do it few times until it freezes.
577
+
Since Codeception 3.0 each action and assertion have an alias prefixed with `retry` which allows to retry a flaky command.
578
+
579
+
{% highlight php %}
580
+
581
+
<?php
582
+
$I->retryClick('flaky element');
583
+
$I->retrySee('Something changed');
584
+
585
+
{% endhighlight %}
586
+
587
+
Retry can be configured via `$I->retry()` command, where you can set number of retries and interval.
588
+
589
+
{% highlight php %}
590
+
591
+
<?php
592
+
// Retry up to 4 sec: 10 times, for 400ms interval
593
+
$I->retry(10, 400);
594
+
595
+
{% endhighlight %}
596
+
597
+
`$I->retry` takes 2 parameters:
598
+
* number of retries (1 by default)
599
+
* interval (200ms by default)
600
+
601
+
Retries are disabled by default. To enable them you should add retry step decorators to suite config:
602
+
603
+
> If you started project as `codecept init acceptance` they should be already enabled in config
604
+
605
+
{% highlight yaml %}
606
+
607
+
# in acceptance.suite.yml
608
+
# or in codeception.yml inside suites section
609
+
step_drcorators:
610
+
- \Codeception\Step\Retry
611
+
612
+
{% endhighlight %}
613
+
614
+
Then add `\Codeception\Lib\Actor\Shared\Retry` trait into `AcceptanceTester` class:
615
+
616
+
{% highlight php %}
617
+
618
+
<?php
619
+
class AcceptanceTester extends \Codeception\Actor
620
+
{
621
+
use _generated\AcceptanceTesterActions;
622
+
623
+
use \Codeception\Lib\Actor\Shared\Retry;
624
+
}
625
+
626
+
{% endhighlight %}
627
+
628
+
Run `codecept build` to recreate actions. New `retry*` actions are available for tests.
629
+
Keep in mind, that you can change retry policy dynamically for each test.
630
+
561
631
#### Wait and Act
562
632
563
633
To combine `waitForElement` with actions inside that element you can use the [performOn](http://codeception.com/docs/modules/WebDriver#performOn) method.
For more options see [`performOn()` reference](http://codeception.com/docs/modules/WebDriver#performOn).
590
660
661
+
#### A/B Testing
662
+
663
+
When a web site acts unpredictably you may need to react on that change.
664
+
This happens if site configured for A/B testing, or shows different popups, based on environment.
665
+
666
+
Since Codeception 3.0 you can have some actions to fail silently, is they are errored.
667
+
Let's say, you open a page and some times there is a popup which should be closed.
668
+
We may try to hit the "close" button but if this action fails (no popup on page) we just continue the test.
669
+
670
+
This is how it can be implemented:
671
+
672
+
{% highlight php %}
673
+
674
+
<?php
675
+
$I->amOnPage('/');
676
+
$I->tryToClick('x', '.alert');
677
+
// continue execution
678
+
679
+
{% endhighlight %}
680
+
681
+
You can also use `tryTo` as condition for your tests:
682
+
683
+
{% highlight php %}
684
+
685
+
<?php
686
+
if ($I->tryToSeeElement('.alert')) {
687
+
$I->waitForText('Do you accept cookies?');
688
+
$I->click('Yes');
689
+
}
690
+
691
+
{% endhighlight %}
692
+
693
+
A/B testing is disabled by default. To enable it you should add corresponding step decorators to suite config:
694
+
695
+
> If you started project as `codecept init acceptance` in Codeception >= 3.0 they should be already enabled in config
696
+
697
+
{% highlight yaml %}
698
+
699
+
# in acceptance.suite.yml
700
+
# or in codeception.yml inside suites section
701
+
step_drcorators:
702
+
- \Codeception\Step\TryTo
703
+
704
+
{% endhighlight %}
705
+
706
+
Then rebuild actors with `codecept build` command.
707
+
591
708
### Multi Session Testing
592
709
593
710
Codeception allows you to execute actions in concurrent sessions. The most obvious case for this
@@ -626,6 +743,20 @@ $nickAdmin->leave();
626
743
627
744
{% endhighlight %}
628
745
746
+
Multi session testing is disabled by default. To enable it, add `\Codeception\Lib\Actor\Shared\Friend` into `AcceptancTester`.
747
+
748
+
{% highlight php %}
749
+
750
+
<?php
751
+
class AcceptanceTester extends \Codeception\Actor
752
+
{
753
+
use _generated\AcceptanceTesterActions;
754
+
755
+
use \Codeception\Lib\Actor\Shared\Friend;
756
+
}
757
+
758
+
{% endhighlight %}
759
+
629
760
### Cloud Testing
630
761
631
762
Some environments are hard to be reproduced manually, testing Internet Explorer 6-8 on Windows XP may be a hard thing,
@@ -651,22 +782,6 @@ It should be mentioned that Cloud Testing services are not free. You should inve
651
782
and choose one that fits your needs. They also may work painfully slowly if ping times between the local server
652
783
and the cloud is too high. This may lead to random failures in acceptance tests.
653
784
654
-
### AngularJS Testing
655
-
656
-
In the modern era of Single Page Applications, the browser replaces the server in creating the user interface.
657
-
Unlike traditional web applications, web pages are not reloaded on user actions.
658
-
All interactions with the server are done in JavaScript with XHR requests.
659
-
However, testing Single Page Applications can be a hard task.
660
-
There could be no information of the application state: e.g. has it completed rendering or not?
661
-
What is possible to do in this case is to use more `wait*` methods or execute JavaScript that checks the application state.
662
-
663
-
For applications built with the AngularJS v1.x framework,
664
-
we implemented [AngularJS module](http://codeception.com/docs/modules/AngularJS) which is based on Protractor
665
-
(an official tool for testing Angular apps). Under the hood, it pauses step execution
666
-
before the previous actions are completed and use the AngularJS API to check the application state.
667
-
668
-
The AngularJS module extends WebDriver so that all the configuration options from it are available.
669
-
670
785
### Debugging
671
786
672
787
Codeception modules can print valuable information while running.
@@ -684,9 +799,8 @@ PhpBrowser will store the HTML code and WebDriver will save a screenshot of the
684
799
685
800
Additional debugging features by Codeception:
686
801
687
-
* [pauseExecution](http://codeception.com/docs/modules/WebDriver#pauseExecution) method of WebDriver module allows pausing the test.
688
-
* [Recorder extension](http://codeception.com/addons#CodeceptionExtensionRecorder) allows to record tests step-by-steps and show them in slideshow
689
-
* [Interactive Console](http://codeception.com/docs/07-AdvancedUsage#Interactive-Console) is a REPL that allows to type and check commands for instant feedback.
802
+
* [Interactive Pause](http://codeception.com/docs/02-GettingStarted#Interactive-Pause) is a REPL that allows to type and check commands for instant feedback.
803
+
* [Recorder Extension](http://codeception.com/addons#CodeceptionExtensionRecorder) allows to record tests step-by-steps and show them in slideshow
0 commit comments