Questions tagged [codeception]
Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides a way of writing acceptance, functional and even unit tests. Powered by PHPUnit.
1,469
questions
0
votes
0
answers
97
views
ChromeDriver: 'DevToolsActivePort file doesn't exist' error
I'm running Codeception tests in our Pipeline using Google Chrome and ChromeDriver on Linux.
When I was using for this Chrome version installed from the downloaded .deb package, it was working fine, ...
0
votes
0
answers
62
views
Installing Chrome browser on Mac m1 arm64
I am using codeception with Cakephp4 for testing. I tried to use chromium browser instead of chrome but I get this error:
System info: host: 'f1c4f5d6ba86', ip: '172.28.0.2', os.name: 'Linux', os.arch:...
0
votes
0
answers
13
views
Integration of allure in selenium project
I am having this error when I am running my selenium test cases
Class `Codeception\Extension\ReportPortal` is not defined. Autoload it or include i
nto '_bootstrap.php' file of 'tests' directory ...
0
votes
0
answers
21
views
TypeError Codeception\Specify\SpecifyTest::run(): Return value must be of type PHPUnit\Framework\TestResult, null returned
I'm migrating some tests from codecption 4 to codecptyion 5 due to an upgrade from PHP 7 to php8 and this test is not working anymore:
public function testValidateRequestParams()
{
$...
1
vote
0
answers
24
views
Can Aspecktmock used in Codeception API testing?
We use Codeception with Phalcon.
We are trying to add testing around an API. This API has DB saves and other application logic. Assume our requirement is to receive 403 HTTP status If the DB save has ...
0
votes
0
answers
60
views
Mocking Symfony services in Codeception unit tests
I'm trying to mock some Symfony services that make HTTP requests, etc. to purify my unit tests in Codeception. I can create the mocks, but I can't insert them into Symfony's/Codeception's test ...
0
votes
0
answers
103
views
Docker Test Failing in Mac apple chip - Could not start a new session. Error while creating session with the driver service. Stopping driver service
I have an existing test which runs fine in my old Mac intel chip. Now, I have a new Mac apple chip (M2) and need to get our existing tests to run using the new one.
I am relatively new with docker ...
0
votes
0
answers
109
views
Using a mock to override Aws\S3\S3Client in a Codeception test with Symfony
In the past when testing code I would use the actual external services. However, I'm now trying to improve my tests and use mocks for external services. I'm trying to mock Aws\S3\S3Client in a ...
1
vote
1
answer
82
views
How to produce a 100% Codeception path coverage report?
I am evaluating Paths coverage and trying to understand how exactly it works. Following are environment details:
Yii2, php-code-coverage 9.2.26 using PHP 8.1.6, Codeception and PHPUnit 9.6.8
Sample ...
0
votes
0
answers
50
views
Unstable symfony session when running codeception tests in github actions
I'm running acceptance tests with Codeception in my Symfony app. When running the tests in Github actions, I frequently encounter errors where flash messages are not displayed or forms are failing due ...
0
votes
1
answer
38
views
Disabling mailcatcher commandline messages
When using mailcatcher for testing the sending of mails i use codeception and the codeception-mailcatcher-module.
Everything runs as a Github action and i trigger stuff like this:
php vendor/bin/...
2
votes
0
answers
369
views
ERR_CONNECTION_REFUSED when using Codeception with Selenium on Docker
Similar to this (unanswered) question: Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED (Session info: headless chrome=96.0.4664.110)
I have a Docker ...
1
vote
1
answer
39
views
Codeception, how to split yml file?
I want to include second yml file to my api.suite.yml. Can I do it somehow?
I have api.suite.yml looking like this
actor: ApiTester
modules:
enabled:
- Asserts
- REST:
...
1
vote
1
answer
32
views
Does Codeception BDD have a @Transform function like Behat does?
In Behat you can do a transformation like so:
<?php
/**
* @Transform /^"([^"]+)" shipping method$/
* @Transform /^shipping method "([^"]+)"$/
* @Transform :...
0
votes
0
answers
278
views
cURL error 7: Failed to connect to ***** upon running a functional test method on codeception
Now I'm working on a monolith on PHP + YII and encountered with a problem.
Specifically, I took a job ticket, made it and some tests failed upon deployment. The testing engine is CodeCeption.
To debug ...
1
vote
0
answers
258
views
Codeception Module \Helper\Api could not be found and loaded
When i try to add some Helper in Api.suite.yml and run build:
php vendor/bin/codecept build
, then get error:
Building Actor classes for suites: Api
In ModuleContainer.php line 102:
Module \Helper\...
0
votes
1
answer
53
views
Codeception 5 test parameters recommendation sought
I'm writing a Gherkin-based acceptance testing PoC. I have a feature file, step object, and a page object. In my sequence I will need to log-in the test user before conducting the rest of the series. ...
0
votes
0
answers
123
views
Yii2 + Codeception: fixture without db component
I have a problem running unit tests in my Yii2 app with Codeception.
I have 2 databases, so in my test-local.php config file I added 2 components (class yii\db\Connection), respectively with id “db1” ...
1
vote
1
answer
37
views
Chromedriver: When is a page considered loaded?
In our project we are using Codeception to automate Chromedriver into running User Acceptance Tests. The issue we are facing is that the tests take a really long time to run. Even the most basic tests ...
0
votes
1
answer
154
views
How to use PhpUnit mocking methods within codeception yii2 tests
I need to use PHPUnit mocking methods like expect($this->once())->returnSelf(); in codecept/yii2 tests. Cannot find any way to call them. The Stub library of codeception does not have as many ...
0
votes
0
answers
41
views
CodeCeption fails to run Cest class but not individual tests
This is my Cest class:
<?php
namespace App\Tests\functional;
use App\Entity\AssetsRecord;
use App\Entity\Provider;
use App\Entity\User;
use App\Tests\FunctionalTester;
use App\Tests\Page\...
1
vote
1
answer
98
views
codeception doesn't builds helper files automatically
I have an YII2 application project with connected Codeception 4.1.8 testing framework (during the life of project before me there where made a lot of modifications).
So I tried to add my own method to ...
0
votes
0
answers
60
views
Chrome failed to start: exited abnormally
When I run an acceptance test on a remote linux server in Jenkins, the job fails
Facebook\WebDriver\Exception\SessionNotCreatedException] Unable to create new service: ChromeDriverService
Build info: ...
0
votes
1
answer
174
views
How to use multiple dataproviders in a single codeception(a php based test automation framework) test?
I use codeception which is a php based test automation framework.
I need to use multiple dataproviders in a single test class.
I know how to use a single dataprovider per test; example of my code ...
0
votes
1
answer
114
views
Yii2: Functional test running locally, fails on CI
I’ve set up testing for my app. The test suite runs fine locally, while it fails when executed via Gitlab CI.
Locally, whether I run:
./vendor/bin/codecept run functional ...
0
votes
0
answers
46
views
How to run an acceptance test in Codeception in Opera Browser?
When I run the test, Opera opens, but the test does not run and an error falls into the console
[Facebook\WebDriver\Exception\SessionNotCreatedException] Unable to create session from {
"...
0
votes
1
answer
25
views
How can I make sure an object is not in the database using Codeception?
I'm working on a Symfony application and writing some tests using CodeCeption.
I need to make sure some entities are created in the database, for which I need to make sure they don't exist previous to ...
1
vote
1
answer
160
views
Can we skip entire cest class in codeception?
I need to skip all the tests in the following cest class and currently I am skipping individual tests with @skip annotation. Is there any way I can skip execution at the class level itself, instead of ...
0
votes
0
answers
96
views
Can I check a checkbox in CodeCeption without a form?
I'm trying to write a test using CodeCeption for a page that looks like this:
My code for the test is the following:
// tests
public function tryToUnifyAgents(FunctionalTester $I)
{
$I->...
0
votes
2
answers
155
views
Click on first element contained in a div
I have a div that contains a set of dynamic elements. I want to click on the first search result.
I want to click on the first element contains in
I tried using creating a custom xPath like so but ...
0
votes
0
answers
41
views
can't specify the correct path to trait (with PHP namespaces)
So I have 2 files:
trait file /tests/_support/_generated/BaseFunctionalTesterActions.php
<?php
namespace tests\_generated;
trait BaseFunctionalTesterActions
{
}
and the class file /tests/actor/...
0
votes
1
answer
49
views
How check value in textarea
How can I check the value in the text field. When you enter a value in this field, it is not displayed in the DOM tree. Are these the problems of this tag or the developer's jamb? Sorry for the ...
0
votes
1
answer
30
views
Loop through multiple accounts in codeception functional test
I got multiple accounts: "userWithCertainRole", "userWithAnotherRole" & "userWithTwoRoles". I want to functional test a specific page for all these accounts with ...
0
votes
0
answers
161
views
Codeception - Clear web cache and storage before test
I am working with Codeception today and I cannot figure it out. How you can clean cache and data before another test ? Everytime my new test start.. there is a things in browser. (for example.. i ...
0
votes
1
answer
78
views
Unable to load dynamic configurations in codeception suite configuration
I'm working to simplify a project's testing suite. There is a suite that uses PhpBrowser and %ABSOLUTE_URL% in the environment is set to "http://127.0.0.1:8888". The config:
class_name: ...
1
vote
1
answer
53
views
Codeception $I->see() action doesn't work with WebDriver
The same action works with PhpBrowser but as soon as I set WebDriver in acceptance.suite.yml it throws the following error :
[PHPUnit\Framework\Exception] Invalid argument supplied for foreach() at ...
0
votes
0
answers
117
views
When I run my symfony application through Codeception functional tests Doctrine events are not fired
I'm creating a set of Functional tests for a Symfony 5.4 application using Doctrine.
Upon creation of a record of a certain type I need to trigger the creation of a record in another table.
For that I'...
0
votes
0
answers
15
views
Upgrading selenium/standalone-chrome from v3 to v4 speed issues
We are trying to upgrade our version of selenium/standalone-chrome in docker from v3.6 to latest v4.x but we are hitting massive performance issues. The time it takes to run tests has increased from ...
1
vote
1
answer
262
views
How do I get a Symfony 6 service from a Codeception Event Handler
I'm getting a "Module is not enabled" when trying to get the Symfony module from within a Codeception EventSubscriber.
git clone https://github.com/tacman/codeception-symfony-demo &&...
1
vote
1
answer
530
views
How to use data providers to create a test that runs before each test in a class?
I'm trying to test a class that handles a user's collection of favorite items, which can be of different types, eg. movies and songs.
So I have this base test class (I'm using Codeception, which uses ...
0
votes
1
answer
181
views
Use _beforeSuite() in Codeception
Good day! Please help me understand _beforeSuite($settings = array()) in Сodeception. I want to register the user before passing all the tests. I have a Tester class - MiddlewareTester, which ...
1
vote
1
answer
227
views
Module \Helper\Acceptance could not be found and loaded
I am new to Codeception. I followed the instructions on the Quick start page (https://codeception.com/quickstart) and saw the error "Module \Helper\Acceptance could not be found and loaded" ...
0
votes
1
answer
134
views
How do I access a DOM element with a dynamic ID in Codeception?
I'm new to autotests and I'm just starting to master Codeception. I am writing an autotest and at the end of the autotest I need to delete the . But when creating a new theme, a delete button with a ...
0
votes
0
answers
265
views
Codeception with docker compose in Symfony: 'No route found'
I'm trying to integrate the codeception framework into my symfony 4.4 app in docker. I have docker-compose.yml file.
version: '2'
services:
application:
build:
context: .
...
0
votes
1
answer
349
views
curl_setopt(): Filename cannot be empty
I try to run test and get this error
In Acceptance.php line 97:
curl_setopt(): Filename cannot be empty
My Acceptence.php file
$imgPath = codecept_output_dir() .'debug/fail.png';
curl_setopt($ch, ...
0
votes
1
answer
54
views
Codeception multiselect none - select no options
I'm trying to test a multiselect having all of its options unselected. I've found how to select multiple options by passing through an array of options, but passing an empty array generates an error.
$...
0
votes
1
answer
108
views
Codeception How to interact with a popup
I have been trying to research how to use Codeception to interact with a checkout modal.
The way the process works is a SPA/view app goes through several pages and builds up the details of a purchase.
...
0
votes
2
answers
102
views
Codeception doesn't override parameter in Gitlab
I have this issue
*********** codeception.yml ***************
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: ...
0
votes
1
answer
93
views
Codeception: '$I->see($text,$Selector)' throws error : 'stale element reference: element is not attached to the page document'
The following code in codeception threw error:
$I->see($text,$Selector);
Error received:
stale element reference: element is not attached to the page document
There are couple of solutions ...
-1
votes
1
answer
41
views
How do you handle dependency in api testing?
I have large api that I want to wirte api tests for each endpoint.
How should I handle testing endpoints that depend on id from other endpoints?
In our application we have to create client first then ...