Skip to content

Commit b3ba16f

Browse files
authored
Merge pull request #14404 from guardian/ih/ab-testing-ui-branch
A/B testing report UI
2 parents 6ea6c95 + 4f16e5c commit b3ba16f

19 files changed

+1443
-0
lines changed

.github/workflows/ab-testing-ui.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 🦕 AB testing UI
2+
on:
3+
pull_request:
4+
paths:
5+
- 'ab-testing/**'
6+
7+
jobs:
8+
build-ui:
9+
name: AB testing UI build
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
defaults:
14+
run:
15+
working-directory: ab-testing/frontend
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
# https://github.com/denoland/setup-deno#latest-stable-for-a-major
20+
- uses: denoland/setup-deno@v1
21+
with:
22+
deno-version: v2.3
23+
- name: Install
24+
run: deno install
25+
- name: Build
26+
run: deno run build
27+
- name: Save build
28+
uses: actions/[email protected]
29+
with:
30+
name: ui-build
31+
path: ${{ github.workspace }}/ab-testing/frontend/output/ab-tests.html
32+
if-no-files-found: error
33+
34+
riff-raff:
35+
name: AB testing Riffraff upload
36+
runs-on: ubuntu-latest
37+
permissions:
38+
id-token: write
39+
contents: read
40+
pull-requests: write
41+
42+
steps:
43+
- name: Checkout
44+
uses: actions/[email protected]
45+
with:
46+
fetch-depth: 0
47+
persist-credentials: false
48+
49+
- name: Set up Node
50+
uses: ./.github/actions/setup-node-env
51+
52+
- name: Fetch build
53+
uses: actions/[email protected]
54+
with:
55+
name: ui-build
56+
path: output/ab-tests.html
57+
58+
- name: Riff-Raff Upload
59+
uses: guardian/[email protected]
60+
with:
61+
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
62+
githubToken: ${{ secrets.GITHUB_TOKEN }}
63+
projectName: dotcom:rendering-all
64+
configPath: ab-testing/riff-raff.yaml
65+
contentDirectories: |
66+
frontend-store/commercial:
67+
- output/ab-tests.html

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ yarn-error.log*
1212
# Dependency directories
1313
node_modules
1414
.yarn
15+
.svelte-kit
1516

1617
# IDE files
1718
.idea
@@ -56,3 +57,6 @@ k6-v*arm64
5657
test-results/
5758
playwright-report/
5859
playwright/.cache/
60+
61+
# svelte output
62+
ab-testing/frontend/output

ab-testing/abTest.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import type { ABTest } from './types';
2+
3+
/**
4+
* Tests are defined here. They will be assigned mvt ranges based on the
5+
* size of the test and the number of groups, these ranges may not be contiguous.
6+
*
7+
* For 100% tests to run concurrently with other tests, they should be assigned to different
8+
* test spaces. This means that some users will be in multiple tests at the same time.
9+
*
10+
* Example:
11+
* [Space A]
12+
* - 20% Test control MVT 0-99
13+
* - 20% Test variant MVT 100-199
14+
* - 50% Test control MVT 200-449
15+
* - 50% Test variant MVT 450-699
16+
*
17+
* [Space B]
18+
* - 100% Test control MVT 0-499
19+
* - 100% Test variant MVT 500-999
20+
*/
21+
22+
export const ABTests: ABTest[] = [
23+
// Sample tests that will be used for testing the AB testing framework
24+
{
25+
name: 'commercial-client-side-test',
26+
description:
27+
'Show new ad block ask component in ad slots when we detect ad blocker usage',
28+
owners: ['[email protected]'],
29+
status: 'ON',
30+
expirationDate: '2050-12-30',
31+
type: 'client',
32+
audienceSize: 10 / 100,
33+
groups: ['control', 'variant'],
34+
},
35+
{
36+
name: 'commercial-server-side-test',
37+
description:
38+
'Show new ad block ask component in ad slots when we detect ad blocker usage',
39+
owners: ['[email protected]'],
40+
status: 'ON',
41+
expirationDate: '2050-12-30',
42+
type: 'server',
43+
audienceSize: 10 / 100,
44+
groups: ['control', 'variant'],
45+
},
46+
{
47+
name: 'commercial-large-overlap-test',
48+
description:
49+
'Allows viewing the beta version of the Europe network front',
50+
owners: [
51+
52+
53+
],
54+
status: 'ON',
55+
expirationDate: '2050-12-30',
56+
type: 'server',
57+
audienceSize: 50 / 100,
58+
groups: ['control', 'variant'],
59+
audienceSpace: 'B',
60+
},
61+
];

ab-testing/frontend/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# A/B Testing - reporting UI
2+
3+
This is a simple UI showing the key details of currently active A/B tests and the distribution of those tests within the available test space. The current implementation is a drop-in replacement for the current reporting page in the [Frontend admin tooling](https://github.com/guardian/frontend/tree/main/admin). The UI is built with Svelte and Sveltekit with no additional dependencies aside from Guardian fonts.
4+
5+
## Developing
6+
7+
Install dependencies with `deno install`, then start a development server:
8+
9+
```bash
10+
deno run dev
11+
```
12+
13+
## Building
14+
15+
The project is set up to build the entire Svelte application into a single HTML file. This can be run locally with `deno run build`, with the resulting file put into `/output`.
16+
17+
After a merge, this file will be built and uploaded to the `frontend-store` S3 bucket. It is then accessed securely and served in an iframe in the Frontend admin tool, in place of the old page which relied on A/B test information being present in the switchboard and client-side config in frontend.

0 commit comments

Comments
 (0)