我最近将 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
看起来布局已经改变,css 类".banner-notice-dismiss"不再有元素。
当我将我的项目(有 Splinter 测试)从 Django 1.6 升级到 1.8 时,我不得不从 LiveServerTestCase
更改为 StaticLiveServerTestCase
。