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

Add tests for section-linking #5918

Merged

Conversation

@dojutsu-user
Copy link
Member

@dojutsu-user dojutsu-user commented Jul 12, 2019

Tests

@dojutsu-user dojutsu-user added this to In progress in In-doc search UI via automation Jul 12, 2019
@ericholscher ericholscher changed the base branch from master to gsoc-19-indoc-search Jul 12, 2019
@ericholscher
Copy link
Member

@ericholscher ericholscher commented Jul 15, 2019

Is this still a WIP?

@dojutsu-user
Copy link
Member Author

@dojutsu-user dojutsu-user commented Jul 15, 2019

Just some last commits.

Copy link
Member

@ericholscher ericholscher left a comment

This is a good upgrade, but I'm worried this will all break when we change the site design and cause a lot of extra work. Can we access the test data directly from rendering, instead of via HTML? That would make it much less brittle, and not dependent on the templates.

@@ -20,40 +25,112 @@ def setup_class(cls):
# installed
cls.url = reverse('doc_search')

@pytest.mark.parametrize('data_type', ['content', 'headers', 'title'])
@pytest.mark.parametrize('data_type', ['title'])
Copy link
Member

@ericholscher ericholscher Jul 15, 2019

We don't need param's here if there's only 1.

assert len(results) >= 2 # there are > 1 results without the filter

# checking if `std:confval` filter is present
content = page.find('.navigable .language-list').text()
Copy link
Member

@ericholscher ericholscher Jul 15, 2019

Also we should fix the HTML, language-list isn't the class we should be using, it should be role-list.

Copy link
Member

@ericholscher ericholscher Jul 15, 2019

I also worry about depending on the HTML structure. This will break all the tests when we do our site redesign. Can we not capture this data from the query result itself? I believe the Django test client gives us template data directly, which we could use: https://docs.djangoproject.com/en/2.2/topics/testing/tools/#django.test.Response.context

@dojutsu-user dojutsu-user requested a review from ericholscher Jul 16, 2019
@dojutsu-user
Copy link
Member Author

@dojutsu-user dojutsu-user commented Jul 16, 2019

@ericholscher
I have updated the tests to be independent of templates as per your suggestion in the comment above.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Jul 16, 2019

Great, thanks!

@ericholscher ericholscher merged commit c4bdddd into readthedocs:gsoc-19-indoc-search Jul 16, 2019
@dojutsu-user dojutsu-user deleted the tests-section-linking branch Jul 16, 2019
@dojutsu-user dojutsu-user moved this from In progress to Done in In-doc search UI Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants