codeceptjs / codeceptjs/CodeceptJS

Cannot grab browser logs on failure with multiple workers - question

Offen
#2,818 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
JavaScript
Sterne
4.2k
Forks
757
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
16

Beschreibung

#### What are you trying to achieve?

I want to grab browser logs when some test failed, tests are run using command: `./node_modules/.bin/codeceptjs run-workers 2 --grep "@sometesttag" --plugins allure`

And I see that custom hook:

```
event.dispatcher.on(event.test.failed, async (test, error) => {

})
```

inside which I use `await I.grabBrowserLogs();` is not working when we use multiple workers. (when we use `run-workers` command, with `run` this code works OK)

Tried also surround some part of the code with `try / catch` block and call `await I.grabBrowserLogs();` on error, but it does not work either.

Is this possible to make it working, simply to grab logs from browser on test failure (i.e. some element is not clickable on the page, or it is not in DOM), when we are using multiple workers? FYI - with standard `run` command I am using custom hook and it works like a charm. And I would like to achieve something similar but when multiple workers are used. Is this possible? I believe it might be doable using https://codecept.io/parallel/#custom-parallel-execution but then, I assume that browser control must be customized as well, and then we simply won't be able to use built-in method on `I` actor, right?

### Details

* CodeceptJS version: `3.0.5`
* NodeJS Version: `12.20.2`
* Operating System: macOS Catalina
* puppeteer

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.