Skip to content

Commit 5b67ee1

Browse files
[js] Add new pointer attributes to actions
1 parent 635363b commit 5b67ee1

3 files changed

Lines changed: 163 additions & 17 deletions

File tree

javascript/node/selenium-webdriver/lib/input.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,14 @@ class Pointer extends Device {
349349
* @return {!Action} An action to press the specified button with this device.
350350
* @package
351351
*/
352-
press(button = Button.LEFT) {
353-
return { type: Action.Type.POINTER_DOWN, button }
352+
press(button = Button.LEFT, width = 0, height = 0, pressure = 0,
353+
tangentialPressure = 0, tiltX = 0, tiltY = 0, twist = 0,
354+
altitudeAngle = 0, azimuthAngle = 0) {
355+
return {
356+
type: Action.Type.POINTER_DOWN, button, width, height,
357+
pressure, tangentialPressure, tiltX, tiltY, twist,
358+
altitudeAngle, azimuthAngle
359+
}
354360
}
355361

356362
/**
@@ -379,8 +385,16 @@ class Pointer extends Device {
379385
* @return {!Action} The new action.
380386
* @package
381387
*/
382-
move({ x = 0, y = 0, duration = 100, origin = Origin.VIEWPORT }) {
383-
return { type: Action.Type.POINTER_MOVE, origin, duration, x, y }
388+
move({ x = 0, y = 0, duration = 100, origin = Origin.VIEWPORT,
389+
width = 0, height = 0, pressure = 0,
390+
tangentialPressure = 0, tiltX = 0, tiltY = 0, twist = 0,
391+
altitudeAngle = 0, azimuthAngle = 0
392+
}) {
393+
return {
394+
type: Action.Type.POINTER_MOVE, origin, duration, x, y,
395+
width, height, pressure, tangentialPressure, tiltX, tiltY, twist,
396+
altitudeAngle, azimuthAngle
397+
}
384398
}
385399
}
386400

javascript/node/selenium-webdriver/test/lib/input_test.js

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,19 @@ describe('input.Actions', function () {
546546
type: 'pointer',
547547
parameters: { pointerType: 'mouse' },
548548
actions: [
549-
{ type: 'pointerDown', button: input.Button.LEFT },
549+
{
550+
type: 'pointerDown',
551+
button: input.Button.LEFT,
552+
altitudeAngle: 0,
553+
azimuthAngle: 0,
554+
width: 0,
555+
height: 0,
556+
pressure: 0,
557+
tangentialPressure: 0,
558+
tiltX: 0,
559+
tiltY: 0,
560+
twist: 0,
561+
},
550562
{ type: 'pointerUp', button: input.Button.LEFT },
551563
],
552564
},
@@ -579,8 +591,29 @@ describe('input.Actions', function () {
579591
duration: 100,
580592
x: 0,
581593
y: 0,
594+
altitudeAngle: 0,
595+
azimuthAngle: 0,
596+
width: 0,
597+
height: 0,
598+
pressure: 0,
599+
tangentialPressure: 0,
600+
tiltX: 0,
601+
tiltY: 0,
602+
twist: 0,
603+
},
604+
{
605+
type: 'pointerDown',
606+
button: input.Button.LEFT,
607+
altitudeAngle: 0,
608+
azimuthAngle: 0,
609+
width: 0,
610+
height: 0,
611+
pressure: 0,
612+
tangentialPressure: 0,
613+
tiltX: 0,
614+
tiltY: 0,
615+
twist: 0,
582616
},
583-
{ type: 'pointerDown', button: input.Button.LEFT },
584617
{ type: 'pointerUp', button: input.Button.LEFT },
585618
],
586619
},
@@ -624,8 +657,29 @@ describe('input.Actions', function () {
624657
duration: 100,
625658
x: 0,
626659
y: 0,
660+
altitudeAngle: 0,
661+
azimuthAngle: 0,
662+
width: 0,
663+
height: 0,
664+
pressure: 0,
665+
tangentialPressure: 0,
666+
tiltX: 0,
667+
tiltY: 0,
668+
twist: 0,
669+
},
670+
{
671+
type: 'pointerDown',
672+
button: input.Button.LEFT,
673+
altitudeAngle: 0,
674+
azimuthAngle: 0,
675+
width: 0,
676+
height: 0,
677+
pressure: 0,
678+
tangentialPressure: 0,
679+
tiltX: 0,
680+
tiltY: 0,
681+
twist: 0,
627682
},
628-
{ type: 'pointerDown', button: input.Button.LEFT },
629683
{ type: 'pointerUp', button: input.Button.LEFT },
630684
{ type: 'pause', duration: 0 },
631685
{ type: 'pause', duration: 0 },
@@ -663,14 +717,44 @@ describe('input.Actions', function () {
663717
origin: e1,
664718
x: 0,
665719
y: 0,
720+
altitudeAngle: 0,
721+
azimuthAngle: 0,
722+
width: 0,
723+
height: 0,
724+
pressure: 0,
725+
tangentialPressure: 0,
726+
tiltX: 0,
727+
tiltY: 0,
728+
twist: 0,
729+
},
730+
{
731+
type: 'pointerDown',
732+
button: input.Button.LEFT,
733+
altitudeAngle: 0,
734+
azimuthAngle: 0,
735+
width: 0,
736+
height: 0,
737+
pressure: 0,
738+
tangentialPressure: 0,
739+
tiltX: 0,
740+
tiltY: 0,
741+
twist: 0,
666742
},
667-
{ type: 'pointerDown', button: input.Button.LEFT },
668743
{
669744
type: 'pointerMove',
670745
duration: 100,
671746
origin: e2,
672747
x: 0,
673748
y: 0,
749+
altitudeAngle: 0,
750+
azimuthAngle: 0,
751+
width: 0,
752+
height: 0,
753+
pressure: 0,
754+
tangentialPressure: 0,
755+
tiltX: 0,
756+
tiltY: 0,
757+
twist: 0,
674758
},
675759
{ type: 'pointerUp', button: input.Button.LEFT },
676760
],
@@ -704,14 +788,44 @@ describe('input.Actions', function () {
704788
origin: e1,
705789
x: 0,
706790
y: 0,
791+
altitudeAngle: 0,
792+
azimuthAngle: 0,
793+
width: 0,
794+
height: 0,
795+
pressure: 0,
796+
tangentialPressure: 0,
797+
tiltX: 0,
798+
tiltY: 0,
799+
twist: 0,
800+
},
801+
{
802+
type: 'pointerDown',
803+
button: input.Button.LEFT,
804+
altitudeAngle: 0,
805+
azimuthAngle: 0,
806+
width: 0,
807+
height: 0,
808+
pressure: 0,
809+
tangentialPressure: 0,
810+
tiltX: 0,
811+
tiltY: 0,
812+
twist: 0,
707813
},
708-
{ type: 'pointerDown', button: input.Button.LEFT },
709814
{
710815
type: 'pointerMove',
711816
duration: 100,
712817
origin: input.Origin.POINTER,
713818
x: 30,
714819
y: 40,
820+
altitudeAngle: 0,
821+
azimuthAngle: 0,
822+
width: 0,
823+
height: 0,
824+
pressure: 0,
825+
tangentialPressure: 0,
826+
tiltX: 0,
827+
tiltY: 0,
828+
twist: 0,
715829
},
716830
{ type: 'pointerUp', button: input.Button.LEFT },
717831
],

javascript/node/selenium-webdriver/test/lib/webdriver_test.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe('WebDriver', function () {
334334
let verifyError = expectedError(
335335
error.NoSuchSessionError,
336336
'This driver instance does not have a valid session ID ' +
337-
'(did you call WebDriver.quit()?) and may no longer be used.'
337+
'(did you call WebDriver.quit()?) and may no longer be used.'
338338
)
339339

340340
let driver = executor.createDriver()
@@ -522,14 +522,14 @@ describe('WebDriver', function () {
522522
let executor = new FakeExecutor()
523523
.expect(CName.EXECUTE_SCRIPT)
524524
.withParameters({
525-
script: 'return (' + function () {} + ').apply(null, arguments);',
525+
script: 'return (' + function () { } + ').apply(null, arguments);',
526526
args: [],
527527
})
528528
.andReturnSuccess(null)
529529
.end()
530530

531531
const driver = executor.createDriver()
532-
return driver.executeScript(function () {})
532+
return driver.executeScript(function () { })
533533
})
534534

535535
it('simpleArgumentConversion', function () {
@@ -629,23 +629,23 @@ describe('WebDriver', function () {
629629
let executor = new FakeExecutor()
630630

631631
const arg = Promise.reject(new StubError())
632-
arg.catch(function () {}) // Suppress default handler.
632+
arg.catch(function () { }) // Suppress default handler.
633633

634634
const driver = executor.createDriver()
635635
return driver
636-
.executeScript(function () {}, arg)
636+
.executeScript(function () { }, arg)
637637
.then(fail, assertIsStubError)
638638
})
639639
})
640640

641641
describe('executeAsyncScript', function () {
642642
it('failsIfArgumentIsARejectedPromise', function () {
643643
const arg = Promise.reject(new StubError())
644-
arg.catch(function () {}) // Suppress default handler.
644+
arg.catch(function () { }) // Suppress default handler.
645645

646646
const driver = new FakeExecutor().createDriver()
647647
return driver
648-
.executeAsyncScript(function () {}, arg)
648+
.executeAsyncScript(function () { }, arg)
649649
.then(fail, assertIsStubError)
650650
})
651651
})
@@ -1563,6 +1563,15 @@ describe('WebDriver', function () {
15631563
type: 'pointerMove',
15641564
x: 0,
15651565
y: 125,
1566+
altitudeAngle: 0,
1567+
azimuthAngle: 0,
1568+
width: 0,
1569+
height: 0,
1570+
pressure: 0,
1571+
tangentialPressure: 0,
1572+
tiltX: 0,
1573+
tiltY: 0,
1574+
twist: 0,
15661575
},
15671576
],
15681577
},
@@ -1597,6 +1606,15 @@ describe('WebDriver', function () {
15971606
type: 'pointerMove',
15981607
x: 0,
15991608
y: 125,
1609+
altitudeAngle: 0,
1610+
azimuthAngle: 0,
1611+
width: 0,
1612+
height: 0,
1613+
pressure: 0,
1614+
tangentialPressure: 0,
1615+
tiltX: 0,
1616+
tiltY: 0,
1617+
twist: 0,
16001618
},
16011619
],
16021620
},
@@ -1909,7 +1927,7 @@ describe('WebDriver', function () {
19091927
})
19101928

19111929
it('passes through function properties', function () {
1912-
function bar() {}
1930+
function bar() { }
19131931
return runDeserializeTest(
19141932
[{ foo: { bar: 123 }, func: bar }],
19151933
[{ foo: { bar: 123 }, func: bar }]

0 commit comments

Comments
 (0)