Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At event RESULT_PRINT_AFTER - Codeception 5 - file report.htlm is not exist yet #6703

Open
maxrexfax opened this issue Oct 10, 2023 · 6 comments

Comments

@maxrexfax
Copy link

maxrexfax commented Oct 10, 2023

What are you trying to achieve?

I was trying to edit report.html file using RESULT_PRINT_AFTER event.

What do you get instead?

I got message File not exist inside public function resultPrintAfter(\Codeception\Event\PrintResultEvent $e) function.

Provide console output if related. Use -vvv mode for more details.
Rude check with

public function resultPrintAfter(\Codeception\Event\PrintResultEvent $e): void
    {
        exit('---------------------------------');

... shows EMPTY folder .../codeception/tests/_output

# paste output here
```php vendor/bin/codecept run --steps --html --xml --phpunit-xml```
> Provide test source code if related

```php
// paste test

Details

  • Codeception version:5
  • PHP Version:7.4
  • Operating System: Ubuntu 20.04
  • Installation type: Composer
  • List of installed packages (composer show)
  • behat/gherkin v4.9.0 Gherkin DSL parser for PHP
    codeception/codeception 5.0.11 BDD-style testing framework
    codeception/lib-asserts 2.1.0 Assertion methods used by Codec...
    codeception/lib-innerbrowser 3.1.3 Parent library for all Codecept...
    codeception/lib-web 1.0.2 Library containing files used b...
    codeception/lib-xml 1.0.1 Files used by module-rest and m...
    codeception/module-asserts 3.0.0 Codeception module containing v...
    codeception/module-phpbrowser 3.0.0 Codeception module for testing ...
    codeception/module-rest 3.3.2 REST module for Codeception
    codeception/stub 4.1.2 Flexible Stub wrapper for PHPUn...
    doctrine/instantiator 1.5.0 A small, lightweight utility to...
    graham-campbell/result-type v1.1.1 An Implementation Of The Result...
    guzzlehttp/guzzle 7.8.0 Guzzle is a PHP HTTP client lib...
    guzzlehttp/promises 2.0.1 Guzzle promises library
    guzzlehttp/psr7 2.6.1 PSR-7 message implementation th...
    justinrainbow/json-schema v5.2.13 A library to validate a json sc...
    myclabs/deep-copy 1.11.1 Create deep copies (clones) of ...
    nikic/php-parser v4.17.1 A PHP parser written in PHP
    phar-io/manifest 2.0.3 Component for reading phar.io m...
    phar-io/version 3.2.1 Library for handling version in...
    phpoption/phpoption 1.9.1 Option Type for PHP
    phpunit/php-code-coverage 9.2.29 Library that provides collectio...
    phpunit/php-file-iterator 3.0.6 FilterIterator implementation t...
    phpunit/php-invoker 3.1.1 Invoke callables with a timeout
    phpunit/php-text-template 2.0.4 Simple template engine.
    phpunit/php-timer 5.0.3 Utility class for timing
    phpunit/phpunit 9.6.13 The PHP Unit Testing framework.
    psr/container 2.0.2 Common Container Interface (PHP...
    psr/event-dispatcher 1.0.0 Standard interfaces for event h...
    psr/http-client 1.0.3 Common interface for HTTP clients
    psr/http-factory 1.0.2 Common interfaces for PSR-7 HTT...
    psr/http-message 2.0 Common interface for HTTP messages
    psy/psysh v0.11.21 An interactive shell for modern...
    ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
    sebastian/cli-parser 1.0.1 Library for parsing CLI options
    sebastian/code-unit 1.0.8 Collection of value objects tha...
    sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or meth...
    sebastian/comparator 4.0.8 Provides the functionality to c...
    sebastian/complexity 2.0.2 Library for calculating the com...
    sebastian/diff 4.0.5 Diff implementation
    sebastian/environment 5.1.5 Provides functionality to handl...
    sebastian/exporter 4.0.5 Provides the functionality to e...
    sebastian/global-state 5.0.6 Snapshotting of global state
    sebastian/lines-of-code 1.0.3 Library for counting the lines ...
    sebastian/object-enumerator 4.0.4 Traverses array structures and ...
    sebastian/object-reflector 2.0.4 Allows reflection of object att...
    sebastian/recursion-context 4.0.5 Provides functionality to recur...
    sebastian/resource-operations 3.0.3 Provides a list of PHP built-in...
    sebastian/type 3.2.1 Collection of value objects tha...
    sebastian/version 3.0.2 Library that helps with managin...
    softcreatr/jsonpath 0.8.3 JSONPath implementation for par...
    symfony/browser-kit v6.0.19 Simulates the behavior of a web...
    symfony/console v6.0.19 Eases the creation of beautiful...
    symfony/css-selector v6.0.19 Converts CSS selectors to XPath...
    symfony/deprecation-contracts v3.0.2 A generic function and conventi...
    symfony/dom-crawler v6.0.19 Eases DOM navigation for HTML a...
    symfony/event-dispatcher v6.0.19 Provides tools that allow your ...
    symfony/event-dispatcher-contracts v3.0.2 Generic abstractions related to...
    symfony/finder v6.0.19 Finds files and directories via...
    symfony/polyfill-ctype v1.28.0 Symfony polyfill for ctype func...
    symfony/polyfill-intl-grapheme v1.28.0 Symfony polyfill for intl's gra...
    symfony/polyfill-intl-normalizer v1.28.0 Symfony polyfill for intl's Nor...
    symfony/polyfill-mbstring v1.28.0 Symfony polyfill for the Mbstri...
    symfony/polyfill-php80 v1.28.0 Symfony polyfill backporting so...
    symfony/service-contracts v3.0.2 Generic abstractions related to...
    symfony/string v6.0.19 Provides an object-oriented API...
    symfony/var-dumper v6.0.19 Provides mechanisms for walking...
    symfony/yaml v6.0.19 Loads and dumps YAML files
    theseer/tokenizer 1.2.1 A small library for converting ...
    vlucas/phpdotenv v5.5.0 Loads environment variables fro...

*Api Suite configuration:

actor: ApiTester
suite_namespace: Tests\Api
modules:
    # enable helpers as array
    enabled:
         - Tests\Support\Helper\Api
         - REST:
             url: https://api....
             depends: PhpBrowser
         - Asserts:
    config:
        REST:
            depends: PhpBrowser
            timeout: 60
        PhpBrowser:
            url: ''
            curl:
                CURLOPT_TIMEOUT: 60
step_decorators:
    - \Codeception\Step\AsJson
extensions:
    enabled:
@maxrexfax
Copy link
Author

With PHP8.0 same result

@Naktibalda
Copy link
Member

Probably your method is executed before HtmlReporter::afterResult

@maxrexfax
Copy link
Author

maxrexfax commented Oct 16, 2023

public static $events = array(
        Events::SUITE_BEFORE => 'suiteBefore',
        Events::RESULT_PRINT_AFTER => 'resultPrintAfter',
    );
 public function resultPrintAfter(\Codeception\Event\PrintResultEvent $e): void
    {
        exit('LINE:' . __LINE__ . '------------- public function resultPrintAfter --------------------');
//     

AND
Folder _output contains only json files with error description but NO result.html exist.

@maxrexfax
Copy link
Author

On the page https://codeception.com/docs/Customization there is no information about HtmlReporter::afterResult. Are we both talking about Codeception REST API testing?

@Naktibalda
Copy link
Member

There is no information about report.html in that page either.

Why do you even expect report.html to exist during test run?
If you want to modify report.html, it would be better to extend HtmlReporter and use your reporter instead, as described at https://codeception.com/docs/Reporting#Custom-Reporter

@maxrexfax
Copy link
Author

Thank you for information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants