Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/e2e/test/allure-awesome/test/testResult.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ test.describe("allure-awesome", () => {
await expect(testResultPage.titleLocator).toHaveText(testTitleText);
});

test("navigation arrows navigate in the expected direction between test results", async () => {
await treePage.clickNthLeaf(0);

const startingPageIndex = 1;
let navCounterText = await testResultPage.navCurrentLocator.textContent();
const navStartingPageNumber = Number(navCounterText?.split("/")[0]);

let isPressBackButtonDisabled = await testResultPage.navPrevLocator.isDisabled();
expect(isPressBackButtonDisabled).toBe(true);

expect(navStartingPageNumber).toEqual(startingPageIndex);
await testResultPage.clickNextTestResult();

navCounterText = await testResultPage.navCurrentLocator.textContent();
const navNextPageNumber = Number(navCounterText?.split("/")[0]);
expect(navNextPageNumber).toEqual(startingPageIndex + 1);

await testResultPage.clickPrevTestResult();

navCounterText = await testResultPage.navCurrentLocator.textContent();
const navPreviousPageNumber = Number(navCounterText?.split("/")[0]);
expect(navPreviousPageNumber).toEqual(startingPageIndex);
});

test("test result fullname copies to clipboard", async ({ browserName, page, context }) => {
test.skip(browserName !== "chromium", "Only chromium supports clipboard API");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export const TrNavigation: FunctionalComponent<TrNavigationProps> = ({ testResul
<IconButton
icon={allureIcons.lineArrowsChevronDown}
style={"ghost"}
isDisabled={currentIndex === data.length}
isDisabled={currentIndex <= 1}
data-testid="test-result-nav-prev"
className={styles["test-result-nav-prev"]}
onClick={() => navigateTo(data[currentIndex])}
onClick={() => navigateTo(data[currentIndex - 2])}
/>
</TooltipWrapper>
<Code
Expand All @@ -66,9 +66,9 @@ export const TrNavigation: FunctionalComponent<TrNavigationProps> = ({ testResul
<IconButton
icon={allureIcons.lineArrowsChevronDown}
style={"ghost"}
isDisabled={currentIndex <= 1}
isDisabled={currentIndex === data.length}
data-testid="test-result-nav-next"
onClick={() => navigateTo(data[currentIndex - 2])}
onClick={() => navigateTo(data[currentIndex])}
/>
</TooltipWrapper>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const TestResultNavigation: FunctionalComponent<TestResultNavigationProps
<IconButton
icon={allureIcons.lineArrowsChevronDown}
style={"ghost"}
isDisabled={currentIndex === data.length}
isDisabled={currentIndex <= 1}
data-testid="test-result-nav-prev"
className={styles["test-result-nav-prev"]}
onClick={() => navigateTo(data[currentIndex])}
onClick={() => navigateTo(data[currentIndex-2])}
/>
</TooltipWrapper>
<Code
Expand All @@ -65,9 +65,9 @@ export const TestResultNavigation: FunctionalComponent<TestResultNavigationProps
<IconButton
icon={allureIcons.lineArrowsChevronDown}
style={"ghost"}
isDisabled={currentIndex <= 1}
isDisabled={currentIndex === data.length}
data-testid="test-result-nav-next"
onClick={() => navigateTo(data[currentIndex - 2])}
onClick={() => navigateTo(data[currentIndex])}
/>
</TooltipWrapper>
</div>
Expand Down