From 184add30595ceb2869e6bd6cb2dc06e53b8e989f Mon Sep 17 00:00:00 2001 From: Julien Mercier-Rojas Date: Tue, 30 Apr 2019 09:55:08 +0200 Subject: [PATCH 1/4] :sparkles: Add select form snippets --- src/WebdriverContext.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/WebdriverContext.php b/src/WebdriverContext.php index 4b25b82..bf03cbc 100644 --- a/src/WebdriverContext.php +++ b/src/WebdriverContext.php @@ -123,6 +123,16 @@ public function iResizeWindow(int $width, int $height) $this->webDriver->resizeWindow($width, $height); } + /** + * @Then I select option :option of :select + * @param string $option + * @param string $select + */ + public function iSelectOptionOf(string $option, string $select) + { + $this->webDriver->selectOption($select, $option); + } + /** * @Then I should not see :text * @param string $text @@ -251,6 +261,16 @@ public function iShouldSeeLinkWithUrl(string $link, string $url) $this->webDriver->seeLink($link, $url); } + /** + * @Then I should see option :option is selected in :select + * @param string $option + * @param string $select + */ + public function iShouldSeeOptionIsSelectedIn(string $option, string $select) + { + $this->webDriver->seeOptionIsSelected($select, $option); + } + /** * @When I submit form :form * @param string $form From ca9e6d8d1c5cc3e39c5a67dee69c0feba18baff4 Mon Sep 17 00:00:00 2001 From: Julien Mercier-Rojas Date: Tue, 7 May 2019 12:53:43 +0200 Subject: [PATCH 2/4] :construction: Init Db context --- src/DbContext.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/DbContext.php diff --git a/src/DbContext.php b/src/DbContext.php new file mode 100644 index 0000000..7fea687 --- /dev/null +++ b/src/DbContext.php @@ -0,0 +1,39 @@ + "Db module required", + ]; + } + // phpcs:enable + + // phpcs:disable + /** + * @param Db $dbc + */ + public function _inject(Db $dbc) + { + $this->dbc = $dbc; + } + // phpcs:enable +} From 2fb2d347416775d378c9bd8eabd418ef102d1505 Mon Sep 17 00:00:00 2001 From: Julien Mercier-Rojas Date: Tue, 7 May 2019 12:54:24 +0200 Subject: [PATCH 3/4] :rotating_light: Fix CS --- src/WebdriverContext.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/WebdriverContext.php b/src/WebdriverContext.php index bf03cbc..69a5c00 100644 --- a/src/WebdriverContext.php +++ b/src/WebdriverContext.php @@ -11,6 +11,7 @@ * Class WebdriverHelper * @package Jeckel\GherkinHelper * @SuppressWarnings(PHPMD.TooManyPublicMethods) + * @SuppressWarnings(PHPMD.TooManyMethods) */ class WebdriverContext extends ContextAbstract implements DependsOnModule { @@ -233,6 +234,16 @@ public function iShouldSeeInCurrentUrl(string $uri) $this->webDriver->seeInCurrentUrl($uri); } + /** + * @Then I should see :value in field :field + * @param string $value + * @param string $field + */ + public function iShouldSeeInField(string $value, string $field) + { + $this->webDriver->seeInField($field, $value); + } + /** * @Then I should see in source * @param string $raw From 4cf392e738437fe3c6b2d648be58a293eef5643d Mon Sep 17 00:00:00 2001 From: Julien Mercier-Rojas Date: Tue, 21 May 2019 16:56:39 +0200 Subject: [PATCH 4/4] :mute: Remove var_dump --- src/RestContext.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/RestContext.php b/src/RestContext.php index 61352af..239a4f4 100644 --- a/src/RestContext.php +++ b/src/RestContext.php @@ -182,7 +182,6 @@ public function iShouldSeeResponseContainsJSONFromFile(string $filepath) */ protected function checkResponseContainsJson(string $jsonString) { - var_dump($jsonString); $json = json_decode($jsonString, true); if (null === $json && json_last_error() != JSON_ERROR_NONE) {