Do you want to work on this issue?
You can request for a bounty in order to promote it!
Serenity Parallel Reporter crashes on testcase finished event with the error failed to cast WebDriverFacade to AndroidDriver #3588
alejobar81 posted onGitHub
What happened?
I'm initializing manually an AndroidDriver (due to the issue with the unrecognized appium capabilities when trying to use the auto setup). The test runs successfully but after it passes, the executions breaks with the error: "class io.appium.java_client.android.AndroidDriver cannot be cast to class net.thucydides.core.webdriver.WebDriverFacade (io.appium.java_client.android.AndroidDriver and net.thucydides.core.webdriver.WebDriverFacade are in unnamed module of loader 'app')"
The issue happens in line 370 of the class SerenityReporterParallel where the method handleTestCaseFinished is adding a new TestFinishedEvent to the step event bus.
The constructor of TestFinishedEvent ends calling the method saveCurrentWebDriverContext and in line 36, WebDriverFacade currentDriver = (WebDriverFacade) SerenityWebdriverManager.inThisTestThread().getCurrentDriver();
the cast to WebDriverFacade fails due to incompatibility with the AndroidDriver loaded.
What did you expect to happen?
The test suite should run successfully with an AndroidDriver configured manually
Serenity BDD version
4.2.8
JDK version
17
Execution environment
Mac OS Sonoma 14.7.1
How to reproduce the bug.
Due to confidentiality issues I can't post the code I did for this purpose. You just need to start with the serenity-cucumber-starter project and then create a new instance of an AndroidDriver. Then just call theActorCalled(userAlias).can(BrowseTheWeb.with(new AppiumDriverFactory().createDriver())) and finally run a test against an Android app.
How can we make it happen?
Work on this myself and propose a PR (with Serenity BDD team guidance)