fix: support resize_page when browser window is maximized/fullscreenwindow state
Related Issue - 465
Description
This change make sure that the browser window is restored to a normal state before resizing the page. When the window is in fullscreen mode we have to set the state twice to match how Chrome CDP behaves.
Tests cover window resizing for every available window states type WindowState = 'normal' | 'minimized' | 'maximized' | 'fullscreen';
I guess might require setting a larger screen info for the test browser similar to https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/src/browser.ts#L178
After testing few times i noticed that the maximized and fullscreen tests often fail, with dimensions overlapping those of the previous tests.
I think this happens because Chrome is still resizing from the previous test when the next test starts, and the resize listener resolves on the previous resize event rather than the current one.
To fix this, I found that the puppeteer's Page.waitForFunction() method can be used to wait until the size dimensions are actually being set
Thanks!