Всем привет. Не писал на codeception уже давно, вот вновь пришлось.
Cest выглядит как-то так:
<?php
use Page\Login as LoginPage;
class LoginCest
{
public function loginAsExistingUser(AcceptanceTester $I)
{
$I->amOnPage(LoginPage::$URL);
$I->see('Вход');
}
}
Запускаю такой тест. Браузер открывается, страница загружается, а потом выводится следующая ошибка:
marx@dell:~/codeception$ php codecept.phar run acceptance --steps --debug
Codeception PHP Testing Framework v2.3.5
Powered by PHPUnit 6.2.4 by Sebastian Bergmann and contributors.
Acceptance Tests (1) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules: WebDriver, \Helper\Acceptance
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LoginCest: Login as existing user
Signature: LoginCest:loginAsExistingUser
Test: tests/acceptance/LoginCest.php:loginAsExistingUser
Scenario --
I am on page "/#/login"
[GET] тут я удалил куда я стучусь
I see "Вхід"
[Selenium server Logs]
16:11:43.662 INFO - /session: Executing POST on /session (handler: BeginSession)
16:11:43.663 INFO - Capabilities are: Capabilities {browserName=firefox}
16:11:43.663 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
16:11:43.663 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
16:11:48.108 INFO - Handler thread for session 07601340-e734-42ca-b439-31f3a60fa800 (firefox): Executing POST on /session/07601340-e734-42ca-b439-31f3a60fa800/window/current/size (handler: ServicedSession)
16:11:48.199 INFO - Handler thread for session 07601340-e734-42ca-b439-31f3a60fa800 (firefox): Executing POST on /session/07601340-e734-42ca-b439-31f3a60fa800/url (handler: ServicedSession)
16:11:56.357 INFO - Handler thread for session 07601340-e734-42ca-b439-31f3a60fa800 (firefox): Executing POST on /session/07601340-e734-42ca-b439-31f3a60fa800/elements (handler: ServicedSession)
16:11:56.378 INFO - /session/07601340-e734-42ca-b439-31f3a60fa800/log/types: Executing GET on /session/07601340-e734-42ca-b439-31f3a60fa800/log/types (handler: GetLogTypes)
16:11:56.384 INFO - /session/07601340-e734-42ca-b439-31f3a60fa800/log: Executing POST on /session/07601340-e734-42ca-b439-31f3a60fa800/log (handler: GetLogsOfType)
Screenshot and page source were saved into '/home/marx/codeception/tests/_output/' dir
ERROR
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 13.06 seconds, Memory: 10.00MB
There was 1 error:
---------
1) LoginCest: Login as existing user
Test tests/acceptance/LoginCest.php:loginAsExistingUser
[PHPUnit\Framework\Exception] Undefined index: ELEMENT
Scenario Steps:
2. $I->see("Вхід") at tests/acceptance/LoginCest.php:10
1. $I->amOnPage("/#/login") at tests/acceptance/LoginCest.php:9
#1 Codeception\Module\WebDriver->see
#2 /home/marx/codeception/tests/_support/_generated/AcceptanceTesterActions.php:363
#3 /home/marx/codeception/tests/acceptance/LoginCest.php:10
#4 LoginCest->loginAsExistingUser
#5 /home/marx/codeception/codecept.phar:7
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.