-
Notifications
You must be signed in to change notification settings - Fork 522
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
fix(karma): allow custom browsers to specify args (fixes #595) #2132
fix(karma): allow custom browsers to specify args (fixes #595) #2132
Conversation
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.
Great! thank you for contributing!
@gregmagolan was the author of this so I'd like his review too
@@ -41,3 +43,9 @@ karma_web_test_suite( | |||
"requirejs-config.js", | |||
], | |||
) | |||
|
|||
custom_browser( |
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.
how is this tested? to put it another way, if I take these changes to packages/karma/test but throw away the change to packages/karma/karma.conf.js will the CI be red?
Feels like maybe we're missing one more target here, like maybe a generated_file_test
that asserts on what the generated karma conf will look like for the :testing
karma_web_test_suite above
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.
That's right. I was a bit concerned about the churn associated with a golden file test, but if that is the standard, I will create one.
Would you happen to know how to get a label to the generated .conf.js file?
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.
it would be nice to test it in a better way but probably hard to sense whether the browser got a right initial dimensions or something.
I don't know the label offhand, if you use bazel query //the/package:all
it will probably show up
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.
I had to make the generated .conf.js a 'predeclared' output so as to write this test. I hope that's okay.
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.
yeah that looks fine. Note you could also add the file to an Output Group to give a way to select the dynamic (non-predeclared) output
Ping! |
@@ -0,0 +1,454 @@ | |||
// Karma configuration |
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.
looks brittle that this golden is so long, probably more than we meant to assert on in this case.
I'd like to make a convenience rule for golden_content_test
or sth so we can just say "make sure this line (± whitespace) appears in the file"
this is okay for now if the content is stable
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.
It is stable. Should I file a bug about (perhaps) amending generated_file_test to include substring match capability?
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.
I have added that capability. PTAL.
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.
do you need help to get the tests green?
Ah, looks like it's not as stable as I would have wished. I'll make that improvement to generated_file_test first. |
Yep! It looks like I will need help. I'm not sure of the mechanism that seems to be excluding the :testing_chromium-local from buildkite/rules-nodejs-nodejs, but when it tried to run :testing_custom_chrome, it errors with a missing .so. |
Ping! |
Hmm, I don't have time to dig in right now. The error for anyone following along:
Could this be due to the custom_chrome.json enabling some options that cause Chromium to dynamic-link more libraries than before? We only installed a minimal set on our CI workers - ideally you'd find a way to assert that the custom browser args are being honored, but without introducing new dependencies on the underlying machine. (Also WDYT about the substring mode accepting a string attribute with the content to match, rather than (or in addition to) accepting a golden file input? In a lot of cases you just want the equivalent of |
So, these tests have never worked on CircleCI. The CircleCL script executes:
which removes tests that are tagged browser:chromium-local. Running
shows the generated test rule as:
which means it does not get excluded from the circlecl integration test. So: either, I can add a misleading tag to the test suite (something like browser:chromium-local), or I can extend the circlecl tag exclusion to include browser:custom_chrome. LMK what you want. |
I found the configuration at .buildci/presubmit.yml and updated it to include an exclusion for tests with the tag 'browser:custom_chrome'. PTAL. |
Ping! |
Pong! |
Pingigidipong! |
Today, the args as specified in the various manifests of the rules_webtesting browsers never make it into the generated karma.conf.js. This results in these arguments never being used when launching Chrome, preventing customization of browsers such as window size, enabling remote debugging, or other flag-based options. This PR fixes this by reading those arguments from the manifest, and adding them to the browsers list in the generated karma.conf.js. Also, this PR includes a change to generated_file_test to allow a golden file to represent a substring of the generated output. Also Also: This PR includes a golden file test that verified that the generated karma.conf.js does read in the specified value. Furthermore, the effect of this can be verified manually via: ``` VERBOSE_LOGS=1 bazel run packages/karma/test/karma:testing_custom_chrome ``` Note the appearance of the additional flags in the new debug output.
CI rerun still failed, trying a rebase on stable/HEAD to see if it's green |
Thanks for pinging :) |
Today, the args as specified in the various manifests of the rules_webtesting
browsers never make it into the generated karma.conf.js. This results in these
arguments never being used when launching Chrome, preventing customization of
browsers such as window size, enabling remote debugging, or other flag-based
options. This PR fixes this by reading those arguments from the manifest, and
adding them to the browsers list in the generated karma.conf.js.
This PR also includes a small (manual) test that specifies an additional
argument in a custom browser, which then can be seen to be used via:
Note the appearance of the additional flags in the new debug output.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
See description above.
Issue Number: #595
What is the new behavior?
See description above.
Does this PR introduce a breaking change?
Perhaps! This might surprise people. If anyone has been using custom browsers up to now, they will suddenly see new arguments on their command-lines. However, given that the feature didn't really work before, I don't think that this is a big deal.
Other information