How to use step object in Codeception v2.1

I'm a starter to learn Codeception and I found that officical guide didn't tell me anything about the step object.The change log of version 2.1 says all support classes moved to tests/_support by default. Actors, Helpers, PageObjects, StepObjects, GroupObjects to follow PSR-4 naming styleSo anybody can tell me how to use step object in the latest version? Or give me a simple example about that? Thanks a lot....Read more

Add unit test paths to Codeception

I have started to create unit tests for small components and added them to a Tests subdirectory within the component directory - so everything is together. No functional or acceptance tests are needed for these simple small components.But I have not found out how to tell Codeception to run all tests in a directory - I am looking for a similar method like in the PHPUnit config file, where I can just tell PHPUnit to go through all PHP files in a directory (<directory>src/*/*/*/Tests</directory> in PHPUnit XML config).Also, there does ...Read more

Can I combine a unit and acceptance test in codeception?

I have a codeception test that I am running that tests the front end submission of a form. I can do this with a simple acceptance test:class ContactCest { public function testContactForm(AcceptanceTester $I) { }}But now I want to check the database to make sure that the correct data about the submission has been saved. In a unit test I could call $I->assertEquals($expected, $found), but that doesn't seem to be available in the AcceptanceTester class. If I turn the test into a unit test class then everything else fails.Is there any way ...Read more

codeception - error [ModuleException] Doctrine2: Module can't be accessed

I am having trouble to follow the doc in https://codeception.com/docs/modules/Doctrine2. This the error [ModuleException] Doctrine2: Module can't be accessedI want to access $entityManger in the unit test. The doctrine bootstrap.php have a createEntityManager function that returns entityManager. #codeception.ymlsuites: unit: path: . actor: UnitTester modules: enabled: # add more modules here - Assertssettings: bootstrap: ../config/bootstrap.php shuffle: true lint: truepat...Read more

codeception - Javascript-generated text not seen by "$I->see"

After adding some input and pressing a button on the targeted page, a JS script will run which will result in (among other things) a text displayed within the page. The "$I->see" line is the very last part of a longer test which up to that point is successful.triple-checked naming, syntax or spelling errors;tried using both CSS and XPath to the text;tried using Locator (but failed miserably due to not knowing exactly how to set it up with Webdriver);The error I keep getting in the terminal is: Element located either by name, CSS or XPath eleme...Read more

acceptance testing - Can I check for multiple paragraphs in Codeception?

I'm using Codeception + Selenium. On my website and in emails sometimes I have a text consisting of multiple paragraphs. I want to check all or most of them in my acceptance tests. I know I can do $I->canSee($par1, $locator);$I->canSee($par2, $locator);however it becomes cumbersome to do this for many paragraphs.If I try to check for more than one paragraph in canSee(), it fails.Do you know how I can check for more than one paragraph of text?...Read more

Codeception Cest Mockery

public function tryRegister(FunctionalTester $I){ //arrange $I->disableEvents(); $user = $I->factory()->instance(User::class); $new_password = str_random(10); // prevent validation error on captcha \NoCaptcha::shouldReceive('verifyResponse') ->once() ->andReturn(true); // provide hidden input for your 'required' validation \NoCaptcha::shouldReceive('display') ->zeroOrMoreTimes() ->andReturn('<input type="hidden" name="g-recaptcha-response" alue="1" />')...Read more

Preventing asserts from failing tests in Codeception

I've just started exploring automated testing, specifically Codeception, as part of my QA work at a web design studio. The biggest issue I'm experiencing is having Codeception fail a test as soon as an assert fails, no matter where it's placed in the code. If my internet connection hiccups or is too slow, things can become difficult. I was wondering if there were methods to provide more control over when Codeception will fail and terminate a test session, or even better, a way to retry or execute a different block or loop of commands when an as...Read more

Codeception 2.1 PageObject doesn't work

Looks like PageObject doesn't work any more in Codeception 2.1exactly it is impossible to use methods in PageObject class!I do not want to put any methods to AcceptancTtester class, I would like to keep it as on example in codeception website in PageObject classJust simply try to reproduce provided by codeception example from this page http://codeception.com/docs/06-ReusingTestCode#PageObjectsWhen try to run will get an error like:[PHPUnit_Framework_Exception] Argument 1 passed to Page\Login::__construct() must be an instance of Page\Acceptance...Read more

Indicate application to use different database when running Codeception acceptance test

The application i am planning to test runs on Database say for example named "main". When using codeception, i want the application to use "main_test" database. The application database name is in a php define. I thought initially i can set the define to main_test in the acceptance test bootstrap and the application will be automatically will be aware of it. I think since codeception creates a new session,, the define which i set, is not being used.So my question is what is a way to indicate my application that it needs to use different databas...Read more

Codeception acceptance test not working with firefox

I am trying to run an acceptance test on firefox using selenium 3.0.1. I am also using wp-browser WPWebDriver module. My acceptance-suit.yml looks like this.class_name: AcceptanceTestermodules: enabled: - \Helper\Acceptance - WPWebDriverconfig: WPWebDriver: url: 'url' adminUsername: 'juhi.saxena@gmail.com' adminPassword: '123456' adminPath: '/wp-admin' browser: firefox webdriver.gecko.driver: 'bin/geckodriver.exe'On runnuning this wpcept run acceptance testsCest.php I get [Faceb...Read more