Re: [geb-dev] Re: Testing spring security protected pages

22 views
Skip to first unread message

Marcin Erdmann

unread,
Nov 29, 2016, 4:41:54 PM11/29/16
to geb...@googlegroups.com
You shouldn't be passing your password and username as arguments to the via/to methods as these are used for advanced page navigation: http://www.gebish.org/manual/current/#advanced-page-navigation

You should add a void login(String username, String password) method to your LoginPage which will perform the necessary actions to log in and then call it after reaching the LoginPage:

to(LoginPage).login("a...@xyz.com", "my_pwd")
at SitePage.

Marcin

P.s. Please ask similar usage questions on the user list (https://groups.google.com/d/forum/geb-user) in the future. User list is followed by more people and this is a dev list intended for discussion about development of Geb itself.

On Fri, Nov 25, 2016 at 8:04 AM, Sohaiba Qazi <soh...@aurorasolutions.io> wrote:
P.S: Currently I am getting the error:
Illegal character in path at index 11: login/auth/[a...@xyz.com, my_pwd]

On Friday, November 25, 2016 at 1:00:45 PM UTC+5, Sohaiba Qazi wrote:
Hi everyone!

I am using Geb version 0.9.1 and I want to be able to test Spring Security protected web pages. My goal is to access a 'site' page to perform some action through the 'login' page by using the correct username and password to login.This is what my test looks like:
 def "do_something_on_site_page"() {
        given:
        via LoginPage, ["a...@xyz.com", "my_pwd"]
        at SitePage

        when:
        //do something

        then:
        //verify action performed
    }
I want to know two things:
1. how do we input multiple parameters when using the 'via' keyword?
2. how do we handle multiple redirects? Is there a better way to achieve this?

Thank you!

--
You received this message because you are subscribed to the Google Groups "Geb Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-dev+unsubscribe@googlegroups.com.
To post to this group, send email to geb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-dev/5dd794b1-0624-4185-9218-8b6863b1a349%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages