You are here

public function SocialMinkContext::attachFileToHiddenField in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  2. 8.3 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  3. 8.4 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  4. 8.5 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  5. 8.6 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  6. 8.7 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  7. 8.8 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  8. 10.3.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  9. 10.0.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()
  10. 10.1.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::attachFileToHiddenField()

Attaches file to field with specified name.

@When /^(?:|I )attach the file "(?P<path>[^"]*)" to hidden field "(?P<field>(?:[^"]|\\")*)"$/

File

tests/behat/features/bootstrap/SocialMinkContext.php, line 150

Class

SocialMinkContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function attachFileToHiddenField($field, $path) {
  $field = $this
    ->fixStepArgument($field);
  $id = $this
    ->getSession()
    ->getPage()
    ->findField($field)
    ->getAttribute('id');
  $javascript = "jQuery('#{$id}').parent().removeClass('hidden')";
  $this
    ->getSession()
    ->executeScript($javascript);
  $this
    ->attachFileToField($field, $path);
}