-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 wdspec tests using new_session fixture #7461
Conversation
Build ERROREDStarted: 2017-10-16 15:35:27 Failing Jobs
View more information about this build on: |
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.
Barring the fact that the documentation for overwrite_dictionary
should be fixed up, this is fine.
@@ -24,6 +24,27 @@ def merge_dictionaries(first, second): | |||
|
|||
return result | |||
|
|||
def overwrite_dictionary(first, second): | |||
"""Given two dictionaries, create a third that defines all specified | |||
key/value pairs. This merge_dictionaries is performed "deeply" on any nested |
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.
Reference to merge_dictionaries
?
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.
Oops, copy paste.
3cf48ab
to
6006a16
Compare
webdriver/tests/support/fixtures.py
Outdated
# TODO: merge in some capabilities from the confguration capabilities | ||
# since these might be needed to start the browser | ||
value = _session.send_command("POST", "session", body=body) | ||
capabilities=overwrite_dictionary(configuration["capabilities"], capabilities)) |
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.
@carlosgcampos @andreastt FYI, I needed to change this to capabilities={"alwaysMatch": caps}
to get it working locally. (Where caps is the result of overwrite_dictionary(...))
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.
hmm, tests are already passing {"alwaysMatch": caps} to new_session, you shouldn't need to add it again.
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.
Wait, not all the tests are doing the same thing, it seems new_session tests are passing {"capabilities": caps}. I'll check those and update the patch, thanks @mjzffr
6006a16
to
77eab20
Compare
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.
Could you also provide a default value for capabilities? e.g. {"alwaysMatch": configuration["capabilities"]}
It would be useful if a test could use new_session()
to mean that we just want the configuration capabilities. This comes up in subtests that aren't testing session creation but just need a new session for each subtest.
77eab20
to
4b41e1f
Compare
Good idea, updated the patch to allow using new_session with no arguments |
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.
r+
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.
Thanks!
Thank you guys, can this be merged now, then? |
The CI appears to be failing because the tests have now become unstable as a result of this change. |
How can I see what is failing? I don't see anything useful here |
Neither can I. I don’t really understand how to debug test stability failures in those Travis jobs. I’ve retriggered the build a couple of times to no avail… |
The stability tests fail because there is actually some kind of crash or disconnect in Firefox. You can see it here: https://travis-ci.org/w3c/web-platform-tests/jobs/280747953#L7012-L7013 It happens directly after As it looks like a Firefox process might be left behind, which prevents Marionette from setting up the server socket for all the following tests. That's why the server socket failure. |
@whimboo do you think this is caused by this patch? or a problem in the bot? or maybe the firefox version used in the bots? |
I cannot see that the issue should be related to your patch. Also because no capabilities should have been changed too. Did someone actually retrigger this failing job once or multiple times? How often does it fail? Given that it's using Firefox Nightly it might have been an issue on that day. So please lets get this job retriggered, so we can see if it still fails. |
Yes, I’ve re-triggered it five or six times with the same result. |
I think this is theoretically problematic because adding extra capabilities can invalidate the tests. I'm not sure what a good workaround is though, given that some capabilities are required to start the browser. |
I think this patch only changes the behavior for tests not passing a valid capabilities dictionary, because when receiving a valid capabilities dict we use that as the body of the new session command like current code does. So, the ones passing {"alwaysMatch": } might be the ones causing the failures. Those tests are using prompts, that I think are not implemented by geckodriver (right?), so with current code they are probably not executed, because the session is rejected due to the invalid capabilities. With this patch, those tests are correctly executed, but prompts are not actually handled. Could it be that we leave a firefox instance with an unhandled prompt or something? Could we try skipping those tests for firefox driver only? |
The failures on Travis are mostly just the tests timing out. I ran locally and got the following unstable results:
I am particularly concerned with the I think a more reasonable approach would be to make a fixture that could add default capabilities to a dictionary and put the tests that use |
(note that I didn't check explicitly for regressions with this patch applied, but at a glance there are some, and we will need to check carefully before landing). |
But default_values.py::test_missing_always_match is passing '{"capabilities": {"firstMatch": [{}]}}' so in that case, the given dictionary is used directly as the body the new session command, there shouldn't be a change in behavior unless I'm missing something. |
Oh right. But presumably then this simply won't fix that case (which is a valid new session). I still think this implementation is too magical and that it would be better to make the tests pass this information themselves. |
This patch doesn't try to fix the tests passing { "capabilities": ... }, since the behavior doesn't change for those, but the ones passing { "alwaysMatch" : ... }. I'm fine with adding a different fixture for these one, though. |
Could we temporarily run a travis job with this patch applied by using trace logging of Marionette, and maybe a debug build of Firefox? Both should give us way more debugging information to finally get a sense of what's going on here. @jgraham if you are still able to reproduce locally maybe you could do it and upload the trace log? |
@whimboo I don't think there's any mystery about what's going on here. The problem is that if the browser isn't on the |
I'm going to try the explicit approach as soon as I find some time to work on this, hopefully later today. |
4b41e1f
to
b3c6e31
Compare
@@ -83,6 +88,11 @@ def test_invalid_values(new_session, body, key, value): | |||
lambda key, value: {"firstMatch": [{key: value}]}]) | |||
@pytest.mark.parametrize("key", invalid_extensions) | |||
def test_invalid_extensions(new_session, body, key): |
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.
You need to change the signature here, right?
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
@@ -24,17 +29,17 @@ def test_platform_name(new_session, platform_name, body): | |||
|
|||
|
|||
@pytest.mark.parametrize("key,value", invalid_merge) | |||
def test_merge_invalid(new_session, key, value): | |||
def test_merge_invalid(new_session, add_browser_capabilites, key, value): |
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 isn't strictly needed, but I guess it's better this way.
b3c6e31
to
bd61ca8
Compare
Tests are passing capabilities that should be used when creating the session, but they are passed directly as body of new session command, without adding them to a capabilities object. This is also ignoring all other configuration capabilities, preventing the browser from being launched in cases where the browser binary is passed to the driver as a capability. This patch adds a new fixture add_browser_capabilites, that is used by tests using new_session to provide the browser capabilities and optionally add others.
bd61ca8
to
8ba8a80
Compare
I ran the stability checker locally and this doesn't seem to introduce any new problems, so merging. |
Tests are passing capabilities that should be used when creating the
session, but they are passed directly as body of new session command,
without adding them to a capabilities object. This is also ignoring all
other configuration capabilities, preventing the browser from being
launched in cases where the browser binary is passed to the driver as a
capability. We should use the configuration capabilities, overwrite
the ones given by the test and pass them to the Session at construction.
This way we can use Session::start() instead of using send_command()
directly.