Browserless v2 is out 🚀! Read more about it here.

How BigBlueButton, an open source project, runs automated E2E tests with Browserless

Ilya AzovtsevMay 27, 2022

What was your goal?

Browserless is used to run automated E2E tests of BigBlueButton, an open source project.

We reached really fast and detailed execution of our BigBlueButton automated tests. Thanks to Browserless we could cover all our automation needs without wasting time on server configurations. Actually, dockerized Browserless server was also used in our CI/CD pipelines and it made a huge difference.

Why did you choose Browserless for automation?

Browserless got us the ability to do and execute browser stuff without really having a browser.

Example of the code:

BigBlueButton is basically connecting to Browserless and setting the connection to emulate as tightly as possible a real device, instead of a server. Once it’s connected, they test all their features, like microphone integration, leaving the meeting, etc

It’s a really impressive test suite, you can take a look at the full code here – https://github.com/bigbluebutton/bigbluebutton/blob/develop/bigbluebutton-tests/puppeteer/core/page.js#L50

Here is one part of it:

async init(isModerator, shouldCloseAudioModal, testFolderName, fullName, meetingId, customParameter, connectionPreset, deviceX, extraFlags) {
    try {
      const args = this.getArgs(extraFlags?.length > 0 ? extraFlags : null);
      this.effectiveParams = Object.assign({}, params);
      if (!isModerator) this.effectiveParams.moderatorPW = '';
      if (fullName) this.effectiveParams.fullName = fullName;
      if (process.env.BROWSERLESS_ENABLED === 'true') {
        this.browser = await puppeteer.connect({
          browserWSEndpoint: `ws://${process.env.BROWSERLESS_URL}?token=${process.env.BROWSERLESS_TOKEN}&${args.args.join('&')}`,
        });
      } else {
        this.browser = await puppeteer.launch(args);
      }
      this.page = await this.browser.newPage();
      this.page.emulate(deviceX || linuxDesktop);
      await this.getUserAgent(this);

      // Connect to Chrome DevTools
      const client = await this.page.target().createCDPSession();

      // Set throttling property
      await client.send('Network.emulateNetworkConditions', connectionPreset || NETWORK_PRESETS.WiFi);

      // if (process.env.DEVICE_NAME === 'Desktop') {
      //   await this.page.setViewport({ width: 1024, height: 720 });
      // }

      this.page.setDefaultTimeout(3600000);

      // Getting all page console logs
      // this.page.on('console', async msg => console[msg._type](
      //   ...await Promise.all(msg.args().map(arg => arg.jsonValue()))
      // ));

      await this.page.setExtraHTTPHeaders({
        'Accept-Language': 'en-US',
      });
      await this.setDownloadBehavior(`${this.parentDir}/downloads`);
      this.meetingId = await helper.createMeeting(params, meetingId, customParameter);
      await this.logger('Meeting ID: ', this.meetingId);

      const joinURL = helper.getJoinURL(this.meetingId, this.effectiveParams, isModerator, customParameter);
      await this.page.goto(joinURL, { waitUntil: 'networkidle2' });

      if (process.env.BBB_COLLECT_METRICS === 'true' && process.env.IS_MOBILE !== 'true') {
        await this.waitForSelector(e.anyUser);
        await this.getMetrics(testFolderName);
      }
      if (shouldCloseAudioModal) await this.closeAudioModal();
    } catch (err) {
      await this.logger(err);
    }
  }

How to get started with Browserless

There are different ways to use our product.

  • Sign up for a free account and get an API key. You have 6 hours of usage for free! After that, you can pay as you go, and only pay per second that you use!
  • If you’ve already tested our service and want a dedicated machine for your requests, you might be interested in signing up for a dedicated account. This works best if you’re doing screencasting or have a heavy load of requests since you won’t be sharing resources.

If you’re using one of our hosted services; be that usage-based or capacity-based, just connect to our WebSocket securely with your token to start web automation!

Share this article

Ready to try benefits of Browserless?