Skip to content

Commit 587ddbf

Browse files
committed
chore: Undo lots of logs.
Test is passing now so these only add noise to the PR diff analysis.
1 parent 661b4fe commit 587ddbf

File tree

1 file changed

+0
-118
lines changed

1 file changed

+0
-118
lines changed

test/webdriverio/test/scroll_test.ts

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,7 @@ suite('Scrolling into view', function () {
6868
await sendKeyAndWait(this.browser, 'm');
6969
await sendKeyAndWait(this.browser, [Key.Alt, Key.ArrowDown], 25);
7070
await sendKeyAndWait(this.browser, Key.Enter);
71-
// setPauseTime(1000);
72-
const movedBlockBounds = await this.browser.execute(() => {
73-
const block = Blockly.getFocusManager().getFocusedNode() as Blockly.BlockSvg;
74-
const blockBounds = block.getBoundingRectangleWithoutChildren();
75-
return blockBounds;
76-
});
77-
console.log("just moved block bounds:", movedBlockBounds);
7871
// Scroll back up, leaving cursor on the draw block out of the viewport.
79-
const scrollPosition1 = await this.browser.execute(() => {
80-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
81-
return [workspace.scrollX, workspace.scrollY];
82-
});
83-
console.log("workspace scroll position before scroll:", scrollPosition1);
8472
await this.browser.execute(() => {
8573
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
8674
workspace.scrollBoundsIntoView(
@@ -91,15 +79,6 @@ suite('Scrolling into view', function () {
9179
});
9280
// Pause to allow scrolling to stabilize before proceeding.
9381
await idle(this.browser);
94-
const scrollPosition2 = await this.browser.execute(() => {
95-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
96-
return [workspace.scrollX, workspace.scrollY];
97-
});
98-
console.log("workspace scroll position after scroll:", scrollPosition2);
99-
const focusedNodeId1 = await this.browser.execute(() => {
100-
return Blockly.getFocusManager().getFocusedNode()?.getFocusableElement()?.id;
101-
});
102-
console.log("current focused node before insert:", focusedNodeId1);
10382

10483
// Insert and confirm the test block which should be scrolled into view.
10584
await sendKeyAndWait(this.browser, 't');
@@ -108,106 +87,9 @@ suite('Scrolling into view', function () {
10887
await keyDown(this.browser);
10988
await keyUp(this.browser);
11089
await sendKeyAndWait(this.browser, Key.Enter);
111-
const focusedNodeId2 = await this.browser.execute(() => {
112-
return Blockly.getFocusManager().getFocusedNode()?.getFocusableElement()?.id;
113-
});
114-
console.log("current focused node after insert:", focusedNodeId2);
115-
const scrollPosition3 = await this.browser.execute(() => {
116-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
117-
return [workspace.scrollX, workspace.scrollY];
118-
});
119-
console.log("workspace scroll position after insert:", scrollPosition3);
12090

12191
// Assert new block has been scrolled into the viewport.
12292
await idle(this.browser);
123-
// await this.browser.saveScreenshot(`failures/extra_snapshot_for_verification.png`);
124-
const blockBounds = await this.browser.execute(() => {
125-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
126-
const block = workspace.getBlocksByType(
127-
'controls_if',
128-
)[0] as Blockly.BlockSvg;
129-
const blockBounds = block.getBoundingRectangleWithoutChildren();
130-
return blockBounds;
131-
});
132-
console.log("block bounds:", blockBounds);
133-
const [blockPosition, blockRelative, x, y, transform, style] = await this.browser.execute(() => {
134-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
135-
const block = workspace.getBlocksByType(
136-
'controls_if',
137-
)[0] as Blockly.BlockSvg;
138-
139-
const XY_REGEX = /translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/;
140-
const XY_STYLE_REGEX =
141-
/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;
142-
const element = block.getSvgRoot();
143-
class Coordinate {
144-
constructor(public x: number, public y: number){}
145-
};
146-
const xy = new Coordinate(0, 0);
147-
// First, check for x and y attributes.
148-
// Checking for the existence of x/y properties is faster than getAttribute.
149-
// However, x/y contains an SVGAnimatedLength object, so rely on getAttribute
150-
// to get the number.
151-
const x = (element as any).x && element.getAttribute('x');
152-
const y = (element as any).y && element.getAttribute('y');
153-
if (x) {
154-
xy.x = parseInt(x);
155-
}
156-
if (y) {
157-
xy.y = parseInt(y);
158-
}
159-
// Second, check for transform="translate(...)" attribute.
160-
const transform = element.getAttribute('transform');
161-
const r = transform && transform.match(XY_REGEX);
162-
if (r) {
163-
xy.x += Number(r[1]);
164-
if (r[3]) {
165-
xy.y += Number(r[3]);
166-
}
167-
}
168-
169-
// Then check for style = transform: translate(...) or translate3d(...)
170-
const style = element.getAttribute('style');
171-
if (style && style.includes('translate')) {
172-
const styleComponents = style.match(XY_STYLE_REGEX);
173-
if (styleComponents) {
174-
xy.x += Number(styleComponents[1]);
175-
if (styleComponents[3]) {
176-
xy.y += Number(styleComponents[3]);
177-
}
178-
}
179-
}
180-
return [block.getRelativeToSurfaceXY(), xy, x, y, transform, style];
181-
});
182-
console.log("block position:", blockPosition, "relative:", blockRelative, x, y, transform, style);
183-
const [blockParentBounds, blockParentId] = await this.browser.execute(() => {
184-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
185-
const block = workspace.getBlocksByType(
186-
'controls_if',
187-
)[0] as Blockly.BlockSvg;
188-
const blockBounds = block.getSurroundParent()?.getBoundingRectangleWithoutChildren();
189-
return [blockBounds, block.getSurroundParent()?.getFocusableElement()?.id];
190-
});
191-
console.log("block's parent bounds:", blockParentBounds, "id:", blockParentId);
192-
const viewport = await this.browser.execute(() => {
193-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
194-
const rawViewport = workspace.getMetricsManager().getViewMetrics(true);
195-
const viewport = new Blockly.utils.Rect(
196-
rawViewport.top,
197-
rawViewport.top + rawViewport.height,
198-
rawViewport.left,
199-
rawViewport.left + rawViewport.width,
200-
);
201-
return viewport;
202-
});
203-
console.log("viewport:", viewport);
204-
const matchedBlocks = await this.browser.execute(() => {
205-
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
206-
return workspace.getBlocksByType(
207-
'controls_if',
208-
).map((block) => { return (block as Blockly.BlockSvg).getFocusableElement().id });
209-
});
210-
console.log('matched blocks to controls_if:', matchedBlocks);
21193
const inViewport = await this.browser.execute(() => {
21294
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
21395
const block = workspace.getBlocksByType(

0 commit comments

Comments
 (0)