serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
721 stars 517 forks source link

BUG: Browser is not restarting when using runner class with junit suite parameters #3193

Open mrpet88 opened 1 year ago

mrpet88 commented 1 year ago

Run sample project with clean test -Dcucumber.filter.tags="@MyTest"

When running with junit suite parameters:

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("/features")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,json:build/test-results/cucumber/frontend/global/results.json,timeline:build/test-results/timeline")
public class CucumberTestSuite {}

And with serenity.conf values:

  restart.browser.for.each = scenario
  use.unique.browser = false

Then browser is not restarting.

Observe that if tests run with the classic cucumber runner class (and with useJUnitPlatform() in gradle deactivated)

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        plugin = {"pretty"},
        features = "src/test/resources/features"
)

Then browser is restarting as expected.

Repo to reproduce: https://github.com/mrpet88/basicProjects/tree/main/src

Other info: serenityCoreVersion = '3.6.x'

wakaleo commented 1 year ago

The sample project doesn't compile.

wakaleo commented 1 year ago

I'm not seeing this behaviour with 3.9.7 - could you check with that version?

mrpet88 commented 1 year ago

Yes 3.9.7 works, but I also found out that it was also happening because the two scenarios I was trying to run had exactly the same name (Searching for a term) After upgrading the serenity core and changed the names it worked. But is 3.9.7 version a stable version that I could use ?

wakaleo commented 1 year ago

Yes, 3.9.7 is stable.

mrpet88 commented 1 year ago

@wakaleo since this is open. Is there a known issue with screenshots on failures and parallel execution? I have a reproducible example if you want I can give another example repo.

wakaleo commented 1 year ago

I am not aware of such an issue

mrpet88 commented 1 year ago

On same repo -> https://github.com/mrpet88/serenity-cucumber-test-project

Running one scenario: image

Running on parallel: image

wakaleo commented 1 year ago

I won't have time to look at this soon: could you take a look and raise a PR?

mrpet88 commented 1 year ago

I could try at least. Can you give me a small direction on where should I look for fixing?

cliviu commented 1 year ago

I can reproduce it, it looks like we have a bug, reported also here : https://github.com/serenity-bdd/serenity-core/issues/3176 . I will take a look

cliviu commented 1 year ago

@mrpet88 , I have pushed my changes here: https://github.com/cliviu/serenity-core/tree/screenshots_on_failures Let my know please if you can try it.

mrpet88 commented 1 year ago

@cliviu is there a public snapshot version I could use? Or do I need to build the jar?

cliviu commented 1 year ago

Currently there is no publicversion

mrpet88 commented 1 year ago

Are there somewhere instuctions on how to use the branch as dependency? Not sure if I am missing something here but cant seem to be able to build the project

cliviu commented 1 year ago

No problem, just wait for the next release

mrpet88 commented 1 year ago

@cliviu should this work under new 4.0.1 version?