getAcceptanceModule(); if ($t->loadSessionSnapshot('login')) { return; } $t->amOnPage('/'); $t->fillField('username', $username); $t->fillField('password', $password); $this->clickAndWait('Accedi'); $t->see($username, '.user-panel'); $t->saveSessionSnapshot('login'); } /** * Clicca sul pulsante e attende la conclusione del caricamento. * * @param $link * @param $context */ public function clickAndWait($link, $context = null) { $t = $this->getAcceptanceModule(); $t->click($link, $context); $t->waitForElementNotVisible('#main_loading'); } /** * Clicca sul pulsante e attende la conclusione del caricamento del modal. * * @param $link * @param $context */ public function clickAndWaitModal($link, $context = null) { $t = $this->getAcceptanceModule(); $this->clickAndWait($link, $context); $t->waitForElementVisible('.modal'); } /** * Clicca sul pulsante dentro il modal. * * @param $link */ public function clickModalButton($link) { $t = $this->getAcceptanceModule(); $this->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->getAcceptanceModule(); $this->clickAndWait($link, $context); $t->waitForElementVisible('.swal2-modal'); } /** * Clicca sul pulsante dentro il modal SWAL. * * @param $link */ public function clickSwalButton($link) { $t = $this->getAcceptanceModule(); $this->clickAndWait($link, '.swal2-buttonswrapper'); } /** * Imposta il valore di un select gestito dal framework Select2. * * @param $selector * @param $option * @param int $timeout seconds. Default to 1 */ 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); } return $this->getModule('WebDriver'); } }