使用Lettuce&amp ;;进行整合测试将Django升级到1.8.9后沙拉失败

时间:2016-02-19 19:26:00

标签: django selenium bdd splinter lettuce

我最近将Django从1.6.11升级到1.8.9,并且所有集成测试都失败了。所有这些测试都在1.16.11中通过。

我得到的一些错误示例是:

    And I should see "Announcements" somewhere in the page within 5 seconds                                     # home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/elements.py:10
And I should see "Announcements" somewhere in the page within 5 seconds                                     # home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/elements.py:10
Traceback (most recent call last):
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/lettuce/core.py", line 144, in __call__
    ret = self.function(self.step, *args, **kw)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/elements.py", line 11, in should_see_in_the_page
    assert_with_negate(text in world.browser.html, negate)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/tests/util.py", line 19, in assert_with_negate
    assert assertion
AssertionError

And I click on the element with the css selector ".banner-announcement-dismiss"                             # home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/mouse.py:49
salad - ERROR - Element not found: find_by_css for .banner-announcement-dismiss
And I click on the element with the css selector ".banner-announcement-dismiss"                             # home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/mouse.py:49
Traceback (most recent call last):
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/lettuce/core.py", line 144, in __call__
    ret = self.function(self.step, *args, **kw)
   File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/mouse.py", line 50, in _this_step
ele = _get_element(finder_function, first, last, find_pattern)
   File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/salad/steps/browser/finders.py", line 43, in _get_element
raise ElementDoesNotExist
ElementDoesNotExist

有没有人有可能出错的想法?我正在运行以下版本:

Django==1.8.9
lettuce==0.2.21
salad==0.4.14
splinter==0.7.3

2 个答案:

答案 0 :(得分:0)

看起来布局已经改变,并且没有更多元素与css类" .banner-announcement-dismiss"。

答案 1 :(得分:0)

当我将项目(具有Splinter测试)从Django 1.6升级到1.8时,我必须从LiveServerTestCase更改为StaticLiveServerTestCase