Page MenuHomePhabricator

Add support for setting different viewport size for tests in CI
Open, Needs TriagePublic

Description

We setup xvfb screen size in the start script of the container in CI. And then we set the recording video size in wdio.conf.json.

However this is "desktop" size, we should make it possible to run tests with mobile size viewport (for example for Minerva). Smaller screen size will make overhead smaller + we will run the test as our users will see Mediawiki.

Acceptance criteria:

  • Make it possible to override the XVFB screen size and the video recording size.
  • Also checkout T408327 and this change so they comply

Event Timeline

Quibble does spawn an Xvfb server on display port 94 and has it hardcoded to 1280x1024x24 . Then I think there might other systems spinning up Xvfb (npm run selenium*, wdio-mediawiki, Cypress?) so that when one runs that locally they will have Xvfb spawned. If they exists, those other means of spawning Xvfb would need to be adjusted as well.

For Quibble the source is https://gerrit.wikimedia.org/g/integration/quibble/+/refs/heads/master/quibble/backend.py

quibble/backend.py
class Xvfb(BackendServer):
    def __init__(self, display=':94'):
        super(Xvfb, self).__init__()
        self.display = display
    def start(self):
        self.log.info('Starting Xvfb on display %s', self.display)
        self.server = subprocess.Popen(
            [
                # fmt: off
                'Xvfb', self.display,
                '-screen', '0', '1280x1024x24',
                '-nolisten', 'tcp',
                '-nolisten', 'unix',
                # fmt: on
            ]
        )
    def __str__(self):
        return "<Xvfb {}>".format(self.display)

It is trivial to set a different size/color depth and we can make it a new option to the quibble command line.