Skip to content

Commit

Permalink
Merge branch 'master' into update-workflow-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Bayheck authored Jan 27, 2025
2 parents 4ec8e4a + a4ff2d4 commit b7e3926
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class BrowserClient {
}

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

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

if (client) {
await this._setDeviceMetricsOverride(client, newDimensions.width, newDimensions.height, 1, config.mobile);

const windowParams = await client.Browser.getWindowForTarget({ targetId: target.id });

if (windowParams.bounds.windowState !== 'normal') {
Expand Down
4 changes: 4 additions & 0 deletions test/functional/fixtures/api/es-next/resize-window/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ describe('[API] Resize window actions', function () {
it('Should resize the window after maximizeWindow', function () {
return runTests('./testcafe-fixtures/resize-window-test.js', 'Resize the window after maximizeWindow', { only: 'chrome' });
});

it('Should maximizeWindow after resize', function () {
return runTests('./testcafe-fixtures/resize-window-test.js', 'Correctly maximizeWindow after resize', { only: 'chrome' });
});
});

describe('t.resizeWindowToFitDevice', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@ test('Resize the window after maximizeWindow', async t => {
expect(await getWindowWidth()).equals(640);
expect(await getWindowHeight()).equals(480);
});

test('Correctly maximizeWindow after resize', async t => {
await t.resizeWindow(640, 480);

expect(await getWindowWidth()).equals(640);
expect(await getWindowHeight()).equals(480);

await t.maximizeWindow();

expect(await getWindowWidth()).to.be.above(640);
expect(await getWindowHeight()).to.be.above(480);
});

0 comments on commit b7e3926

Please sign in to comment.