Skip to content

Commit fb8e2b3

Browse files
committed
wip
1 parent f0ece41 commit fb8e2b3

2 files changed

Lines changed: 53 additions & 21 deletions

File tree

frontend/tests/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,15 @@ Stories live in `tests/e2e/stories/`. To create a new story using Playwright Cod
7272
```bash
7373
npm run test:e2e:codegen --prefix ./frontend
7474
```
75-
If you are in GitHub codespace you can view the application on port XXX.
76-
75+
If you are in GitHub codespace you can view the application on port 6080.
7776
Captured actions are stored to `tests/e2e/stories/_recorded.gen.ts`
7877
5. Copy `tests/e2e/stories/_story.template.ts` to `<yourStory>.test.ts` and port the captured
7978
selectors/actions into it, wrapping interactions in `smoothClick`/`smoothFill` and adding
80-
`narrate(...)` lines. `codegen` emits plain Playwright calls, so this adaptation is manual.
81-
6. Verify with `npm run test:e2e:record`
82-
83-
## TODO: Do we need to run sudo iptables-legacy -P FORWARD ACCEPT ?
84-
79+
`narrate(...)` lines.
80+
6. Verify with
81+
```bash
82+
npm run test:e2e:record --prefix ./frontend
83+
```
8584

8685
## Component tests
8786

frontend/tests/e2e/stories/grid3d.test.ts

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ import {
2020
dragModuleOntoLayout,
2121
hideDevOverlays,
2222
installFakeCursor,
23+
pace,
2324
smoothClick,
25+
smoothFill,
2426
} from "../support/walkthroughHelpers";
27+
import { DROGON_AHM } from "../support/drogonTestData";
2528

2629
test.describe("My module", () => {
2730
test("does the thing", async ({ page, narrate }) => {
@@ -35,34 +38,64 @@ test.describe("My module", () => {
3538
await expect(page.getByText("FMU Analysis").first()).toBeVisible();
3639

3740
await narrate("Describe what this walkthrough will show.");
38-
39-
40-
await page.goto('/');
41+
const newSessionNarration = narrate("Let's start by creating a new session...")
4142
await smoothClick(page, page.getByRole("button", { name: "New session" }));
43+
await newSessionNarration;
44+
45+
const ensembleNarration = narrate(
46+
"...and then add an ensemble. We pick the Drogon asset and find the case we want.",
47+
);
48+
await expect(page.getByText("Ensembles used in this session")).toBeVisible({ timeout: 60_000 });
49+
await smoothClick(page, page.getByTestId("add-regular-ensemble-button"));
50+
await pace(page);
51+
52+
await smoothClick(page, page.getByRole("combobox", { name: "Asset" }));
53+
await smoothClick(page, page.getByRole("option", { name: DROGON_AHM.assetName }));
54+
await pace(page);
55+
56+
// Filter the case table by the test case UUID.
57+
await smoothFill(page, page.getByPlaceholder("Filter ...").first(), DROGON_AHM.caseUuid);
58+
await expect(page.getByText(DROGON_AHM.caseUuid)).toBeVisible({ timeout: 60_000 });
59+
await pace(page);
4260

43-
await smoothClick(page, page.getByRole('button', { name: 'New session' }));
44-
await smoothClick(page, page.getByTestId('add-regular-ensemble-button'));
45-
await smoothClick(page, page.locator('[id="base-ui-:rbn:"]'));
46-
await page.locator('[id="base-ui-:rbn:"]').fill('My description');
47-
await smoothClick(page, page.getByText('My description').first());
48-
await smoothClick(page, page.getByText('iter-0 (100 realizations)'));
49-
await smoothClick(page, page.getByRole('button', { name: 'Apply' }));
50-
await smoothClick(page, page.getByRole('button', { name: 'Apply' }));
61+
await smoothClick(
62+
page,
63+
page
64+
.locator("tbody")
65+
.getByRole("row", { name: new RegExp(DROGON_AHM.caseUuid) })
66+
.first(),
67+
);
68+
69+
await expect(page.getByText(DROGON_AHM.ensembleName).first()).toBeVisible({ timeout: 60_000 });
70+
await ensembleNarration;
71+
await pace(page);
72+
73+
const applyNarration = narrate("We select the ensemble and apply it to load it into the session.");
74+
await smoothClick(page, page.getByText(DROGON_AHM.ensembleName).first());
75+
76+
await smoothClick(page, page.getByRole("button", { name: "Apply" }).last());
77+
await pace(page);
78+
79+
await smoothClick(page, page.getByRole("button", { name: "Apply" }));
80+
await expect(page.getByText("Ensembles used in this session")).not.toBeVisible({ timeout: 120_000 });
81+
await applyNarration;
5182

5283
const dragNarration = narrate(
5384
"Now we drag the 3D Viewer module from the list onto the dashboard and wait for the relevant data and settings to load.",
5485
);
5586
await dragModuleOntoLayout(page, "3D Viewer");
5687
await dragNarration;
5788

58-
await smoothClick(page, page.getByText('3D Viewer'));
59-
await smoothClick(page, page.getByTestId('module-layout').getByTestId('WebAssetIcon'));
6089
await expect(page.getByRole('button', { name: 'Add first view' })).toBeVisible();
6190
await smoothClick(page, page.getByRole('button', { name: 'Add first view' }));
6291
await smoothClick(page, page.getByRole('button', { name: 'Add' }).nth(1));
6392
await smoothClick(page, page.getByRole('menuitem', { name: 'Layers' }));
64-
await smoothClick(page, page.getByRole('menuitem', { name: 'Grid Model' }));
93+
await smoothClick(page, page.getByRole('menuitem', { name: 'Grid Model', exact: true }));
6594
await smoothClick(page, page.getByRole('menuitem', { name: 'Grid Model 3D' }));
6695

96+
await expect(page.getByTestId('module-layout')).toContainText('Loading 0%Loading assets...');
97+
await expect(page.getByTestId('module-layout')).not.toContainText('Loading 0%Loading assets...');
98+
99+
await narrate("And there we see our 3D model grid");
67100
});
68101
});

0 commit comments

Comments
 (0)