1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Search for element using getByTestId

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-12-02 11:27:28 +03:00
parent a49c947e51
commit 5921098bde
2 changed files with 3 additions and 2 deletions

View File

@ -188,7 +188,7 @@ describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
await frame.click(".MenuItem >> text=Logs"); await frame.click(".MenuItem >> text=Logs");
await frame.waitForSelector(".Dock.isOpen"); await frame.waitForSelector(".Dock.isOpen");
const logLine = await frame.waitForSelector("[data-testid=pod-log-list] [data-index='0']"); const logLine = await frame.getByTestId("log-row-0");
expect(logLine).toHaveStyle({ expect(logLine).toHaveStyle({
"white-space": "nowrap", "white-space": "nowrap",
@ -196,7 +196,7 @@ describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
await frame.click("[data-testid='log-controls'] .wrap-logs"); await frame.click("[data-testid='log-controls'] .wrap-logs");
const wrappedLogLine = await frame.waitForSelector("[data-testid=pod-log-list] [data-index='0']"); const wrappedLogLine = await frame.getByTestId("log-row-0");
expect(wrappedLogLine).toHaveStyle({ expect(wrappedLogLine).toHaveStyle({
"white-space": "normal", "white-space": "normal",

View File

@ -80,6 +80,7 @@ export const LogList = observer(({ model }: LogListProps) => {
<div <div
key={virtualRow.index + uniqRowKey} key={virtualRow.index + uniqRowKey}
data-index={virtualRow.index} data-index={virtualRow.index}
data-testid={`log-row-${virtualRow.index}`}
ref={rowVirtualizer.measureElement} ref={rowVirtualizer.measureElement}
style={{ style={{
transform: `translateY(${virtualRow.start}px)`, transform: `translateY(${virtualRow.start}px)`,