1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-11 16:06:20 +01:00
openstamanager/tests/_support/AcceptanceTester.php

111 lines
2.3 KiB
PHP
Raw Normal View History

2018-08-03 17:19:45 +02:00
<?php
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;
2019-07-11 17:20:58 +02:00
use \Codeception\Lib\Actor\Shared\Retry;
2018-10-20 10:12:23 +02:00
/**
* Clicca sul pulsante e attende la conclusione del caricamento.
*
* @param $link
* @param $context
*/
public function clickAndWait($link, $context = null)
{
$t = $this;
2019-07-11 17:20:58 +02:00
$t->retryClick($link, $context);
2018-10-20 10:12:23 +02:00
$t->waitForElementNotVisible('#main_loading');
$t->waitForElementNotVisible('#mini-loader');
}
/**
* Clicca sul pulsante e attende la conclusione del caricamento del modal.
*
* @param $link
* @param $context
*/
public function clickAndWaitModal($link, $context = null)
{
$t = $this;
$t->clickAndWait($link, $context);
$t->waitForElementVisible('.modal');
$t->wait(1);
}
/**
* Clicca sul pulsante dentro il modal.
*
* @param $link
*/
public function clickModalButton($link)
{
$t = $this;
$t->clickAndWait($link, '.modal-content');
}
/**
* Clicca sul pulsante e attende la conclusione del caricamento del modal SWAL.
*
* @param $link
* @param $context
*/
public function clickAndWaitSwal($link, $context = null)
{
$t = $this;
$t->clickAndWait($link, $context);
$t->waitForElementVisible('.swal2-modal');
}
/**
* Clicca sul pulsante dentro il modal SWAL.
*
* @param $link
*/
public function clickSwalButton($link)
{
$t = $this;
$t->clickAndWait($link, '.swal2-buttonswrapper');
}
public function navigateTo($link)
{
2019-07-11 17:20:58 +02:00
$this->wait(0.5);
2018-10-20 10:12:23 +02:00
$this->clickAndWait($link, '.sidebar');
}
/**
* Effettua il login dalla pagina principale.
*
* @param string $username
* @param string $password
*/
public function login($username, $password)
{
$t = $this;
// Operazioni di login
$t->amOnPage('/');
$t->fillField('username', $username);
$t->fillField('password', $password);
$t->clickAndWait('Accedi');
// Controlla il completamento del login
$t->see($username, '.user-panel');
// Rimozione barra di debug
$t->executeJS('$(".phpdebugbar-close-btn").click()');
}
2018-08-03 17:19:45 +02:00
}