Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
syedsalehinipg committed Jan 22, 2024
1 parent 38ec6b4 commit c4718dd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
33 changes: 17 additions & 16 deletions src/TreeViewList/TreeViewList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ test("should render the tree list", async ({ page }) => {
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByRole("treeitem", { name: "AER" })
.getByRole("treeitem", { name: "BRK" })
).toBeVisible();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByRole("treeitem", { name: "BRK" })
.getByRole("treeitem", { name: "ELE" })
).toBeVisible();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByRole("treeitem", { name: "TRM" })
).toBeVisible();
});

Expand All @@ -28,12 +33,12 @@ test("should display parameter value once expanded", async ({ page }) => {
);
await page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("AER")
.getByText("TRM")
.click();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("ConsiderationPointPosition", { exact: true })
.getByText("Efficiency1D", { exact: true })
).toBeVisible();
});

Expand Down Expand Up @@ -82,18 +87,16 @@ test("should hide tooltip when not hovering over parameter", async ({
);
await page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("AER")
.getByText("TRM")
.click();
await page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("ConsiderationPointPosition", { exact: true })
.getByText("GearSpred")
.hover();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText(
"AER.ConsiderationPointPositionWhen the vehicle is gripped by side wind, the wind starts to take effect only from a certain point on, e.g. if only the bumper is attacked by side wind the driver will usually not recognize the effects. Ahead of this point, the vehicle body does not offer enough contact surface to the wind to take effect."
)
.getByText("TRM.GearSpredEfficieny for")
).toBeVisible();

// Move the mouse to the top left corner of the page to simulate "unhovering"
Expand All @@ -102,9 +105,7 @@ test("should hide tooltip when not hovering over parameter", async ({
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText(
"AER.ConsiderationPointPositionWhen the vehicle is gripped by side wind, the wind starts to take effect only from a certain point on, e.g. if only the bumper is attacked by side wind the driver will usually not recognize the effects. Ahead of this point, the vehicle body does not offer enough contact surface to the wind to take effect."
)
.getByText("TRM.GearSpred Efficieny for")
).toBeHidden();
});

Expand All @@ -117,20 +118,20 @@ test("should hide child when is collapsed", async ({ page }) => {
);
await page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("AER")
.getByText("TRM")
.click();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("ConsiderationPointPosition", { exact: true })
.getByText("GearSpred", { exact: true })
).toBeVisible();
await page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("AER")
.getByText("TRM")
.click();
await expect(
page
.frameLocator('iframe[title="storybook-preview-iframe"]')
.getByText("ConsiderationPointPosition", { exact: true })
.getByText("GearSpred", { exact: true })
).toBeHidden();
});
7 changes: 6 additions & 1 deletion src/TreeViewList/TreeViewList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export const Default = {
{
children: [
{ name: "Efficiency1D", options: [] },
{ name: "GearSpred", options: [] }
{
name: "GearSpred",
options: [],
tooltip:
"Efficieny for all gear numbers. If the number of efficiencies are less than the number of gears, the last entry in the table will be applied to all remaining gears."
}
],
name: "TRM"
}
Expand Down

0 comments on commit c4718dd

Please sign in to comment.