Skip to content

The test result is not displayed in allure-report if statusDetails.message or statusDetails.trace contains html-tags #3043

@sharovd

Description

@sharovd

Describe the Bug

While investigating a defect in allure-python project allure-framework/allure-python#867, I found that the issue described can also be reproduced in allure-java.
In my opinion, this problem should be fixed in the report generator rather than in adapter projects such as allure-python or allure-java.

Steps to Reproduce

  1. Create a Maven project with the following dependencies and build configuration
<dependencies>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-junit5</artifactId>
        <version>2.29.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.microsoft.playwright</groupId>
        <artifactId>playwright</artifactId>
        <version>1.53.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.10.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.3</version>
          <configuration>
              <systemPropertyVariables>
                  <allure.results.directory>allure-results</allure.results.directory>
              </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.15.2</version>
        </plugin>
    </plugins>
</build>
  1. Add a test that reproduces the original issue
@Test
void testAllure() {
    try (Playwright playwright = Playwright.create()) {
        Browser browser = playwright.chromium().launch();
        Page page = browser.newPage();
        page.navigate("https://github.com");
        assertThat(page.locator("h1#hero-section-brand-heading")).isEditable();
    }
}
  1. Run the test using the command
$ mvn clean test
  1. Generate the Allure report
$ allure serve allure-results
  1. Open the test result in the Allure report to view detailed information
  2. The test result is not displayed (1); the browser console shows an error (2)
    Image

Expected Behaviour

The test result should be displayed correctly in the Allure report

Screenshots or Additional Context

Additional information that may help resolve the Issue:

  1. When generating the report in dev mode via ./gradlew dev, the error looks like this:
ERROR
An "el" must exist in DOM for this region mnr199
    at constructor._ensureElement (http://localhost:3000/app.js:11810:15)
    at constructor.show (http://localhost:3000/app.js:11715:15)
    at TestResultOverviewView.showChildView (http://localhost:3000/app.js:12270:24)
    at TestResultOverviewView.onRender (http://localhost:3000/app.js:4036:12)
    at TestResultOverviewView.triggerMethod (http://localhost:3000/app.js:10375:21)
    at TestResultOverviewView.triggerMethod$$1 [as triggerMethod] (http://localhost:3000/app.js:11579:29)
    at TestResultOverviewView.render (http://localhost:3000/app.js:12420:10)
    at executeBound (http://localhost:3000/app.js:66822:65)
    at TestResultOverviewView.<anonymous> (http://localhost:3000/app.js:67465:72)
    at TestResultOverviewView.render (http://localhost:3000/app.js:70799:27)
  1. The original content from the -result.json file that reproduces the issue:
"statusDetails": {
    "known": false,
    "muted": false,
    "flaky": false,
    "message": "<input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n  name='Error\n  stack='Error: Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n    at CRExecutionContext.evaluateWithArguments (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/chromium/crExecutionContext.js:80:13)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n    at async evaluateExpression (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/javascript.js:217:12)\n    at async Frame._expectInternal (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1225:57)\n    at async /private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1182:18\n    at async ProgressController.run (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/progress.js:80:22)\n    at async Frame._expectImpl (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1181:31)\n    at async Frame.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1165:20)\n    at async FrameDispatcher.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/dispatchers/frameDispatcher.js:212:20)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n}\nCall log:\n-   - Assert \"isEditable\" with timeout 5000ms\n-   - waiting for locator(\"h1#hero-section-brand-heading\")\n",
    "trace": "com.microsoft.playwright.PlaywrightException: Error {\n  message='Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n  name='Error\n  stack='Error: Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n    at CRExecutionContext.evaluateWithArguments (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/chromium/crExecutionContext.js:80:13)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n    at async evaluateExpression (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/javascript.js:217:12)\n    at async Frame._expectInternal (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1225:57)\n    at async /private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1182:18\n    at async ProgressController.run (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/progress.js:80:22)\n    at async Frame._expectImpl (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1181:31)\n    at async Frame.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1165:20)\n    at async FrameDispatcher.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/dispatchers/frameDispatcher.js:212:20)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n}\nCall log:\n-   - Assert \"isEditable\" with timeout 5000ms\n-   - waiting for locator(\"h1#hero-section-brand-heading\")\n\n\tat com.microsoft.playwright.impl.WaitableResult.get(WaitableResult.java:56)\n\tat com.microsoft.playwright.impl.ChannelOwner.runUntil(ChannelOwner.java:138)\n\tat com.microsoft.playwright.impl.Connection.sendMessage(Connection.java:131)\n\tat com.microsoft.playwright.impl.ChannelOwner.sendMessage(ChannelOwner.java:124)\n\tat com.microsoft.playwright.impl.LocatorImpl.expectImpl(LocatorImpl.java:662)\n\tat com.microsoft.playwright.impl.LocatorImpl.lambda$expect$8(LocatorImpl.java:648)\n\tat com.microsoft.playwright.impl.ChannelOwner.withTitle(ChannelOwner.java:98)\n\tat com.microsoft.playwright.impl.LocatorImpl.expect(LocatorImpl.java:648)\n\tat com.microsoft.playwright.impl.AssertionsBase.expectImpl(AssertionsBase.java:61)\n\tat com.microsoft.playwright.impl.AssertionsBase.expectImpl(AssertionsBase.java:50)\n\tat com.microsoft.playwright.impl.LocatorAssertionsImpl.expectTrue(LocatorAssertionsImpl.java:463)\n\tat com.microsoft.playwright.impl.LocatorAssertionsImpl.isEditable(LocatorAssertionsImpl.java:418)\n\tat com.microsoft.playwright.assertions.LocatorAssertions.isEditable(LocatorAssertions.java:670)\n\tat AllurePlaywrightTest.testAllure(AllurePlaywrightTest.java:17)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:565)\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1604)\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1604)\nCaused by: com.microsoft.playwright.impl.DriverException: Error {\n  message='Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n  name='Error\n  stack='Error: Error: Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]\n    at CRExecutionContext.evaluateWithArguments (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/chromium/crExecutionContext.js:80:13)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n    at async evaluateExpression (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/javascript.js:217:12)\n    at async Frame._expectInternal (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1225:57)\n    at async /private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1182:18\n    at async ProgressController.run (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/progress.js:80:22)\n    at async Frame._expectImpl (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1181:31)\n    at async Frame.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/frames.js:1165:20)\n    at async FrameDispatcher.expect (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/server/dispatchers/frameDispatcher.js:212:20)\n    at async LongStandingScope._race (/private/var/folders/12/37hthb0x7k77zjlh1x6x4j880000gp/T/playwright-java-8288164331955664814/package/lib/utils/isomorphic/manualPromise.js:94:14)\n}\nCall log:\n-   - Assert \"isEditable\" with timeout 5000ms\n-   - waiting for locator(\"h1#hero-section-brand-heading\")\n\n\tat com.microsoft.playwright.impl.Connection.dispatch(Connection.java:262)\n\tat com.microsoft.playwright.impl.Connection.processOneMessage(Connection.java:214)\n\tat com.microsoft.playwright.impl.ChannelOwner.runUntil(ChannelOwner.java:136)\n\t... 15 more\n"
  }
  1. The minimal -result.json content that still reproduces the issue:
"statusDetails": {
    "known": false,
    "muted": false,
    "flaky": false,
    "message": "<input>, <textarea>, <select>",
    "trace": "<input>, <textarea>, <select>"
  },
  1. Possible solution (replace <> to &lt;&gt;)
"statusDetails": {
    "known": false,
    "muted": false,
    "flaky": false,
    "message": "&lt;input&gt;, &lt;textarea&gt;, &lt;select&gt;",
    "trace": "&lt;input&gt;, &lt;textarea&gt;, &lt;select&gt;"
  },

What Language are you using?

Java

What Framework/Allure Integration you are using?

allure-junit5

What version of Allure Integration you are using?

2.29.1

What version of Allure Report you are using?

2.34.1

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions