Skip to content

Commit b7ab6dc

Browse files
committed
auto updated documentation
1 parent f03c22d commit b7ab6dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+855
-897
lines changed

docs/01-Introduction.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ $I->amOnPage('/');
3434
$I->click('Sign Up');
3535
$I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']);
3636
$I->see('Thank you for Signing Up!');
37-
?>
3837

3938
{% endhighlight %}
4039

@@ -72,7 +71,6 @@ $I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.c
7271
$I->see('Thank you for Signing Up!');
7372
$I->seeEmailSent('miles@davis.com', 'Thank you for registration');
7473
$I->seeInDatabase('users', ['email' => 'miles@davis.com']);
75-
?>
7674

7775
{% endhighlight %}
7876

@@ -111,7 +109,6 @@ function testSavingUser()
111109
$this->assertEquals('Miles Davis', $user->getFullName());
112110
$this->unitTester->seeInDatabase('users', ['name' => 'Miles', 'surname' => 'Davis']);
113111
}
114-
?>
115112

116113
{% endhighlight %}
117114

docs/02-GettingStarted.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A Scenario always starts with Actor class initialization. After that, writing a
5555
<?php
5656
$I = new AcceptanceTester($scenario);
5757
$I->wantTo('login to website');
58-
?>
58+
5959

6060
{% endhighlight %}
6161

@@ -87,7 +87,6 @@ $I->fillField('Username','davert');
8787
$I->fillField('Password','qwerty');
8888
$I->click('Login');
8989
$I->see('Hello, davert');
90-
?>
9190

9291
{% endhighlight %}
9392

@@ -229,7 +228,6 @@ class PageCrudCest
229228
// todo: write test
230229
}
231230
}
232-
?>
233231

234232
{% endhighlight %}
235233

docs/03-AcceptanceTests.md

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Probably the first test you would want to run would be signing in. In order to w
1616

1717
{% highlight php %}
1818

19+
<?php
1920
$I->amOnPage('/login');
2021
$I->fillField('username', 'davert');
2122
$I->fillField('password', 'qwerty');
@@ -56,7 +57,6 @@ We should start by creating a 'Cept' file in the `tests/acceptance` directory. L
5657
<?php
5758
$I = new AcceptanceTester($scenario);
5859
$I->wantTo('sign in');
59-
?>
6060

6161
{% endhighlight %}
6262

@@ -66,7 +66,6 @@ The `$I` object is used to write all interactions. The methods of the `$I` objec
6666

6767
<?php
6868
$I->amOnPage('/login');
69-
?>
7069

7170
{% endhighlight %}
7271

@@ -88,7 +87,6 @@ $I->click('#login a');
8887
$I->click('//a[@id=login]');
8988
// Using context as second argument
9089
$I->click('Login', '.nav');
91-
?>
9290

9391
{% endhighlight %}
9492

@@ -107,7 +105,6 @@ Codeception tries to locate element either by its text, name, CSS or XPath. You
107105
// By specifying locator type
108106
$I->click(['link' => 'Login']);
109107
$I->click(['class' => 'btn']);
110-
?>
111108

112109
{% endhighlight %}
113110

@@ -154,7 +151,6 @@ $I->fillField('Name', 'Miles');
154151
$I->fillField('user[email]','miles@davis.com');
155152
$I->selectOption('Gender','Male');
156153
$I->click('Update');
157-
?>
158154

159155
{% endhighlight %}
160156

@@ -171,7 +167,6 @@ $I->submitForm('#update_form', array('user' => array(
171167
'email' => 'Davis',
172168
'gender' => 'm'
173169
)));
174-
?>
175170

176171
{% endhighlight %}
177172

@@ -194,7 +189,6 @@ $I->submitForm('#update_form', array('user' => array(
194189
'gender' => 'm',
195190
'submitButton' => 'Update'
196191
)));
197-
?>
198192

199193
{% endhighlight %}
200194

@@ -216,7 +210,6 @@ $I->see('Thank you, Miles', '.notice');
216210
$I->see('Thank you, Miles', "//table/tr[2]");
217211
// We check this message is not on page.
218212
$I->dontSee('Form is filled incorrectly');
219-
?>
220213

221214
{% endhighlight %}
222215

@@ -227,7 +220,6 @@ You can check that specific element exists (or not) on a page
227220
<?php
228221
$I->seeElement('.notice');
229222
$I->dontSeeElement('.error');
230-
?>
231223

232224
{% endhighlight %}
233225

@@ -240,7 +232,6 @@ $I->seeInCurrentUrl('/user/miles');
240232
$I->seeCheckboxIsChecked('#agree');
241233
$I->seeInField('user[name]', 'Miles');
242234
$I->seeLink('Login');
243-
?>
244235

245236
{% endhighlight %}
246237

@@ -254,7 +245,6 @@ Sometimes you don't want the test to be stopped when an assertion fails. Maybe y
254245
$I->canSeeInCurrentUrl('/user/miles');
255246
$I->canSeeCheckboxIsChecked('#agree');
256247
$I->cantSeeInField('user[name]', 'Miles');
257-
?>
258248

259249
{% endhighlight %}
260250

@@ -273,7 +263,6 @@ $I->fillField('user[email]', 'miles');
273263
$I->click('Update');
274264
$I->expect('the form is not submitted');
275265
$I->see('Form is filled incorrectly');
276-
?>
277266

278267
{% endhighlight %}
279268

@@ -291,7 +280,6 @@ $I->click('Login');
291280
$I->fillField('email', 'miles@davis.com');
292281
$I->fillField('password', $password);
293282
$I->click('Log in!');
294-
?>
295283

296284
{% endhighlight %}
297285

@@ -303,7 +291,6 @@ Grabbers allow you to get a single value from the current page with commands.
303291
$token = $I->grabTextFrom('.token');
304292
$password = $I->grabTextFrom("descendant::input/descendant::*[@id = 'password']");
305293
$api_key = $I->grabValueFrom('input[name=api]');
306-
?>
307294

308295
{% endhighlight %}
309296

@@ -317,7 +304,6 @@ Actions for cookies:
317304
$I->setCookie('auth', '123345');
318305
$I->grabCookie('auth');
319306
$I->seeCookie('auth');
320-
?>
321307

322308
{% endhighlight %}
323309

@@ -328,7 +314,6 @@ Actions for checking page title:
328314
<?php
329315
$I->seeInTitle('Login');
330316
$I->dontSeeInTitle('Register');
331-
?>
332317

333318
{% endhighlight %}
334319

@@ -341,7 +326,6 @@ $I->seeCurrentUrlEquals('/login');
341326
$I->seeCurrentUrlMatches('~$/users/(\d+)~');
342327
$I->seeInCurrentUrl('user/1');
343328
$user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
344-
?>
345329

346330
{% endhighlight %}
347331

@@ -376,11 +360,9 @@ In this case `seeElement` won't just check that the element exists on a page, bu
376360

377361
<?php
378362
$I->seeElement('#modal');
379-
?>
380363

381364
{% endhighlight %}
382365

383-
384366
#### Wait
385367

386368
While testing web application, you may need to wait for JavaScript events to occur. Due to its asynchronous nature, complex JavaScript interactions are hard to test. That's why you may need to use `wait` actions, which can be used to specify what event you expect to occur on a page, before proceeding the test.
@@ -392,7 +374,6 @@ For example:
392374
<?php
393375
$I->waitForElement('#agree_button', 30); // secs
394376
$I->click('#agree_button');
395-
?>
396377

397378
{% endhighlight %}
398379

@@ -406,6 +387,7 @@ Codeception allows you to execute actions in concurrent sessions. The most obvio
406387

407388
{% highlight php %}
408389

390+
<?php
409391
$I->amOnPage('/messages');
410392
$nick = $I->haveFriend('nick');
411393
$nick->does(function(AcceptanceTester $I) {
@@ -416,30 +398,27 @@ $nick->does(function(AcceptanceTester $I) {
416398
});
417399
$I->wait(3);
418400
$I->see('Hello all!', '.message');
419-
?>
420401

421402
{% endhighlight %}
422403

423404
In this case we did some actions in second window with `does` command on a friend object.
424405

425406
Sometimes you may want to close a web page before the end of the test. For such cases you may use leave(). You can also specify roles for friend :
407+
426408
{% highlight php %}
427409

428410
<?php
429-
430411
$nickAdmin = $I->haveFriend('nickAdmin', adminStep::class);
431412
$nickAdmin->does(function(adminStep $I) {
432413
// Admin does ...
433414
});
434415
$nickAdmin->leave();
435-
?>
436416

437417
{% endhighlight %}
438418

439-
440419
### Cloud Testing
441420

442-
Selenium Webdriver allows to execute tests in real browsers on different platforms. Some environments are hard to be reproduced manually, testing Internet Explorer 6-8 on Windows XP may be a hard thing, especially if you don't have Windows XP installed. This is where Cloud Testing services come to help you. Services such as [SauceLabs](https://saucelabs.com), [BrowserStack](https://www.browserstack.com/) and [others](http://codeception.com/docs/modules/WebDriver#Cloud-Testing) can create virtual machine on demand and set up Selenium Server and desired browser. Tests are executed on a remote machine in a cloud, to access local files cloud testing service provides special application called **Tunnel**. Tunnel operates on secured protocol and allows browser executed in a cloud to connect to local web server.
421+
Selenium WeDdriver allows to execute tests in real browsers on different platforms. Some environments are hard to be reproduced manually, testing Internet Explorer 6-8 on Windows XP may be a hard thing, especially if you don't have Windows XP installed. This is where Cloud Testing services come to help you. Services such as [SauceLabs](https://saucelabs.com), [BrowserStack](https://www.browserstack.com/) and [others](http://codeception.com/docs/modules/WebDriver#Cloud-Testing) can create virtual machine on demand and set up Selenium Server and desired browser. Tests are executed on a remote machine in a cloud, to access local files cloud testing service provides special application called **Tunnel**. Tunnel operates on secured protocol and allows browser executed in a cloud to connect to local web server.
443422

444423
Cloud Testing services work with standard WebDriver protocol. This makes setting up cloud testing relly easy. You just need to set [configuration into WebDriver module](http://codeception.com/docs/modules/WebDriver#Cloud-Testing):
445424

@@ -487,7 +466,6 @@ Codeception modules can print valuable information while running. Just execute t
487466

488467
<?php
489468
codecept_debug($I->grabTextFrom('#name'));
490-
?>
491469

492470
{% endhighlight %}
493471

docs/04-FunctionalTests.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ $I->fillField('Password', 'Davis');
2424
$I->click('Enter');
2525
$I->see('Hello, Miles', 'h1');
2626
// $I->seeEmailIsSent() - special for Symfony2
27-
?>
2827

2928
{% endhighlight %}
3029

@@ -179,9 +178,8 @@ Therefore we can open a web page with `amOnPage` command.
179178
{% highlight php %}
180179

181180
<?php
182-
$I = new FunctionalTester;
181+
$I = new FunctionalTester($scenario);
183182
$I->amOnPage('/login');
184-
?>
185183

186184
{% endhighlight %}
187185

@@ -197,7 +195,6 @@ $I->click('Logout', '.nav');
197195
$I->click('a.logout');
198196
// click with strict locator
199197
$I->click(['class' => 'logout']);
200-
?>
201198

202199
{% endhighlight %}
203200

@@ -211,7 +208,6 @@ $I->submitForm('form#login', ['name' => 'john', 'password' => '123456']);
211208
$I->fillField('#login input[name=name]', 'john');
212209
$I->fillField('#login input[name=password]', '123456');
213210
$I->click('Submit', '#login');
214-
?>
215211

216212
{% endhighlight %}
217213

@@ -223,7 +219,6 @@ And do assertions:
223219
$I->see('Welcome, john');
224220
$I->see('Logged in successfully', '.notice');
225221
$I->seeCurrentUrlEquals('/profile/john');
226-
?>
227222

228223
{% endhighlight %}
229224

@@ -246,7 +241,6 @@ class Functional extends \Codeception\Module
246241
$service->doSomething();
247242
}
248243
}
249-
?>
250244

251245
{% endhighlight %}
252246

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