Skip to content

Mrc 6896 tests pt 7 - fix bugs and e2e tests#277

Open
M-Kusumgar wants to merge 3 commits intomrc-6896-new-test-6from
mrc-6896-new-test-7
Open

Mrc 6896 tests pt 7 - fix bugs and e2e tests#277
M-Kusumgar wants to merge 3 commits intomrc-6896-new-test-6from
mrc-6896-new-test-7

Conversation

@M-Kusumgar
Copy link
Copy Markdown
Collaborator

@M-Kusumgar M-Kusumgar commented Apr 20, 2026

This should fix all the e2e tests. There are a couple of random bug fixes so ive left comments in the PR for explanations

ive also added a short plugin test that i forgot to add earlier

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.53%. Comparing base (d1fa27c) to head (88469b2).

Files with missing lines Patch % Lines
app/static/src/components/WodinTabs.vue 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           mrc-6896-new-test-6     #277      +/-   ##
=======================================================
- Coverage                98.70%   98.53%   -0.18%     
=======================================================
  Files                      183      183              
  Lines                     4554     4566      +12     
  Branches                  1010     1018       +8     
=======================================================
+ Hits                      4495     4499       +4     
- Misses                      47       54       +7     
- Partials                    12       13       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +14 to +17
<wodin-tabs id="right-tabs"
:tab="tab"
:tabNames="rightTabNames"
@tabSelected="rightTabSelected">
Copy link
Copy Markdown
Collaborator Author

@M-Kusumgar M-Kusumgar Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will see this change in all the tabs. this is because we need to "control" wodin tab and make it mirror the store state instead of its internal state for the right tabs (where the graphs are).

if we dont sync the internal state of wodin tabs with the store then our store in the graphs state could think the visible graph groups are "Fit" for example (remember visible graph groups are from the open tab) and wodin tabs may think the tab that is selected is "Run" so when the user loads a session then the store generates a graph for the fit tab but the run tab is displayed, meaning its basically a blank graph

Comment on lines +27 to +33
// multi sensitivity tab does not actually care about what variables are selected
// so select them all otherwise wodin will raise no variables selected error
const allSelectedVariables = computed(() =>
multiSensitivity
? store.state.model.variablesCopy
: getAllSelectedVariables(store.state)
);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out multi sens doesnt care what variables are selected which makes sense, it should just give the data for all the variables

Comment on lines +39 to +49
const selectedTabName = ref(props.tab || props.tabNames[0]);

const tabSelected = (tabName: string) => {
selectedTabName.value = tabName;
if (!props.tab) selectedTabName.value = tabName;
emit("tabSelected", tabName);
};

watch(() => [props.tab], ([newTab]) => {
if (newTab) selectedTabName.value = newTab;
});

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if props.tab exists we make it watch the prop and update in sync with it, the best way to do this is to just refactor this component so it always mirrors the store but it is also used for the left tabs ("Options", "Code", "Data") which would require a bit more work and this refactor has gone on for long enough

odinModelCodeError: model.odinModelCodeError,
paletteModel: model.paletteModel
paletteModel: model.paletteModel,
variablesCopy: model.variablesCopy,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipped on serialising this which caused errors, it was very difficult to spot this because our serialisation types for states are declared as new types instead of being derived from the actual state types, i think at some point we should make them all derived from the actual state to avoid bugs like this

persisted: true
});

targetState.graphs.visibleData = {};
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be added back in as an empty obj as graph state doesnt serialise this

const yAxis = page.locator(`g[id^="y-axes"]`);
const firstTick = yAxis.locator(".tick").first();
await expect(await firstTick.textContent()).toBe("100p");
await expect(firstTick).toHaveText("100p");
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graph updates are async with the plugin we wrote to update the data so we need to use playwright's auto retrying assertions like ".toHaveText"


// Check run plot
await page.click(":nth-match(.wodin-right .nav-tabs a, 1)"); // Run tab
await page.waitForTimeout(50);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 3 waits are the only functionality changes i made to this test

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had to scratch an itch that was bothering me for a while with this file (and e2e tests in wodin), most of the playwright tests in wodin are written incorrectly and my linter in my editor goes mental but also i go a bit mental seeing the await spam, await a page locator has no effect and await expect(...).<function>() is only a thing when the <function> is a playwright auto retrying assertion, it will not auto retry if we write await expect(...).toBe(...) for example so i fixed it in this file, i may fix this slowly over future tickets whenever the opportunity arises

Comment on lines -115 to -122
it("renders Sensitivity as expected", async () => {
const wrapper = getWrapper();
const rightTabs = wrapper.find("#right-tabs");

// Change to Sensitivity tab
await rightTabs.findAll("li a").at(1)!.trigger("click");
expect(rightTabs.find("div.mt-4 button").text()).toBe("Run sensitivity");
});
Copy link
Copy Markdown
Collaborator Author

@M-Kusumgar M-Kusumgar Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it no longer changes tabs without changing it in the store so this test would be equivalent to the next test where we test that clicking a tab calls mockSetOpenTab, this is the same for the other tests ive deleted in fitApp.test.ts and stochasticApp.test.ts

@M-Kusumgar M-Kusumgar requested a review from EmmaLRussell April 20, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant