本文整理汇总了TypeScript中@theintern/leadfoot/Command.findByCssSelector函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findByCssSelector函数的具体用法?TypeScript findByCssSelector怎么用?TypeScript findByCssSelector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findByCssSelector函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resize
function resize(command: Command<Element | void>, x: number, y: number): Command<void> {
return command
.findByCssSelector(`.${css.divider}`)
.moveMouseTo()
.pressMouseButton(0)
.moveMouseTo(x, y)
.releaseMouseButton(0)
.sleep(DELAY)
.end();
}
示例2: testResizes
function testResizes(command: Command<Element | void>, resizes: Coord[], expected: CoordTest[]) {
assert.strictEqual(resizes.length, expected.length, 'Resizes array should match expected array.');
let currentX: number;
let currentY: number;
command = command
.findByCssSelector(`.${css.divider}`)
.getPosition()
.then(({ x, y }) => {
currentX = x;
currentY = y;
})
.end();
for (let i = 0; i < resizes.length; i++) {
const move = resizes[i];
const delta = expected[i];
command = resize(command, move.x, move.y)
.findByCssSelector(`.${css.divider}`)
.getPosition()
.then(({ x, y }) => {
if (typeof delta.x === 'function') {
assert.isTrue(delta.x(x), `Resize ${i} should pass x test.`);
}
else {
assert.closeTo(x, currentX + delta.x, ERROR_MARGIN, `Resize ${i} should move x by ${move.x}.`);
}
if (typeof delta.y === 'function') {
assert.isTrue(delta.y(y), `Resize ${i} should pass y test.`);
}
else {
assert.closeTo(y, currentY + delta.y, ERROR_MARGIN, `Resize ${i} should move y by ${move.y}.`);
}
currentX = x;
currentY = y;
})
.end();
}
return command;
}