Skip to main content

externalTestRunsView <NET>

Interaction object representing the Test Runs view in the HTML report.

Shows historical test runs with a stacked bar trend chart, a run list, and a details panel that appears when a run is selected. The details panel shows run metadata, commit information, and a module table with outcome counts.

Instantiation

import { TestRunsView, Navigation } from '@serenity-js/html-reporter/serenity';
import { By, PageElement } from '@serenity-js/web';

const testRunsView = new TestRunsView(
PageElement.located(By.css('[data-testid="test-runs"]')).describedAs('test runs view'),
new Navigation(),
);

Usage in an integration test

await actor.attemptsTo(
testRunsView.open(),
Ensure.that(testRunsView.runCount(), isGreaterThan(0)),
Ensure.that(testRunsView.hasTrendChart(), equals(true)),
testRunsView.selectRun(0),
Ensure.that(testRunsView.detailsPanel, isPresent()),
Ensure.that(testRunsView.moduleNames(), contain('playwright-web')),
);

Hierarchy

Index

Constructors

externalconstructor

Properties

externalreadonlydetailsPanel

detailsPanel: InteractionObject<unknown> = ...

The run details panel, which appears when a run is selected via the chart or the run list.

Example

await actor.attemptsTo(
testRunsView.selectRun(0),
Ensure.that(testRunsView.detailsPanel, isPresent()),
);

externalreadonlymoduleTable

moduleTable: InteractionObject<unknown> = ...

The table of modules in the run details panel, shown for runs with multiple modules.

Example

await actor.attemptsTo(
testRunsView.clickChartBar(0),
Ensure.that(testRunsView.moduleTable, isPresent()),
);

Methods

externalisPresent

  • Checks whether the interaction object's root element is present in the DOM.

    Since InteractionObject implements Optional, you can assert on presence directly:

    Ensure.that(view, isPresent())

    Returns Answerable<boolean>

externalbodyText

  • The full body text of the test runs view container.

    Example

    Ensure.that(testRunsView.bodyText(), includes('Test Runs'))

    Returns QuestionAdapter<string>

externalrunCount

  • The number of test run rows currently displayed in the list.

    Example

    Ensure.that(testRunsView.runCount(), equals(5))

    Returns Question<Promise<number>>

externalhasTrendChart

  • hasTrendChart(): Question<Promise<boolean>>
  • Whether the trend chart canvas element is present.

    Example

    Ensure.that(testRunsView.hasTrendChart(), equals(true))

    Returns Question<Promise<boolean>>

externalhasDetailsPanel

  • hasDetailsPanel(): Question<Promise<boolean>>
  • Whether the run details panel is currently visible.

    The panel appears when a run is selected via the chart or the run list.

    Example

    await actor.attemptsTo(
    testRunsView.selectRun(0),
    Ensure.that(testRunsView.hasDetailsPanel(), equals(true)),
    );
    @deprecated

    Use TestRunsView.detailsPanel with the isPresent() expectation instead.

    Migration

    // Before
    Ensure.that(testRunsView.hasDetailsPanel(), equals(true))
    // After
    Ensure.that(testRunsView.detailsPanel, isPresent())

    Returns Question<Promise<boolean>>

externaldetailsPanelTitle

  • The title text of the run details panel (typically the run timestamp).

    Example

    Ensure.that(testRunsView.detailsPanelTitle(), includes('2024-'))

    Returns QuestionAdapter<string>

externaldetailsPanelText

  • The full text content of the run details panel.

    Example

    Ensure.that(testRunsView.detailsPanelText(), includes('modules'))

    Returns QuestionAdapter<string>

externaldetailsCtaText

  • The text of the call-to-action button in the run details panel.

    Example

    Ensure.that(testRunsView.detailsCtaText(), equals('View Test Run'))

    Returns QuestionAdapter<string>

externalcommitLinkText

  • The displayed commit link text (typically a short SHA).

    Example

    Ensure.that(testRunsView.commitLinkText(), equals('abc1234'))

    Returns QuestionAdapter<string>

externalcommitLinkHref

  • The href attribute of the commit link.

    Example

    Ensure.that(testRunsView.commitLinkHref(), includes('/commit/abc1234'))

    Returns QuestionAdapter<string>

externalhasModuleTable

  • hasModuleTable(): Question<Promise<boolean>>
  • Whether the module table is present in the run details panel.

    Example

    Ensure.that(testRunsView.hasModuleTable(), equals(true))
    @deprecated

    Use TestRunsView.moduleTable with the isPresent() expectation instead.

    Migration

    // Before
    Ensure.that(testRunsView.hasModuleTable(), equals(true))
    // After
    Ensure.that(testRunsView.moduleTable, isPresent())

    Returns Question<Promise<boolean>>

externalmoduleNames

  • moduleNames(): Question<Promise<string[]>>
  • The module names displayed in the details panel's module table.

    Example

    Ensure.that(testRunsView.moduleNames(), contain('playwright-web'))

    Returns Question<Promise<string[]>>

externalselectedRunId

  • The ID of the run shown in the run details panel, i.e. the run selected via the chart or the run list.

    Use it to verify that the views you navigate to from the details panel show the selected run.

    Example

    await actor.attemptsTo(
    testRunsView.clickChartBar(0),
    notes().set('selectedRun', testRunsView.selectedRunId()),
    testRunsView.clickModuleName('playwright-web'),
    Ensure.that(Page.current().url().hash, includes(notes().get('selectedRun'))),
    );

    Returns QuestionAdapter<string>

externalcurrentRunId

  • currentRunId(): Question<Promise<string>>
  • Returns the current run ID from the URL's hash parameters. Returns undefined if no run parameter is found.


    Returns Question<Promise<string>>

externalclickChart

  • Clicks the last bar in the trend chart canvas.

    Uses coordinate calculation to click the rightmost bar based on the number of runs.

    Example

    await actor.attemptsTo(
    testRunsView.clickChart(),
    Ensure.that(testRunsView.hasDetailsPanel(), equals(true)),
    );

    Returns Task

externalclickChartBar

  • clickChartBar(barIndex: number): Task
  • Clicks a specific bar in the trend chart canvas by its zero-based index.

    Example

    await actor.attemptsTo(
    testRunsView.clickChartBar(2),
    Ensure.that(testRunsView.hasDetailsPanel(), equals(true)),
    );

    Parameters

    • externalbarIndex: number

      Zero-based index of the chart bar to click

    Returns Task

externalselectRun

  • selectRun(index: number): Task
  • Selects a test run by clicking its row at the given zero-based index.

    Example

    await actor.attemptsTo(
    testRunsView.selectRun(0),
    Ensure.that(testRunsView.hasDetailsPanel(), equals(true)),
    );

    Parameters

    • externalindex: number

      Zero-based index of the run row to click

    Returns Task

externalclickDetailsCtaButton

  • clickDetailsCtaButton(): Task
  • Clicks the call-to-action button in the run details panel (e.g. "View Test Run").

    Example

    await actor.attemptsTo(
    testRunsView.selectRun(0),
    testRunsView.clickDetailsCtaButton(),
    );

    Returns Task

externaldismissDetailsPanel

  • dismissDetailsPanel(): Task
  • Dismisses the run details panel by pressing Escape.

    Example

    await actor.attemptsTo(
    testRunsView.dismissDetailsPanel(),
    Ensure.that(testRunsView.hasDetailsPanel(), equals(false)),
    );

    Returns Task

externalclickModuleName

  • clickModuleName(moduleName: string): Task
  • Clicks a module name link in the details panel's module table.

    Example

    await actor.attemptsTo(
    testRunsView.clickModuleName('playwright-web'),
    );

    Parameters

    • externalmoduleName: string

      Substring to match against module name links

    Returns Task

externalclickModulePassedCount

  • clickModulePassedCount(moduleName: string): Task
  • Clicks the "Passed" outcome count for a module in the details panel table.

    Example

    await actor.attemptsTo(
    testRunsView.clickModulePassedCount('playwright-web'),
    );

    Parameters

    • externalmoduleName: string

      Module name to locate the row

    Returns Task

externalclickModuleFailedCount

  • clickModuleFailedCount(moduleName: string): Task
  • Clicks the "Failed" outcome count for a module in the details panel table.

    Example

    await actor.attemptsTo(
    testRunsView.clickModuleFailedCount('playwright-web'),
    );

    Parameters

    • externalmoduleName: string

      Module name to locate the row

    Returns Task

externalclickModuleSkippedCount

  • clickModuleSkippedCount(moduleName: string): Task
  • Clicks the "Skipped" outcome count for a module in the details panel table.

    Example

    await actor.attemptsTo(
    testRunsView.clickModuleSkippedCount('playwright-web'),
    );

    Parameters

    • externalmoduleName: string

      Module name to locate the row

    Returns Task

externalmoduleUrl

  • Builds URL for viewing a module's scenarios with optional outcome filter.

    Accepts Answerable parameters so Questions can be passed directly without actor.answer().


    Parameters

    • externalmoduleName: Answerable<string>

      Module identifier (e.g., 'playwright-web')

    • externalrunId: Answerable<string>

      Test run ID (can be a Question)

    • externaloptionalfilter: Answerable<OutcomeFilter>

      Optional outcome filter ('passed', 'failed', 'skipped')

    Returns QuestionAdapter<string>

    URL path with hash and query parameters

    Example

    // With static values
    view.moduleUrl('playwright-web', '42')
    // → '#/tests?run=42&search=%40module%3Aplaywright-web'

    // With outcome filter
    view.moduleUrl('playwright-web', '42', 'failed')
    // → '#/tests?run=42&search=%40module%3Aplaywright-web&filter=failed'

    // With Question (idiomatic Screenplay)
    view.moduleUrl('playwright-web', view.currentRunId(), 'passed')
    // Actor resolves currentRunId() automatically

externalopen

  • Navigates to the Test Runs view via the sidebar navigation.

    Example

    await actor.attemptsTo(
    testRunsView.open(),
    Ensure.that(testRunsView.runCount(), isGreaterThan(0)),
    );

    Returns Task