rust/tests/rustdoc-gui
Matthias Krüger 9be97ae8e2
Rollup merge of #129796 - GuillaumeGomez:unify-code-examples, r=notriddle
Unify scraped examples with other code examples

Fixes #129763.

This first PR both fixes #129763 but also unifies buttons display for code examples:

![image](https://github.com/user-attachments/assets/c8475945-dcc3-4c25-8d7d-1659f85301c8)

You can test it [here](https://rustdoc.crud.net/imperio/unify-code-examples/doc/scrape_examples/fn.test.html) and [here](https://rustdoc.crud.net/imperio/unify-code-examples/doc/scrape_examples/fn.test_many.html).

I'm planning to send a follow-up to make the buttons generated in JS directly (or I can do it in this PR directly if you prefer).

cc ```@willcrichton```
r? ```@notriddle```
2024-09-05 18:58:56 +02:00
..
src Rollup merge of #129796 - GuillaumeGomez:unify-code-examples, r=notriddle 2024-09-05 18:58:56 +02:00
anchor-navigable.goml
anchors.goml
basic-code.goml
check_info_sign_position.goml
check-code-blocks-margin.goml
check-stab-in-docblock.goml
code-blocks-overflow.goml
code-color.goml
code-example-buttons.goml Simplify CSS but wrapping scraped example into a div and move the title out of the code block 2024-09-02 15:59:00 +02:00
code-sidebar-toggle.goml
code-tags.goml
codeblock-sub.goml
codeblock-tooltip.goml
copy-code.goml Update GUI tests for code example buttons 2024-08-05 11:04:51 +02:00
copy-path.goml
cursor.goml
default-settings.goml
deref-block.goml Add tests for new toggle on deref blocks 2024-07-15 20:07:24 +02:00
docblock-big-code-mobile.goml
docblock-code-block-line-number.goml Fix square corners on line numbers when code is collapsed 2024-09-03 22:17:04 +02:00
docblock-details.goml
docblock-table-overflow.goml
docblock-table.goml
duplicate-macro-reexport.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
enum-variants.goml
escape-key.goml
extend-css.goml
fields.goml
font-weight.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
globals.goml
go-to-collapsed-elem.goml
hash-item-expansion.goml
headers-color.goml
headings-anchor.goml
headings.goml
help-page.goml Don't call switch-theme function 2024-06-29 11:56:06 +02:00
hide-mobile-topbar.goml
highlight-colors.goml
huge-collection-of-constants.goml
huge-logo.goml rustdoc: add test cases for mile wide bar 2024-07-16 13:29:35 -07:00
impl_on_foreign_order.goml
impl-default-expansion.goml
impl-doc.goml
implementors.goml
item-decl-colors.goml
item-decl-comment-highlighting.goml
item-info-alignment.goml
item-info-overflow.goml
item-info.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
item-name-wrap.goml Add regression test for items list size (#128023) 2024-07-22 11:33:03 +02:00
item-summary-table.goml
javascript-disabled.goml
jump-to-def-background.goml
label-next-to-symbol.goml rustdoc: properly handle path wrapping 2024-07-29 10:31:02 -07:00
links-color.goml
list_code_block.goml
method-margins.goml
mobile-crate-name.goml
mobile.goml
module-items-font.goml
no-docblock.goml
notable-trait.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
overflow-tooltip-information.goml
pocket-menu.goml
README.md
rust-logo.goml
scrape-examples-button-focus.goml Fix wrong padding for expanded scraped example 2024-09-03 01:04:59 +02:00
scrape-examples-color.goml Simplify CSS but wrapping scraped example into a div and move the title out of the code block 2024-09-02 15:59:00 +02:00
scrape-examples-fonts.goml
scrape-examples-layout.goml Fix wrong padding for expanded scraped example 2024-09-03 01:04:59 +02:00
scrape-examples-toggle.goml
search-corrections.goml
search-error.goml
search-filter.goml
search-form-elements.goml
search-input-mobile.goml
search-keyboard.goml
search-no-result.goml
search-reexport.goml
search-result-color.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
search-result-description.goml
search-result-display.goml
search-result-go-to-first.goml
search-result-impl-disambiguation.goml rustdoc-search: account for numeric disambiguators on impls 2024-08-06 07:36:12 -07:00
search-result-keyword.goml
search-tab-change-title-fn-sig.goml
search-tab.goml
search-title.goml Add rustdoc GUI test to check title with and without search 2024-07-27 12:12:16 +02:00
setting-auto-hide-content-large-items.goml
setting-auto-hide-item-methods-docs.goml
setting-auto-hide-trait-implementations.goml
setting-go-to-only-result.goml
settings-button.goml
settings.goml
shortcuts.goml
sidebar-links-color.goml
sidebar-macro-reexport.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
sidebar-mobile-scroll.goml
sidebar-mobile.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
sidebar-modnav-position.goml rustdoc: add test case for modnav position when TOC is off 2024-08-20 16:54:04 -07:00
sidebar-resize-close-popover.goml
sidebar-resize-setting.goml
sidebar-resize-window.goml
sidebar-resize.goml
sidebar-source-code-display.goml
sidebar-source-code.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
sidebar.goml rustdoc: consistentify #TOC and #ModNav to lowercase 2024-08-20 16:51:40 -07:00
source-anchor-scroll.goml rustdoc: use <wbr>-tolerant function to check text contents 2024-07-29 08:46:11 -07:00
source-code-page-code-scroll.goml Update source-code-page-code-scroll.goml GUI test 2024-07-21 12:47:34 +02:00
source-code-page.goml
src-font-size.goml
stab-badge.goml
stab-in-doc.goml Add regression test for stab display in doc blocks 2024-07-21 11:52:24 +02:00
struct-fields.goml
target.goml rustdoc: animate the :target highlight 2024-08-19 18:14:35 -07:00
theme-change.goml
theme-defaults.goml
theme-in-history.goml
toggle-click-deadspace.goml
toggle-docs-mobile.goml
toggle-docs.goml
toggle-implementors.goml
toggled-open-implementations.goml
tooltip-over-sidebar.goml
trait-sidebar-item-order.goml
trait-with-bounds.goml Add GUI test for trait bounds display 2024-07-19 21:31:30 +02:00
type-declation-overflow.goml Reduce width to ensure that the name is wider and thus still triggering the scroll 2024-07-19 21:31:30 +02:00
type-impls.goml
unsafe-fn.goml
utils.goml
warning-block.goml
where-whitespace.goml

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 tests/rustdoc-gui --stage 1 --test-args --debug

If you don't want to run in headless mode (helpful to debug sometimes), you can use --no-headless:

$ ./x.py test tests/rustdoc-gui --stage 1 --test-args --no-headless

To see the supported options, use --help.

Important to be noted: if the chromium instance crashes when you run it, you might need to use --no-sandbox to make it work:

$ ./x.py test tests/rustdoc-gui --stage 1 --test-args --no-sandbox