-
Notifications
You must be signed in to change notification settings - Fork 96
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
Random error testing test-combined-actions
#674
Comments
Here's the source for (deftest test-combined-actions
(testing "input key and mouse click"
(let [input (e/query *driver* :simple-input)
password (e/query *driver* :simple-password)
textarea (e/query *driver* :simple-textarea)
submit (e/query *driver* :simple-submit)
keyboard (-> (e/make-key-input)
e/add-double-pause
(e/with-key-down "\uE01B")
e/add-double-pause
(e/with-key-down "\uE01C")
e/add-double-pause
(e/with-key-down "\uE01D"))
mouse (-> (e/make-mouse-input)
(e/add-pointer-click-el input)
e/add-pause
(e/add-pointer-click-el password)
e/add-pause
(e/add-pointer-click-el textarea)
e/add-pause
(e/add-pointer-click-el submit))]
(e/perform-actions *driver* keyboard mouse)
(e/wait 1)
(is (str/ends-with? (e/get-url *driver*) "?login=1&password=2&message=3"))))) I think the problem here is that submission as performed by a keystroke or a pointer click (e.g., |
Hmmm... yeah. I suppose we could wait for the URL to be what we expect it to be... using |
The root problem is probably the same for #646. |
Fix welcome! |
OK, so I just came up with a new little macro, (defmacro wait-url-change
[& body]
`(let [old-url# (e/get-url *driver*)]
~@body
(e/wait-predicate (fn [] (not= old-url# (e/get-url *driver*)))
{:timeout 30 ; 30 second timeout total
:interval 0.100 ;
:message "Timeout waiting for URL change"})))
(deftest test-combined-actions
(testing "input key and mouse click"
(let [input (e/query *driver* :simple-input)
password (e/query *driver* :simple-password)
textarea (e/query *driver* :simple-textarea)
submit (e/query *driver* :simple-submit)
keyboard (-> (e/make-key-input)
e/add-double-pause
(e/with-key-down "\uE01B")
e/add-double-pause
(e/with-key-down "\uE01C")
e/add-double-pause
(e/with-key-down "\uE01D"))
mouse (-> (e/make-mouse-input)
(e/add-pointer-click-el input)
e/add-pause
(e/add-pointer-click-el password)
e/add-pause
(e/add-pointer-click-el textarea)
e/add-pause
(e/add-pointer-click-el submit))]
(wait-url-change
(e/perform-actions *driver* keyboard mouse))
(is (str/ends-with? (e/get-url *driver*) "?login=1&password=2&message=3"))))) |
And yes, I think this is the same problem as #646. |
BTW, this also cuts out several generic and Safari-specific |
Hm. I'm still seeing errors in CI, specifically with Firefox, which seems to do something odd with the URL when it's loading. The error is:
I don't see this on my MacOS development machine with the latest Firefox. I copied the above error from the CI output. It seems like Firefox might be setting the URL to |
I like your idea of |
I’ll make some changes and see if I can get something reliable. |
Here's the new code. This works on my machine. Will push a commit as part of the existing PR and see if it passes CI tests. (defmacro wait-url-change
[re & body]
`(let [old-url# (e/get-url *driver*)]
~@body
(e/wait-predicate (fn [] (let [new-url# (e/get-url *driver*)]
(and (not= old-url# new-url#)
(re-find ~re new-url#))))
{:timeout 30 ; 30 second timeout total
:interval 0.100 ;
:message "Timeout waiting for URL change"}))) |
BTW, there may be a Firefox bug here that we should report. I would not expect the URL in the browser to change to |
Thanks, Dave! Feel free to raise a bug against |
Version
SHA: 1c611d which is in my own private branch, but I don't think it has anything to do with the version since the error is with a test that hasn't been touched by me and the failure is transient.
Platform
Symptom
The
test-combined-actions
test failed randomly. See output below.Reproduction
Cannot easily reproduce. There is a race condition of some sort. Rerunning the test suite resulted in no errors.
Actual behavior
Running the test suite resulted in the following failure.
Expected behavior
I would expect the test suite to pass and not fail randomly.
Diagnosis
None.
The text was updated successfully, but these errors were encountered: