小さな問題があります。Codeception を使用して最初のテスト フェーズを実行しようとしています。これを行うために、私は Selenium2 と PrestaShop を使用しています。
私が達成しようとしている最初のステップは、PrestaShop のバックオフィスにログインすることです。
しかし、PrestaShop Backoffice には接続したくないようです。ログインページにリダイレクトされます!
これがどこから来るのか誰か知っていますか?Cookie やセッションに何か問題があるようですが、これを修正する方法がわかりません。
編集:ここに私のコードがあります:
Selenium.suite.yml :
class_name: SeleniumGuy
modules:
enabled:
- SeleniumHelper
- Selenium2
config:
Selenium2:
url: 'http://localhost/Sites/PrestaShop1.5.4/'
browser: 'firefox'
capabilities:
unexpectedAlertBehaviour: 'accept'
codeception.yml
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: false
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: ''
user: 'root'
password: 'root'
dump: tests/_data/dump.sql
フォルダ tests/Selenium に PrestaShopGlobalCest.php があります
<?php
use \SeleniumGuy;
class PrestaShopModuleListCest
{
// tests
public function install_the_module(SeleniumGuy $I) {
PrestaShopGlobalHelper::loginBackoffice($I);
PrestaShopGlobalHelper::goToPage($I, 'modules');
}
}
_bootstrap.php
<?php
Codeception\Util\Autoload::registerSuffix('Helper', __DIR__.'/../helpers/Selenium');
?>
私が持っているテスト/ヘルパー/セレンで
PrestaShopGlobalHelper
<?php
use \SeleniumGuy;
class PrestaShopGlobalHelper
{
static $mainTabID = array(
'modules' => 'maintab15'
);
static $menuLink = array(
'modules' => '#maintab15 .submenu li:first'
);
// tests
static public function loginBackOffice(SeleniumGuy $I) {
$I->wantTo('Login in Backoffice');
$I->amOnPage('/bb');
PrestaShopGlobalHelper::login($I);
}
static public function login(SeleniumGuy $I, $login = '****', $pass = '****')
{
$I->fillField('#email',$login);
$I->fillField('#passwd',$pass);
$I->click('Connexion');
}
static public function goToPage(SeleniumGuy $I, $page)
{
$I->moveMouseOver('#'.self::$mainTabID[$page]);
$I->click(self::$menuLink[$page]);
}
}