Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
rainforestappPublic archive

About

Provides access to information about the currently executed Rainforest QA run test environment.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

rainforest-run-info

A Rainforest QA package that can be used inside a Rainforest run test environment to find out which run and test ID the current test execution belongs to. This can be useful when sending metadata to error tracking software like Sentry.

Installation and usage

To install run

npm install --save @rainforestqa/rainforest-run-info

Then use it in your frontend code like this (please note that fetchRunInfo is an async function):

ES modules

import { fetchRunInfo } from '@rainforestqa/rainforest-run-info';

const setSentryRunInfo = async () => {
  const { error, resultUrlAtCurrentTime, runId, testId } = await fetchRunInfo();

  if (!error) {
      window.Sentry.setTag('rainforest_run_id', runId);
      window.Sentry.setTag('rainforest_test_id', testId);
      window.Sentry.configureScope(scope => {
        scope.addEventProcessor(event => {
          event.tags.rainforest_result_url = resultUrlAtCurrentTime();
          return event;
        });
      })
  }
};

setSentryRunInfo();

Script tag

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Testing with Rainforest QA</title>
    <script src="dist/main.js" ></script>
  </head>
  <body>
    <script type="text/javascript">
        Rainforest.fetchRunInfo().then(({ error, resultUrl, runId, testId }) => {
        if (error) {
          console.error(error);
        } else {
          alert(`Test result URL: ${resultUrl}, Run ID: ${runId}, Test ID: ${testId}`);
        }
      })
    </script>
  </body>
</html>

Development

Run script/bootstrap to install dependencies and script/test to run unit tests.

About

Provides access to information about the currently executed Rainforest QA run test environment.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages