Skip to content
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 Parallel Reporter crashes on testcase finished event with the error failed to cast WebDriverFacade to AndroidDriver #3588

Open
alejobar81 opened this issue Dec 17, 2024 · 1 comment

Comments

@alejobar81
Copy link

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)

@wakaleo
Copy link
Member

wakaleo commented Dec 21, 2024

The saveCurrentWebDriverContext() is assuming that the driver is manager by Serenity (and therefore an instance of WebDriverFacade). You need to add logic to allow the code to cater for normal WebDriver (or RemoteWebDriver) instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants