Skip to content

Commit efecfd9

Browse files
committed
chore: Re-add logs for investigation.
1 parent 531979e commit efecfd9

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

test/webdriverio/test/scroll_test.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ suite('Scrolling into view', function () {
3939
await testSetup(testFileLocations.BASE, this.timeout());
4040
});
4141

42-
test('Insert scrolls new block into view', async function () {
42+
test.only('Insert scrolls new block into view', async function () {
4343
// Increase timeout to 10s for this longer test.
4444
this.timeout(PAUSE_TIME ? 0 : 10000);
4545

@@ -51,6 +51,11 @@ suite('Scrolling into view', function () {
5151
await sendKeyAndWait(this.browser, [Key.Alt, Key.ArrowDown], 25);
5252
await sendKeyAndWait(this.browser, Key.Enter);
5353
// Scroll back up, leaving cursor on the draw block out of the viewport.
54+
const scrollPosition1 = await this.browser.execute(() => {
55+
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
56+
return [workspace.scrollX, workspace.scrollY];
57+
});
58+
console.log("workspace scroll position before scroll:", scrollPosition1);
5459
await this.browser.execute(() => {
5560
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
5661
workspace.scrollBoundsIntoView(
@@ -61,6 +66,11 @@ suite('Scrolling into view', function () {
6166
});
6267
// Pause to allow scrolling to stabilize before proceeding.
6368
await this.browser.pause(PAUSE_TIME);
69+
const scrollPosition2 = await this.browser.execute(() => {
70+
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
71+
return [workspace.scrollX, workspace.scrollY];
72+
});
73+
console.log("workspace scroll position after scroll:", scrollPosition2);
6474

6575
// Insert and confirm the test block which should be scrolled into view.
6676
await sendKeyAndWait(this.browser, 't');
@@ -69,6 +79,27 @@ suite('Scrolling into view', function () {
6979

7080
// Assert new block has been scrolled into the viewport.
7181
await this.browser.pause(PAUSE_TIME);
82+
const blockBounds = await this.browser.execute(() => {
83+
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
84+
const block = workspace.getBlocksByType(
85+
'controls_if',
86+
)[0] as Blockly.BlockSvg;
87+
const blockBounds = block.getBoundingRectangleWithoutChildren();
88+
return blockBounds;
89+
});
90+
console.log("block bounds:", blockBounds);
91+
const viewport = await this.browser.execute(() => {
92+
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
93+
const rawViewport = workspace.getMetricsManager().getViewMetrics(true);
94+
const viewport = new Blockly.utils.Rect(
95+
rawViewport.top,
96+
rawViewport.top + rawViewport.height,
97+
rawViewport.left,
98+
rawViewport.left + rawViewport.width,
99+
);
100+
return viewport;
101+
});
102+
console.log("viewport:", viewport);
72103
const inViewport = await this.browser.execute(() => {
73104
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg;
74105
const block = workspace.getBlocksByType(

0 commit comments

Comments
 (0)