Arquillian Graphene and Angular JS

solved

#1

Hi I am developing a Graphene test with Angular JS. First of all before using Graphene I have written a Drone test:

    @Test
        public void shouldShowLoginPage() {
            driver.get(contextPath.toExternalForm());
            driver.findElement(By.id("username")).sendKeys("alex");
            driver.findElement(By.id("password")).sendKeys("alex");
            driver.findElement(By.id("loginBtn")).click();
            //wait
        }

And in this case the browser is opened both fields are filled and when the login button is pushed there is an AngularJS transition to “next” page.

But then I decided to move to Graphene and I jhave created a PageObject:

    @Location("")
    public class LoginPage {
    
        @FindBy(id = "username")
        private WebElement username;
        @FindBy(id = "password")
        private WebElement password;
        @FindBy(id = "loginBtn")
        private WebElement loginButton;
    
        public void login(String username, String password) {
            this.username.sendKeys(username);
            this.password.sendKeys(password);
            guardAjax(loginButton).click();
        }
    }

In this case the browser is opened, both fields are filled, the login button is pushed because I can see how the colour changes, but the page does not transition. Also I can remove the guardAjax protection but the result is exactly the same. So what I am doing wrong?

I am using Arquillian 1.1.8, Drone 2.0.0.Alpha4, Graphene 2.1.0.Alhpa2 and Selenium bom 2.45.0.

You can execute yourself the project: https://github.com/lordofthejars/films

Thank you so much,


#2

Did you find the solution for your issue?


#3

I can’t remember but I think so.


#4

In general it’s good to have a wait for all pending requests initiated by Angular. You can easily do it yourself or grab angularjs-graphene extension which comes with this functionality too.