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

tests: hello world playground run with success and failure tests #2513

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michael-kerscher
Copy link
Collaborator

Implement two tests for the rust playground:

  • successful run of the hello world example with the hello world message in stdout and a hidden stderr
  • on purpose compilation error is shown in stderr and "No output" in stdout

@michael-kerscher
Copy link
Collaborator Author

michael-kerscher commented Dec 13, 2024

Tests are failing because the Hello world message is localized.
It is at least great news that this is visible with the tests :)

Checking for only the world icon to be present

@michael-kerscher michael-kerscher force-pushed the js-test-framework branch 2 times, most recently from ce32ed4 to 6f5054f Compare December 13, 2024 15:18
@michael-kerscher
Copy link
Collaborator Author

Without localization issues another error class shows.
There are additional issues that don't show in my local runs and also not for all languages:

[0-2] 2024-12-13T15:25:07.756Z WARN webdriver: WebDriverError: javascript error: {"status":60,"value":"[object HTMLButtonElement] has no size and location"}
[0-2]   (Session info: chrome=131.0.6778.139) when running "actions" with method "POST" and args "{"actions":[{"id":"action1","type":"wheel","parameters":{},"actions":[{"type":"scroll","x":-751,"y":978,"deltaX":0,"deltaY":0,"duration":0,"origin":{"element-6066-11e4-a52e-4f735466cecf":"f.173C819DA147237EEEF427DC48FFF96F.d.A21CD0374576D9BD3747C260A5497CB1.e.45"}}]}]}"
[0-1] Error in "Playground.executes the hello world code and prints the hello message"
Error: Expect $(`.ace_content`) to exist

@michael-kerscher
Copy link
Collaborator Author

michael-kerscher commented Dec 16, 2024

I looked again into this and it seems I used a not ideal directory for the hello-world page as the "types-and-values" directory does not have this file in e.g. pl translation

$ find comprehensive-rust-* -name "hello-world.html"
comprehensive-rust-en/html/hello-world/hello-world.html
comprehensive-rust-en/html/hello-world.html
comprehensive-rust-en/html/types-and-values/hello-world.html
comprehensive-rust-en/pandoc/pdf/src/hello-world/hello-world.html
comprehensive-rust-pl/html/hello-world/hello-world.html
comprehensive-rust-pl/html/hello-world.html

using the hello-world directory redirection

"hello-world/hello-world.html" = "../types-and-values/hello-world.html"

@mgeisler
Copy link
Collaborator

mgeisler commented Jan 2, 2025

Happy New Year!

I looked again into this and it seems I used a not ideal directory for the hello-world page as the "types-and-values" directory does not have this file in e.g. pl translation

Perhaps a good first step would be to limit these tests to the English text?

The mdbook test run will already execute the translated source code for each language, thus ensuring that the translations don't accidentally break the Rust code (this happened in the past).

The JavaScript tests are not there to ensure that translations compile, their goal is to ensure that the JS code works. I think it's sufficient to test with just the English base version. One day (#1390), we might do some localization with the JS code, but not today 😄

@michael-kerscher
Copy link
Collaborator Author

Yes, I agree, testing the English base version is the best approach. If there is something that depends on something language specific, this could be added later.
To document it here as well: the issue with translations that differ in directory structure is likely be caused by translations being up2date regarding the theme, js and such things but the Markdown is on the state of the last change to the translation change (this avoids having out-of-date translations that have a lot of English text). #2541 should document this behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants