ola pessoal
por que nao consigo usar esses asserts dentro do arquivo criado para ser o page object
<?php
namespace Src\tests\PageObject;
use Facebook\WebDriver\WebDriver;
use Facebook\WebDriver\WebDriverBy;
class PaginaLogin
{
private WebDriver $driver;
public function __construct(WebDriver $driver)
{
$this->driver = $driver;
}
public function realizarLoginCom(string $email, string $senha)
{
$this->driver->get('https://github.com/login');
$inputEmail = WebDriverBy::id('login_field');
$this->driver->findElement($inputEmail)->sendKeys($email);
$inputPassword = WebDriverBy::id('password');
$this->driver->findElement($inputPassword)->sendKeys($senha);
$h1Locator = WebDriverBy::tagName('h1');
$textoh1 = self::$driver->findElement($h1Locator)->getText();
$this->assertSame('Sign in to GitHub', $textoh1);
self::$driver->findElement(WebDriverBy::className('js-sign-in-button'))->click();
$this->assertSame('https://github.com/', self::$driver->getCurrentURL());
self::$driver->findElement(WebDriverBy::id('feed-original'))->getText();
}
}
no arquivo loginTest, esses asserts nao dao erro, o e teste roda certinho, porem qdo coloco dentro da funcao realizarLoginCom
da erro...