Skip to content

Running UITests Locally (Mozillans Only)

CMasterson edited this page May 16, 2023 · 1 revision

We rely on analytics events to ensure UITests are behaving correctly and, therefore, passing. We host a configured instance of Snowplow Micro in a Docker instance, to run UITests you need to:

  1. Install Docker
  2. Register for Snowplow Micro image
  3. Run the Snowplow Micro image
  4. Configure the project for local analytics

Install

You can install Docker using Homebrew: brew install docker Or you may download it from the Docker website

Register

Provide your Docker username to the iOS lead so they can add you to the Pocket Docker Organization.

Run

Execute docker compose up in Terminal from the root Pocket directory to run an instance of Snowplow Micro.

Configure

In your XCode Pocket (iOS) schema, access the Run Arguments. Uncheck the disableSnowplow launch argument. Enable both the SNOWPLOW_POST_PATH and SNOWPLOW_ENDPOINT Environment Variables.

You should now be able to run the UITests.

When you are done, run docker compose down to clean up the Snowplow Micro instance.

Other Snowplow Micro Information

Snowplow micro has 4 endpoints of note:

  1. http://localhost:9090/micro/all - Lists the total number of events received and whether they are bad or good.
  2. http://localhost:9090/micro/good - Returns all the good (passed validation) events snowplow received and the data within.
  3. http://localhost:9090/micro/bad - Returns all the bad (failed validation) events snowplow received and the reason why.
  4. http://localhost:9090/micro/reset - Resets snowplow to 0 events received. Should be ran at the start of each test.

These are very useful for debugging. If you have added new events and wish to check that they are firing correctly you can visit the URLs in Firefox and see the results.

The SnowplowMicro class is used to interact with Snowplow and provide helper assertions to make testing events easier.