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

View File

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

View File

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