Skip to content

Commit 980abf3

Browse files
committed
auto updated documentation
1 parent 4ce1fa1 commit 980abf3

File tree

6 files changed

+289
-28
lines changed

6 files changed

+289
-28
lines changed

changelog.markdown

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,33 @@ title: Codeception Changelog
77

88
# Changelog
99

10+
#### 2.2.9
11+
12+
* **[Laravel5]** **Laravel 5.4 support** by **[janhenkgerritsen](https://github.com/janhenkgerritsen)**
13+
* **[WebDriver]** Added `performOn` to wait for element, and run actions inside it. See [complete reference](http://codeception.com/docs/modules/WebDriver#performOn). [#3986](https://github.com/Codeception/Codeception/issues/3986)
14+
* **[WebDriver]** Improved error messages for `wait*` methods by **[disc](https://github.com/disc)**. See [#3983](https://github.com/Codeception/Codeception/issues/3983)
15+
* **[REST]** Binary responses support by **[spikyjt](https://github.com/spikyjt)** [#3993](https://github.com/Codeception/Codeception/issues/3993) [#3985](https://github.com/Codeception/Codeception/issues/3985)
16+
* `seeBinaryResponseEquals` assert that binary response matches a hash
17+
* `seeBinaryResponseEquals` assert that binary response doesn't match a hash
18+
* hide binary response on debug
19+
* **[Laravel5]** module fix error for applications that do not use a database. See [#3954](https://github.com/Codeception/Codeception/issues/3954) by **[janhenkgerritsen](https://github.com/janhenkgerritsen)**. Fixed [#3942](https://github.com/Codeception/Codeception/issues/3942)
20+
* **[Laravel5]** database seeders to be executed inside a transaction. See [#3954](https://github.com/Codeception/Codeception/issues/3954) by **[janhenkgerritsen](https://github.com/janhenkgerritsen)**. Fixed [#3948](https://github.com/Codeception/Codeception/issues/3948) by **[janhenkgerritsen](https://github.com/janhenkgerritsen)**
21+
* **[Yii2]** reverted [#3834](https://github.com/Codeception/Codeception/issues/3834), closing transaction after each request. [#3973](https://github.com/Codeception/Codeception/issues/3973) by **[iRipVanWinkle](https://github.com/iRipVanWinkle)**. Fixes [#3961](https://github.com/Codeception/Codeception/issues/3961)
22+
* Added crap4j report support. Use `--coverage-crap4j` option and `codeception/c3` 2.0.10
23+
* [PhpBrowser][Frameworks] If form has no id, use action attribute as identifier by **[Naktibalda](https://github.com/Naktibalda)**. Fixes [#3953](https://github.com/Codeception/Codeception/issues/3953)
24+
* Fixed test coloring output when a Feature title has some special chars in it like `/` or `-`
25+
* **[REST]** Added missing **[part](https://github.com/part)** `json` and `xml` to `deleteHeader` by **[freezy](https://github.com/freezy)**-sk
26+
1027
#### 2.2.8
1128

1229
* **[WebDriver]** Added tab actions (not supported in PhantomJS):
13-
* [openNewTab](http://codeception.com/docs/modules/WebDriver#openNewTab) opens a new tab and switches to it
14-
* [closeTab](http://codeception.com/docs/modules/WebDriver#closeTab) closes a tab and switches to previous
15-
* [switchToNextTab](http://codeception.com/docs/modules/WebDriver#switchToNextTab) switches to next tab
16-
* [switchToPreviousTab](http://codeception.com/docs/modules/WebDriver#switchToPreviousTab) switches to previous tab
30+
* `openNewTab` opens a new tab and switches to it
31+
* `closeTab` closes a tab and switches to previous
32+
* `switchToNextTab` switches to next tab
33+
* `switchToPreviousTab` switches to previous tab
1734
* **[WebDriver]** Added actions to click element by coordinates. Via **[gimler](https://github.com/gimler)**
18-
* [clickWithLeftButton](http://codeception.com/docs/modules/WebDriver#clickWithLeftButton) clicks element with offset
19-
* [clickWithRightButton](http://codeception.com/docs/modules/WebDriver#clickWithRightButton) right clicks on element with offset
35+
* `clickWithLeftButton` clicks element with offset
36+
* `clickWithRightButton` right clicks on element with offset
2037
* **[WebDriver]** Added `js_error_logging` option to print JS logs in console and in HTML report by **[ngraf](https://github.com/ngraf)**. See [#3821](https://github.com/Codeception/Codeception/issues/3821)
2138
* **[WebDriver]** Improvements to `seeInField` by **[gimler](https://github.com/gimler)**. See [#3905](https://github.com/Codeception/Codeception/issues/3905)
2239
* support option text in seeInField not only value

docs/03-AcceptanceTests.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ $I->seeElement('#modal');
399399
#### Wait
400400

401401
While testing web application, you may need to wait for JavaScript events to occur. Due to its asynchronous nature,
402-
complex JavaScript interactions are hard to test. That's why you may need to use `wait` actions,
403-
which can be used to specify what event you expect to occur on a page, before continuing the test.
402+
complex JavaScript interactions are hard to test. That's why you may need to use waiters, actions with *wait* prefix.
403+
They can be used to specify what event you expect to occur on a page, before continuing the test.
404404

405405
For example:
406406

@@ -413,9 +413,47 @@ $I->click('#agree_button');
413413
{% endhighlight %}
414414

415415
In this case we are waiting for the 'agree' button to appear and then clicking it. If it didn't appear after 30 seconds,
416-
the test will fail. There are other `wait` methods you may use.
416+
the test will fail. There are other `wait` methods you may use, like [waitForText](http://codeception.com/docs/modules/WebDriver#waitForText),
417+
[waitForElementVisible](http://codeception.com/docs/modules/WebDriver#waitForElementVisible) and others.
417418

418-
See Codeception's [WebDriver module documentation](http://codeception.com/docs/modules/WebDriver) for the full reference.
419+
If you don't know what exact element you need to wait for, you can simply pause execution with using `$I->wait()`
420+
421+
{% highlight php %}
422+
423+
<?php
424+
$I->wait(3); // wait for 3 secs
425+
426+
{% endhighlight %}
427+
428+
#### Wait and Act
429+
430+
To combine `waitForElement` with actions inside that element you can use [performOn](http://codeception.com/docs/modules/WebDriver#performOn) method.
431+
Let's see how can you perform some actions inside an HTML popup:
432+
433+
{% highlight php %}
434+
435+
<?php
436+
$I->performOn('.confirm', \Codeception\Util\ActionSequence::build()
437+
->see('Warning')
438+
->see('Are you sure you want to delete this?')
439+
->click('Yes')
440+
);
441+
442+
{% endhighlight %}
443+
Alternatively, this can be executed using callback, in this case WebDriver module instance is passed as argument
444+
445+
{% highlight php %}
446+
447+
<?php
448+
$I->performOn('.confirm', function(\Codeception\Module\WebDriver $I) {
449+
$I->see('Warning');
450+
$I->see('Are you sure you want to delete this?');
451+
$I->click('Yes');
452+
});
453+
454+
{% endhighlight %}
455+
456+
For more options see [`performOn` reference]([performOn](http://codeception.com/docs/modules/WebDriver#performOn) ).
419457

420458
### Multi Session Testing
421459

docs/modules/AMQP.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,60 @@ To use this module with Composer you need <em>"videlalvaro/php-amqplib": "*"</em
5858

5959
### Actions
6060

61+
#### bindQueueToExchange
62+
63+
Binds a queue to an exchange
64+
65+
This is an alias of method `queue_bind` of `PhpAmqpLib\Channel\AMQPChannel`.
66+
67+
{% highlight php %}
68+
69+
<?php
70+
$I->bindQueueToExchange(
71+
'nameOfMyQueueToBind', // name of the queue
72+
'transactionTracking.transaction', // exchange name to bind to
73+
'your.routing.key' // Optionally, provide a binding key
74+
//.. see the original method for more options
75+
)
76+
77+
{% endhighlight %}
78+
79+
80+
#### declareExchange
81+
82+
Declares an exchange
83+
84+
This is an alias of method `exchange_declare` of `PhpAmqpLib\Channel\AMQPChannel`.
85+
86+
{% highlight php %}
87+
88+
<?php
89+
$I->declareExchange(
90+
'nameOfMyExchange', // exchange name
91+
'topic' // exchange type
92+
//.. see the original method for more options
93+
)
94+
95+
{% endhighlight %}
96+
97+
98+
#### declareQueue
99+
100+
Declares a queue
101+
102+
This is an alias of method `queue_declare` of `PhpAmqpLib\Channel\AMQPChannel`.
103+
104+
{% highlight php %}
105+
106+
<?php
107+
$I->declareQueue(
108+
'nameOfMyQueue', // exchange name
109+
//.. see the original method for more options
110+
)
111+
112+
{% endhighlight %}
113+
114+
61115
#### grabMessageFromQueue
62116

63117
Takes last message from queue.

docs/modules/AngularJS.md

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,6 @@ $I->fillField(['name' => 'email'], 'jon@mail.com');
702702
* `param` $value
703703

704704

705-
#### getVisibleText
706-
707-
Grabs all visible text from the current page.
708-
709-
* `return` string
710-
711-
712705
#### grabAttributeFrom
713706

714707
Grabs the value of the given attribute value from the given element.
@@ -915,6 +908,57 @@ This method is useful while writing tests,
915908
since it allows you to inspect the current page in the middle of a test case.
916909

917910

911+
#### performOn
912+
913+
Waits for element and runs a sequence of actions inside its context.
914+
Actions can be defined with array, callback, or `Codeception\Util\ActionSequence` instance.
915+
916+
Actions as array are recommended for simple to combine "waitForElement" with assertions;
917+
`waitForElement($el)` and `see('text', $el)` can be simplified to:
918+
919+
{% highlight php %}
920+
921+
<?php
922+
$I->performOn($el, ['see' => 'text']);
923+
924+
{% endhighlight %}
925+
926+
List of actions can be pragmatically build using `Codeception\Util\ActionSequence`:
927+
928+
{% highlight php %}
929+
930+
<?php
931+
$I->performOn('.model', ActionSequence::build()
932+
->see('Warning')
933+
->see('Are you sure you want to delete this?')
934+
->click('Yes')
935+
);
936+
937+
{% endhighlight %}
938+
939+
Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to
940+
exception on failure.
941+
942+
Whenever you need to define more actions a callback can be used. A WebDriver module is passed for argument:
943+
944+
{% highlight php %}
945+
946+
<?php
947+
$I->performOn('.rememberMe', function (WebDriver $I) {
948+
$I->see('Remember me next time');
949+
$I->seeElement('#LoginForm_rememberMe');
950+
$I->dontSee('Login');
951+
});
952+
953+
{% endhighlight %}
954+
955+
In 3rd argument you can set number a seconds to wait for element to appear
956+
957+
* `param` $element
958+
* `param` $actions
959+
* `param int` $timeout
960+
961+
918962
#### pressKey
919963

920964
Presses the given key on the given element.
@@ -1652,9 +1696,9 @@ An offset can be specified.
16521696
16531697
<?php
16541698
// switch to previous tab
1655-
$I->switchToPreviousTab();
1699+
$I->switchToNextTab();
16561700
// switch to 2nd previous tab
1657-
$I->switchToPreviousTab(2);
1701+
$I->switchToNextTab(-2);
16581702
16591703
{% endhighlight %}
16601704

docs/modules/REST.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,27 @@ $I->sendPOST('some-other-page.php');
9797
{% endhighlight %}
9898

9999
* `param string` $name the name of the header to delete.
100+
* `[Part]` json
101+
* `[Part]` xml
102+
103+
104+
#### dontSeeBinaryResponseEquals
105+
106+
Checks if the hash of a binary response is not the same as provided.
107+
108+
{% highlight php %}
109+
110+
<?php
111+
$I->dontSeeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
112+
?>
113+
114+
{% endhighlight %}
115+
Opposite to `seeBinaryResponseEquals`
116+
117+
* `param` $hash the hashed data response expected
118+
* `param` $algo the hash algorithm to use. Default md5.
119+
* `[Part]` json
120+
* `[Part]` xml
100121

101122

102123
#### dontSeeHttpHeader
@@ -318,6 +339,49 @@ $I->haveHttpHeader('Content-Type', 'application/json');
318339
* `[Part]` xml
319340

320341

342+
#### seeBinaryResponseEquals
343+
344+
Checks if the hash of a binary response is exactly the same as provided.
345+
Parameter can be passed as any hash string supported by hash(), with an
346+
optional second parameter to specify the hash type, which defaults to md5.
347+
348+
Example: Using md5 hash key
349+
350+
{% highlight php %}
351+
352+
<?php
353+
$I->seeBinaryResponseEquals("8c90748342f19b195b9c6b4eff742ded");
354+
?>
355+
356+
{% endhighlight %}
357+
358+
Example: Using md5 for a file contents
359+
360+
{% highlight php %}
361+
362+
<?php
363+
$fileData = file_get_contents("test_file.jpg");
364+
$I->seeBinaryResponseEquals(md5($fileData));
365+
?>
366+
367+
{% endhighlight %}
368+
Example: Using sha256 hsah
369+
370+
{% highlight php %}
371+
372+
<?php
373+
$fileData = '/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k='; // very small jpeg
374+
$I->seeBinaryResponseEquals(hash("sha256", base64_decode($fileData)), 'sha256');
375+
?>
376+
377+
{% endhighlight %}
378+
379+
* `param` $hash the hashed data response expected
380+
* `param` $algo the hash algorithm to use. Default md5.
381+
* `[Part]` json
382+
* `[Part]` xml
383+
384+
321385
#### seeHttpHeader
322386

323387
Checks over the given HTTP header and (optionally)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy