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

WebElementFacade for Android Native App elements causing error #732

Closed iamsethi closed 7 years ago

iamsethi commented 7 years ago

The problem

I am trying to use Serenity for mobile automation. I am able to use WebElementFacade for the elements in a browser using FindBy Annotation. But when i use FindBy annotation for an element of native android app, it is throwing an error. Below is the error i am getting. I have also provided the code that i used below the error.

Did anyone else face the same situation? If yes, can you please provide the solution? This is blocking me from automating the Salesforce1 mobile app for android.

Environment

*Serenity Core : 1.2.3

Link to Appium logs

net.serenitybdd.core.exceptions.SerenityManagedException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7 milliseconds Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800' System info: host: '5CG544240N', ip: '10.188.192.85', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45' Driver info: io.appium.java_client.android.AndroidDriver Capabilities [{app=C:/Users/ab42596/Desktop/sfa-test-mobile/src/test/resources/Salesforce1.apk, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=emulator-5554, platform=LINUX, desired={app=C:/Users/ab42596/Desktop/sfa-test-mobile/src/test/resources/Salesforce1.apk, hub=http://127.0.0.1:4723/wd/hub, platformName=Android, deviceName=Salesforce1}, hub=http://127.0.0.1:4723/wd/hub, platformVersion=6.0, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android}] Session ID: bf7bf50e-c956-458f-bf88-fcfb484df770 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:540) at net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade.executeScript(JavascriptExecutorFacade.java:61) at net.thucydides.core.pages.jquery.JQueryEnabledPage.isJQueryAvailable(JQueryEnabledPage.java:45) at net.serenitybdd.core.pages.WebElementFacadeImpl.enableHighlightingIfRequired(WebElementFacadeImpl.java:1021) at net.serenitybdd.core.pages.WebElementFacadeImpl.click(WebElementFacadeImpl.java:985) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.thucydides.core.annotations.locators.AbstractSingleItemHandler.invoke(AbstractSingleItemHandler.java:45) at com.sun.proxy.$Proxy23.click(Unknown Source) at com.ctl.it.qa.sfa.tools.steps.user.UserSteps.logs_in_as(UserSteps.java:22) at com.ctl.it.qa.sfa.tools.steps.user.UserSteps$$EnhancerByCGLIB$$46b8b202.CGLIB$logs_in_as$0() at com.ctl.it.qa.sfa.tools.steps.user.UserSteps$$EnhancerByCGLIB$$46b8b202$$FastClassByCGLIB$$ec8cae2.invoke() at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:369) at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:354) at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:329) at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:134) at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:61) at com.ctl.it.qa.sfa.tools.steps.user.UserSteps$$EnhancerByCGLIB$$46b8b202.logs_in_as() at com.ctl.it.qa.sfa.tests.steps.user.UserStepDefinition.i_am_logged_in_as_a_user_in_SFA(UserStepDefinition.java:16) at ✽.Given I am logged in as a "Commercial" user in "SFA"(features/Login.feature:6)

Code To Reproduce Issue [ Good To Have ]

@RunWith(SerenityRunner.class)

public class AppTest {

   @Steps

   usersteps usteps;

   @Test

   public void SFA_MobileTest() {

                System.out.println("Test Started");

                 usteps.SFA_LaunchPage();

   }

}

userSteps.Java

@SuppressWarnings("serial")

public class usersteps extends ScenarioSteps {

   LaunchPage launchPage;

   @Step

   public void SFA_LaunchPage(){

          launchPage.btn_Accept.click();

          System.out.println("Test Ended");

}

}.

wakaleo commented 7 years ago

The stack trace is not from serenity-core 1.2.3; you might get different results with the latest version.

iamsethi commented 7 years ago

I've updated to latest version serenity-core 1.2.3 and now i am able to see expected results. Thanks!