Fixing behat context

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent 3acea70a56
commit bac9946d81
  1. 5
      tests/behat.yml
  2. 88
      tests/features/bootstrap/FeatureContext.php

@ -1,9 +1,6 @@
default:
extensions:
Behat\MinkExtension\Extension:
Behat\MinkExtension:
base_url: http://localhost
goutte: ~
selenium2: ~
paths:
features: features
bootstrap: %behat.paths.features%/bootstrap

@ -3,15 +3,7 @@
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step,
Behat\Behat\Context\Step\Given,
Behat\Behat\Exception\PendingException,
Behat\Behat\Event\SuiteEvent;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
Behat\MinkExtension\Context\MinkContext;
//
// Require 3rd-party libraries here:
@ -28,25 +20,21 @@ class FeatureContext extends MinkContext
/**
* Initializes context.
* Every scenario gets its own context object.
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public function __construct(array $parameters)
public function __construct()
{
// Initialize your context here
}
/**
* @Given /^I am a platform administrator$/
*/
public function iAmAPlatformAdministrator()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "admin"'),
new Given('I fill in "password" with "admin"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'admin');
$this->fillField('password', 'admin');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a session administrator$/
@ -66,13 +54,11 @@ class FeatureContext extends MinkContext
*/
public function iAmATeacher()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "mmosquera"'),
new Given('I fill in "password" with "mmosquera"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'mmosquera');
$this->fillField('password', 'mmosquera');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a teacher in course "([^"]*)"$/
@ -89,52 +75,44 @@ class FeatureContext extends MinkContext
*/
public function iAmAStudent()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "mbrandybuck"'),
new Given('I fill in "password" with "mbrandybuck"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'mbrandybuck');
$this->fillField('password', 'mbrandybuck');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am an HR manager$/
*/
public function iAmAnHR()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "ptook"'),
new Given('I fill in "password" with "ptook"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'ptook');
$this->fillField('password', 'ptook');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a student boss$/
*/
public function iAmAStudentBoss()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "abaggins"'),
new Given('I fill in "password" with "abaggins"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'abaggins');
$this->fillField('password', 'abaggins');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am an invitee$/
*/
public function iAmAnInvitee()
{
return array(
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "bproudfoot"'),
new Given('I fill in "password" with "bproudfoot"'),
new Given('I press "submitAuth"')
);
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'bproudfoot');
$this->fillField('password', 'bproudfoot');
$this->pressButton('submitAuth');
}
/**
* @Given /^course "([^"]*)" exists$/

Loading…
Cancel
Save