[Answer]-Django tests failing on CI after adding django-bower

0👍

I use Bower with Django projects, but I don’t used django-bower. I use it standalone (via bower install), have it store front-end deps in static/bower-components, and refer to that path in templates with the {% static %} template tag. No idea whether doing that would affect your odd test results, but worth a try.

1👍

This would be still a guess, but I’ve seen these kind of problems solved by tweaking your tests and adding an Explicit Wait. Instead of just:

form = driver.find_element_by_id('message-form')

use:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

form = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "message-form")))

Basically, you are waiting for the element to become present on a page for 10 seconds, checking every 500 ms. If the element would not become present in 10 seconds, it would throw TimeoutException.

👤alecxe

Leave a comment