From 323a0b6ec588a320b425c7d482168ad3ac07dca9 Mon Sep 17 00:00:00 2001 From: Jessica Kuelz <15003460+jkuelz@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:51:10 -0700 Subject: [PATCH] chore: Fix tests by updating test selector --- .../runtime-drawers-controllability.test.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app-layout/__integ__/runtime-drawers-controllability.test.ts b/src/app-layout/__integ__/runtime-drawers-controllability.test.ts index 42b6ce4f5a..d0d5535064 100644 --- a/src/app-layout/__integ__/runtime-drawers-controllability.test.ts +++ b/src/app-layout/__integ__/runtime-drawers-controllability.test.ts @@ -7,12 +7,22 @@ import createWrapper from '../../../lib/components/test-utils/selectors'; const wrapper = createWrapper().findAppLayout(); +class AppLayoutDrawerControllabilityPage extends BasePageObject { + // Option 3 to make tests pass + getActiveDrawerText() { + const drawerSelector = wrapper.findActiveDrawer().toSelector(); + return this.browser.execute(drawerSelector => { + return document.querySelector(drawerSelector)!.textContent; + }, drawerSelector); + } +} + describe.each(['classic', 'refresh', 'refresh-toolbar'] as const)('%s', theme => { for (const pageName of ['runtime-drawers', 'runtime-drawers-imperative']) { describe(`page=${pageName}`, () => { - function setupTest(testFn: (page: BasePageObject) => Promise) { + function setupTest(testFn: (page: AppLayoutDrawerControllabilityPage) => Promise) { return useBrowser(async browser => { - const page = new BasePageObject(browser); + const page = new AppLayoutDrawerControllabilityPage(browser); await browser.url( `#/light/app-layout/${pageName}?${new URLSearchParams({ @@ -55,7 +65,7 @@ describe.each(['classic', 'refresh', 'refresh-toolbar'] as const)('%s', theme => ); await page.click(wrapper.findDrawerTriggerById('circle').toSelector()); await expect(page.isDisplayed(wrapper.findToolsClose().toSelector())).resolves.toBeFalsy(); - await expect(page.getText(wrapper.findActiveDrawer().getElement())).resolves.toContain('Nothing to see here'); + await expect(page.getActiveDrawerText()).resolves.toContain('Nothing to see here'); }) );