mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
use Codeception\Util\Fixtures;
|
|
|
|
/**
|
|
* Inherited Methods
|
|
* @method void wantToTest($text)
|
|
* @method void wantTo($text)
|
|
* @method void execute($callable)
|
|
* @method void expectTo($prediction)
|
|
* @method void expect($prediction)
|
|
* @method void amGoingTo($argumentation)
|
|
* @method void am($role)
|
|
* @method void lookForwardTo($achieveValue)
|
|
* @method void comment($description)
|
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
|
*
|
|
* @SuppressWarnings(PHPMD)
|
|
*/
|
|
class AcceptanceTester extends \Codeception\Actor
|
|
{
|
|
use _generated\AcceptanceTesterActions;
|
|
|
|
/**
|
|
* Define custom actions here
|
|
*/
|
|
function checkIfLogin(\AcceptanceTester $I)
|
|
{
|
|
//if ($I->loadSessionSnapshot('login')) return;
|
|
|
|
$I->amOnPage('/login');
|
|
$I->fillField(['name' => 'email'], Fixtures::get('username'));
|
|
$I->fillField(['name' => 'password'], Fixtures::get('password'));
|
|
$I->click('Let\'s go');
|
|
|
|
//$I->saveSessionSnapshot('login');
|
|
}
|
|
|
|
function selectDataPicker(\AcceptanceTester $I, $element, $date = 'now')
|
|
{
|
|
$_date = date('Y, m, d', strtotime($date));
|
|
$I->executeJS(sprintf('$(\'%s\').datepicker(\'update\', new Date(%s))', $element, $_date));
|
|
}
|
|
|
|
function selectDropdown(\AcceptanceTester $I, $option, $dropdownSelector)
|
|
{
|
|
$I->click($dropdownSelector);
|
|
$I->click(sprintf('ul.typeahead li[data-value="%s"]', $option));
|
|
}
|
|
|
|
function selectDropdownRow(\AcceptanceTester $I, $option, $dropdownSelector)
|
|
{
|
|
$I->click("$dropdownSelector span.dropdown-toggle");
|
|
$I->click("$dropdownSelector ul li:nth-child($option)");
|
|
}
|
|
}
|