FeatureContext.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. use Behat\Behat\Context\ClosuredContextInterface,
  3. Behat\Behat\Context\TranslatedContextInterface,
  4. Behat\Behat\Context\BehatContext,
  5. Behat\Behat\Exception\PendingException;
  6. use Behat\Gherkin\Node\PyStringNode,
  7. Behat\Gherkin\Node\TableNode;
  8. use Behat\MinkExtension\Context\MinkContext;
  9. //
  10. // Require 3rd-party libraries here:
  11. //
  12. // require_once 'PHPUnit/Autoload.php';
  13. // require_once 'PHPUnit/Framework/Assert/Functions.php';
  14. //
  15. /**
  16. * Features context.
  17. */
  18. class FeatureContext extends MinkContext
  19. {
  20. /**
  21. * Initializes context.
  22. * Every scenario gets its own context object.
  23. *
  24. * @param array $parameters context parameters (set them up through behat.yml)
  25. */
  26. public function __construct(array $parameters)
  27. {
  28. // Initialize your context here
  29. }
  30. /**
  31. * @Given /^I click on "([^"]*)"$/
  32. */
  33. public function iClickOn($arg1)
  34. {
  35. # $findName = $this->getSession()->getPage()->find("css", $arg1);
  36. # if (!$findName) {
  37. # throw new Exception($arg1 . " could not be found");
  38. # } else {
  39. # $findName->click();
  40. # }
  41. }
  42. /**
  43. * @Given /^there are clients:$/
  44. */
  45. public function thereAreClients(TableNode $table)
  46. {
  47. foreach ($table->getHash() as $row => $val) {
  48. echo $val['name'] . " - " . $val['Teléfono'] ."\n";
  49. }
  50. # css=a[id$='_id_sufix'];
  51. }
  52. /**
  53. * @Given /^espero a que se cargue$/
  54. */
  55. public function esperoAQueSeCargue()
  56. {
  57. $this->getSession()->wait(5000);
  58. }
  59. /**
  60. * @Given /^relleno el campo "([^"]*)" con "([^"]*)"$/
  61. */
  62. public function rellenoElCampoCon($arg1, $arg2)
  63. {
  64. # $rem = ("[id*=$arg1]");
  65. # echo $rem;
  66. $dom = new DomDocument;
  67. //load the html into the object
  68. $dom->loadHTML($html);
  69. //discard white space
  70. $dom->preserveWhiteSpace = false;
  71. $input_tags = $dom->getElementsByTagName('input');
  72. echo $input_tags;
  73. # $element = getElementById("[id*=$arg1]");
  74. # $element = $page->findAll('id', $arg1);
  75. }
  76. //
  77. // Place your definition and hook methods here:
  78. //
  79. // /**
  80. // * @Given /^I have done something with "([^"]*)"$/
  81. // */
  82. // public function iHaveDoneSomethingWith($argument)
  83. // {
  84. // doSomethingWith($argument);
  85. // }
  86. //
  87. }