Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

✨ Add select form snippets #10

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/DbContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Jeckel\Gherkin;

use Behat\Gherkin\Node\TableNode;
use Codeception\Lib\Interfaces\DependsOnModule;
use Codeception\Module\Db;

/**
* Class DbContext
* @package Jeckel\Gherkin
*/
class DbContext extends ContextAbstract implements DependsOnModule
{
/** @var Db */
protected $dbc;

// phpcs:disable
/**
* @return array|mixed
*/
public function _depends()
{
return [
Db::class => "Db module required",
];
}
// phpcs:enable

// phpcs:disable
/**
* @param Db $dbc
*/
public function _inject(Db $dbc)
{
$this->dbc = $dbc;
}
// phpcs:enable
}
1 change: 0 additions & 1 deletion src/RestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
31 changes: 31 additions & 0 deletions src/WebdriverContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Class WebdriverHelper
* @package Jeckel\GherkinHelper
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.TooManyMethods)
*/
class WebdriverContext extends ContextAbstract implements DependsOnModule
{
Expand Down Expand Up @@ -123,6 +124,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
Expand Down Expand Up @@ -223,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
Expand Down Expand Up @@ -251,6 +272,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
Expand Down