How to test with selenium the creation of posts of wordpress and what happens in the frontend?

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.

Read More

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

Related posts

Leave a Reply

1 comment

  1. 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%2Fhttp://www.example.com%2Fblog%2Fwp-admin%2F