-
Notifications
You must be signed in to change notification settings - Fork 293
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
[CHORE, TESTING] Test code can run form the front-end in all languages #3822
Conversation
Hi @TiBiBa! I think we said in the meeting that we'd close this and do the testing of the run button in a "manual" way, right (by repeatedly 'clicking' a language and then the run button) |
…_dependent' into make_editor_box_test_non_english_dependent
@TiBiBa I think I fixed your problems with this tests, let me know if there is more to fix! |
Hello everyone! I'm turning this into a draft while we keep working on it! |
…est_non_english_dependent
Hello, everyone! I made a few changes to the test so it can run in every language! |
Maybe @TiBiBa can take a look? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jpelay
I tried to test the tests as follows, but it seems to still work?
- Break a print keyword, f.e. in French:
_PRINT: ("affiche" | "prt") _SPACE?
-
Be sure to not rerun
on-deploy.sh
or it will restore the grammar! -
Observe the app is now broken:
- But the tests still passes:
Hi @Felienne! Thank you for pointing it out! It does seem like the page is refreshing, but the language is not changing? This one was supposed to show content from Bulgarian (notice that |
Hi @jpelay!! I might have a hunch as to why this does not test all languages!!! (@rix0rrr gave me the idea) The current language is not present in the dropdown, so if you start with the first one (Arabic) will be selected: Then we pick the second one, Bulgarian: Now... the next one is Bengali: This might mean we are skipping languages (I am not sure) So we first need to populate a stable list of languages and iterate over these. |
It might be, but I'm actually iterating trhough the list of languages, and clicking each one individually. Each language have their own id, so you can select then individually! |
Ah ok.... then it is probably something else! |
I'm still kinda blocked here, but found out something. This is how the logs look after printing
Notice how the only path that retains the language ar is in the path /hedy, and that is try for every language! |
Yes so that does look suspiciously like it is trying the first language (ar) and then the first one again (bg) and then again the first one (ar)! |
I changed the premise a little, maybe this is a cheat technique that might help! There are three things I did:
Does this help as a start? Up to you to finish it by finding a way to get the list of languages in Cypress (potentially copy/paste might even be good enough for a bit...?) and making the test check what you want it to. If you want to do multiple tests per language, it might even be nicer to put the const LANGUAGES_TO_TEST = [ /* ... */ ];
for (const language of LANGUAGES_TO_TEST) {
describe(`in the language ${language}`, () => {
it('is possible to run a program', () => { ... });
it('is possible to do something else', () => { ... });
});
} For some reason, this An easy fix if we are uneasy might be: for (const x of LANGUAGES_TO_TEST) {
const language = x; // Make a fresh variable for every loop iteration
// ...
} Although it just might be that declaring the loop variable |
@rix0rrr below is not a response about your for loop strategy. I think you just nailed it your first time and no more changes are necessary but good to keep everyone aware of that sticky JS confusion! I followed my (and Felienne's) suspicions about the for loop during the collaborator meeting. I just did a quick search Tl;dr: this problem is exactly what This is of course if we are not satisfied with @rix0rrr 's solid approach! That seems like a very reasonable tactic! |
@reedspool that SO post seems to be about using loops inside the test, vs what this code is doing which is creating multiple tests at module load time. But it might be you are referring back to a discussion I wasn’t part of? |
Hi! @rix0rrr and @reedspool! @reedspool I quickly tried the SO approach about wrapping the array and running Thanks to both of you for the help! |
…est_non_english_dependent
Hi all!! @Felienne I added the languages to test just hard coding there in the test. I will improve this once we tackle the test for the pygame features. But it now works! I edited Thanks @rix0rrr and @reedspool again for the help offered! |
OMG what a tour de force this was!! So happy it is working now. I made an issue for the hard-coded list of languages, just so we don't forget: #4168 |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Verify that the code can be ran in all languages:
This PR fixes #3760