-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 base for GUI tests #2476
Open
GuillaumeGomez
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
GuillaumeGomez:gui-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add base for GUI tests #2476
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GuillaumeGomez
force-pushed
the
gui-tests
branch
2 times, most recently
from
November 8, 2024 14:39
a3f8cd0
to
1a2991f
Compare
GuillaumeGomez
force-pushed
the
gui-tests
branch
4 times, most recently
from
November 8, 2024 16:38
063ee3a
to
ef31501
Compare
GuillaumeGomez
force-pushed
the
gui-tests
branch
from
November 8, 2024 16:46
ef31501
to
4b48db3
Compare
Finally fixed windows build. :') |
I think we should not use the default test harness for this. We can lean on Cargo a lot more instead of using environment variables: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 984e19222..1f9c84522 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -58,11 +58,9 @@ jobs:
- name: Install browser-ui-test
if: matrix.os != 'windows-latest'
run: npm install browser-ui-test@"${BROWSER_UI_TEST_VERSION}"
- - name: Build and run tests (+ GUI)
+ - name: Build and run GUI tests
if: matrix.os != 'windows-latest'
- env:
- GUI_TESTS: 1
- run: cargo test --locked --target ${{ matrix.target }}
+ run: cargo test --locked --target ${{ matrix.target }} --test gui
- name: Build and run tests
if: matrix.os == 'windows-latest'
run: cargo test --locked --target ${{ matrix.target }}
diff --git a/Cargo.toml b/Cargo.toml
index 5d593b270..3d3704390 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -82,3 +82,10 @@ name = "remove-emphasis"
path = "examples/remove-emphasis/test.rs"
crate-type = ["lib"]
test = true
+
+[[test]]
+harness = false
+test = false
+name = "gui"
+path = "tests/gui/runner.rs"
+crate-type = ["bin"]
diff --git a/tests/gui.rs b/tests/gui/runner.rs
similarity index 93%
rename from tests/gui.rs
rename to tests/gui/runner.rs
index 92d9df319..0ec7f5456 100644
--- a/tests/gui.rs
+++ b/tests/gui/runner.rs
@@ -38,12 +38,7 @@ fn expected_browser_ui_test_version() -> String {
panic!("failed to retrieved `browser-ui-test` version");
}
-#[test]
-fn gui() {
- if !std::env::var("GUI_TESTS").is_ok_and(|value| value == "1") {
- eprintln!("Skipping GUI tests. To enable them, add the GUI_TESTS=1 environment variable.");
- return;
- }
+fn main() {
let browser_ui_test_version = expected_browser_ui_test_version();
match get_available_browser_ui_test_version() {
Some(version) => {
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index dcbb9dbb4..347f3a04f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -141,7 +141,7 @@ If possible, do your best to avoid breaking older browser releases.
GUI tests are checked with the GUI testsuite. To run it, you need to install `npm` first. Then run:
```
-GUI_TESTS=1 cargo test gui
+cargo test --test gui
```
The first time, it'll fail and ask you to install the `browser-ui-test` package. Install it then re-run the tests. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed with @ehuss, this PR adds the basics for adding more GUI tests. Just add more
.goml
files in thetests/gui
folder.This is the same GUI test framework used in rustdoc and docs.rs.
If you need any explanation on how it works, or if you have any question, please don't hesitate to ask.