serenity-appium is working fine on using serenity version 1.7.4 and serenity cucumber version 1.6.3. However getting below error on using serenity and cucumber version 3.0.5 for the page
[main] WARN net.thucydides.core.pages.PageFactory - Failed to instantiate page of type class pageObjects.LoginPageMobile (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)
Given User launches "Mobile" application # starter.stepdefinitions.LoginSteps.userLaunchesApplication(java.lang.String)
net.thucydides.core.pages.WrongPageError: The page object class pageObjects.LoginPageMobile could not be instantiated:
Failed to instantiate page (net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class io.appium.java_client.AppiumDriver)
Tried with below pages
Without MobilePageObject
package pageObjects;
import io.appium.java_client.pagefactory.AndroidFindBy;
import net.serenitybdd.core.pages.PageObject;
import org.openqa.selenium.WebElement;
public class LoginPageMobile extends PageObject {
@AndroidFindBy(xpath="//android.widget.Button[@text='Log In']")
private WebElement WPLogInButton;
public void doLogin(){
typeInto(WPLogInButton,"[email protected]");
}
}
With MobilePageObject
package pageObjects;
import com.google.common.base.Predicate;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import net.serenitybdd.core.pages.PageObject;
import io.appium.java_client.android.AndroidDriver;
import net.thucydides.core.webdriver.WebDriverFacade;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class MobilePageObject extends PageObject {
public MobilePageObject(final WebDriver driver) {
super(driver, new Predicate<PageObject>() {
@Override
public boolean apply(PageObject page) {
PageFactory.initElements(new AppiumFieldDecorator(((WebDriverFacade) page.getDriver()).getProxiedDriver()), page);
return true;
}
});
}
public MobilePageObject() {
}
}
Serenity.properties
webdriver.driver= appium
appium.hub = http://localhost:4723/wd/hub
######## android CAPS ######
appium.automationName = Appium
appium.platformName= Android
appium.platformVersion = 11.0
appium.deviceName = emulator-5554
appium.app = serenity-cucumber-starter/src/test/resources/Calculator.apk
Extending PageObject rather than MobilePageObject for the page resolved the issue for serenity and cucumber version 3.0.5.