Giter Site home page Giter Site logo

Comments (10)

1MateuszKruk avatar 1MateuszKruk commented on June 1, 2024 1

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.
image

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.

1MateuszKruk avatar 1MateuszKruk commented on June 1, 2024

And also I think running npm ls --all is kinda too long for an issue 😄

from serenity-js.

1MateuszKruk avatar 1MateuszKruk commented on June 1, 2024

Another thing I discovered, Serenity reporter leaves ambiguous report when test times out from playwright setup test.
image
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.

jan-molak avatar jan-molak commented on June 1, 2024

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.

1MateuszKruk avatar 1MateuszKruk commented on June 1, 2024

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.

jan-molak avatar jan-molak commented on June 1, 2024

Nice!

OK, so Serenity/JS uses SerenityReporterForPlaywrightTest to extract data from a Playwright Test run -

export class SerenityReporterForPlaywrightTest implements Reporter {

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.

In1th avatar In1th commented on June 1, 2024

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.

jan-molak avatar jan-molak commented on June 1, 2024

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.

In1th avatar In1th commented on June 1, 2024

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.

jan-molak avatar jan-molak commented on June 1, 2024

Fixed by #2252, released in Serenity/JS 3.19.0 🚀

from serenity-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.