Skip to content

Commit 095a9d1

Browse files
committed
Fix Folder and table test
1 parent 98eab88 commit 095a9d1

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

browser/data-browser/src/components/Dialog/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ const InnerDialog: React.FC<React.PropsWithChildren<InternalDialogProps>> = ({
159159
onMouseDown={handleOutSideClick}
160160
$width={width}
161161
>
162-
<PopoverContainer>
163-
<StyledInnerDialog ref={innerDialogRef}>
162+
<StyledInnerDialog ref={innerDialogRef}>
163+
<PopoverContainer>
164164
<DropdownContainer>
165165
<CloseButtonSlot slot='close'>
166166
<Button icon onClick={cancelDialog} aria-label='close'>
@@ -169,8 +169,8 @@ const InnerDialog: React.FC<React.PropsWithChildren<InternalDialogProps>> = ({
169169
</CloseButtonSlot>
170170
{children}
171171
</DropdownContainer>
172-
</StyledInnerDialog>
173-
</PopoverContainer>
172+
</PopoverContainer>
173+
</StyledInnerDialog>
174174
</StyledDialog>
175175
);
176176
};

browser/data-browser/src/components/SideBar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function SideBar(): JSX.Element {
6161
<SideBarStyled
6262
ref={mountRefs}
6363
size={size}
64-
data-test='sidebar'
64+
data-testid='sidebar'
6565
locked={isWideScreen && sideBarLocked}
6666
exposed={sidebarVisible}
6767
{...listeners}

browser/e2e/tests/e2e.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
openAgentPage,
3535
fillSearchBox,
3636
waitForCommitOnCurrentResource,
37+
clickSidebarItem,
3738
} from './test-utils';
3839

3940
test.describe('data-browser', async () => {
@@ -313,13 +314,15 @@ test.describe('data-browser', async () => {
313314
// Create a new folder
314315
await newResource('folder', page);
315316
// Createa sub-resource in the folder
316-
await page.click('text=Untitled folder');
317-
await page.click('main >> text=New Resource');
317+
await page
318+
.getByRole('main')
319+
.getByRole('button', { name: 'New Resource', exact: true })
320+
.click();
318321
await page.click('button:has-text("Document")');
319322
await page.locator(editableTitle).click();
320323
await page.keyboard.type('RAM Downloading Strategies');
321324
await page.keyboard.press('Enter');
322-
await page.click('[data-test="sidebar"] >> text=Untitled folder');
325+
await clickSidebarItem('Untitled folder', page);
323326
await expect(
324327
page.locator(
325328
'[data-test="folder-list"] >> text=RAM Downloading Strategies',
@@ -415,36 +418,34 @@ test.describe('data-browser', async () => {
415418
// create a resource, make sure its visible in the sidebar (and after refresh)
416419
const klass = 'folder';
417420
await newResource(klass, page);
418-
await expect(
419-
page.locator(`[data-test="sidebar"] >> text=${klass}`),
420-
).toBeVisible();
421+
await expect(page.getByTestId('sidebar').getByText(klass)).toBeVisible();
421422
const d0 = 'depth0';
422423
await setTitle(page, d0);
423424

424425
// Create a subresource, and later check it in the sidebar
425-
await page.locator(`[data-test="sidebar"] >> text=${d0}`).hover();
426+
await page.getByTestId('sidebar').getByText(d0).hover();
426427
await page.locator(`[title="Create new resource under ${d0}"]`).click();
427428
await page.click(`button:has-text("${klass}")`);
428429
const d1 = 'depth1';
429430

430431
await setTitle(page, d1);
431432

432433
await expect(
433-
page.locator(`[data-test="sidebar"] >> text=${d0}`),
434+
page.getByTestId('sidebar').getByText(d0),
434435
"Sidebar doesn't show updated parent resource title",
435436
).toBeVisible();
436437
await expect(
437-
page.locator(`[data-test="sidebar"] >> text=${d1}`),
438+
page.getByTestId('sidebar').getByText(d1),
438439
"Sidebar doesn't show child resource title",
439440
).toBeVisible();
440441
await page.waitForTimeout(500);
441442
await page.reload();
442443
await expect(
443-
page.locator(`[data-test="sidebar"] >> text=${d1}`),
444+
page.getByTestId('sidebar').getByText(d1),
444445
"Sidebar doesn't show parent resource resource title after refresh",
445446
).toBeVisible();
446447
await expect(
447-
page.locator(`[data-test="sidebar"] >> text=${d0}`),
448+
page.getByTestId('sidebar').getByText(d0),
448449
"Sidebar doesn't show child resource title after refresh",
449450
).toBeVisible();
450451
});

browser/e2e/tests/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export async function editTitle(title: string, page: Page) {
304304
}
305305

306306
export async function clickSidebarItem(text: string, page: Page) {
307-
await page.click(`[data-test="sidebar"] >> text="${text}"`);
307+
await page.getByTestId('sidebar').getByText(text).click();
308308
}
309309

310310
export async function fillInput(

0 commit comments

Comments
 (0)