![](/img/trans.png)
[英]Testing a Flask app with pytest-flask + pytest-selenium (docker)
[英]pytest-selenium: pytest_selenium_capture_debug hook is not fired on test failure
我使用 pytest 和 selenium 為 Web 應用程序進行 e2e 測試。 一切都很好,但有一件事我無法弄清楚,盡管花了一天時間在網上搜索。
我無法使pytest_selenium_capture_debug
工作。 我把它放在測試源根目錄的conftest.py
中。 測試在 docker 容器內運行。 Firefox 使用xvfb-run
。 我錄制屏幕視頻並希望在測試失敗時將其復制到主機。
我使用python 3.6.11
,這些庫版本是
pytest==6.2.4
pytest-base-url==1.4.2
pytest-helpers-namespace==2021.4.29
pytest-html==3.1.1
pytest-lazy-fixture==0.6.3
pytest-metadata==1.11.0
pytest-repeat==0.9.1
pytest-selenium==2.0.1
pytest-variables==1.9.0
selenium==3.141.0
使用custom_selenium
夾具引起的問題。 為了使所有pytest-selenium
鈎子正常工作,必須使用由pytest-selenium
定義的selenium
固定裝置,如下所示。
@pytest.fixture
def logged_in_selenium(selenium):
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.