Skip to content

Commit 8383c61

Browse files
committed
Update test randomness and screenshots
1 parent 26363ca commit 8383c61

12 files changed

+25
-22
lines changed

tests/e2e/NewOrgModal.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test.describe("without being signed in", () => {
1414
test("can *NOT* see the 'New Org' button", async ({ page, isMobile }) => {
1515
const response = await page.goto("http://localhost:1234");
1616
expect(response?.status()).toBeLessThan(400);
17-
await expect(page).toHaveScreenshot("no-new-org-button.png");
17+
await expect(page).toHaveScreenshot("no-new-org-button.png", { maxDiffPixels: 100 });
1818

1919
if (isMobile) {
2020
await expect(
@@ -36,7 +36,7 @@ test.describe("while being signed in", () => {
3636
test("can see the 'New Org' button", async ({ page, isMobile }) => {
3737
const response = await page.goto("http://localhost:1234");
3838
expect(response?.status()).toBeLessThan(400);
39-
await expect(page).toHaveScreenshot("new-org-button.png");
39+
await expect(page).toHaveScreenshot("new-org-button.png", { maxDiffPixels: 100 });
4040

4141
if (isMobile) {
4242
await expect(
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

tests/e2e/TestHelpers/Data.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { faker } from "@faker-js/faker";
22

3+
// Ensures test data is the same between runs (especially useful for screenshot comparisons)
4+
faker.seed(42);
5+
36
function account(handle: string) {
47
return {
58
...user(),
@@ -21,7 +24,7 @@ function user(handle?: string) {
2124
const handle_ = handle ? handle : userHandle();
2225

2326
return {
24-
avatarUrl: faker.image.avatar(),
27+
avatarUrl: faker.image.personPortrait(),
2528
handle: handle_.replace("@", ""),
2629
name: `${firstName} ${lastName}`,
2730
userId: faker.string.uuid(),
@@ -207,28 +210,28 @@ type DiffErrorCulprit = "new" | "old";
207210
type DiffErrorDetails =
208211
| { tag: "impossibleError" }
209212
| {
210-
tag: "constructorAlias";
211-
oldOrNewBranch: DiffErrorCulprit;
212-
typeName: string;
213-
constructorName1: string;
214-
constructorName2: string;
215-
}
213+
tag: "constructorAlias";
214+
oldOrNewBranch: DiffErrorCulprit;
215+
typeName: string;
216+
constructorName1: string;
217+
constructorName2: string;
218+
}
216219
| {
217-
tag: "missingConstructorName";
218-
oldOrNewBranch: DiffErrorCulprit;
219-
typeName: string;
220-
}
220+
tag: "missingConstructorName";
221+
oldOrNewBranch: DiffErrorCulprit;
222+
typeName: string;
223+
}
221224
| {
222-
tag: "nestedDeclAlias";
223-
oldOrNewBranch: DiffErrorCulprit;
224-
constructorName1: string;
225-
constructorName2: string;
226-
}
225+
tag: "nestedDeclAlias";
226+
oldOrNewBranch: DiffErrorCulprit;
227+
constructorName1: string;
228+
constructorName2: string;
229+
}
227230
| {
228-
tag: "strayConstructor";
229-
oldOrNewBranch: DiffErrorCulprit;
230-
constructorName: string;
231-
};
231+
tag: "strayConstructor";
232+
oldOrNewBranch: DiffErrorCulprit;
233+
constructorName: string;
234+
};
232235

233236
type ContributionDiffConfig =
234237
| { tag: "ok" }

0 commit comments

Comments
 (0)