Bharath Kashyap
Bharath Kashyap

Reputation: 133

How to load dashboard by default in extent reports

When i open my extent report post run, by default it opens with list of tests that are run. But what i need is, by default it should show Dashboard. Is there any way to do so? Help on this will be appreciated. Thanks

Upvotes: 0

Views: 1728

Answers (2)

S. Molina
S. Molina

Reputation: 1

You can set your preferred order when creating the reporter. It would look something like this: (I'm using version 5 as well)

ExtentSparkReporter htmlReporter = new ExtentSparkReporter(fileName);
List<ViewName> DEFAULT_ORDER = Arrays.asList(ViewName.DASHBOARD, ViewName.CATEGORY, ViewName.TEST);
htmlReporter.viewConfigurer().viewOrder().as(DEFAULT_ORDER);

report = new ExtentReports();
report.attachReporter(htmlReporter);

In this case the Dashboard will be the default page and on the top the left menu, followed by Categories and then the list of tests.

Upvotes: 0

Neagu V
Neagu V

Reputation: 480

You can inject javascript on document load to make the dashboard view visible by default.

<scripts>
        <![CDATA[
            $(document).ready(function() {
                $('#an_unique_identifier_of_dashboard_e.g.[id/name/xpath/css]').click();
            });
        ]]>
    </scripts>

Upvotes: 0

Related Questions