Acceptance test set window size

I have an acceptance test to make sure a PDF viewer on a specific route isn’t accidentally sized incorrectly. Due to a convergence of prior choices and the way the embed tag works, the viewer can sometimes become truncated when seemingly unrelated elements are restyled. This is there to warn me that this has occurred, and it works.

EXCEPT, on some test machines, with really small displays, the test will fail. Trying to reproduce the problem, when running with the --server option, I can make the test fail by making the test window really, really narrow.

How do I control/test for this? I don’t see any method to either get the screen size or set it.

Thanks in advance!

Im not sure if there is a way to during the tests but you can set the window size in testem.js so that the window size is consistent

This works for now…

it seems that the interactive --server window only produces two widths, or only two that I’ve seen. But how reliable is this? I don’t want to have to keep coming back, again and again to tweak it.

   >  let variance = applicationYieldWrapperWidth === 1242 // borders, margins, etc.
   >             ? 168  // The wrapper seems to have two sizes during testing.
   >             : 136; // This affects the PDF viewer height.

Im not 100% sure what you mean but the test em by default has the window size set for CI you should be able to set browser args so that it set the window size when running --server locally.

While the test server is open, the tester may resize the window. This causes the tested behavior to resize. How can my test adapt to the new size if I can’t reliably query the size?