Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ModelAdmin breadcrumbs regression tests to be more flexible #8547

Conversation

thibaudcolas
Copy link
Member

Attempts to fix test regressions in stable/3.0.x by making the ModelAdmin breadcrumb tests more flexible. We’ve changed those templates in #8491, and only cherry-picked the most fundamental changes to stable/3.0.x, which is causing test failures for that branch only.

There are 3 "breadcrumbs position in ModelAdmin" test cases, 2 were failing. I’ve updated those two to work the same as the one that was still passing. I’ve also updated the three tests to check the presence of the nav landmark region, rather than the ul, as that’s more semantically what should denote where the breadcrumbs are.

I find the value of this "position" test a bit dubious compared to just testing whether the breadcrumbs are present or not. Hopefully something we could revisit as part of #8539.

@squash-labs
Copy link

squash-labs bot commented May 16, 2022

Manage this branch in Squash

Test this branch here: https://thibaudcolasbug8471-modeladmin-nvurz.squash.io

@gasman
Copy link
Collaborator

gasman commented May 16, 2022

With this change there are now failures against both main and stable/3.0.x:

======================================================================
ERROR: test_choose_inspect_page (wagtail.contrib.modeladmin.tests.test_page_modeladmin.TestHeaderBreadcrumbs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/matthew/Development/tbx/wagtail/devscript/wagtail/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py", line 406, in test_choose_inspect_page
    position_of_breadcrumbs = content_str.index('<nav aria-label="Breadcrumb">')
ValueError: substring not found

======================================================================
ERROR: test_choose_parent_page (wagtail.contrib.modeladmin.tests.test_page_modeladmin.TestHeaderBreadcrumbs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/matthew/Development/tbx/wagtail/devscript/wagtail/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py", line 377, in test_choose_parent_page
    position_of_breadcrumbs = content_str.index('<nav aria-label="Breadcrumb">')
ValueError: substring not found

======================================================================
ERROR: test_choose_inspect_model (wagtail.contrib.modeladmin.tests.test_simple_modeladmin.TestHeaderBreadcrumbs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/matthew/Development/tbx/wagtail/devscript/wagtail/wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py", line 952, in test_choose_inspect_model
    position_of_breadcrumbs = content_str.index('<nav aria-label="Breadcrumb">')
ValueError: substring not found

----------------------------------------------------------------------
Ran 107 tests in 9.304s

@gasman
Copy link
Collaborator

gasman commented May 16, 2022

Superseded by #8549

@gasman gasman closed this May 16, 2022
@thibaudcolas thibaudcolas deleted the bug/8471-modeladmin-breadcrumb-tests branch August 3, 2022 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants