I have an acceptance test to ensure that 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 very narrow.
How do I control/test for this?
I don’t see any method to either get the screen size or set it. The ember forum states that I should ask these kinds of questions here.
Thanks in advance!
The variance represents all the cumulative borders, margins, etc. between the outer element and the actual viewer. This remains consistent except when the display is very, very narrow and some elements need to wrap.
await visit('/code-nav');
await fillIn('[data-test-code-nav-selector]', 'PDF_I10_PCS_REFERENCE_MANUAL');
let applicationYieldWrapper = find('[data-test-application-yield-wrapper]');
let applicationYieldWrapperHeight = applicationYieldWrapper.offsetHeight;
await waitFor('[data-test-pdf-viewer]');
let pdfViewer = find('[data-test-pdf-viewer]')
let pdfViewerHeight = pdfViewer.offsetHeight;
let variance = 136; // borders, margins, etc.
assert.equal(pdfViewerHeight + variance, applicationYieldWrapperHeight);