Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Jan 17, 2017
1 parent ec7cc17 commit 4e38a8c
Show file tree
Hide file tree
Showing 27 changed files with 493 additions and 324 deletions.
2 changes: 1 addition & 1 deletion RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 341,7 @@ public function buildDocsModules()
$text = str_replace('@part ', ' * `[Part]` ', $text);
$text = str_replace("@return mixed\n", '', $text);
$text = preg_replace('~@return (.*?)~', ' * `return` $1', $text);
$text = preg_replace("~@(.*?)([$\s])~", ' * `$1` $2', $text);
$text = preg_replace("~^@(.*?)([$\s])~", ' * `$1` $2', $text);
return $title . $text;
})->processMethodSignature(false)
->reorderMethods('ksort')
Expand Down
12 changes: 9 additions & 3 deletions docs/12-ContinuousIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 80,7 @@ Jenkins should locate `report.html` at `tests/_output/`. Now Jenkins will displa

## TeamCity

![TeamCity](http://codeception.com/images/teamcity.png)
![TeamCity](http://codeception.com/images/teamcity/logo.jpg)

TeamCity is a hotsed solution from JetBrains. The setup of it can be a bit tricky as TeamCity uses its own reporter format for parsing test results. PHPUnit since verison 5.x has integrated support for this format, so does Codeception. What we need to do is to configure Codeception to use custom reporter. By default there is `--report` option which provides an alternative output. You can change the reporter class in `codeception.yml` configuration:

Expand All @@ -101,7 101,7 @@ php codecept run --report

Once you execute your first build you should see detailed report inside TeamCity interface:

![report](http://codeception.com/images/teamcity/report.png)
![report](http://codeception.com/images/teamcity/report2.png)

## TravisCI

Expand All @@ -119,7 119,9 @@ Travis doesn't provide visualization for XML or HTML reports so you can't view r

## GitLab

If a file ```.gitlab-ci.yml``` exists in the root of the git repository, gitlab will run a pipeline each time you push to the gitlab server. The file configures the docker image that will be called. Below is a sample which loads a php7 docker image, clones your files, installs composer dependencies, runs the built-in php webserver and finally runs codeception:
![report](http://codeception.com/images/gitlab/logo.png)

If a file `.gitlab-ci.yml` exists in the root of the git repository, GitLab will run a pipeline each time you push to the gitlab server. The file configures the docker image that will be called. Below is a sample which loads a php7 docker image, clones your files, installs composer dependencies, runs the built-in php webserver and finally runs codeception:

```yaml
# Select image from https://hub.docker.com/_/php/
Expand All @@ -146,6 148,10 @@ test:
- vendor/bin/codecept run
```
![report](http://codeception.com/images/gitlab/build.png)
For acceptance testing you can use `codeception/codeception` docker image as base.

## Conclusion

It is tringly recommended to use Continuous Integration system in development. Codeception is easy to install and run in any CI systems. However, each of them has their differences you should take into account. You can use different repoters to provide output in format expected by CI system.
107 changes: 77 additions & 30 deletions docs/modules/AngularJS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 70,15 @@ PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` i

Uri of currently opened page.
* `return` string
* `throws` ModuleException
@throws ModuleException


### _getUrl

*hidden API method, expected to be used from Helper classes*

Returns URL of a host.
* `throws` ModuleConfigException
@throws ModuleConfigException


### _savePageSource
Expand Down Expand Up @@ -183,7 183,7 @@ $I->appendField('#myTextField', 'appended');

* `param string` $field
* `param string` $value
* `throws` \Codeception\Exception\ElementNotFound
@throws \Codeception\Exception\ElementNotFound


### attachFile
Expand All @@ -193,7 193,7 @@ Attaches a file relative to the Codeception data directory to the given file upl
``` php
<?php
// file is stored in 'tests/_data/prices.xls'
$I->attachFile('input[ * `type="file"]',` 'prices.xls');
$I->attachFile('input[@type="file"]', 'prices.xls');
?>
```

Expand Down Expand Up @@ -240,7 240,7 @@ $I->click('Submit');
// CSS button
$I->click('#form input[type=submit]');
// XPath
$I->click('//form/*[ * `type=submit]');`
$I->click('//form/*[@type=submit]');
// link in context
$I->click('Logout', '#nav');
// using strict locator
Expand All @@ -252,18 252,58 @@ $I->click(['link' => 'Login']);
* `param` $context


### clickWithLeftButton

Performs click with the left mouse button on an element.
If the first parameter `null` then the offset is relative to the actual mouse position.
If the second and third parameters are given,
then the mouse is moved to an offset of the element's top-left corner.
Otherwise, the mouse is moved to the center of the element.

``` php
<?php
$I->clickWithLeftButton(['css' => '.checkout']);
$I->clickWithLeftButton(null, 20, 50);
$I->clickWithLeftButton(['css' => '.checkout'], 20, 50);
?>
```

* `param string` $cssOrXPath css or xpath of the web element (body by default).
* `param int` $offsetX
* `param int` $offsetY

@throws \Codeception\Exception\ElementNotFound


### clickWithRightButton

Performs contextual click with the right mouse button on an element.
If the first parameter `null` then the offset is relative to the actual mouse position.
If the second and third parameters are given,
then the mouse is moved to an offset of the element's top-left corner.
Otherwise, the mouse is moved to the center of the element.

* `param` $cssOrXPath
* `throws` \Codeception\Exception\ElementNotFound
``` php
<?php
$I->clickWithRightButton(['css' => '.checkout']);
$I->clickWithRightButton(null, 20, 50);
$I->clickWithRightButton(['css' => '.checkout'], 20, 50);
?>
```

* `param string` $cssOrXPath css or xpath of the web element (body by default).
* `param int` $offsetX
* `param int` $offsetY

@throws \Codeception\Exception\ElementNotFound


### debugWebDriverLogs

Print out latest Selenium Logs in debug mode

* `param TestInterface` $test


### dontSee

Expand Down Expand Up @@ -398,7 438,7 @@ $I->dontSeeInField('Body','Type your comment here');
$I->dontSeeInField('form textarea[name=body]','Type your comment here');
$I->dontSeeInField('form input[type=hidden]','hidden_value');
$I->dontSeeInField('#searchform input','Search');
$I->dontSeeInField('//form/*[ * `name=search]','Search');`
$I->dontSeeInField('//form/*[@name=search]','Search');
$I->dontSeeInField(['name' => 'search'], 'Search');
?>
```
Expand Down Expand Up @@ -514,7 554,7 @@ $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
Performs a double-click on an element matched by CSS or XPath.

* `param` $cssOrXPath
* `throws` \Codeception\Exception\ElementNotFound
@throws \Codeception\Exception\ElementNotFound


### dragAndDrop
Expand Down Expand Up @@ -571,8 611,8 @@ Fills a text field or textarea with the given string.

``` php
<?php
$I->fillField("//input[ * `type='text']",` "Hello World!");
$I->fillField(['name' => 'email'], 'jon * `mail.com');`
$I->fillField("//input[@type='text']", "Hello World!");
$I->fillField(['name' => 'email'], 'jon@mail.com');
?>
```

Expand Down Expand Up @@ -683,7 723,7 @@ If a fuzzy locator is used, the field is found by field name, CSS, and XPath.
<?php
$name = $I->grabValueFrom('Name');
$name = $I->grabValueFrom('input[name=username]');
$name = $I->grabValueFrom('descendant-or-self::form/descendant::input[ * `name` = 'username']');
$name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']');
$name = $I->grabValueFrom(['name' => 'username']);
?>
```
Expand Down Expand Up @@ -731,12 771,15 @@ Moves forward in history.
### moveMouseOver
Move mouse over the first element matched by the given locator.
If the first parameter null then the page is used.
If the second and third parameters are given,
then the mouse is moved to an offset of the element's top-left corner.
Otherwise, the mouse is moved to the center of the element.

``` php
<?php
$I->moveMouseOver(['css' => '.checkout']);
$I->moveMouseOver(null, 20, 50);
$I->moveMouseOver(['css' => '.checkout'], 20, 50);
?>
```
Expand All @@ -745,7 788,7 @@ $I->moveMouseOver(['css' => '.checkout'], 20, 50);
* `param int` $offsetX
* `param int` $offsetY

* `throws` \Codeception\Exception\ElementNotFound
@throws \Codeception\Exception\ElementNotFound


### pauseExecution
Expand All @@ -770,14 813,14 @@ For special keys use key constants from WebDriverKeys class.
$I->pressKey('#page','a'); // => olda
$I->pressKey('#page',array('ctrl','a'),'new'); //=> new
$I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x
$I->pressKey('descendant-or-self::*[ * `id='page']','u');` //=> oldu
$I->pressKey('descendant-or-self::*[@id='page']','u'); //=> oldu
$I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>''
?>
```

* `param` $element
* `param` $char string|array Can be char or array with modifier. You can provide several chars.
* `throws` \Codeception\Exception\ElementNotFound
@throws \Codeception\Exception\ElementNotFound


### reloadPage
Expand Down Expand Up @@ -872,7 915,7 @@ Checks that the specified checkbox is checked.
<?php
$I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
$I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
$I->seeCheckboxIsChecked('//form/input[ * `type=checkbox` and * `name=agree]');`
$I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
?>
```

Expand Down Expand Up @@ -942,7 985,7 @@ $I->seeElement(['css' => 'form input'], ['name' => 'login']);

* `param` $selector
* `param array` $attributes
* `return`
@return


### seeElementInDOM
Expand Down Expand Up @@ -985,7 1028,7 @@ $I->seeInField('Body','Type your comment here');
$I->seeInField('form textarea[name=body]','Type your comment here');
$I->seeInField('form input[type=hidden]','hidden_value');
$I->seeInField('#searchform input','Search');
$I->seeInField('//form/*[ * `name=search]','Search');`
$I->seeInField('//form/*[@name=search]','Search');
$I->seeInField(['name' => 'search'], 'Search');
?>
```
Expand Down Expand Up @@ -1047,9 1090,9 @@ $form = [
'checkbox1' => true,
// ...
];
$I->submitForm('//form[ * `id=my-form]',` $form, 'submitButton');
$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
$I->seeInFormFields('//form[ * `id=my-form]',` $form);
$I->seeInFormFields('//form[@id=my-form]', $form);
?>
```

Expand Down Expand Up @@ -1163,7 1206,7 @@ Selects an option in a select tag or in radio button group.
<?php
$I->selectOption('form select[name=account]', 'Premium');
$I->selectOption('form input[name=payment]', 'Monthly');
$I->selectOption('//form/select[ * `name=account]',` 'Monthly');
$I->selectOption('//form/select[@name=account]', 'Monthly');
?>
```

Expand Down Expand Up @@ -1286,9 1329,9 @@ $form = [
'checkbox1' => true,
// ...
];
$I->submitForm('//form[ * `id=my-form]',` $form, 'submitButton');
$I->submitForm('//form[@id=my-form]', $form, 'submitButton');
// $I->amOnPage('/path/to/form-page') may be needed
$I->seeInFormFields('//form[ * `id=my-form]',` $form);
$I->seeInFormFields('//form[@id=my-form]', $form);
?>
```

Expand Down Expand Up @@ -1445,15 1488,19 @@ $I->uncheckOption('#notify');


### unselectOption
__not documented__

Unselect an option in the given select box.

* `param` $select
* `param` $option


### wait

Wait for $timeout seconds.

* `param int` $timeout secs
* `throws` \Codeception\Exception\TestRuntimeException
@throws \Codeception\Exception\TestRuntimeException


### waitForElement
Expand All @@ -1470,7 1517,7 @@ $I->click('#agree_button');

* `param` $element
* `param int` $timeout seconds
* `throws` \Exception
@throws \Exception


### waitForElementChange
Expand All @@ -1491,7 1538,7 @@ $I->waitForElementChange('#menu', function(WebDriverElement $el) {
* `param` $element
* `param \Closure` $callback
* `param int` $timeout seconds
* `throws` \Codeception\Exception\ElementNotFound
@throws \Codeception\Exception\ElementNotFound


### waitForElementNotVisible
Expand All @@ -1507,7 1554,7 @@ $I->waitForElementNotVisible('#agree_button', 30); // secs

* `param` $element
* `param int` $timeout seconds
* `throws` \Exception
@throws \Exception


### waitForElementVisible
Expand All @@ -1524,7 1571,7 @@ $I->click('#agree_button');

* `param` $element
* `param int` $timeout seconds
* `throws` \Exception
@throws \Exception


### waitForJS
Expand Down Expand Up @@ -1561,6 1608,6 @@ $I->waitForText('foo', 30, '.title'); // secs
* `param string` $text
* `param int` $timeout seconds
* `param null` $selector
* `throws` \Exception
@throws \Exception

<p>&nbsp;</p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.2/src/Codeception/Module/AngularJS.php">Help us to improve documentation. Edit module reference</a></div>
2 changes: 1 addition & 1 deletion docs/modules/Apc.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 74,7 @@ Examples:
```php
<?php
// Array
$I->haveInApc('users', ['name' => 'miles', 'email' => 'miles * `davis.com']);`
$I->haveInApc('users', ['name' => 'miles', 'email' => 'miles@davis.com']);

// Object
$I->haveInApc('user', UserRepository::findFirst());
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/Db.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 125,7 @@ Provide table name and column values.

``` php
<?php
$I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert * `mail.com'));`
$I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
```
Fails if such user was found.

Expand Down Expand Up @@ -165,7 165,7 @@ Inserts an SQL record into a database. This record will be erased after the test

```php
<?php
$I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles * `davis.com'));`
$I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
?>
```

Expand All @@ -182,7 182,7 @@ Provide table name and column values.

``` php
<?php
$I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert * `mail.com'));`
$I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
```
Fails if no such user found.

Expand Down
Loading

0 comments on commit 4e38a8c

Please sign in to comment.