Skip to content

Commit

Permalink
chore: Fix tests by updating test selector
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuelz authored and just-boris committed Nov 1, 2024
1 parent a25e406 commit 323a0b6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/app-layout/__integ__/runtime-drawers-controllability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>) {
function setupTest(testFn: (page: AppLayoutDrawerControllabilityPage) => Promise<void>) {
return useBrowser(async browser => {
const page = new BasePageObject(browser);
const page = new AppLayoutDrawerControllabilityPage(browser);

await browser.url(
`#/light/app-layout/${pageName}?${new URLSearchParams({
Expand Down Expand Up @@ -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');
})
);

Expand Down

0 comments on commit 323a0b6

Please sign in to comment.