Skip to content

Commit 07019b9

Browse files
[WIP] improving example.
1 parent 7af829d commit 07019b9

File tree

10 files changed

+37
-1152
lines changed

10 files changed

+37
-1152
lines changed

Features/bootstrap/MainContext.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,40 @@ class MainContext extends QAToolsContext
66
{
77

88
/**
9-
* @When /^the user enters (.+?) and (.+?)$/
9+
* @Given I'm on ':page'
1010
*/
11-
public function fillForm($username, $password)
11+
public function openPage($page)
1212
{
13-
$this->page->fillForm($username, $password);
13+
$this->page = $this->pageFactory->getPage($page);
14+
$this->page->open();
1415
}
1516

1617
/**
17-
* @Then /^the login should fail$/
18+
* @When I login with ':username' and ':password'
1819
*/
19-
public function loginFail()
20+
public function login($username, $password)
2021
{
21-
$this->page = $this->page->loginFailure();
22+
$this->page->login($username, $password);
2223
}
2324

2425
/**
25-
* @Then /^the login should succeed/
26+
* @Then I should be on ':page'
2627
*/
27-
public function loginSucceed()
28+
public function pageOpen($page)
2829
{
29-
$this->page = $this->page->loginSuccess();
30+
$this->page = $this->pageFactory->getPage($page);
31+
32+
if ( !$this->page->opened() ) {
33+
throw new Exception($page . ' is not open!');
34+
}
35+
}
36+
37+
/**
38+
* @Then I should see ':message' error message
39+
*/
40+
public function errorMessageVisible($message)
41+
{
42+
3043
}
3144

3245
/**

Fixtures/account.html

100644100755
File mode changed.

Fixtures/additional.css

100644100755
File mode changed.

Fixtures/index.html

100644100755
File mode changed.

Fixtures/login.php

100644100755
File mode changed.

behat.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ default:
1414

1515
QATools\BehatExtension:
1616
qa_tools:
17-
base_url: 'http://localhost'
18-
page_namespace_§prefix: ['\QATools\Example\Pages']
17+
base_url: 'http://behat-example.qa-tools.io'
18+
page_namespace_prefix: ['\QATools\Example\Pages']

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
"behat/behat": "~3.0",
88
"behat/mink-extension": "~2.0",
99
"mindplay/annotations": "~1.2@dev",
10-
"qa-tools/qa-tools": "dev-develop",
11-
"qa-tools/behat-extension": "dev-master"
10+
"qa-tools/qa-tools": "dev-121-page-matcher",
11+
"qa-tools/behat-extension": "dev-cleanup"
1212
},
1313
"repositories": [
14-
{
14+
{
15+
"type": "vcs",
16+
"url": "https://github.com/evangelion1204/qa-tools.git"
17+
},
18+
{
1519
"type": "vcs",
1620
"url": "https://github.com/evangelion1204/behat-extension.git"
1721
}

0 commit comments

Comments
 (0)