/** * @dataProvider credentialProvider */ public function testLogin($login, $password, $expected) { $loginPage = new LoginPage($this); $homePage = $loginPage->doLogin($login, $password); //TODO switch if ($expected == "pass") { $this->assertEquals(strtoupper($login), $this->byCssSelectorAndWait(".welcome")->text()); $homePage->doLogOut(); } elseif ($expected == "fail") { if ($login == "" || $password == "") { $this->acceptAlert(); } $this->assertEquals("LOCALHOST ? Connexion", utf8_decode($this->title())); } }
/** * @dataProvider credentialProvider */ public function testLogin($login, $password, $expected) { $loginPage = new LoginPage($this); $homePage = $loginPage->doLogin($login, $password); switch ($expected) { case "pass": $this->assertEquals(strtoupper($login), $this->byCssSelectorAndWait(".welcome")->text()); $homePage->doLogOut(); break; case "fail": if ($login == "" || $password == "") { $this->acceptAlert(); } $this->assertEquals("LOCALHOST ? Connexion", utf8_decode($this->title())); break; default: //default break; } }