Hello,
I have just built two Pages (Launch screen and Sign up screen) and created a test class where I am trying to call out a method from Sign up screen. Getting and error:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1
I am using android real device.
Similar test case works great in a separate class without pointing it to a Page.
here’ Sign up screen:
public class SignUpScreen {
private AppiumDriver driver;
private WebDriverWait wait;
public SignUpScreen(AndroidDriver<AndroidElement>driver){
this.driver=driver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}
// //Constructor
// public SignUpScreen(AndroidDriver driver){
// super(driver);
// }
//elements on the screen
@AndroidFindBy(id="signup_input_first_name")
private AndroidElement Signup_firstname;
@AndroidFindBy(id= "signup_input_last_name")
private AndroidElement Signgup_lastname;
@AndroidFindBy(id = "signup_input_email")
private AndroidElement Signup_email;
@AndroidFindBy(id = "signup_input_password")
private AndroidElement Signup_password;
@AndroidFindBy(id = "signup_input_vin")
private AndroidElement Signup_vin;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"Please enter a first name\\\"]\")")
private AndroidElement Signup_emptyname;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"Please enter a last name\\\"]\")")
private AndroidElement Signup_emptylastname;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"Please enter a valid email address\\\"]\")")
private AndroidElement Signup_invalidemail;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"Please enter a password\\\"]\")")
private AndroidElement Signup_invalidpassw;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"VIN must be 17 characters\\\"]\")")
private AndroidElement Signup_vinLess17chars;
@AndroidFindBy(id = "onboarding_signup_continue_button")
private AndroidElement SignupContinuebtn;
@AndroidFindBy(xpath = "\"//android.widget.TextView[@text=\\\"Already have an account?\\\"]\")")
private AndroidElement Signup_alreadyHaveAccount;
@AndroidFindBy(id= "btn_login")
private AndroidElement loginbtnInSignUp;
@AndroidFindBy(id="onboarding_barcode_button")
private AndroidElement barcodebtn;
@AndroidFindBy(id="text_input_password_toggle")
private AndroidElement showpassword;
@AndroidFindBy(className = "UIAKeyboard")
private AndroidElement keyboard;
//functions for all elements
public boolean isDisplayed(){
return SignupContinuebtn.isDisplayed();
}
public void clickContinuebtn(){
SignupContinuebtn.click();
}
public void enterFirstname(String name){
Signup_firstname.sendKeys(name);
}
public void enterLasname(String lastName){
Signgup_lastname.sendKeys(lastName);
}
public void enterEmail(String email){
Signup_email.sendKeys(email);
}
public void enterpassword(String password){
Signup_password.sendKeys(password);
}
public void enterVin(String vin){
Signup_vin.sendKeys(vin);
}
public void emptyName(){
Signup_emptyname.getText();
}
public void emptyLastname(){
Signup_emptylastname.getText();
}
public void invalidEmail(){
Signup_invalidemail.getText();
}
public void invalidFormatPassword(){
Signup_invalidpassw.getText();
}
public void vinLess17Chars(){
Signup_vinLess17chars.getText();
}
public void continueBtn(){
SignupContinuebtn.click();
}
public void haveAccountbtn(){
Signup_alreadyHaveAccount.click();
}
public void loginBtnSignUp(){
loginbtnInSignUp.click();
}
public void scanbtn(){
barcodebtn.click();
}
public void togglePassword(){
showpassword.click();
}
//function to enter all fields in sign up screen
public void signUp(String name,String lastName,String email,String password, String vin ){
wait = new WebDriverWait(driver, 15);
enterFirstname(name);
enterLasname(lastName);
enterEmail(email);
enterpassword(password);
enterVin(vin);
togglePassword();
driver.hideKeyboard();
wait = new WebDriverWait(driver, 15);
continueBtn();
}
and here’s a test class with all my caps. the following test case fails:
@Test
public void sighUpTest() throws MalformedURLException, InterruptedException{
LaunchScreen launchscreen = new LaunchScreen(driver);
if (!launchscreen.isDisplayed()) {
return;
}
launchscreen.selectServerCompanion();
launchscreen.clickSignup();
SignUpScreen signUpscreen = new SignUpScreen(driver);
if (!signUpscreen.isDisplayed()) {
return;
}
signUpscreen.signUp("Tanya", "Test", "x07sepage@gmail.com","qa123123", "TOPTESTVINX07TGTI");
Thread.sleep(3000);
}