Skip to content
Snippets Groups Projects
Commit 1e0617af authored by Kumiko Ono's avatar Kumiko Ono Committed by Yas Naoi
Browse files

Issue #3274116 by kumikoono, yas: Refactor composer.json to use docomoinnovations/drupal-extension

parent 96870084
No related branches found
No related tags found
5 merge requests!1759Issue #3356778: Release 5.1.1,!1679Issue #3349074: Fix the OpenStack Project create and edit form in SPA that "Member" cannot be saved due to a validation error,!1607Issue #3343582: Add the function to preview OpenStack stack in the SPA,!1032Issue #3284576: Release 5.0.0-alpha2,!832Issue #3274116: Refactor composer.json to use docomoinnovations/drupal-extension
......@@ -6,6 +6,7 @@ default:
contexts:
- Drupal\Tests\aws_cloud\Behat\features\bootstrap\FeatureContext
- Drupal\Tests\cloud\Behat\features\bootstrap\FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
......
......@@ -6,6 +6,7 @@ default:
contexts:
- Drupal\Tests\k8s\Behat\features\bootstrap\FeatureContext
- Drupal\Tests\cloud\Behat\features\bootstrap\FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
......
......@@ -9,7 +9,7 @@ default:
# See https://behat-drupal-extension.readthedocs.io/en/v4.0.1/contexts.html
- Drupal\Tests\cloud\Behat\features\bootstrap\FeatureContext
# Provides step-definitions for creating users, terms, and nodes.
# - Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\DrupalContext
# Builds on top of the Mink Extension and adds steps specific to regions
# and forms.
- Drupal\DrupalExtension\Context\MinkContext
......@@ -49,10 +49,11 @@ default:
# drupal api driver: limitation is that the tests must run on the
# same server as the Drupal site set by the base_url above.
api_driver: 'drupal'
# Comment if no $BEHAT_PARAMS is set.
drush:
alias: 'local'
# Uncomment if no $BEHAT_PARAMS is set.
# drupal:
# Uncomment if no $BEHAT_PARAMS is set.
# drupal:
# drupal_root: '/var/www/html/web'
region_map:
actions: ".local-actions"
......@@ -70,3 +71,6 @@ default:
error_message_selector: '.alert-error'
success_message_selector: '.alert-success'
warning_message_selector: '.alert-warning'
# The following parameter is enabled by docomoinnovations/drupal-extension.
screenshot:
path: sites/screenshots
......@@ -2,12 +2,12 @@
namespace Drupal\Tests\cloud\Behat\features\bootstrap;
use Drupal\DrupalExtension\Context\DrupalContext;
use Drupal\DrupalExtension\Context\RawDrupalContext;
/**
* Defines application features from the specific context.
*/
class FeatureContext extends DrupalContext {
class FeatureContext extends RawDrupalContext {
/**
* Initializes context.
......@@ -19,91 +19,4 @@ class FeatureContext extends DrupalContext {
public function __construct() {
}
/**
* Wait specified milliseconds.
*
* @When I wait :msec milliseconds
*/
public function waitMilliSeconds($msec): void {
usleep($msec * 1000);
}
/**
* Find text in a table row containing given text.
*
* @Then I should see (the text ):text1 or :text2 in the :rowText row
*/
public function assertTextOrInTableRow($text1, $text2, $rowText): void {
$row = $this->getTableRow($this->getSession()->getPage(), $rowText);
if (strpos($row->getText(), $text1) === FALSE && strpos($row->getText(), $text2) === FALSE) {
throw new \RuntimeException(sprintf('Found a row containing "%s", but it contained neither the text "%s" nor "%s".', $rowText, $text1, $text2));
}
}
/**
* Check a box in a table row containing given text.
*
* @When I check the box in the :rowText row
*/
public function checkBoxInTableRow($rowText): void {
$row = $this->getTableRow($this->getSession()->getPage(), $rowText);
$input = $row->find('css', 'input');
$input->check();
}
/**
* Fill in a form field w/ id|name|title|alt|value in the specified table row.
*
* @When I fill in :value for :field in the row :row in the :region( region)
*/
public function fillFieldInTableRowInRegion($value, $field, $row, $region): void {
$regionObj = $this->getRegion($region);
$tableRowSelector = sprintf('.row-%d', intval($row));
$rowObj = $regionObj->find('css', $tableRowSelector);
$rowObj->fillField($field, $value);
}
/**
* Follows link in a table row with given value set in specified field.
*
* @When I follow/click :link in a row with :value set in :field in the :region( region)
*/
public function followLinkInTableRowWithValueInRegion($link, $value, $field, $region): void {
$regionObj = $this->getRegion($region);
$rows = $regionObj->findAll('css', 'table > tbody > tr');
foreach ($rows as $row) {
$fieldObj = $row->findField($field);
if (strpos($fieldObj->getValue(), $value) === FALSE) {
continue;
}
$row->clickLink($link);
return;
}
}
/**
* Find text in a table row containing given text in specified region.
*
* @Then I should see (the text ):text in the :rowText row in the :region( region)
*/
public function assertTextInTableRowInRegion($text, $rowText, $region): void {
$regionObj = $this->getRegion($region);
$row = $this->getTableRow($regionObj, $rowText);
if (strpos($row->getText(), $text) === FALSE) {
throw new \Exception(sprintf("The text '%s' was not found in the row with '%s' in the region '%s' on the page %s", $text, $rowText, $region, $this->getSession()->getCurrentUrl()));
}
}
/**
* Return a region from the current page.
*/
private function getRegion($region) {
$session = $this->getSession();
$regionObj = $session->getPage()->find('region', $region);
if (!$regionObj) {
throw new \Exception(sprintf('No region "%s" found on the page %s.', $region, $session->getCurrentUrl()));
}
return $regionObj;
}
}
......@@ -99,7 +99,7 @@ function require_module() {
function setup() {
run_pushd "${DRUPAL_HOME}"
require_module drupal/drupal-extension
require_module docomoinnovations/drupal-extension
require_module dmore/behat-chrome-extension
# Remove once this patch is unneeded.
local dest='DevToolsConnection.php'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment