Comments (10)
Ok, I figured it out (I guess). Turns out that Playwright's wrapper for reporters expects onError method from custom reporter, and that's something SerenityReporterForPlaywrightTest doesn't have.
Now to Serenity's part @jan-molak , do you have a reliable way to test serenity's console reporter?
(gonna also change to my main account, I want to have first real contribution well documented on my GH account 😄 )
from serenity-js.
And also I think running npm ls --all
is kinda too long for an issue 😄
from serenity-js.
Another thing I discovered, Serenity reporter leaves ambiguous report when test times out from playwright setup test.
This test times out on custom Interaction waiting for invoice, but it's not visible.
Also, @serenity-js/code:StreamReporter doesn't indicate the test was timed out
{"type":"SceneFinishes","event":{"sceneId":"j9eesfa8xwgfoaa2c3ec8hpf","timestamp":"2024-02-20T14:08:43.087Z"}}
{"type":"AsyncOperationAttempted","event":{"correlationId":"fzfrpma1qgycaicdk59qjzpv","description":"Dismissing Steve...","name":"Stage","timestamp":"2024-02-20T14:08:43.104Z"}}
It even seems that reporter labels tests in the same case (interaction is so long that test times out) as execution ignored or failed
from serenity-js.
Nice catch; thanks for reporting! I'll need to investigate that! (Unless you already have an idea for a fix, in which case PRs are also very welcome)
from serenity-js.
I can work on that one in free time, but I don't have any implementation in mind and I'm not doing any cookie-licking, so feel free to investigate that yourself.
from serenity-js.
Nice!
OK, so Serenity/JS uses SerenityReporterForPlaywrightTest
to extract data from a Playwright Test run -
That's where we'd need the
onError
handler.
However, Serenity/JS also decouples the process of extracting the data from reporting by emitting domain events.
For example, you have a TestRunFinishes
and TestRunFinished
events, the latter of which could be emitted with an outcome indicating an error.
Playwright docs state that onError
is:
Called on some global error, for example unhandled exception in the worker process.
I assume this means that the handler should be invoked at most once.
However, I don't know if Playwright executes both onError
and onEnd
handlers should a global error occur.
If it does, then onError
could remember the error, and then the existing onEnd
could emit that, if present.
Regarding testing, you can simulate error conditions and how a global error is picked up by the SerenityReporterForPlaywrightTest
using the integration/playwright-test
suite.
To test the ConsoleReporter
, you can use the specs inside packages/console-reporter
Any questions just let me know! And thanks for offering to help out 👍
from serenity-js.
Alright, alright. I decided to create a new Domain Event for that - GlobalExceptionEncountered. I guess it would be clearer in StreamReporter.
I'll try as well your approach with emitting this during onEnd, but...
I wanted to run this to just see how it works, but I can't get it working with my new event type and building throws me an error complaining it doesn't know this type. I couldn't find it on the Contribute docs, any tips? 😄
from serenity-js.
I couldn't find it on the Contribute docs, any tips?
Haha, sure. You're digging deep into the heart of Serenity/JS :-)
What's the error you're getting? Any stack trace you could share? If you want, feel free to open a draft PR and we can discuss there.
from serenity-js.
added a draft PR. I'm more of a fan of trying to do and try things several times so I can see what sticks. The problem is that my new Domain Event I created in core package is not recognised by console-reporter package. What should I run to mak those packaged sync between each other?
from serenity-js.
Fixed by #2252, released in Serenity/JS 3.19.0 🚀
from serenity-js.
Related Issues (20)
- Serenity/JS should allow to attach files or other attachments to test cases and show them in the html report HOT 1
- Serenity/JS should contain templates with Selenium HOT 1
- Serenity/JS docs should explain how to set window size when using Playwright without Playwright Test
- Serenity/JS should have a "Community" page
- Serenity/JS should automatically propose updates when they're available
- SerenityBDD report still contains dead links in nested spec structures HOT 1
- Serenity/JS should provide the actual value of a note in reports HOT 13
- Serenity/JS Github main README.md - Deadlink to playwright-test in handbook HOT 1
- How to create a question that would Round number and convert to string.
- Documentation: Official Playwright component testing tutorial
- Getting TypeError [ERR_INVALID_URL]: Invalid URL for Switch.to
- serenity-bdd: The id generated doesn't include the path to the feature, so the context of the feature is lost. HOT 6
- Serenity/JS could show where the changes between releases have been made in SCM tool (git) and highlight areas that have not been retested HOT 2
- After Switching to iFrame not able to click on any other element which is outside of the page HOT 2
- Playwright 1.43.1 not compatible. HOT 1
- serenity-js/cucumber/playwright can't able to run the example tests with NODE v20.12.2 HOT 3
- Serenity/JS own integration test reports for web specs are not complete HOT 2
- Inconsistency when injecting Playwright Browser with mocha as test runner HOT 1
- Inconsistency between WDIO and Playwright with reload and onbeforeunload event
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serenity-js.