Skip to content

Commit 83e7e51

Browse files
trallardpeytondmurraydrammock
authored
MAINT - Ensure Playwright tests use test sites and are run in CI (#2133)
Ensures playwright is always available for tests following conversations in #2119 (comment) Note, however, that the `test_version_switcher_highlighting` test is currently failing due to changes to the version switcher component (as part of recent a11y improvements) and due to RTD version switcher no longer being flushed into the sidebar (#2034). I could try and add an alternative test that checks perhaps that we have at least a latest and a dev version in the version switcher? --------- Co-authored-by: Peyton Murray <peynmurray@gmail.com> Co-authored-by: Daniel McCloy <dan@mccloy.info>
1 parent 404c3c8 commit 83e7e51

File tree

12 files changed

+220
-71
lines changed

12 files changed

+220
-71
lines changed

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ doc = [
8181
"ipywidgets",
8282
"graphviz",
8383
]
84-
test = ["pytest", "pytest-cov", "pytest-regressions", "sphinx[test]"]
8584
dev = [
8685
"pyyaml",
8786
"pre-commit",
@@ -90,7 +89,14 @@ dev = [
9089
"pandoc",
9190
"sphinx-theme-builder[cli]",
9291
]
93-
a11y = ["pytest-playwright"]
92+
test = [
93+
"pytest",
94+
"pytest-cov",
95+
"pytest-regressions",
96+
"sphinx[test]",
97+
"pytest-playwright"
98+
]
99+
a11y = ["pydata-sphinx-theme[test]"]
94100
i18n = ["Babel", "jinja2"]
95101

96102
[project.entry-points]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"version": "dev",
4+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/latest/"
5+
},
6+
{
7+
"name": "0.16.1 (stable)",
8+
"version": "v0.16.1",
9+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/stable/"
10+
}
11+
]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Test conf file - basic site with version switcher."""
2+
3+
# -- Project information -----------------------------------------------------
4+
project = "PyData Tests"
5+
copyright = "2020, Pydata community"
6+
author = "Pydata community"
7+
8+
root_doc = "index"
9+
10+
# -- General configuration ---------------------------------------------------
11+
html_theme = "pydata_sphinx_theme"
12+
13+
html_static_path = ["_static"]
14+
15+
# Add version switcher
16+
html_theme_options = {
17+
"switcher": {
18+
"json_url": "_static/switcher.json",
19+
"version_match": "dev",
20+
},
21+
"navbar_start": ["navbar-logo", "version-switcher"],
22+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Simple site with version switcher
2+
=================================
3+
4+
.. toctree::
5+
:caption: Caption 1
6+
:numbered:
7+
8+
page1
9+
page2
10+
section1/index
11+
12+
Other content
13+
-------------
14+
15+
Nothing to see here
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Page 1
2+
======
3+
4+
**normal link**
5+
6+
- https://pydata-sphinx-theme.readthedocs.io/en/latest/
7+
8+
**GitHub**
9+
10+
.. container:: github-container
11+
12+
https://github.com
13+
https://github.com/pydata
14+
https://github.com/pydata/pydata-sphinx-theme
15+
https://github.com/pydata/pydata-sphinx-theme/pull/1012
16+
https://github.com/orgs/pydata/projects/2
17+
18+
**GitLab**
19+
20+
.. container:: gitlab-container
21+
22+
https://gitlab.com
23+
https://gitlab.com/gitlab-org
24+
https://gitlab.com/gitlab-org/gitlab
25+
https://gitlab.com/gitlab-org/gitlab/-/issues/375583
26+
https://gitlab.com/gitlab-org/gitlab/issues/375583
27+
https://gitlab.com/gitlab-org/gitlab/-/issues/
28+
https://gitlab.com/gitlab-org/gitlab/issues/
29+
https://gitlab.com/gitlab-org/gitlab/-/issues
30+
https://gitlab.com/gitlab-org/gitlab/issues
31+
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84669
32+
https://gitlab.com/gitlab-org/gitlab/-/pipelines/511894707
33+
https://gitlab.com/gitlab-com/gl-infra/production/-/issues/6788
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:html_theme.sidebar_secondary.remove: true
2+
3+
Page :math:`\beta`
4+
==================
5+
6+
.. code-block:: python
7+
8+
import pydata_sphinx_theme as pst
9+
raise RuntimeError('Test of pygments highlighting')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Section 1 index
2+
===============
3+
.. toctree::
4+
5+
page1
6+
https://google.com
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Section 1 page1
2+
===============

tests/test_a11y.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""Using Axe-core, scan the Kitchen Sink pages for accessibility violations."""
1+
"""
2+
Using Axe-core, scan the Kitchen Sink pages for accessibility violations.
3+
Note that in contrast with the rest of our tests, the accessibility tests in this file
4+
are run against a build of our PST documentation, not purposedly-built test sites.
5+
"""
26

37
from urllib.parse import urljoin
48

@@ -288,17 +292,6 @@ def test_notebook_ipywidget_output_tab_stop(page: Page, url_base: str) -> None:
288292
expect(ipywidget).to_have_attribute("tabindex", "0")
289293

290294

291-
def test_breadcrumb_expansion(page: Page, url_base: str) -> None:
292-
"""Foo."""
293-
# page.goto(urljoin(url_base, "community/practices/merge.html"))
294-
# expect(page.get_by_label("Breadcrumb").get_by_role("list")).to_contain_text("Merge and review policy") # noqa: E501
295-
page.set_viewport_size({"width": 1440, "height": 720})
296-
page.goto(urljoin(url_base, "community/topics/config.html"))
297-
expect(page.get_by_label("Breadcrumb").get_by_role("list")).to_contain_text(
298-
"Update Sphinx configuration during the build"
299-
)
300-
301-
302295
@pytest.mark.a11y
303296
def test_search_as_you_type(page: Page, url_base: str) -> None:
304297
"""Search-as-you-type feature should support keyboard navigation.

0 commit comments

Comments
 (0)