зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 95bc55ad64d7 (bug 1781066) for causing linting failures. CLOSED TREE
This commit is contained in:
Родитель
7cea3b3b0d
Коммит
0a4c1b25bc
|
@ -1070,8 +1070,12 @@ class PointerMoveAction extends PointerAction {
|
|||
);
|
||||
}
|
||||
const originObject = Origin.fromJSON(origin);
|
||||
lazy.assert.integer(x, lazy.pprint`Expected 'x' (${x}) to be an Integer`);
|
||||
lazy.assert.integer(y, lazy.pprint`Expected 'y' (${y}) to be an Integer`);
|
||||
if (x !== undefined) {
|
||||
lazy.assert.integer(x, lazy.pprint`Expected 'x' (${x}) to be an Integer`);
|
||||
}
|
||||
if (y !== undefined) {
|
||||
lazy.assert.integer(y, lazy.pprint`Expected 'y' (${y}) to be an Integer`);
|
||||
}
|
||||
props.duration = duration;
|
||||
props.origin = originObject;
|
||||
props.x = x;
|
||||
|
@ -1121,16 +1125,24 @@ class WheelScrollAction extends WheelAction {
|
|||
);
|
||||
}
|
||||
const originObject = Origin.fromJSON(origin);
|
||||
lazy.assert.integer(x, lazy.pprint`Expected 'x' (${x}) to be an Integer`);
|
||||
lazy.assert.integer(y, lazy.pprint`Expected 'y' (${y}) to be an Integer`);
|
||||
lazy.assert.integer(
|
||||
deltaX,
|
||||
lazy.pprint`Expected 'deltaX' (${deltaX}) to be an Integer`
|
||||
);
|
||||
lazy.assert.integer(
|
||||
deltaY,
|
||||
lazy.pprint`Expected 'deltaY' (${deltaY}) to be an Integer`
|
||||
);
|
||||
if (x !== undefined) {
|
||||
lazy.assert.integer(x, lazy.pprint`Expected 'x' (${x}) to be an Integer`);
|
||||
}
|
||||
if (y !== undefined) {
|
||||
lazy.assert.integer(y, lazy.pprint`Expected 'y' (${y}) to be an Integer`);
|
||||
}
|
||||
if (deltaX !== undefined) {
|
||||
lazy.assert.integer(
|
||||
deltaX,
|
||||
lazy.pprint`Expected 'deltaX' (${deltaX}) to be an Integer`
|
||||
);
|
||||
}
|
||||
if (deltaY !== undefined) {
|
||||
lazy.assert.integer(
|
||||
deltaY,
|
||||
lazy.pprint`Expected 'deltaY' (${deltaY}) to be an Integer`
|
||||
);
|
||||
}
|
||||
|
||||
return new this(id, {
|
||||
duration,
|
||||
|
|
|
@ -168,14 +168,7 @@ add_test(function test_processPointerMoveActionOriginStringValidation() {
|
|||
add_test(function test_processPointerMoveActionElementOrigin() {
|
||||
let state = new action.State();
|
||||
const inputTickActions = [
|
||||
{
|
||||
type: "pointer",
|
||||
duration: 5000,
|
||||
subtype: "pointerMove",
|
||||
origin: domEl,
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
{ type: "pointer", duration: 5000, subtype: "pointerMove", origin: domEl },
|
||||
];
|
||||
const chain = action.Chain.fromJSON(state, chainForTick(inputTickActions));
|
||||
deepEqual(chain[0][0].origin.element, domEl);
|
||||
|
@ -185,7 +178,7 @@ add_test(function test_processPointerMoveActionElementOrigin() {
|
|||
add_test(function test_processPointerMoveActionDefaultOrigin() {
|
||||
let state = new action.State();
|
||||
const inputTickActions = [
|
||||
{ type: "pointer", duration: 5000, subtype: "pointerMove", x: 0, y: 0 },
|
||||
{ type: "pointer", duration: 5000, subtype: "pointerMove" },
|
||||
];
|
||||
const chain = action.Chain.fromJSON(state, chainForTick(inputTickActions));
|
||||
// The default is viewport coordinates which have an origin at [0,0] and don't depend on inputSource
|
||||
|
@ -203,15 +196,22 @@ add_test(function test_processPointerMoveAction() {
|
|||
duration: 5000,
|
||||
type: "pointerMove",
|
||||
origin: undefined,
|
||||
x: 0,
|
||||
y: 0,
|
||||
x: undefined,
|
||||
y: undefined,
|
||||
},
|
||||
{
|
||||
duration: undefined,
|
||||
type: "pointerMove",
|
||||
origin: domEl,
|
||||
x: undefined,
|
||||
y: undefined,
|
||||
},
|
||||
{
|
||||
duration: 5000,
|
||||
type: "pointerMove",
|
||||
x: 0,
|
||||
y: 0,
|
||||
y: undefined,
|
||||
origin: undefined,
|
||||
},
|
||||
{
|
||||
duration: 5000,
|
||||
|
@ -315,8 +315,6 @@ add_test(function test_processPointerAction() {
|
|||
{
|
||||
type: "pointerMove",
|
||||
duration: 2000,
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
{
|
||||
type: "pointerUp",
|
||||
|
@ -672,7 +670,7 @@ add_test(function test_computeTickDuration() {
|
|||
const inputTickActions = [
|
||||
{ type: "none", subtype: "pause", duration: 5000 },
|
||||
{ type: "key", subtype: "pause", duration: 1000 },
|
||||
{ type: "pointer", subtype: "pointerMove", duration: 6000, x: 0, y: 0 },
|
||||
{ type: "pointer", subtype: "pointerMove", duration: 6000 },
|
||||
// invalid because keyDown should not have duration, so duration should be ignored.
|
||||
{ type: "key", subtype: "keyDown", duration: 100000, value: "a" },
|
||||
{ type: "pointer", subtype: "pause", duration: expected },
|
||||
|
@ -692,7 +690,7 @@ add_test(function test_computeTickDuration_noDurations() {
|
|||
{ type: "key", subtype: "keyDown", duration: 100000, value: "a" },
|
||||
// undefined duration permitted
|
||||
{ type: "none", subtype: "pause" },
|
||||
{ type: "pointer", subtype: "pointerMove", button: 0, x: 0, y: 0 },
|
||||
{ type: "pointer", subtype: "pointerMove", button: 0 },
|
||||
{ type: "pointer", subtype: "pointerDown", button: 0 },
|
||||
{ type: "key", subtype: "keyUp", value: "a" },
|
||||
];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from webdriver.error import InvalidArgumentException, NoSuchWindowException, StaleElementReferenceException
|
||||
from webdriver.error import NoSuchWindowException, StaleElementReferenceException
|
||||
|
||||
from tests.perform_actions.support.mouse import get_inview_center, get_viewport_rect
|
||||
from tests.perform_actions.support.refine import get_events
|
||||
|
@ -183,12 +183,3 @@ def test_drag_and_drop_with_draggable_element(session_new_window,
|
|||
assert "dragenter" in drag_events_captured
|
||||
assert "dragleave" in drag_events_captured
|
||||
assert "drop" in drag_events_captured
|
||||
|
||||
|
||||
@pytest.mark.parametrize("missing", ["x", "y"])
|
||||
def test_missing_coordinates(session, test_actions_page, mouse_chain, missing):
|
||||
outer = session.find.css("#outer", all=False)
|
||||
actions = mouse_chain.pointer_move(x=0, y=0, origin=outer)
|
||||
del actions._actions[-1][missing]
|
||||
with pytest.raises(InvalidArgumentException):
|
||||
actions.perform()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from webdriver.error import InvalidArgumentException, NoSuchWindowException
|
||||
from webdriver.error import NoSuchWindowException
|
||||
|
||||
from tests.perform_actions.support.refine import get_events
|
||||
from tests.support.asserts import assert_move_to_coordinates
|
||||
|
@ -62,15 +62,3 @@ def test_wheel_scroll_iframe(session, test_actions_scroll_page, wheel_chain):
|
|||
assert events[0]["deltaY"] >= 10
|
||||
assert events[0]["deltaZ"] == 0
|
||||
assert events[0]["target"] == "iframeContent"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("missing", ["x", "y", "deltaX", "deltaY"])
|
||||
def test_wheel_missing_prop(session, test_actions_scroll_page, wheel_chain, missing):
|
||||
session.execute_script("document.scrollingElement.scrollTop = 0")
|
||||
|
||||
outer = session.find.css("#outer", all=False)
|
||||
actions = wheel_chain.scroll(0, 0, 5, 10, origin=outer)
|
||||
print(actions._actions)
|
||||
del actions._actions[-1][missing]
|
||||
with pytest.raises(InvalidArgumentException):
|
||||
actions.perform()
|
||||
|
|
|
@ -211,8 +211,18 @@ pub struct PointerMoveAction {
|
|||
pub duration: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub origin: PointerOrigin,
|
||||
pub x: i64,
|
||||
pub y: i64,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub x: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub y: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
|
@ -397,9 +407,29 @@ pub struct WheelScrollAction {
|
|||
pub duration: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub origin: PointerOrigin,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub x: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub y: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub deltaX: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
deserialize_with = "deserialize_to_option_i64"
|
||||
)]
|
||||
pub deltaY: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -604,8 +634,8 @@ mod test {
|
|||
PointerActionItem::Pointer(PointerAction::Move(PointerMoveAction {
|
||||
origin: PointerOrigin::Pointer,
|
||||
duration: None,
|
||||
x: 10,
|
||||
y: 20,
|
||||
x: Some(10),
|
||||
y: Some(20),
|
||||
..Default::default()
|
||||
})),
|
||||
PointerActionItem::Pointer(PointerAction::Up(PointerUpAction {
|
||||
|
@ -1043,8 +1073,8 @@ mod test {
|
|||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Viewport,
|
||||
x: 5,
|
||||
y: 10,
|
||||
x: Some(5),
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -1085,8 +1115,8 @@ mod test {
|
|||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: None,
|
||||
origin: PointerOrigin::Viewport,
|
||||
x: 5,
|
||||
y: 10,
|
||||
x: Some(5),
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -1140,8 +1170,8 @@ mod test {
|
|||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Viewport,
|
||||
x: 5,
|
||||
y: 10,
|
||||
x: Some(5),
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -1160,8 +1190,8 @@ mod test {
|
|||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Element(WebElement("elem".into())),
|
||||
x: 5,
|
||||
y: 10,
|
||||
x: Some(5),
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -1180,8 +1210,8 @@ mod test {
|
|||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Element(WebElement("elem".into())),
|
||||
x: 5,
|
||||
y: 10,
|
||||
x: Some(5),
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
@ -1200,6 +1230,25 @@ mod test {
|
|||
assert!(serde_json::from_value::<PointerOrigin>(json).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_json_pointer_action_move_with_x_missing() {
|
||||
let json = json!({
|
||||
"type": "pointerMove",
|
||||
"duration": 100,
|
||||
"origin": "viewport",
|
||||
"y": 10,
|
||||
});
|
||||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Viewport,
|
||||
x: None,
|
||||
y: Some(10),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
assert_ser_de(&pointer_move, json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_json_pointer_action_move_with_x_null() {
|
||||
let json = json!({
|
||||
|
@ -1224,6 +1273,25 @@ mod test {
|
|||
assert!(serde_json::from_value::<PointerAction>(json).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_json_pointer_action_move_with_y_missing() {
|
||||
let json = json!({
|
||||
"type": "pointerMove",
|
||||
"duration": 100,
|
||||
"origin": "viewport",
|
||||
"x": 5,
|
||||
});
|
||||
let pointer_move = PointerAction::Move(PointerMoveAction {
|
||||
duration: Some(100),
|
||||
origin: PointerOrigin::Viewport,
|
||||
x: Some(5),
|
||||
y: None,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
assert_ser_de(&pointer_move, json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_json_pointer_action_move_with_y_null() {
|
||||
let json = json!({
|
||||
|
@ -1385,9 +1453,6 @@ mod test {
|
|||
json.insert("type".into(), actionType.into());
|
||||
if actionType != "pointerMove" {
|
||||
json.insert("button".into(), Value::from(0));
|
||||
} else {
|
||||
json.insert("x".into(), Value::from(0));
|
||||
json.insert("y".into(), Value::from(0));
|
||||
}
|
||||
json.insert(prop_name.into(), value);
|
||||
println!("{:?}", json);
|
||||
|
|
Загрузка…
Ссылка в новой задаче