Background Image
Table of Contents Table of Contents
Previous Page  406 / 478 Next Page
Information
Show Menu
Previous Page 406 / 478 Next Page
Page Background

Figure 20-10. Screenshot looking normal

Well, that didn’t help much.

A Common Selenium Problem: Race Conditions

Whenever you see an inexplicable failure in a Selenium test, one of the most likely

explanations is a hidden race condition. Let’s look at the line that failed:

functional_tests/test_my_lists.py.

# She sees that her list is in there, named according to its

# first list item

self

.

browser

.

find_element_by_link_text

(

'Reticulate splines'

)

.

click

()

self

.

assertEqual

(

self

.

browser

.

current_url

,

first_list_url

)

Immediately after we click the “Reticulate splines” link, we ask Selenium to check

whether the current URL matches the URL for our first list. But it doesn’t:

AssertionError:

'http://localhost

:8081/accounts

/edith@example.com

/' !=

'http://localhost

:8081/lists/1/'

It looks like the current URL is still the URL of the “My Lists” page. What’s going on?

378

|

Chapter 20: Continuous Integration (CI)