Skip to content

justeattakeaway/pie-aperture

Repository files navigation

PIE Aperture

PIE Aperture is designed to be a testbed repo for the PIE Web component library. This repo houses test applications currently for NextJS, Nuxt and vanilla JS. These applications import the web components and ensure that they work as expected when installed in a variety of different frameworks.

Aperture deployment links

Nuxt application NextJS application Vanilla application

Automated Testing

We utilise both Playwright and WebDriverIO to facilitate automation testing in PIE Aperture.

WebDriverIO

WebDriverIO is a widely-used testing framework that is used for executing our Percy visual tests. In contrast to the PIE monorepo, these tests aim to verify the visual accuracy of our components across various popular web frameworks.

PIE Aperture leverages Percy Automate, a new feature in Percy that allows for the execution of visual tests across an array of desktop operating systems, browser versions, and mobile devices.

At present, WebDriverIO is the only framework we're familiar with that offers an SDK for this capability. In future, we will look to transition to Playwright when an Automate SDK becomes available.

Tests

All Visual tests can be found in a test/visual folder within the application root directory.

Tests can be run by executing the following command at the root of the monorepo:

# Run all visual tests
yarn test:visual

# Run visual tests for a specific project
# app-name - can be one of the following: nextjs-app, nuxt-app, vanilla-app
yarn test:visual --filter=<app-name>

Devices & Browsers

A list of our tested browsers and devices can be found in the WebDriverIO configuration

Playwright

Playwright is used to facilitate system testing. This ensures that components function as expected when integrated into web applications.

Given that the goal of this repo is to ensure consistent implementation of our components, we follow an approach where a single test can be executed across our test applications. This has a number of key benefits such as reduced duplication of tests and consistent DOM structure of our implemented components.

Tests

All shared tests live within the test/system folder at the root of the monorepo.

Should you need to add a test for a specific application due to implementation differences, these can be added to the test/system folder within the application root directory.

Running Tests Locally

When running test locally, Playwright will automatically execute the yarn dev command to start the server (if not already running). The server process will be killed as part of the test teardown.

Viewing Test Reports

After test execution, if you wish to view a test report (for example on test failure), you can execute the following command from the root of the monorepo:

# app-name - can be one of the following: nextjs-app, nuxt-app, vanilla-app
yarn playwright:show-report --filter=<app-name>
CI

Unlike the local dev server that utilises Server-Side Rendering (SSR), we currently only deploy to AWS via Static-Site Generation (SSG). It's worth noting this may result in different behaviour when executing tests.