Adjust the tests to not rely on parent-button-clicks

This commit is contained in:
Tessa Kelly 2023-09-01 16:17:34 -06:00
parent 359b26d617
commit fd584d56b2
2 changed files with 6 additions and 14 deletions

View File

@ -84,9 +84,7 @@ view model =
, Container.custom [ Events.onClick ParentClick ]
, Container.css [ Css.maxWidth (Css.px 500) ]
]
, p [ id "parent-button-clicks" ]
[ text ("Parent Clicks: " ++ String.fromInt model.parentClicks)
]
, Text.mediumBody [ Text.plaintext ("Parent Clicks: " ++ String.fromInt model.parentClicks) ]
]

View File

@ -190,15 +190,8 @@ describe("UI tests", function () {
location
) => {
await defaultUsageExampleProcessing(testName, name, location);
await page.waitForSelector("#parent-button-clicks");
const getCounterText = async () => {
const counter = await page.$("#parent-button-clicks");
const text = await page.evaluate((el) => el.innerText, counter);
return text;
};
assert.equal(await getCounterText(), "Parent Clicks: 0");
await page.waitForXPath("//p[contains(., 'Parent Clicks: 0')]", 200 );
await page.waitForSelector("[data-tooltip-visible=false]");
// Opening and closing the tooltip doesn't trigger the container effects
@ -207,18 +200,19 @@ describe("UI tests", function () {
await page.click('[aria-label="Tooltip trigger"]');
await page.waitForSelector("[data-tooltip-visible=false]");
assert.equal(await getCounterText(), "Parent Clicks: 0");
await page.waitForXPath("//p[contains(., 'Parent Clicks: 0')]", 200 );
// Clicking the button does trigger container effects
const [button] = await page.$x("//button[contains(., 'Click me')]");
await button.click();
assert.equal(await getCounterText(), "Parent Clicks: 1");
await page.waitForXPath("//p[contains(., 'Parent Clicks: 1')]", 200 );
// Clicking the container does trigger container effects
const [container] = await page.$x("//div[contains(., 'in the Container!')]");
await container.click();
assert.equal(await getCounterText(), "Parent Clicks: 2");
await page.waitForXPath("//p[contains(., 'Parent Clicks: 2')]", 200 );
};
const skippedRules = {