Skip to content

Commit 81d3641

Browse files
Merge branch 'main' into storybook9
2 parents 2f82c8c + 981b21b commit 81d3641

28 files changed

+212
-165
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
/dotcom-rendering/src/lib/braze/ @guardian/value
2828
/dotcom-rendering/webpack/ @guardian/dotcom-platform
2929
/scripts/ @guardian/dotcom-platform
30+
/ab-testing/ @guardian/commercial-dev

ab-testing/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ To add a test where there is not enough space in the default audience space (`A`
6363

6464
For example if there are already 3 25% tests in space `A` totalling 75%, and you want to run a 50% test, you can set the `audienceSpace` to `B` to allow this test to overlap with the existing tests.
6565

66+
### Test Status
67+
68+
Tests can be set to `ON` or `OFF` using the `status` field. Only tests with status `ON` will be validated and deployed.
69+
6670
## How it works
6771

6872
The AB testing framework uses Deno to run scripts that validate and deploy the tests. The `deno.json` file contains the tasks that can be run, such as `validate`, `deploy`, and `build`.

ab-testing/abTest.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ import type { ABTest } from './types';
1919
* - 100% Test variant MVT 500-999
2020
*/
2121

22-
export const ABTests: ABTest[] = [];
22+
const ABTests: ABTest[] = [];
23+
24+
const activeABtests = ABTests.filter((test) => test.status === 'ON');
25+
26+
export { ABTests as allABTests, activeABtests };

ab-testing/frontend/src/routes/+page.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { ABTests } from '../../../abTest';
2+
import { allABTests, activeABtests } from '../../../abTest';
33
import Table from '$lib/components/TableFixed.svelte';
44
import AudienceBreakdown from '$lib/components/AudienceBreakdown.svelte';
55
</script>
@@ -31,8 +31,8 @@
3131
</p>
3232
</section>
3333
<section>
34-
<AudienceBreakdown tests={ABTests} />
35-
<Table tests={ABTests} />
34+
<AudienceBreakdown tests={activeABtests} />
35+
<Table tests={allABTests} />
3636
</section>
3737

3838
<style>

ab-testing/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-ignore - extension is required to import this as a package in DCR
2-
import { ABTests } from './abTest.ts';
1+
import { allABTests, activeABtests } from './abTest';
32

4-
export { ABTests };
3+
export { allABTests, activeABtests };

ab-testing/scripts/build/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ABTests } from '../../abTest.ts';
21
import { getMVTGroupsFromDictionary } from '../lib/fastly-api.ts';
32
import { buildABTestGroupKeyValues } from './build-ab-tests-dict.ts';
43
import { parseArgs } from 'jsr:@std/cli/parse-args';
54
import { calculateAllSpaceUpdates } from './calculate-mvt-updates.ts';
65
import { parseMVTValue, stringifyMVTValue } from '../lib/fastly-subfield.ts';
76
import { dirname } from 'jsr:@std/path';
7+
import { activeABtests } from '../../abTest.ts';
88

99
const flags = parseArgs(Deno.args, {
1010
string: ['mvts', 'ab-tests'],
@@ -26,9 +26,9 @@ const mvtGroups = new Map(
2626
}),
2727
);
2828

29-
const abTestGroupKeyValues = buildABTestGroupKeyValues(ABTests);
29+
const abTestGroupKeyValues = buildABTestGroupKeyValues(activeABtests);
3030

31-
const mvtIdKeyValues = calculateAllSpaceUpdates(mvtGroups, ABTests);
31+
const mvtIdKeyValues = calculateAllSpaceUpdates(mvtGroups, activeABtests);
3232

3333
const mvtDictArray = Array.from(
3434
mvtIdKeyValues.entries().map(([key, value]) => ({

ab-testing/scripts/validation/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ABTests } from '../../abTest.ts';
21
import { ABTest } from '../../types.ts';
2+
import { activeABtests } from '../../abTest.ts';
33
import { enoughSpace } from './enoughSpace.ts';
44
import { limitServerSideTests } from './limitServerSide.ts';
55
import { uniqueName } from './uniqueName.ts';
@@ -19,7 +19,7 @@ function validateTests(testList: ABTest[]) {
1919
}
2020

2121
try {
22-
validateTests(ABTests);
22+
validateTests(activeABtests);
2323
console.log('AB test validations passed');
2424
} catch (err) {
2525
const error = err as Error;

ab-testing/scripts/validation/validExpiration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function allExpirationsValid(tests: ABTest[]): boolean {
1212
throw new Error(
1313
`${
1414
test.name
15-
} has an expiration date in the past: ${expires.toISOString()}, has it expired?`,
15+
} has an expiration date in the past: ${expires.toISOString()}, has it expired? If it doesn't belong to you or your team, you can set the status to OFF for now.`,
1616
);
1717
});
1818
}

dotcom-rendering/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"@guardian/bridget": "8.7.0",
3333
"@guardian/browserslist-config": "6.1.0",
3434
"@guardian/cdk": "62.0.1",
35-
"@guardian/commercial-core": "28.0.0",
35+
"@guardian/commercial-core": "29.0.0",
3636
"@guardian/core-web-vitals": "7.0.0",
3737
"@guardian/eslint-config-typescript": "11.0.0",
3838
"@guardian/identity-auth": "6.0.1",
3939
"@guardian/identity-auth-frontend": "8.1.0",
4040
"@guardian/libs": "26.0.1",
4141
"@guardian/ophan-tracker-js": "2.6.1",
42-
"@guardian/react-crossword": "6.3.0",
42+
"@guardian/react-crossword": "11.1.0",
4343
"@guardian/shimport": "1.0.2",
4444
"@guardian/source": "11.3.0",
4545
"@guardian/source-development-kitchen": "18.1.1",
@@ -54,8 +54,8 @@
5454
"@swc/cli": "0.7.8",
5555
"@swc/core": "1.13.5",
5656
"@swc/jest": "0.2.39",
57-
"@testing-library/dom": "10.4.0",
58-
"@testing-library/jest-dom": "6.6.3",
57+
"@testing-library/dom": "10.4.1",
58+
"@testing-library/jest-dom": "6.9.1",
5959
"@testing-library/react": "16.3.0",
6060
"@testing-library/user-event": "14.6.1",
6161
"@types/body-parser": "1.19.2",

dotcom-rendering/playwright/tests/commercial.e2e.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ test.describe('Commercial E2E tests', () => {
1313
await cmpAcceptAll(page);
1414

1515
const fixedSlots = [
16-
'carrot', // Not used often, likely to be unfilled
1716
'right',
1817
'merchandising-high',
1918
'mostpop',
2019
'merchandising',
2120
];
2221

23-
const totalSlotsExpected = 16; // All slots, even if unfilled ie. `display: none`
22+
const totalSlotsExpected = 15; // All slots, even if unfilled ie. `display: none`
2423
const inlineSlots = totalSlotsExpected - fixedSlots.length;
2524

2625
// We are excluding survey slot as they can be switched off

0 commit comments

Comments
 (0)