Reading the CLI Docs, there doesn't appear to be a way to set the default browser window size. Is there a way to do this so that each test or each test fixture doesn't have to?
I should point out that adding a resizeWindow
call in each test, or even once per test fixture is not a scalable solution across many fixtures so the "proper" solution should/would involve some sort of config so it only needs to be set once.
As you can see, TestCafe automatically determines browsers installed on your machine. TestCafe will automatically open the chosen browsers and start test execution within them. When the test task is accomplished, the browser windows will be closed by TestCafe.
After you click a fixture's Rec button, a browser loads the tested page and opens the recorder to create a test. A TestCafe test consists of the steps. Each step may contain an action or (one or more) assertions.
The TestCafe API includes methods that open, close, and switch between browser windows. You can test websites with pop-up windows and OAuth login forms, debug complex multi-window applications, or run multiple instances of the same web app side-by-side.
Call the testcafe command with the --list-browsers flag to view a list of all available browsers. To run tests in a different local browser, specify the path to the browser’s executable file.
TestCafe does not have such an option out of the box. However, you can put the t.resizeWindow action into the beforeEach test hook.
Another way is to run a browser with the special command line argument. For example, the command line for Chrome:
testcafe "chrome '--window-size=800,600'" test.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With