Skip to content
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

simulated mouse fixes, rightclick, dblclick #3030

Merged
merged 59 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9cd40ad
cleanup type_spec, allow unused-vars for args
kuceb Jul 18, 2019
3671278
fix missing return
kuceb Jul 18, 2019
e38ffa5
rename mouse/keyboard
kuceb Jul 16, 2019
e31ae9c
apply changes on this branch with rename
kuceb Jul 16, 2019
2adf013
temp 07/18/19 [skip ci] type_spec minor changes
kuceb Jul 18, 2019
cc27fec
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 18, 2019
57b0e0e
temp 07/19/19 [skip ci]
kuceb Jul 19, 2019
ea73b8f
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 19, 2019
fa2fbcf
temp 07/22/19 [skip ci]
kuceb Jul 22, 2019
9ca64cd
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 22, 2019
c8424ef
temp 07/22/19 [skip ci]
kuceb Jul 22, 2019
b13051d
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 26, 2019
d744235
remove accidental spec, use beforeEach visit in click_spec
kuceb Jul 26, 2019
b96cefa
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 26, 2019
645476d
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 26, 2019
a035caf
Merge remote-tracking branch 'origin/issue-2957' into issue-2957
kuceb Jul 26, 2019
be2fdec
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 29, 2019
994b74f
add tests for cy.trigger changes
kuceb Jul 29, 2019
76f8307
re-run build
kuceb Jul 29, 2019
de2dd0d
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Jul 29, 2019
9977737
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Aug 8, 2019
5a123bf
add typedefs
kuceb Aug 8, 2019
53771dc
temp 08/08/19 [skip ci]
kuceb Aug 8, 2019
3db8363
fix type_spec, click_spec
kuceb Aug 8, 2019
977a19e
fix console table event table logging
kuceb Aug 11, 2019
5d58038
Merge branch 'develop' into issue-2957
kuceb Aug 11, 2019
ef536c5
fix spec utils
kuceb Aug 12, 2019
9202ff6
fix invalid clicking-into-iframe spec
kuceb Aug 14, 2019
44eb740
address review, cleanup
kuceb Aug 15, 2019
c1ea88b
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Sep 5, 2019
32fa7e8
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Sep 25, 2019
1097638
temp 09/25/19 [skip ci]
kuceb Sep 25, 2019
799631a
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Sep 26, 2019
f7ab2eb
add test for clicking checkbox, cleanup click_spec
kuceb Sep 26, 2019
fbc43eb
document mouse click and mouse move algo, adjust mouse move, add test…
kuceb Sep 27, 2019
f12ff55
Merge branch 'develop' into issue-2957
brian-mann Sep 29, 2019
83a35ed
cleanup / formatting
brian-mann Sep 29, 2019
7a229f9
scope the getCommandLogWithText to the active runnable to prevent lea…
brian-mann Sep 30, 2019
adb6f2c
cleanup tests, make values static so tests pass consistently
brian-mann Sep 30, 2019
5683645
begin implementation for returning fromAutWindow
brian-mann Sep 30, 2019
0eebba1
move describe block with the others
brian-mann Sep 30, 2019
9f09c3c
refactor actions to DRY up duplicated logic between click/dblclick/ri…
brian-mann Sep 30, 2019
807ada5
remove comment
brian-mann Sep 30, 2019
138454a
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Oct 3, 2019
e2182ef
Merge remote-tracking branch 'origin/issue-2957' into issue-2957
kuceb Oct 4, 2019
b4b160a
fix iframe coords and test
kuceb Oct 4, 2019
460466a
Merge branch 'develop' into issue-2957
jennifer-shehane Oct 7, 2019
5bb77e4
rename fromDocCoords->fromWindowCoords, fix type_spec ux test
kuceb Oct 7, 2019
69c413e
Merge remote-tracking branch 'origin/issue-2957' into issue-2957
kuceb Oct 7, 2019
46c3b5a
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Oct 10, 2019
cb377a3
Merge remote-tracking branch 'origin/develop' into issue-2957
kuceb Oct 10, 2019
a7b45f3
tighten up method, remove unnecessary arg
brian-mann Oct 11, 2019
8389bf2
Merge remote-tracking branch 'origin/issue-2957' into issue-2957
brian-mann Oct 11, 2019
67443b5
add debug logic for retries to console.error() non cypress errors
brian-mann Oct 11, 2019
07e2f72
renamed fromWindow -> fromElWindow, and fromViewport -> fromElViewport
brian-mann Oct 11, 2019
de38df7
handle calculating the fromElWindow coordinates inline
brian-mann Oct 11, 2019
5c8a625
extract out function for clarity, receive consistent arg names
brian-mann Oct 11, 2019
a18dd32
cleanup, add lots of comments
brian-mann Oct 11, 2019
706b10c
Merge branch 'develop' into issue-2957
brian-mann Oct 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cli/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,14 @@ declare namespace Cypress {
*
* @see https://on.cypress.io/dblclick
*/
dblclick(options?: Partial<Loggable>): Chainable
dblclick(options?: Partial<ClickOptions>): Chainable<Subject>

/**
* Right-click a DOM element.
*
* @see https://on.cypress.io/rightclick
*/
rightclick(options?: Partial<ClickOptions>): Chainable<Subject>

/**
* Set a debugger and log what the previous command yields.
Expand Down
4 changes: 4 additions & 0 deletions cli/types/tests/chainer-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,7 @@ cy.writeFile('../file.path', '', {
flag: 'a+',
encoding: 'utf-8'
})

cy.get('foo').click()
cy.get('foo').rightclick()
cy.get('foo').dblclick()
28 changes: 14 additions & 14 deletions packages/driver/src/cy/actionability.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ getPositionFromArguments = (positionOrX, y, options) ->

return {options, position, x, y}

ensureElIsNotCovered = (cy, win, $el, fromViewport, options, log, onScroll) ->
ensureElIsNotCovered = (cy, win, $el, fromElViewport, options, log, onScroll) ->
$elAtCoords = null

getElementAtPointFromViewport = (fromViewport) ->
getElementAtPointFromViewport = (fromElViewport) ->
## get the element at point from the viewport based
## on the desired x/y normalized coordinations
if elAtCoords = $dom.getElementAtPointFromViewport(win.document, fromViewport.x, fromViewport.y)
if elAtCoords = $dom.getElementAtPointFromViewport(win.document, fromElViewport.x, fromElViewport.y)
$elAtCoords = $dom.wrap(elAtCoords)

ensureDescendents = (fromViewport) ->
ensureDescendents = (fromElViewport) ->
## figure out the deepest element we are about to interact
## with at these coordinates
$elAtCoords = getElementAtPointFromViewport(fromViewport)
$elAtCoords = getElementAtPointFromViewport(fromElViewport)

cy.ensureElDoesNotHaveCSS($el, 'pointer-events', 'none', log)
cy.ensureDescendents($el, $elAtCoords, log)
Expand All @@ -57,8 +57,8 @@ ensureElIsNotCovered = (cy, win, $el, fromViewport, options, log, onScroll) ->

ensureDescendentsAndScroll = ->
try
## use the initial coords fromViewport
ensureDescendents(fromViewport)
## use the initial coords fromElViewport
ensureDescendents(fromElViewport)
catch err
## if we're being covered by a fixed position element then
## we're going to attempt to continously scroll the element
Expand Down Expand Up @@ -146,16 +146,16 @@ ensureElIsNotCovered = (cy, win, $el, fromViewport, options, log, onScroll) ->
## now that we've changed scroll positions
## we must recalculate whether this element is covered
## since the element's top / left positions change.
fromViewport = getCoordinatesForEl(cy, $el, options).fromViewport
fromElViewport = getCoordinatesForEl(cy, $el, options).fromElViewport

## this is a relative calculation based on the viewport
## so these are the only coordinates we care about
ensureDescendents(fromViewport)
ensureDescendents(fromElViewport)
catch err
## we failed here, but before scrolling the next container
## we need to first verify that the element covering up
## is the same one as before our scroll
if $elAtCoords = getElementAtPointFromViewport(fromViewport)
if $elAtCoords = getElementAtPointFromViewport(fromElViewport)
## get the fixed element again
$fixed = getFixedOrStickyEl($elAtCoords)

Expand Down Expand Up @@ -201,7 +201,7 @@ ensureNotAnimating = (cy, $el, coordsHistory, animationDistanceThreshold) ->
## if we dont have at least 2 points
## then automatically retry
if coordsHistory.length < 2
throw new Error("coordsHistory must be at least 2 sets of coords")
throw $utils.cypressErr("coordsHistory must be at least 2 sets of coords")

## verify that our element is not currently animating
## by verifying it is still at the same coordinates within
Expand Down Expand Up @@ -277,16 +277,16 @@ verify = (cy, $el, options, callbacks) ->
## (see https://github.com/cypress-io/cypress/pull/1478)

sticky = !!getStickyEl($el)
coordsHistory.push(if sticky then coords.fromViewport else coords.fromWindow)
coordsHistory.push(if sticky then coords.fromElViewport else coords.fromElWindow)

## then we ensure the element isnt animating
ensureNotAnimating(cy, $el, coordsHistory, options.animationDistanceThreshold)

## now that we know our element isn't animating its time
## to figure out if its being covered by another element.
## this calculation is relative from the viewport so we
## only care about fromViewport coords
$elAtCoords = options.ensure.notCovered && ensureElIsNotCovered(cy, win, $el, coords.fromViewport, options, _log, onScroll)
## only care about fromElViewport coords
$elAtCoords = options.ensure.notCovered && ensureElIsNotCovered(cy, win, $el, coords.fromElViewport, options, _log, onScroll)

## pass our final object into onReady
finalEl = $elAtCoords ? $el
Expand Down
Loading