Improve Locators for new create HTTP test (#5406)

This commit is contained in:
kreosus 2022-11-14 03:10:19 -06:00 committed by GitHub
parent 7eb3725781
commit e5af9ba6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -84,8 +84,8 @@ test.describe('Debug-Sidebar', async () => {
});
test('Create a new HTTP request', async ({ page }) => {
await page.locator('div:nth-child(3) > .btn').click();
await page.locator('button:has-text("HTTP RequestCtrl + N")').first().click();
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('[data-testid="CreateHttpRequest"]').first().click();
await expect(page.locator('.app')).toContainText('New Request');
});
});

View File

@ -34,15 +34,15 @@ export const SidebarCreateDropdown: FC<Props> = ({ right }) => {
createRequestGroup(activeWorkspaceId);
}, [activeWorkspaceId]);
const dataTestId = 'SidebarCreateDropdown';
return (
<Dropdown right={right}>
<Dropdown right={right} dataTestId={dataTestId}>
<DropdownButton className="btn btn--compact">
<i className="fa fa-plus-circle" />
<i className="fa fa-caret-down" />
</DropdownButton>
<DropdownItem onClick={() => create('HTTP')}>
<DropdownItem dataTestId='CreateHttpRequest' onClick={() => create('HTTP')}>
<i className="fa fa-plus-circle" />HTTP Request
<DropdownHint keyBindings={hotKeyRegistry.request_createHTTP} />
</DropdownItem>

View File

@ -67,9 +67,9 @@ export const SidebarFilter: FC<Props> = ({ filter }) => {
await db.flushChanges(flushId);
}
};
const dataTestId = 'SidebarFilter';
return (
<div className="sidebar__filter">
<div className="sidebar__filter" data-testid={dataTestId}>
<div className="form-control form-control--outlined form-control--btn-right">
<input
ref={inputRef}