Update behat tests

pull/2487/head
jmontoyaa 8 years ago
parent 99b115feed
commit ef1670f778
  1. 2
      tests/behat/behat.yml
  2. 17
      tests/behat/features/agenda.feature
  3. 25
      tests/behat/features/bootstrap/FeatureContext.php
  4. 11
      tests/behat/features/lp.feature

@ -1,7 +1,7 @@
default:
extensions:
Behat\MinkExtension:
base_url: http://my.chamilo.net
base_url: http://localhost/
goutte: ~
show_cmd: 'open %s'
selenium2:

@ -0,0 +1,17 @@
#Feature: Agenda tool
# In order to use the Agenda tool
# The admin should be able to add an event
#
# Background:
# Given I am a platform administrator
#
# Scenario: Create a personal event
# Given I am on "/main/calendar/agenda.php?&action=add&type=personal"
# When I fill in the following:
# | title | Event 1 |
# Then I fill in ckeditor field "content" with "Description event"
# Then wait for the page to be loaded
#
# And I press "Add event"
# Then I should see "Event added"
#

@ -311,7 +311,6 @@ class FeatureContext extends MinkContext
*/
public function iFillInSelectInputWithAndSelect($field, $id, $value)
{
$page = $this->getSession()->getPage();
$this->getSession()->executeScript("$('$field').select2({data : [{id: $id, text: '$value'}]});");
}
@ -363,6 +362,14 @@ class FeatureContext extends MinkContext
}
}
/**
* @When /^(?:|I )fill in select bootstrap static input "(?P<field>(?:[^"]|\\")*)" select "(?P<value>(?:[^"]|\\")*)"$/
*/
public function iFillInSelectStaticBootstrapInputWithAndSelect($field, $value)
{
$this->getSession()->executeScript("$(input[name='$field']).selectpicker('val', '$value');");
}
/**
* @When /^wait for the page to be loaded$/
*/
@ -384,4 +391,20 @@ class FeatureContext extends MinkContext
//$value = $radioButton->getAttribute('value');
$this->getSession()->getDriver()->click($radioButton->getXPath());
}
/**
* @When /^I select "([^"]*)" from select with label "([^"]*)"/
*/
public function iSelectFromSelectWithLabel($option, $label)
{
$label = $this->getSession()->getPage()->findField($label);
if (null === $label) {
throw new Exception("Cannot find label ".$label);
}
$select = $label->getParent()->getParent()->find('select');
if (null === $select) {
throw new Exception("Select not found: ".$select);
}
$select->selectOption($option);
}
}

@ -31,12 +31,23 @@ Feature: LP tool
And I press "submit_button"
Then I should see "Document 1"
Scenario: Add an exercise to LP
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
And I follow "Edit learnpath"
And I follow "Tests"
And I follow "Exercise 1"
Then I should see "Adding a test to the course"
And I press "submit_button"
Then I should see "Click on the [Learner view] button to see your learning path"
And I should see "Exercise 1"
Scenario: Enter LP
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
And I follow "LP 1"
And wait for the page to be loaded
Then I should see "LP 1"
And I should see "Document 1"
And I should see "Exercise 1"
Scenario: Delete a LP category
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"

Loading…
Cancel
Save