Skip to content

Commit a4ff2d4

Browse files
BayheckBayheck
andauthored
Fix maximizeWindow after resize (#8361)
<!-- Thank you for your contribution. Before making a PR, please read our contributing guidelines at https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution We recommend creating a *draft* PR, so that you can mark it as 'ready for review' when you are done. --> ## Purpose Window did not maximize properly after resizing. ## Approach Remove redundant use of _setDeviceMetricsOverride in resize window using CDP. ## References closes #8360 ## Pre-Merge TODO - [ ] Write tests for your proposed changes - [ ] Make sure that existing tests do not fail --------- Co-authored-by: Bayheck <[email protected]>
1 parent 45310bf commit a4ff2d4

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class BrowserClient {
244244
}
245245

246246
public async resizeBounds (newDimensions: Size): Promise<void> {
247-
const { viewportSize, config } = this._runtimeInfo;
247+
const { viewportSize } = this._runtimeInfo;
248248

249249
let nonClientWidth = 0;
250250
let nonClientHeight = 0;
@@ -258,8 +258,6 @@ export class BrowserClient {
258258
const client = await this.getActiveClient();
259259

260260
if (client) {
261-
await this._setDeviceMetricsOverride(client, newDimensions.width, newDimensions.height, 1, config.mobile);
262-
263261
const windowParams = await client.Browser.getWindowForTarget({ targetId: target.id });
264262

265263
if (windowParams.bounds.windowState !== 'normal') {

test/functional/fixtures/api/es-next/resize-window/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ describe('[API] Resize window actions', function () {
3434
it('Should resize the window after maximizeWindow', function () {
3535
return runTests('./testcafe-fixtures/resize-window-test.js', 'Resize the window after maximizeWindow', { only: 'chrome' });
3636
});
37+
38+
it('Should maximizeWindow after resize', function () {
39+
return runTests('./testcafe-fixtures/resize-window-test.js', 'Correctly maximizeWindow after resize', { only: 'chrome' });
40+
});
3741
});
3842

3943
describe('t.resizeWindowToFitDevice', function () {

test/functional/fixtures/api/es-next/resize-window/testcafe-fixtures/resize-window-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,15 @@ test('Resize the window after maximizeWindow', async t => {
100100
expect(await getWindowWidth()).equals(640);
101101
expect(await getWindowHeight()).equals(480);
102102
});
103+
104+
test('Correctly maximizeWindow after resize', async t => {
105+
await t.resizeWindow(640, 480);
106+
107+
expect(await getWindowWidth()).equals(640);
108+
expect(await getWindowHeight()).equals(480);
109+
110+
await t.maximizeWindow();
111+
112+
expect(await getWindowWidth()).to.be.above(640);
113+
expect(await getWindowHeight()).to.be.above(480);
114+
});

0 commit comments

Comments
 (0)