rust/src/test/rustdoc-gui
Guillaume Gomez 10165f8af9
Rollup merge of #88093 - Kobzol:rustdoc-wrap-code-in-code-tag, r=GuillaumeGomez
[rustdoc] Wrap code blocks in <code> tag

This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in `<pre><code>` instead of just `<pre>`. This should improve the semantic meaning of the generated content.

I'm not sure what to do about `render_attributes_in_pre` and `render_attributes_in_code`. These functions were clearly expected to be used for things inside `<pre>` or `<code>`, and since I added `<code>` in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example, `item_constant` used `render_attributes_in_code` for its attributes, however there was no `<code>` used for constants before this PR...

Should I create some `rustdoc-gui` tests? For example to check that all `<pre>` tags have a `<code>` child?

Fixes: https://github.com/rust-lang/rust/issues/88020
2021-08-19 19:30:09 +02:00
..
src Rollup merge of #87288 - ijackson:rustdoc-theme, r=GuillaumeGomez 2021-07-22 13:39:22 +02:00
auto-hide-trait-implementations.goml Add GUI test for auto-hide-trait-implementations setting 2021-07-16 15:15:23 +02:00
ayu-code-tag-colors.goml Add GUI test to check ayu <code> colors 2021-07-14 15:00:12 +02:00
basic-code.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
basic.goml Move rustdoc-gui rust libraries into their own folder and prepare the field for more libraries 2021-05-11 20:56:16 +02:00
check_info_sign_position.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
code-blocks-overflow.goml Add test for codeblocks overflow 2021-07-14 12:03:55 +02:00
code-sidebar-toggle.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
code-tags.goml [rustdoc] Wrap code blocks in <code> tag 2021-08-19 10:30:08 +02:00
default-settings.goml Add tests for default-settings 2021-07-22 12:58:59 +02:00
docblock-table-overflow.goml Add GUI test for <table> overflow 2021-07-18 00:03:30 +02:00
escape-key.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
font-weight.goml Rustdoc accessibility: use real headers for doc items 2021-07-25 21:41:57 +00:00
hash-item-expansion.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
headers-color.goml Add rustdoc GUI test for headers 2021-08-13 14:23:13 +02:00
impl-default-expansion.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
implementors.goml Rustdoc accessibility: use real headers for doc items 2021-07-25 21:41:57 +00:00
item-info-width.goml Add test to check width of item-info 2021-07-18 12:32:26 +02:00
item-summary-table.goml Add test to ensure tables are not inside items summary 2021-07-21 20:06:06 +02:00
label-next-to-symbol.goml Enable the tests developed with #86594 2021-07-01 10:13:28 +02:00
list_code_block.goml Move rustdoc-gui rust libraries into their own folder and prepare the field for more libraries 2021-05-11 20:56:16 +02:00
module-items-font.goml Merge the two test files as they are testing the same features 2021-08-16 21:50:13 +02:00
README.md Allow to pass arguments to rustdoc-gui tool 2021-06-16 11:54:19 +02:00
search-filter.goml Fix search filter update 2021-06-23 10:09:26 +02:00
search-input-mobile.goml Move rustdoc-gui rust libraries into their own folder and prepare the field for more libraries 2021-05-11 20:56:16 +02:00
search-result-color.goml Add test for keyword/primitive text color 2021-07-13 10:18:24 +02:00
search-result-colors.goml Add rustdoc GUI test for headers 2021-08-13 14:23:13 +02:00
search-result-description.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
search-result-display.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
search-result-go-to-first.goml Add test for "go to first" feature 2021-07-13 19:41:58 +02:00
search-result-keyword.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
search-tab-selection-if-current-is-empty.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
shortcuts.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
sidebar-mobile.goml Fix sidebar-mobile test to focus on an actual focusable element 2021-07-17 11:53:59 -07:00
sidebar.goml Fixing the test rustdoc by ignoring *[@id="module-item"]//following-sibling::item-right relationship and rustdoc-gui 2021-06-24 16:46:15 +02:00
source-code-page.goml [rustdoc] Wrap code blocks in <code> tag 2021-08-19 10:30:08 +02:00
theme-change.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
toggle-docs-mobile.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
toggle-docs.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
toggled-open-implementations.goml Update browser-ui-test version 2021-06-22 11:11:45 +02:00
trait-sidebar-item-order.goml Update browser-ui-test version 2021-06-19 14:19:39 +02:00
type-declation-overflow.goml Add regression test for type declaration layout overflow 2021-07-15 18:19:25 +02:00

The tests present here are used to test the generated HTML from rustdoc. The goal is to prevent unsound/unexpected GUI changes.

This is using the browser-ui-test framework to do so. It works as follows:

It wraps puppeteer to send commands to a web browser in order to navigate and test what's being currently displayed in the web page.

You can find more information and its documentation in its repository.

If you need to have more information on the tests run, you can use --test-args:

$ ./x.py test src/test/rustdoc-gui --stage 1 --jobs 8 --test-args --debug

There are three options supported:

  • --debug: allows to see puppeteer commands.
  • --no-headless: disable headless mode so you can see what's going on.
  • --show-text: by default, text isn't rendered because of issues with fonts, it enables it back.