Search code examples
phpcodeception

codeception just run one scenario


I'm a codeception newbie, I have try to do a simple acceptance test, but not work. I need your help, thanks. I refer to this [video]

This is my WelcomeCept.php

<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('create account');
$I->see('Create Account', 'a[href="simple/bootstrap"]');
$I->click('Create Account', 'a[href="simple/bootstrap"]');
$I->see('Username');
$I->fillField('Username', 'test');
$I->fillField('Email', '[email protected]');
$I->fillField('Password', '123456');
$I->click('Create');
$I->see('create success');

And this is my config

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser
        - AcceptanceHelper
    config:
        PhpBrowser:
            url: 'http://localhost/ciexample/simple/read_account'

And I input this command

$ ./vendor/bin/codecept run --steps

I get just one request, I have no idea. I don't get any error message.

Codeception PHP Testing Framework v2.0.4
Powered by PHPUnit 4.2.2 by Sebastian Bergmann.

Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------
Trying to create account (WelcomeCept)
Scenario:
* I see "Create Account","a[href="simple/bootstrap"]"

Solution

  • I know this question, I miss amOnPage(). And I should not use fillField, because phpbrowser can't work on fillField. I refer this [answer]

    $I->wantTo('view all data');
    $I->amOnPage('/read_account'); // I miss this 
    $I->see('Create Account', 'a[href="simple/bootstrap"]');