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.
fix: add support for non-root base-href #75
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
base: main
Are you sure you want to change the base?
fix: add support for non-root base-href #75
Changes from 8 commits
8892812
31526ae
606ade6
b4114a9
e948054
9e1fd5b
39f6598
f2542bd
b8d0b58
bd3e7a7
4900aaf
ac4e069
a7ddb22
897dca4
f5d5bc4
8f38c22
bb3d4ca
be5d5f5
bb5d60d
12cd725
8f1ed7a
3886996
27f6d07
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 know this change is unrelated, but consider adding an id attribute to your script element, that way this method can be simplified to:
You may need to keep a small map of urls to each of its idForScriptElement String (probably it'll only contain a single element?)
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.
done. I hope the locking part works out as planned. These things are really hard to test. The happy path works though
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.
This is better than nothing, but super non-standard! If you want to run tests like this, I'd suggest you try to migrate them to
flutter drive
, like what we did in flutter/packages, for example:https://github.com/flutter/packages/tree/main/packages/video_player/video_player_web/example <- this "example" actually contains the
integration_test
and all that jazz. The README.md should have some links to the docs on how to run those.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.
@ditman we already have those
flutter drive
tests declared inexample/integration_test/wakelock_plus_test.dart
. I guess the question is whether these are the tests that should be run instead of the above ones?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.
Right, we also have some
flutter test --platform=chrome
tests in flutter/packages.I'd recommend using either
flutter test
orflutter drive
to run the tests. I'm not even sure what this program would return if the tests failed? (is this usable for CI, for example?)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.
@ditman Looks like even after porting this test to use
flutter drive
, it's still complaining about the requesting page not being visible.Run with while in the example folder:
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.
Bottom line, what I'm looking for is an integration test that runs on a browser, that can also be spun up in a CI context. Not sure which one is the right approach, since the above is not working at all when using
chromedriver
.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.
@ditman looks like it's related to this issue when running
flutter test --platform=chrome
onwakelock_plus_web_plugin_test.dart
in the roottest
folder.Not sure what can be done if asset support isn't present when running the tests against a 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.
I suspect the problem is that the
WakelockPlus
calls must happen in the application under test, and not the test code itself.If you inject a test app that has a button that enables/disables wakelock, and you trigger the button through the test driver, this should work, and assets would be available.
I think the code here is attempting to run Wakelock in the test runner code, not the application under test? :)
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 don't have time to try my solution right now, but I think the migration to an integration test with flutter driver might be inescapable if we want to test app assets)
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.
So what you're saying is that I should instead inject the Example App, get a lock on the button that toggles the wakelock, and then make assertions from there?
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.
Yes, that's what I'm saying... What I'm not sure now is that the assets are going to be available when the example app runs in flutter drive mode, as you're saying (because your test looks all right to me).
As a reference, a few examples of tests that "inject an app and then look at the DOM of the page or something else" to do integration testing:
Neither of those use assets, though.
Here's an example of an integration test that uses assets: