Problems running acceptance tests with Codeception in Yii2





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm trying to run some test with codeception and when I try to test a form, always I got fail and I don't know why. With the rest of them, they are passed. The test code is this one:



<?php namespace backendtestsacceptance;

use AcceptanceTester;

class HomeDriverCest

{

public function _before(AcceptanceTester $I){}

// tests
public function tryToTest(AcceptanceTester $I)
{
$I->amGoingTo("Check login on backend");
$I->see("Login");
$I->amOnPage('/site/login');
$I->wait(5);
$I->see("Email");
$I->clearField('LoginForm[username]');
$I->reloadPage();

$I->submitForm('#login-form', array(
'LoginForm[username]' => 'pepe@xxx.es',
'LoginForm[password]' => '123456'
), 'submitButton');

$I->see("Holidays");
}
}


When I run the tests with the command ../vendor/bin/run -vvv --html --debug I have this log:



 ....
12:52 (hace 10 minutos)
para mí

Home2Cest: Try to test
Signature: backendtestsacceptanceHome2Cest:tryToTest
Test: tests/acceptance/Home2Cest.php:tryToTest
Scenario --
Destroying application
Starting application
[ConnectionWatcher] watching new connections
[Fixtures] Loading fixtures
[Fixtures] Done
[TransactionForcer] watching new connections
I am on page "/site/login"
[GET] http://backend.smartholidays.test/site/login
I see "Login"
PASSED
[TransactionForcer] no longer watching new connections
Destroying application
[ConnectionWatcher] no longer watching new connections
[ConnectionWatcher] closing all (0) connections
HomeDriverCest: Try to test
Signature: backendtestsacceptanceHomeDriverCest:tryToTest
Test: tests/acceptance/HomeDriverCest.php:tryToTest
Scenario --
Destroying application
Starting application
[ConnectionWatcher] watching new connections
[Fixtures] Loading fixtures
[Fixtures] Done
[TransactionForcer] watching new connections
I am going to Check login on backend
I see "Login"
I am on page "/site/login"
[GET] http://backend.smartholidays.test/site/login
I wait 5
I see "Email"
I clear field "LoginForm[username]"
I reload page
I submit form "#login-form",{"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"},"submitButton"
[Uri] http://backend.smartholidays.test/site/login
[Method] post
[Parameters]
{"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"}
[Page] /site/login
I see "Holidays"
[Selenium server Logs]
11:35:23.268 INFO - Capabilities are: {
"browserName": "chrome"
}
11:35:23.268 INFO - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
11:35:23.738 INFO - Detected dialect: OSS
11:35:23.765 INFO - Started new session efab3c8277ad657b2dd22db4602e1b08 (org.openqa.selenium.chrome.ChromeDriverService)
[Selenium browser Logs]
11:35:25.449 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

11:35:25.939 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

11:35:31.598 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

11:35:32.688 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see ....

[Selenium driver Logs] EMPTY

Screenshot and page source were saved into '/var/www/vhosts/smartholidays.test/backend/tests/_output/' dir

FAIL


The acceptance.suite.yml is this one:



       suite_namespace: backendtestsacceptance


actor: AcceptanceTester



modules:



enabled:

- WebDriver:

url: http://backend.smartholidays.test
browser: chrome
- Yii2:
part: init
cleanup: true
- HelperAcceptance


What is wrong? What I want it's to test the form and see the next page where is written holidays, why some tests are passed and a simple form no?. Can you help me with any idea?










share|improve this question





























    0















    I'm trying to run some test with codeception and when I try to test a form, always I got fail and I don't know why. With the rest of them, they are passed. The test code is this one:



    <?php namespace backendtestsacceptance;

    use AcceptanceTester;

    class HomeDriverCest

    {

    public function _before(AcceptanceTester $I){}

    // tests
    public function tryToTest(AcceptanceTester $I)
    {
    $I->amGoingTo("Check login on backend");
    $I->see("Login");
    $I->amOnPage('/site/login');
    $I->wait(5);
    $I->see("Email");
    $I->clearField('LoginForm[username]');
    $I->reloadPage();

    $I->submitForm('#login-form', array(
    'LoginForm[username]' => 'pepe@xxx.es',
    'LoginForm[password]' => '123456'
    ), 'submitButton');

    $I->see("Holidays");
    }
    }


    When I run the tests with the command ../vendor/bin/run -vvv --html --debug I have this log:



     ....
    12:52 (hace 10 minutos)
    para mí

    Home2Cest: Try to test
    Signature: backendtestsacceptanceHome2Cest:tryToTest
    Test: tests/acceptance/Home2Cest.php:tryToTest
    Scenario --
    Destroying application
    Starting application
    [ConnectionWatcher] watching new connections
    [Fixtures] Loading fixtures
    [Fixtures] Done
    [TransactionForcer] watching new connections
    I am on page "/site/login"
    [GET] http://backend.smartholidays.test/site/login
    I see "Login"
    PASSED
    [TransactionForcer] no longer watching new connections
    Destroying application
    [ConnectionWatcher] no longer watching new connections
    [ConnectionWatcher] closing all (0) connections
    HomeDriverCest: Try to test
    Signature: backendtestsacceptanceHomeDriverCest:tryToTest
    Test: tests/acceptance/HomeDriverCest.php:tryToTest
    Scenario --
    Destroying application
    Starting application
    [ConnectionWatcher] watching new connections
    [Fixtures] Loading fixtures
    [Fixtures] Done
    [TransactionForcer] watching new connections
    I am going to Check login on backend
    I see "Login"
    I am on page "/site/login"
    [GET] http://backend.smartholidays.test/site/login
    I wait 5
    I see "Email"
    I clear field "LoginForm[username]"
    I reload page
    I submit form "#login-form",{"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"},"submitButton"
    [Uri] http://backend.smartholidays.test/site/login
    [Method] post
    [Parameters]
    {"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"}
    [Page] /site/login
    I see "Holidays"
    [Selenium server Logs]
    11:35:23.268 INFO - Capabilities are: {
    "browserName": "chrome"
    }
    11:35:23.268 INFO - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
    11:35:23.738 INFO - Detected dialect: OSS
    11:35:23.765 INFO - Started new session efab3c8277ad657b2dd22db4602e1b08 (org.openqa.selenium.chrome.ChromeDriverService)
    [Selenium browser Logs]
    11:35:25.449 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

    11:35:25.939 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

    11:35:31.598 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

    11:35:32.688 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see ....

    [Selenium driver Logs] EMPTY

    Screenshot and page source were saved into '/var/www/vhosts/smartholidays.test/backend/tests/_output/' dir

    FAIL


    The acceptance.suite.yml is this one:



           suite_namespace: backendtestsacceptance


    actor: AcceptanceTester



    modules:



    enabled:

    - WebDriver:

    url: http://backend.smartholidays.test
    browser: chrome
    - Yii2:
    part: init
    cleanup: true
    - HelperAcceptance


    What is wrong? What I want it's to test the form and see the next page where is written holidays, why some tests are passed and a simple form no?. Can you help me with any idea?










    share|improve this question

























      0












      0








      0








      I'm trying to run some test with codeception and when I try to test a form, always I got fail and I don't know why. With the rest of them, they are passed. The test code is this one:



      <?php namespace backendtestsacceptance;

      use AcceptanceTester;

      class HomeDriverCest

      {

      public function _before(AcceptanceTester $I){}

      // tests
      public function tryToTest(AcceptanceTester $I)
      {
      $I->amGoingTo("Check login on backend");
      $I->see("Login");
      $I->amOnPage('/site/login');
      $I->wait(5);
      $I->see("Email");
      $I->clearField('LoginForm[username]');
      $I->reloadPage();

      $I->submitForm('#login-form', array(
      'LoginForm[username]' => 'pepe@xxx.es',
      'LoginForm[password]' => '123456'
      ), 'submitButton');

      $I->see("Holidays");
      }
      }


      When I run the tests with the command ../vendor/bin/run -vvv --html --debug I have this log:



       ....
      12:52 (hace 10 minutos)
      para mí

      Home2Cest: Try to test
      Signature: backendtestsacceptanceHome2Cest:tryToTest
      Test: tests/acceptance/Home2Cest.php:tryToTest
      Scenario --
      Destroying application
      Starting application
      [ConnectionWatcher] watching new connections
      [Fixtures] Loading fixtures
      [Fixtures] Done
      [TransactionForcer] watching new connections
      I am on page "/site/login"
      [GET] http://backend.smartholidays.test/site/login
      I see "Login"
      PASSED
      [TransactionForcer] no longer watching new connections
      Destroying application
      [ConnectionWatcher] no longer watching new connections
      [ConnectionWatcher] closing all (0) connections
      HomeDriverCest: Try to test
      Signature: backendtestsacceptanceHomeDriverCest:tryToTest
      Test: tests/acceptance/HomeDriverCest.php:tryToTest
      Scenario --
      Destroying application
      Starting application
      [ConnectionWatcher] watching new connections
      [Fixtures] Loading fixtures
      [Fixtures] Done
      [TransactionForcer] watching new connections
      I am going to Check login on backend
      I see "Login"
      I am on page "/site/login"
      [GET] http://backend.smartholidays.test/site/login
      I wait 5
      I see "Email"
      I clear field "LoginForm[username]"
      I reload page
      I submit form "#login-form",{"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"},"submitButton"
      [Uri] http://backend.smartholidays.test/site/login
      [Method] post
      [Parameters]
      {"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"}
      [Page] /site/login
      I see "Holidays"
      [Selenium server Logs]
      11:35:23.268 INFO - Capabilities are: {
      "browserName": "chrome"
      }
      11:35:23.268 INFO - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
      11:35:23.738 INFO - Detected dialect: OSS
      11:35:23.765 INFO - Started new session efab3c8277ad657b2dd22db4602e1b08 (org.openqa.selenium.chrome.ChromeDriverService)
      [Selenium browser Logs]
      11:35:25.449 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:25.939 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:31.598 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:32.688 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see ....

      [Selenium driver Logs] EMPTY

      Screenshot and page source were saved into '/var/www/vhosts/smartholidays.test/backend/tests/_output/' dir

      FAIL


      The acceptance.suite.yml is this one:



             suite_namespace: backendtestsacceptance


      actor: AcceptanceTester



      modules:



      enabled:

      - WebDriver:

      url: http://backend.smartholidays.test
      browser: chrome
      - Yii2:
      part: init
      cleanup: true
      - HelperAcceptance


      What is wrong? What I want it's to test the form and see the next page where is written holidays, why some tests are passed and a simple form no?. Can you help me with any idea?










      share|improve this question














      I'm trying to run some test with codeception and when I try to test a form, always I got fail and I don't know why. With the rest of them, they are passed. The test code is this one:



      <?php namespace backendtestsacceptance;

      use AcceptanceTester;

      class HomeDriverCest

      {

      public function _before(AcceptanceTester $I){}

      // tests
      public function tryToTest(AcceptanceTester $I)
      {
      $I->amGoingTo("Check login on backend");
      $I->see("Login");
      $I->amOnPage('/site/login');
      $I->wait(5);
      $I->see("Email");
      $I->clearField('LoginForm[username]');
      $I->reloadPage();

      $I->submitForm('#login-form', array(
      'LoginForm[username]' => 'pepe@xxx.es',
      'LoginForm[password]' => '123456'
      ), 'submitButton');

      $I->see("Holidays");
      }
      }


      When I run the tests with the command ../vendor/bin/run -vvv --html --debug I have this log:



       ....
      12:52 (hace 10 minutos)
      para mí

      Home2Cest: Try to test
      Signature: backendtestsacceptanceHome2Cest:tryToTest
      Test: tests/acceptance/Home2Cest.php:tryToTest
      Scenario --
      Destroying application
      Starting application
      [ConnectionWatcher] watching new connections
      [Fixtures] Loading fixtures
      [Fixtures] Done
      [TransactionForcer] watching new connections
      I am on page "/site/login"
      [GET] http://backend.smartholidays.test/site/login
      I see "Login"
      PASSED
      [TransactionForcer] no longer watching new connections
      Destroying application
      [ConnectionWatcher] no longer watching new connections
      [ConnectionWatcher] closing all (0) connections
      HomeDriverCest: Try to test
      Signature: backendtestsacceptanceHomeDriverCest:tryToTest
      Test: tests/acceptance/HomeDriverCest.php:tryToTest
      Scenario --
      Destroying application
      Starting application
      [ConnectionWatcher] watching new connections
      [Fixtures] Loading fixtures
      [Fixtures] Done
      [TransactionForcer] watching new connections
      I am going to Check login on backend
      I see "Login"
      I am on page "/site/login"
      [GET] http://backend.smartholidays.test/site/login
      I wait 5
      I see "Email"
      I clear field "LoginForm[username]"
      I reload page
      I submit form "#login-form",{"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"},"submitButton"
      [Uri] http://backend.smartholidays.test/site/login
      [Method] post
      [Parameters]
      {"LoginForm[username]":"pepe@xxxx.es","LoginForm[password]":"123456"}
      [Page] /site/login
      I see "Holidays"
      [Selenium server Logs]
      11:35:23.268 INFO - Capabilities are: {
      "browserName": "chrome"
      }
      11:35:23.268 INFO - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
      11:35:23.738 INFO - Detected dialect: OSS
      11:35:23.765 INFO - Started new session efab3c8277ad657b2dd22db4602e1b08 (org.openqa.selenium.chrome.ChromeDriverService)
      [Selenium browser Logs]
      11:35:25.449 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:25.939 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:31.598 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see .....

      11:35:32.688 WARNING - http://backend.smartholidays.test/site/login - This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see ....

      [Selenium driver Logs] EMPTY

      Screenshot and page source were saved into '/var/www/vhosts/smartholidays.test/backend/tests/_output/' dir

      FAIL


      The acceptance.suite.yml is this one:



             suite_namespace: backendtestsacceptance


      actor: AcceptanceTester



      modules:



      enabled:

      - WebDriver:

      url: http://backend.smartholidays.test
      browser: chrome
      - Yii2:
      part: init
      cleanup: true
      - HelperAcceptance


      What is wrong? What I want it's to test the form and see the next page where is written holidays, why some tests are passed and a simple form no?. Can you help me with any idea?







      selenium yii2 codeception






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 12:27









      Carl35Carl35

      437




      437
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It works writting some waits throught the code, for example, once you call the submitForm, you put the wait and it works






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337917%2fproblems-running-acceptance-tests-with-codeception-in-yii2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It works writting some waits throught the code, for example, once you call the submitForm, you put the wait and it works






            share|improve this answer




























              0














              It works writting some waits throught the code, for example, once you call the submitForm, you put the wait and it works






              share|improve this answer


























                0












                0








                0







                It works writting some waits throught the code, for example, once you call the submitForm, you put the wait and it works






                share|improve this answer













                It works writting some waits throught the code, for example, once you call the submitForm, you put the wait and it works







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 20:56









                Carl35Carl35

                437




                437
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337917%2fproblems-running-acceptance-tests-with-codeception-in-yii2%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python