May 9, 2016
0
Level 1
Codeception test error
I am trying to text using Codeception but getting the following error:
There was 1 failure:
---------
1) Failed to check that login works in EnterLoginCept (tests\acceptance\\EnterLoginCept.php)
Step I see "Welcome"
Fail Failed asserting that /login
-->
Depression App
a:link {
text-decoration: none;
color: #000000;
padding-left:100px;
}
a:visited {
text-decoration: none;
color: #000000;
padding-left:100px;
}
a:hover {
text-decoration: none;
color: #000000;
padding-left:100px;
}
a:active {
text-decoration:
[Content too long to display. See complete response in 'C:\xampp\htdocs\depressionapp\tests/_output\' directory]
--> contains "welcome".
Scenario Steps:
6. $I->see("Welcome")
5. // I expect to be registered
4. $I->click("Login")
3. $I->fillField("password","password")
2. $I->fillField("email","jason@yahoo.com")
1. $I->amOnPage("/login")
This is my login page:
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<H2>Login</h2>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password">
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-sign-in"></i>Login
</button>
<a class="btn btn-link" href="{{ url('/password/reset') }}">Forgot Your Password?</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
And this is my test:
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('check that login works');
$I->amOnPage('/login');
$I->fillField('email','jason@yahoo.com');
$I->fillField('password','password');
$I->click('Login');
$I->expect('to be registered');
$I->see('Welcome');
?>
What is wrong I cannot work it out? I have tried to change $I->click('Login'); to $I->click('submit '); but then it throws this error
1) Failed to check that login works in EnterLoginCept (tests\acceptance\\EnterLoginCept.php)
Step I click "submit"
Fail Link or Button by name or CSS or XPath element with 'submit' was not found.
Scenario Steps:
4. $I->click("submit")
3. $I->fillField("password","password")
2. $I->fillField("email","jason@yahoo.com")
1. $I->amOnPage("/login")
```.
Please or to participate in this conversation.