Commit d08c95a9 authored by Robert Lyon's avatar Robert Lyon

Adjusting behat to run Selenium2 with the 64 bit Chrome driver

For both normal and headless

behatnotneeded - testing behat itself

Change-Id: If5595809ed871a5a81ef0f8710bb49f076083261
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 1463b86d
......@@ -156,16 +156,12 @@ class BehatConfigManager {
'Behat\MinkExtension' => array(
'base_url' => $CFG->behat_wwwroot,
'files_path' => get_mahararoot_dir() . '/test/behat/upload_files',
'sessions' => array(
'default' => array(
'selenium2' => array (
'wd_host' => $CFG->behat_selenium2
),
),
'headless' => array(
'goutte' => null
),
'javascript_session' => 'selenium2',
'selenium2' => array(
'browser' => 'chrome',
'wd_host' => $CFG->behat_selenium2
),
'goutte' => null,
),
),
'suites' => $suites
......
......@@ -58,9 +58,7 @@ class BehatGeneral extends BehatBase {
* @Given /^I log out$/
*/
public function i_logout() {
$this->visitPath("/");
$this->wait_until_the_page_is_ready();
$this->i_follow_in_the("Logout", "//header//li[contains(concat(' ', normalize-space(@class), ' '), ' btn-logout ')]", "xpath_element");
$this->visitPath("/?logout");
}
/**
......@@ -324,7 +322,7 @@ class BehatGeneral extends BehatBase {
}
$node = $this->get_selected_node('field', $nodeelement);
// Note: keyPres does not work with all drivers
$node->keyPress($key_press);
}
......
......@@ -15,6 +15,7 @@ Scenario: Editing admin profile page (Bug: 1426983)
| Student ID | 1234 |
| Display name | Test Admin |
# Updating Contact information tab
And I scroll to the top
And I follow "Contact information"
And I press "Add email address"
And I fill in the following:
......
......@@ -41,7 +41,7 @@ Scenario: Enable/disable external resources in mahara pages
| Block title | Text block with an external image |
| Block content | <p><img title="Open source logo" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Opensource.svg/744px-Opensource.svg.png" alt="" width="300" /></p> |
And I press "Save"
And I scroll to the id "main-nav"
And I scroll to the top
And I follow "Display page"
Then I should see images in the block "Text block with an internal image"
And I should see images in the block "Text block with an external image"
......
......@@ -46,8 +46,10 @@ Scenario: Clicking randomly around Mahara (Bug: 1426983)
And I choose "Institution membership" in "Groups"
And I choose "Topics" in "Groups"
# Checking messages
And I follow "mail"
And I follow "Inbox"
# And I click on "Show User Menu" # problem with chrome driver clicking on user icon instead
# And I follow "mail"
And I choose "mail" from user menu by id
And I follow "Inbox" in the ".arrow-bar" "css_element"
And I follow "Sent"
And I follow "Compose"
# Checking Homepage
......
......@@ -10,7 +10,7 @@ Scenario: sql injection attempt on search field
And I wait "1" seconds
When I set the following fields to these values:
| Search users | 'or 1=1;-- |
And I press the key "Enter" in the "Search users" field
And I press "Go"
Then I should see "No search results found"
......@@ -22,6 +22,7 @@ Scenario: Making adjustments to the mathslate plugin for mahara (Bug 1472446)
And I choose "Pages" in "Configure site"
And I follow "test"
# Tinymce field adding a math equation
And I scroll to the id "feedbacktable"
And I fill in "\\[\\alpha A\\beta B\\]" in editor "Message"
And I press "Comment"
And I wait "1" seconds
......
......@@ -133,7 +133,7 @@ Scenario: Newly created user can get a copy of the journal (Bug 1472467)
| Email * | test01@example.com |
| Username * | userA |
| Password * | KKJHH$$67686 |
And I press the key "Enter" in the "Username" field
And I press "Create user"
# Logging in as new user
And I follow "Log in as this user"
And I follow "log in anyway"
......
......@@ -19,17 +19,17 @@ Scenario: Turning on and off switches in the group forums tab (Bug 1431569)
# Checking "Automatically subscribe users" switchbox is on by default
And the "edit_interaction_autosubscribe" checkbox should be checked
# Checking it can be turned off
When I uncheck "edit_interaction_autosubscribe"
And I disable the switch "Automatically subscribe users"
# Checking it can turn back on
Then I check "edit_interaction_autosubscribe"
And I enable the switch "Automatically subscribe users"
# Verifying that it did turn back on
And the "edit_interaction_autosubscribe" checkbox should be checked
# Checking off is the default setting on the close new topics checkbox
And the "edit_interaction_closetopics" checkbox should not be checked
# Checking it turns on
And I check "edit_interaction_closetopics"
And I enable the switch "Close new topics"
# Checking it turns back off
And I uncheck "edit_interaction_closetopics"
And I disable the switch "Close new topics"
And I press "Save"
# And I add another forum
And I follow "Forums"
......
......@@ -65,7 +65,7 @@ Scenario: Clicking ID's (Bug 1428456)
| Block title | Crime and punishment |
| Block content | <p>On an exceptionally hot evening early in July a young man came out of the garret in which he lodged in S. Place and walked slowly, as though in hesitation, towards K. bridge...</p> |
And I close the config dialog
And I scroll to the id "main-nav"
And I scroll to the top
# Checking if we can change page layout
When I follow "Edit layout"
......
......@@ -5,7 +5,7 @@ ACTION=$1
SCRIPTPATH=`readlink -f "${BASH_SOURCE[0]}"`
MAHARAROOT=`dirname $( dirname $( dirname "$SCRIPTPATH" ))`
SERVER=0
test -z $SELENIUM_PORT && export SELENIUM_PORT=4400
test -z $SELENIUM_PORT && export SELENIUM_PORT=4444
test -z $PHP_PORT && export PHP_PORT=8000
test -z $XVFB_PORT && export XVFB_PORT=10
......@@ -103,6 +103,8 @@ then
SELENIUM_FILENAME=selenium-server-standalone-$SELENIUM_VERSION_MAJOR.$SELENIUM_VERSION_MINOR.jar
SELENIUM_PATH=./test/behat/$SELENIUM_FILENAME
# @todo make this more flexible, cross-platform?
CHROMEDRIVER_PATH=./test/behat/chromedriver-2.26-linux64
# If no Selenium installed, download it
if [ ! -f $SELENIUM_PATH ]; then
......@@ -115,11 +117,10 @@ then
then
# we want to run selenium headless on a different display - this allows for that ;)
echo "Starting Xvfb ..."
Xvfb :${XVFB_PORT} -ac > /tmp/xvfb.log 2>&1 & echo "PID [$!]"
DISPLAY=:${XVFB_PORT} nohup java -jar $SELENIUM_PATH -port ${SELENIUM_PORT} > /tmp/selenium.log 2>&1 & echo $!
Xvfb :${XVFB_PORT} -ac > /tmp/xvfb-${XVFB_PORT}.log 2>&1 & echo "PID [$!]"
DISPLAY=:${XVFB_PORT} nohup java -Dwebdriver.chrome.driver=$CHROMEDRIVER_PATH -jar $SELENIUM_PATH -port ${SELENIUM_PORT} -log /tmp/selenium-${SELENIUM_PORT}.log > /tmp/selenium-${SELENIUM_PORT}.log 2>&1 & echo $!
else
java -jar $SELENIUM_PATH -port ${SELENIUM_PORT} &> /tmp/selenium.log &
java -Dwebdriver.chrome.driver=$CHROMEDRIVER_PATH -jar $SELENIUM_PATH -port ${SELENIUM_PORT} -log /tmp/selenium-${SELENIUM_PORT}.log > /tmp/selenium-${SELENIUM_PORT}.log 2>&1 &
fi
if is_selenium_running; then
......@@ -131,7 +132,7 @@ then
fi
echo "Start PHP server"
php --server localhost:${PHP_PORT} --docroot $MAHARAROOT/htdocs &> /tmp/php.log &
php --server localhost:${PHP_PORT} --docroot $MAHARAROOT/htdocs > /tmp/php-${PHP_PORT}.log 2>&1 &
SERVER=$!
BEHATCONFIGFILE=`php htdocs/testing/frameworks/behat/cli/util.php --config`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment