-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from punktDe/licenseReadmeAdditionalSteps
TASK: add license, readme and new module and steps
- Loading branch information
Showing
9 changed files
with
1,226 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?php | ||
namespace PunktDe\Codeception\Webdriver\ActorTraits; | ||
|
||
/* | ||
* This file is part of the PunktDe\Codeception-Webdriver package. | ||
* | ||
* This package is open source software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
trait Checks { | ||
|
||
/** | ||
* @Then I should see :text | ||
* @param string $text | ||
*/ | ||
public function iShouldSee(string $text) | ||
{ | ||
$this->see($text); | ||
} | ||
|
||
/** | ||
* @Then I should be on :url | ||
* @param string $url | ||
*/ | ||
public function iShouldBeOn(string $url) | ||
{ | ||
$this->seeInCurrentUrl($url); | ||
} | ||
|
||
/** | ||
* @Then I should see an :selector element | ||
* @param string $selector | ||
*/ | ||
public function iShouldSeeElement(string $selector) | ||
{ | ||
$this->seeElement($selector); | ||
} | ||
|
||
/** | ||
* @Given I should not see :text | ||
* @param string $text | ||
*/ | ||
public function iShouldNotSee(string $text) | ||
{ | ||
$this->dontSee($text); | ||
} | ||
|
||
/** | ||
* @Given I should not see an :selector element | ||
* @param string $selector | ||
*/ | ||
public function iShouldNotSeeElement(string $selector) | ||
{ | ||
$this->dontSeeElement($selector); | ||
} | ||
|
||
/** | ||
* @Given I see link with the text :text | ||
* @param string $text | ||
*/ | ||
public function iSeeLink(string $text) | ||
{ | ||
$this->seeLink($text); | ||
} | ||
|
||
/** | ||
* @Given I should see :text in page source | ||
* @param string $text | ||
*/ | ||
public function iShouldSeeInPageSource(string $text) | ||
{ | ||
$this->seeInPageSource($text); | ||
} | ||
|
||
/** | ||
* @Given I should see :value in :field field | ||
* @param string $value | ||
* @param string $field | ||
*/ | ||
public function iShouldSeeInField(string $value, string $field) | ||
{ | ||
$this->seeInField($field, $value); | ||
} | ||
|
||
/** | ||
* @Given I see checkbox :selector is checked | ||
* @param string $selector | ||
*/ | ||
public function checkboxIsChecked(string $selector) | ||
{ | ||
$this->seeCheckboxIsChecked($selector); | ||
} | ||
|
||
/** | ||
* @Given I see checkbox :selector is unchecked | ||
* @param string $selector | ||
*/ | ||
public function checkboxIsUnChecked(string $selector) | ||
{ | ||
$this->dontSeeCheckboxIsChecked($selector); | ||
} | ||
|
||
/** | ||
* @Given I should see :expected :selector elements | ||
* @param int $expected | ||
* @param string $selector | ||
*/ | ||
public function seeNElements(int $expected, string $selector) | ||
{ | ||
$this->seeNumberOfElements($selector, $expected); | ||
} | ||
|
||
/** | ||
* @Then I accept the open popup | ||
*/ | ||
public function iAcceptOpenPopup(): void | ||
{ | ||
$this->acceptPopup(); | ||
} | ||
|
||
/** | ||
* @Then I should see :text in :element element | ||
* @param string $text | ||
* @param string $selector | ||
*/ | ||
public function iShouldSeeTextInElement(string $text, string $selector): void | ||
{ | ||
$this->see($text, $selector); | ||
} | ||
|
||
/** | ||
* @Then I should see at least :number :selector elements | ||
* @param string $number | ||
* @param string $selector | ||
*/ | ||
public function iShouldSeeMinNumberOfElements(string $number, string $selector): void | ||
{ | ||
$this->seeNumberOfElements($selector, [$number, PHP_INT_MAX]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?php | ||
namespace PunktDe\Codeception\Webdriver\ActorTraits; | ||
|
||
/* | ||
* This file is part of the PunktDe\Codeception-Webdriver package. | ||
* | ||
* This package is open source software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
use WebDriverKeys; | ||
|
||
trait Controls { | ||
|
||
/** | ||
* @Given I am on :page | ||
* @param string $page | ||
*/ | ||
public function iAmOn(string $page): void | ||
{ | ||
$this->amOnPage($page); | ||
} | ||
|
||
/** | ||
* @Given I wait for the text :text | ||
* @Given /^I wait for the text (?P<pattern>"(?:[^"]|\\")*")$/ | ||
* @param string $text | ||
*/ | ||
public function iWaitForTheText(string $text): void | ||
{ | ||
$text = str_replace('\\', '', $text); | ||
$this->waitForText($text); | ||
} | ||
|
||
/** | ||
* @Given I fill in :field with :value | ||
* @param string $field | ||
* @param string $value | ||
*/ | ||
public function iFillInWith(string $field, string $value): void | ||
{ | ||
$this->fillField($field, $value); | ||
} | ||
|
||
/** | ||
* @Given I click on :element | ||
* @param string $element | ||
*/ | ||
public function iClickOn(string $element): void | ||
{ | ||
$this->click($element); | ||
} | ||
|
||
/** | ||
* @Given I press enter on :element | ||
* @param string $element | ||
*/ | ||
public function iPressEnter(string $element): void | ||
{ | ||
$this->pressKey($element, WebDriverKeys::ENTER); | ||
} | ||
|
||
/** | ||
* @Then I select :value from :field | ||
* @Then I select :field :value | ||
* @param string $value | ||
* @param string $field | ||
*/ | ||
public function iSelectFrom(string $value, string $field): void | ||
{ | ||
$this->selectOption($field, $value); | ||
} | ||
|
||
/** | ||
* @Then I check option :option | ||
* @param string $option | ||
*/ | ||
public function iCheckOption(string $option): void | ||
{ | ||
$this->checkOption($option); | ||
} | ||
|
||
/** | ||
* @Given I wait for :seconds seconds | ||
* @param int $seconds | ||
*/ | ||
public function iWaitForSeconds(int $seconds): void | ||
{ | ||
$this->wait($seconds); | ||
} | ||
|
||
/** | ||
* @Then I uncheck option :option | ||
* @param string $option | ||
*/ | ||
public function iUncheckOption(string $option): void | ||
{ | ||
$this->uncheckOption($option); | ||
} | ||
|
||
/** | ||
* @Then I attach :field the :file | ||
* @param string $field | ||
* @param string $filename | ||
*/ | ||
public function attachFileTo(string $field, string $filename): void | ||
{ | ||
$this->attachFile($field, $filename); | ||
} | ||
|
||
/** | ||
* @Given I click on :element inside :id | ||
* @param string $element | ||
* @param string $id | ||
*/ | ||
public function iClickOnInside(string $element, string $id): void | ||
{ | ||
$this->click($element, '#' . $id); | ||
} | ||
|
||
/** | ||
* @Then I execute JS :script | ||
* @param string $script | ||
*/ | ||
public function iExecuteJS(string $script): void | ||
{ | ||
$this->executeJS($script); | ||
} | ||
|
||
/** | ||
* @Then I move mouse over :select | ||
* @param string $select | ||
*/ | ||
public function iMoveMouseOver(string $select): void | ||
{ | ||
$this->moveMouseOver($select); | ||
} | ||
|
||
/** | ||
* @Then I submit form :form | ||
* @param string $form | ||
*/ | ||
public function iSubmitForm(string $form): void | ||
{ | ||
$this->submitForm($form, []); | ||
} | ||
|
||
/** | ||
* @Then I submit form :form with :values | ||
* @param string $form | ||
* @param array $values | ||
*/ | ||
public function iSubmitFormWithValues(string $form, array $values): void | ||
{ | ||
$this->submitForm($form, $values); | ||
} | ||
|
||
/** | ||
* @Then I wait for invisible :selector in :seconds | ||
* @param string $selector | ||
* @param int $seconds | ||
*/ | ||
public function iWaitForElementNotVisible(string $selector, int $seconds): void | ||
{ | ||
$this->waitForElementNotVisible($selector, $seconds); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
namespace PunktDe\Codeception\Webdriver\ActorTraits; | ||
|
||
/* | ||
* This file is part of the PunktDe\Codeception-Webdriver package. | ||
* | ||
* This package is open source software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
trait Cookie { | ||
/** | ||
* @Then the cookie :cookie has value :value | ||
*/ | ||
public function cookieHasValue($cookie, $value) | ||
{ | ||
$this->seeCookie($cookie); | ||
$actualCookie = $this->grabCookie($cookie); | ||
if ($actualCookie !== $value) { | ||
throw new \Exception(sprintf('Cookie "%s" doesn\'t have expected value "%s", actual value is "%s"', $cookie, $value, $actualCookie), 1552656511); | ||
} | ||
} | ||
|
||
/** | ||
* @Then I set cookie :cookie with value :value | ||
*/ | ||
public function iSetCookie($cookie, $value) | ||
{ | ||
$this->setCookie($cookie, $value); | ||
} | ||
|
||
/** | ||
* @Then I remove cookie :cookie | ||
*/ | ||
public function iRemoveCookie($cookie) | ||
{ | ||
$this->resetCookie($cookie); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
namespace PunktDe\Codeception\Webdriver\ActorTraits; | ||
|
||
/* | ||
* This file is part of the PunktDe\Codeception-Webdriver package. | ||
* | ||
* This package is open source software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
trait Storage { | ||
/** | ||
* @Given I memorize the text in the :selector element | ||
* @param string $selector | ||
*/ | ||
public function iMemorizeTextInElement(string $selector): void | ||
{ | ||
$this->storeTextOfElement($selector); | ||
} | ||
|
||
/** | ||
* @Given I forget the memorized text | ||
*/ | ||
public function iForgetText(): void | ||
{ | ||
$this->clearTextStore(); | ||
} | ||
|
||
/** | ||
* @Given the text in the :selector element should be different from memorized | ||
* @param string $selector | ||
*/ | ||
public function elementTextShouldBeDifferentFromMemorized(string $selector): void | ||
{ | ||
$this->elementTextShouldNotBeEqualToStore($selector); | ||
} | ||
} |
Oops, something went wrong.