1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-29 23:14:55 +01:00

58 lines
1.4 KiB
PHP
Raw Normal View History

2018-08-03 17:19:45 +02:00
<?php
2018-08-03 19:11:45 +02:00
2018-08-03 17:19:45 +02:00
namespace Helper;
// here you can define custom actions
2018-08-03 19:11:45 +02:00
// all public methods declared in helper class will be available in $t
2018-08-03 17:19:45 +02:00
class Acceptance extends \Codeception\Module
{
2018-08-03 19:11:45 +02:00
public function login($username, $password)
{
$t = $this->getAcceptanceModule();
$t->amOnPage('/');
$t->fillField('username', $username);
$t->fillField('password', $password);
$this->clickAndWait('Accedi');
}
public function clickAndWait($link, $context = null)
{
$t = $this->getAcceptanceModule();
$t->click($link, $context);
$t->waitForElementNotVisible('#main_loading');
}
public function clickAndWaitModal($link, $context = null)
{
$t = $this->getAcceptanceModule();
$this->clickAndWait($link, $context);
$t->waitForElementVisible('.modal');
}
public function select2($selector, $option, $timeout = 5)
{
$select2 = $this->getModule('\Helper\Select2');
$select2->openSelect2($selector);
$select2->selectOptionForSelect2($selector, $option, $timeout);
$select2->closeSelect2($selector);
}
protected function getAcceptanceModule()
{
if (!$this->hasModule('WebDriver')) {
throw new \Exception('You must enable the WebDriver module', 1);
}
2018-08-03 17:19:45 +02:00
2018-08-03 19:11:45 +02:00
return $this->getModule('WebDriver');
}
2018-08-03 17:19:45 +02:00
}