Behat: And I fill in the following step throwing error when I use it for drop down boxes

Bug #1449334 reported by Jinelle Foley-Barnes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon
15.04
Fix Released
High
Robert Lyon
15.10
Fix Released
Undecided
Unassigned

Bug Description

Hi,

While writing a Behat test for a bug I used the step And I set the following fields to these values:
for selecting the different types of Social media under Content.

The firefox window stayed open and the console gave me this output and stopped the test from running any further. I have attached a segment of the test to test with.

The Behat test environment has been already installed and enabled

Acceptance tests environment enabled on http://localhost:8000, to run the tests use:
 /vendor/bin/behat --config /var/www/maharagerritdata/behat/behat/behat.yml

Start Selenium...
Selenium started
Start PHP server
Run Behat...
Only run tests with the tag: @jinelle

==================================================

Mahara , postgres
Server OS "Linux", Browser: "firefox"
Started at 28-04-2015, 14:00
......PHP Fatal error: Class 'behat_base' not found in /var/www/html/maharagerrit/htdocs/testing/frameworks/behat/classes/FormFields/BehatFormSelect.php on line 92
PHP Stack trace:
PHP 1. {main}() /var/www/html/maharagerrit/external/vendor/behat/behat/bin/behat:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/html/maharagerrit/external/vendor/behat/behat/bin/behat:32
PHP 3. Behat\Behat\Console\BehatApplication->doRun() /var/www/html/maharagerrit/external/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 4. Symfony\Component\Console\Application->doRun() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php:68
PHP 5. Symfony\Component\Console\Application->doRunCommand() /var/www/html/maharagerrit/external/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() /var/www/html/maharagerrit/external/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Behat\Behat\Console\Command\BehatCommand->execute() /var/www/html/maharagerrit/external/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 8. Behat\Behat\Console\Command\BehatCommand->runFeatures() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:128
PHP 9. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:150
PHP 10. Behat\Behat\Tester\FeatureTester->visit() /var/www/html/maharagerrit/external/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 11. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/FeatureTester.php:88
PHP 12. Behat\Behat\Tester\ScenarioTester->visit() /var/www/html/maharagerrit/external/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 13. Behat\Behat\Tester\ScenarioTester->visitStep() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php:87
PHP 14. Behat\Gherkin\Node\AbstractNode->accept() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php:148
PHP 15. Behat\Behat\Tester\StepTester->visit() /var/www/html/maharagerrit/external/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
PHP 16. Behat\Behat\Tester\StepTester->executeStep() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:95
PHP 17. Behat\Behat\Tester\StepTester->executeStepDefinition() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:126
PHP 18. Behat\Behat\Definition\Annotation\Definition->run() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php:157
PHP 19. call_user_func_array() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Definition/Annotation/Definition.php:155
PHP 20. BehatForms->i_set_the_following_fields_to_these_values() /var/www/html/maharagerrit/external/vendor/behat/behat/src/Behat/Behat/Definition/Annotation/Definition.php:155
PHP 21. BehatForms->set_field_value() /var/www/html/maharagerrit/htdocs/testing/frameworks/behat/classes/BehatForms.php:45
PHP 22. BehatFormSelect->set_value() /var/www/html/maharagerrit/htdocs/testing/frameworks/behat/classes/BehatForms.php:320
Shutdown Selenium
Shutdown PHP server

Thanks,
Jinelle

Revision history for this message
Jinelle Foley-Barnes (jinelleb) wrote :
description: updated
Robert Lyon (robertl-9)
Changed in mahara:
status: New → In Progress
importance: Medium → High
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/4708

Revision history for this message
Robert Lyon (robertl-9) wrote :

Error stems from copying code from moodle and it using slightly different name for behat base class

behat_base vs BehatBase

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
tags: added: no-behat-needed
Revision history for this message
Jinelle Foley-Barnes (jinelleb) wrote :

Hi Rob,

I ran it and this is the output that I got.

Acceptance tests environment enabled on http://localhost:8000, to run the tests use:
 /vendor/bin/behat --config /var/www/maharagerritdata/behat/behat/behat.yml

Start Selenium...
Selenium started
Start PHP server
Run Behat...
Only run tests with the tag: @jinelle

==================================================

@javascript @core @core_artefact @jinelle
Feature: Visibility of social medial buttons
  In order to view and click on the social media buttons
  As a student
  So I can view others social media pages

  Background: # /var/www/html/maharagerrit/test/behat/features/testing_patch.feature:7
    Given the following "users" exist: # BehatDataGenerators::the_following_exist()
      | username | password | email | firstname | lastname | institution | authname | role |
      | userA | Password1 | <email address hidden> | Thor | Almighty | mahara | internal | member |
    And the following "users" exist: # BehatDataGenerators::the_following_exist()
      | username | password | email | firstname | lastname | institution | authname | role |
      | userB | Password1 | <email address hidden> | Iron | Man | mahara | internal | member |

  Scenario: Creating and accessing social media buttons (Bug 1448948) # /var/www/html/maharagerrit/test/behat/features/testing_patch.feature:16
    Given I log in as "userA" with password "Password1" # BehatGeneral::i_login_as()
    And I follow "Content" # BehatMaharaInitContext::clickLink()
    And I follow "Social media" # BehatMaharaInitContext::clickLink()
    And I follow "New social media account" # BehatMaharaInitContext::clickLink()
    And I set the following fields to these values: # BehatForms::i_set_the_following_fields_to_these_values()
      | Social network * | Facebook URL |
      | Your URL or username * | facebook.com |
      Notice: Undefined property: BehatFormSelect::$escaper in /var/www/html/maharagerrit/htdocs/testing/frameworks/behat/classes/FormFields/BehatFormSelect.php line 334
    And I press "Save" # BehatMaharaInitContext::pressButton()

1 scenario (1 failed)
8 steps (6 passed, 1 skipped, 1 failed)
0m23.618s
Shutdown Selenium
Shutdown PHP server
((a8e0ed7...))jinelleb@boris:/var/www/html/maharagerrit$

Cheers,
Jinelle

tags: added: needs-behat
removed: no-behat-needed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/4708
Committed: http://gitorious.org/mahara/mahara/commit/88b0ef49a9652764790fdedd68d6a6c20692e713
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 88b0ef49a9652764790fdedd68d6a6c20692e713
Author: Robert Lyon <email address hidden>
Date: Tue Apr 28 16:32:48 2015 +1200

Changing moodle specific behat_base to mahara specific BehatBase

Bug #1449334

There are a few places that try to access the BehatBase constants via
using behat_base but that is not correct.

Also the way we access get_option_xpath is slightly different to the
way moodle now does it

Change-Id: I5fea9db5f135e4808af08ee83da1e9c58d09feca
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/4733

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/4733
Committed: http://gitorious.org/mahara/mahara/commit/d3d3f34e993e56df034cba1a1f494e48aa3e637a
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit d3d3f34e993e56df034cba1a1f494e48aa3e637a
Author: Robert Lyon <email address hidden>
Date: Tue Apr 28 16:32:48 2015 +1200

Changing moodle specific behat_base to mahara specific BehatBase

Bug #1449334

There are a few places that try to access the BehatBase constants via
using behat_base but that is not correct.

Also the way we access get_option_xpath is slightly different to the
way moodle now does it

Change-Id: I5fea9db5f135e4808af08ee83da1e9c58d09feca
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.