@brightspace-ui/testing 1.52.0 → 1.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@brightspace-ui/testing",
|
|
3
3
|
"description": "Utilities for testing front-end components and applications",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.53.1",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/testing.git",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "npm run lint:eslint && npm run lint:style",
|
package/src/browser/commands.js
CHANGED
|
@@ -40,7 +40,7 @@ export async function dragDropElems(elem, toElem) {
|
|
|
40
40
|
await sendMouse({ type: 'up' });
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export async function dragElemBy(elem, offsetX = 0, offsetY = 0) {
|
|
43
|
+
export async function dragElemBy(elem, offsetX = 0, offsetY = 0, completeDrag = true) {
|
|
44
44
|
const dragIncrementSize = 10; // To mimic real user dragging
|
|
45
45
|
const numSteps = Math.ceil(Math.max(Math.abs(offsetX), Math.abs(offsetY)) / dragIncrementSize);
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ export async function dragElemBy(elem, offsetX = 0, offsetY = 0) {
|
|
|
53
53
|
const dy = Math.sign(offsetY) * Math.min(Math.abs(offsetY), dragIncrementSize * i);
|
|
54
54
|
await sendMouse({ type: 'move', position: [position.x + dx, position.y + dy] });
|
|
55
55
|
}
|
|
56
|
-
await sendMouse({ type: 'up' });
|
|
56
|
+
if (completeDrag) await sendMouse({ type: 'up' });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export async function focusElem(elem) {
|
package/src/browser/reset.js
CHANGED
|
@@ -74,7 +74,8 @@ export async function reset(opts = {}) {
|
|
|
74
74
|
|
|
75
75
|
if (shouldResetMouse) {
|
|
76
76
|
shouldResetMouse = false;
|
|
77
|
-
await sendMouse({ type: 'move', position: [0, 0] })
|
|
77
|
+
await sendMouse({ type: 'move', position: [0, 0] });
|
|
78
|
+
await sendMouse({ type: 'up' });
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
if (document.activeElement !== document.body) {
|
|
@@ -2,7 +2,7 @@ import * as os from 'node:os';
|
|
|
2
2
|
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { env } from 'node:process';
|
|
5
|
-
import {
|
|
5
|
+
import { execFileSync } from 'node:child_process';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { getTestInfo } from './visual-diff-info.js';
|
|
8
8
|
import { PATHS } from './paths.js';
|
|
@@ -163,7 +163,13 @@ export function visualDiffReporter({ updateGoldens } = {}) {
|
|
|
163
163
|
cpSync(inputDir, tempDir, { force: true, recursive: true });
|
|
164
164
|
writeFileSync(join(tempDir, 'data.js'), `export default ${json};`);
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
execFileSync('npx', [
|
|
167
|
+
'rollup',
|
|
168
|
+
'-c',
|
|
169
|
+
join(__dirname, './rollup.config.js')
|
|
170
|
+
], {
|
|
171
|
+
stdio: 'pipe'
|
|
172
|
+
});
|
|
167
173
|
|
|
168
174
|
rmSync(tempDir, { recursive: true });
|
|
169
175
|
|