Sid
Sid

Reputation: 455

Is the Yii bridge for codeception necessary to test Yii applications and how to get around phpBrowser limitations

I am setting up codeception to test my Yii application. I came across the 'YiiBridge' and I can't really understand why this is required since I created a simple acceptance test case and it worked fine. My test case is:

<?php
    $I = new AcceptanceTester($scenario);
    $I->wantTo('ensure that the frontpage works');
    $I->amOnPage('/');
    $I->see('LOGIN');
    ?>

Will more complicated test cases require the YiiBridge?

Also I noted that acceptance and functional test cases are exactly the same with the difference that in the functional.suite.yml file, phpBrowser is missing which is present in the acceptance.suite.yml file, and on the codeception website they say that phpBrowser has the following drawbacks:

In this way I will not be able to test my AngularJs functionalities.Is there any way to get around these limitations?

Thanks in advance!

Upvotes: 2

Views: 192

Answers (1)

Bfcm
Bfcm

Reputation: 2746

Will more complicated test cases require the YiiBridge?

No, they won't.

We're also using Yii and writing our acceptance tests with WebDriver. It's similar to phpBrowser and you don't need Yii Bridge for that since WebDriver/phpBrowser will "simulate" a real browser. Yii Bridge is needed for Functional tests. And yes, you're right:

functional tests are almost the same, with just one major difference: functional tests don't require a web server to run tests.

More about functional tests.

For AngularJS and another javascript tests you will have to write some custom functions like the following:

public function openDevice() {
    $I = $this;
    $script = 'return document.getElementById("createDevice").children[0].click()';
    $I->executeJS($script);
}

It's always a little bit annoying to test JS, however it's possible.

Upvotes: 1

Related Questions