views:

167

answers:

1

I am using Selenium RC and I have a test case creating posts and checking in the frontend (public side) if the posts were created and how they are rendered.

But even if I log in at the beginning of the test case when I call the open command to go to wp-admin I am sent to the log in page.

Why is the open ignoring that I am already authenticated ?

My goal is to create a test suite with a log in test case at its beginning and a log out test case at its end.

Here is my broken test case :

    <tr>
            <td>open</td>
            <td>wp-admin/</td>
            <td></td>
    </tr>
    <tr>
            <td>type</td>
            <td>user_login</td>
            <td>admin</td>
    </tr>
    <tr>
            <td>type</td>
            <td>user_pass</td>
            <td>pass</td>
    </tr>
    <tr>
            <td>clickAndWait</td>
            <td>wp-submit</td>
            <td></td>
    </tr>
    <tr>
            <td>open</td>
            <td>wp-admin</td>
            <td></td>
    </tr>
    <tr>
            <td>break</td>
            <td></td>
            <td></td>
    </tr>
    // ---> Login page instead of Dashboard

And it works with Selenium IDE.

java -jar "selenium-server.jar" -avoidProxy -userExtensions "user-extensions.js"
   -trustAllSSLCertificates -proxyInjectionMode -log "log.log"
   -Dhttp.proxyHost=proxy -Dhttp.proxyPort=80
   -htmlSuite "*firefox" "http://localhost/wordpress/" "testSuite.html" "results.html"

Thank you

+1  A: 

I was able to replicate this, and found the problem to be the address of the site. I was opening http://www.example.com/ and it was being redirected to http://example.com

Check that your base URL (http://localhost/wordpress/) is not being changed when the logon page is loaded.

The clue for me was the URL in the address bar when the logon page was displayed for the second time:

http://example.com/blog/wp-login.php?redirect_to=http%3A%2F%2F**www.example.com**%2Fblog%2Fwp-admin%2F

Dave Hunt
Thanks a lot :)I was running the server with :`-htmlSuite "*firefox" "localhost" "%1" "%~dp1results.html"`but my wordpress base url was redirecting me to my computer's hostname.Thanks a lot
Dreur
Thought it might be something like that. You're welcome.
Dave Hunt