Yii Framework Forum: [SOLVED] Codeception test fail for LoginCest - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] Codeception test fail for LoginCest

#1 User is offline   ateshabaev 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 19-August 15

Posted 06 July 2017 - 08:51 AM

I would like to use different model for LoginCest from frontend/tests/.

I have the following test within LoginCest:
Spoiler


However, when I run the test, I keep on seeing the following:

8) LoginCest: Check valid login
 Test  tests/functional/LoginCest.php:checkValidLogin
 Step  Have fixtures {"user":{"class":"common\\fixtures\\User","dataFile":"\/var\/www\/test\/frontend\/tests\/_data\/user.php"}}
 Fail  Failed asserting that any element by 'form button[type=submit]' on page /enter/login 
+ <button class="btn btn-primary" name="login-button" type="submit">Login</button>
contains text 'Logout (test@test.com)'

Scenario Steps:

 4. $I->see("Logout (test@test.com)","form button[type=submit]") at tests/functional/LoginCest.php:46
 3. $I->submitForm("#login-form",{"ClientLoginForm[email]":"test@test.com","ClientLoginForm[password]":"123456"}) at tests/functional/LoginCest.php:45
 2. $I->amOnRoute("site/login") at tests/functional/LoginCest.php:18
 1. $I->haveFixtures({"clients":{"class":"common\\fixtures\\Clients","dataFile":"\/var\/www\/test\/frontend\/tests\/_data\/login_data.php"}}) at tests/functional/LoginCest.php:17


Which says that I using different fixture, which is why the last test is failing with correct login details, because it must look in the clients table, but instead it is looking in users.

{"class":"common\\fixtures\\User","dataFile":"\/var\/www\/test\/frontend\/tests\/_data\/user.php"}}


Any suggestions?
0

#2 User is offline   ateshabaev 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 19-August 15

Posted 06 July 2017 - 10:37 AM

Why is it using common\\fixtures\\User when I changed it do Clients? And how to change it to a different user class? Let's say Clients or so.


What am I doing wrong in LoginCest model?

I use two different classes for frontend and backend and don't know how to fix problem about frontend, it is just forcing to use User class.
0

#3 User is offline   ateshabaev 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 19-August 15

Posted 06 July 2017 - 12:37 PM

Alright, problem is fixed, it was regiarding the configuration of user login (username and password were incorrect).
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users