AngularJS and Play Scala 2.1 Integration Testing

105 views
Skip to first unread message

Daniel Hollcraft

unread,
Aug 27, 2013, 3:48:10 PM8/27/13
to play-fr...@googlegroups.com
Hey guys I'm having trouble with getting the following test to pass which runs through AngularJS functionality. I'm currently  using Play Scala 2.1. The code works ok in Safari (atleast enough so that the test should pass) and works good in Firefox and Chrome. But the test just wont pass. I'm not getting any errors. Its just red. I even tested to see if HTMLUNIT could see the html attributes and it could! Its as if HTMLUNIT doesn't do know what to do. Any ideas? Thanks for your help in advance!

view:

<html ng-app="easy-pie">
     ...
     <body ng-controller="MainCtrl">
          ....

        <form name="myForm" method= "GET" action = "@routes.AdminPages.showUsers()">
            <select id="filterBy" name="fby">
                <option value=@Messages("admin.user.uid")>@Messages("admin.user.uid")</option>
                <option value=@Messages("admin.user.userName")>@Messages("admin.user.userName")</option>
                <option value=@Messages("admin.user.authMethod")>@Messages("admin.user.authMethod")</option>
                <option value=@Messages("admin.user.role")>@Messages("admin.user.role")</option>
                <option value=@Messages("admin.user.email")>@Messages("admin.user.email")</option>
                <option value=@Messages("admin.user.firstName").replace(" ", "")>@Messages("admin.user.firstName")</option>
                <option value=@Messages("admin.user.lastName").replace(" ", "")>@Messages("admin.user.lastName")</option>
            </select>

            <input type="search" id="searchBox" name="f" value="@currentFilter" ng-model="f" required
             required placeholder='@Messages("admin.user.enter.filter")'>

            <input type="submit" id="searchSubmit" ng-disabled="myForm.$invalid" value="Filter"
                 class="btn btn-primary">
        </form>


Javascript:

var app = angular.module('easy-pie', []);

app.controller('MainCtrl', function($scope) {
    $scope.name = 'World';
});

Test:

    "disable filter button with javascript if nothing has been inputed into search box" in new Setup {
      running(TestServer(3333), HTMLUNIT) { implicit browser =>
        loginAdmin
        goToAdminUserPage
        browser.$("input#searchSubmit").click()
        browser.url must_== s"$siteRoot/admin/user"
      }
    }

Daniel Hollcraft

unread,
Aug 27, 2013, 3:54:09 PM8/27/13
to play-fr...@googlegroups.com
Sorry I should have added that Im making the submit button disabled unless there is text in text field. Thanks.
Reply all
Reply to author
Forward
0 new messages