1
0

LoginCest.php 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace backend\tests\functional;
  3. use backend\tests\FunctionalTester;
  4. use common\fixtures\UserFixture;
  5. /**
  6. * Class LoginCest
  7. */
  8. class LoginCest
  9. {
  10. /**
  11. * Load fixtures before db transaction begin
  12. * Called in _before()
  13. * @see \Codeception\Module\Yii2::_before()
  14. * @see \Codeception\Module\Yii2::loadFixtures()
  15. * @return array
  16. */
  17. public function _fixtures()
  18. {
  19. return [
  20. 'user' => [
  21. 'class' => UserFixture::className(),
  22. 'dataFile' => codecept_data_dir() . 'login_data.php'
  23. ]
  24. ];
  25. }
  26. /**
  27. * @param FunctionalTester $I
  28. */
  29. public function loginUser(FunctionalTester $I)
  30. {
  31. $I->amOnPage('/site/login');
  32. $I->fillField('Username', 'erau');
  33. $I->fillField('Password', 'password_0');
  34. $I->click('login-button');
  35. $I->see('Logout (erau)', 'form button[type=submit]');
  36. $I->dontSeeLink('Login');
  37. $I->dontSeeLink('Signup');
  38. }
  39. }