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
Serenity/JS should offer a more intelligent strategy to take photos of failures #1996
Comments
It's a good idea. I can imagine something like An interesting challenge we're going to have is where to accumulate the photos that may or may not need to be discarded. For example, the new implementation of the So assuming there's some internal - stage.announce(new ActivityRelatedArtifactGenerated(
+ this.events.push(new ActivityRelatedArtifactGenerated(
event.sceneId,
event.activityId,
photoName,
Photo.fromBase64(screenshot),
stage.currentTime(),
)); Then, upon a failure, all artifacts cached internally could be emitted together. Since they would be already associated with a scene, activity, and the time the photo was taken, Emitting all Serenity BDD reporter already temporarily caches screenshots in memory (using Hmm, I actually quite like this behaviour. I wonder if this is how |
give the Photographer the chance to intercept creation of artifact in file system Related tickets: serenity-js#1996
Thought a bit about this. Actually, we're not changing the Today, As you already said: We now have to queue this somehow until we now more about the outcome of the test. But this will completely change the behaviour and will cause a lot of tests to fail, because
Making this the default would also imply the So maybe we should go into something like a |
give the Photographer the chance to intercept creation of artifact in file system Related tickets: serenity-js#1996
Added a second commit, but this does not work as expected. I think, I do not understand the order of the |
give the Photographer the chance to intercept creation of artifact in file system Related tickets: serenity-js#1996
Related tickets: serenity-js#1996
Related tickets: serenity-js#1996
Well, I found the array holding my artefacts was not initialized and so undefined. The I had to announce the Result so far: A screenshot is not saved immediately after it was taken, but collected into an array. Screenshots are now saved when But this help to solve the problem of this feature request? 😄 No, because the way it's build now we still have to announce before As I already wrote in our elements chat, I think, there is a bit missing in the eventing concept. Maybe some event like |
Simplified sequence diagram of current situation: sequenceDiagram
autonumber
participant TestRunner
participant EventBus
participant Photographer
participant BDDReporter
participant ArtifactArchiver
participant FileSystem
TestRunner ->> EventBus: TaskStarted
activate TestRunner
loop
TestRunner ->> EventBus: ActivityStarted / Finished
EventBus -->> Photographer: ActivityStarted / Finished
activate Photographer
Photographer ->> Photographer: takePhoto
Photographer ->> EventBus: ActivityRelatedArtifactGenerated
deactivate Photographer
par
EventBus -->> BDDReporter: notifyOf(ArtifactGenerated)
activate BDDReporter
BDDReporter ->> BDDReporter: enque DomainEvent (with filename)
deactivate BDDReporter
and
EventBus -->> ArtifactArchiver: notifyOf(ArtifactGenerated)
activate ArtifactArchiver
ArtifactArchiver ->> FileSystem: write to
ArtifactArchiver ->> EventBus: ArtifactArchived
deactivate ArtifactArchiver
end
end
TestRunner ->> EventBus: TaskFinishes
EventBus -->> BDDReporter: TaskFinishes
activate BDDReporter
BDDReporter ->> BDDReporter: processQueue()
BDDReporter ->> EventBus: ArtifactGenerated()
deactivate BDDReporter
EventBus -->> ArtifactArchiver: ArtifactGenerated
activate ArtifactArchiver
ArtifactArchiver ->> FileSystem: write to
ArtifactArchiver ->> EventBus: ArtifactArchived
deactivate ArtifactArchiver
TestRunner ->> EventBus: TaskFinished
deactivate TestRunner
|
…porter Related tickets: serenity-js#1996
@jan-molak, I overthought this a bit by all my experiments and all your input by now: First, taking screenshots and using The It's about if a certain collection of photos should be included in the report under certain circumstances. So the behaviour proposed in this request should not be default behaviour of About the eventing: When a photo was taken it's announced to the stage ( The The While the When the test runner announces the
When processing has finished, Question is, if the Though, there is another problem: Or is there a mechanism in place, that prevents a test run to finish as long as not all async operations returned with So either we let the Or, alternative we would delete the pngs from disk and the related events from the queue before processing. This would maybe be the easier way, and maybe the more consistent one, at all?
|
Hi @jan-molak, I'm back on this one and overthought it a bit. You mentioned in one of our discussions that you think about making the
For solving the problem in this issue:
What do you think? |
What's the problem you're trying to solve?
We have the
PhotoTakingStrategy
calledTakePhotosOfFailures
. But most times it helps to see the screenshots fron before that leaded to this failure, as well. We can use the strategyTakePhotosOfInteractions
to generate this helpful screenshots, but as a pitfall we generate a lot of screenshots and a lot of data. Especially in combination with nestedTask
s this strategy can get very verbose.How would you like to solve it?
We take photos of interactions for the whole scene, but if it finishes with SUCCESS, we remove the photos from the filesystem, or at least prevent them from getting part of reporting.
Are there any alternatives?
We reduce the amount of photos taken by a new
TakePhotosOfTasks
strategy, that will check, if an interaction is part of aTask
or a nestedTask
, and if so, no photo is taken. Drawback: Depending on how you tasks are tailored, this can lead to missing screenshots of important interactions.How can we make it happen?
The text was updated successfully, but these errors were encountered: