2

I am trying to categorize by the failed test result in various categories using the categories.json file. I am using following JSON file:

[
    {
      "name": "Ignored tests", 
      "matchedStatuses": ["skipped"]
    },
    {
      "name": "Infrastructure problems",
      "matchedStatuses": ["broken", "failed"],
      "messageRegex": ".*An unknown server-side error occurred.*"
    },
    {
      "name": "Outdated tests",
      "matchedStatuses": ["broken"],
      "traceRegex": ".*FileNotFoundException.*"
    },
    {
      "name": "Test defects",
      "matchedStatuses":[
          "broken",
          "Element is not currently visible and may not be manipulated"
        ],
      "traceRegex":[
          ".*Cannot read property.*",
          ".*is not in DOM or there is no element.*",
          ".*is not a function.*"
        ]
    },
    {
      "name": "Element Not visible",
      "traceRegex":[
          ".*still not visible after.*",
          ".*Element is not currently visible and may not be manipulated.*",
          ".*was not found by text|CSS|XPath.*"
        ]
    },
    {
      "name":"Promise Rejected",
      "traceRegex": [".*Promise was rejected with the following reason.*"]
    }
  ]

and in the allure report and getting only Product Defects.

This is how it looks

I am using allure: 2.8.1 codeceptjs: 1.4.6 appium: 1.8.2

Wasiq Bhamla
  • 909
  • 1
  • 7
  • 11

2 Answers2

0

You have wrong categories.json file format (traceRegex expected to be a string). If you want to have multiply matchers per category, simply use the same name:

[{
  "name": "Element Not visible",
  "traceRegex": ".*still not visible after.*"
}, {
  "name": "Element Not visible",
  "traceRegex": ".*Element is not currently visible and may not be manipulated.*"
}]
Dmitry Baev
  • 2,075
  • 10
  • 22
0

In addition to Dmitry Baev's answer you can always use "|" - Regex Alternation Operator (| or |)

In your case it would look as follows:

{
  "name": "Element Not visible",
  "traceRegex": "(.*still not visible after.*)|(.*Element is not currently visible and may not be manipulated.*)|(.*was not found by text|CSS|XPath.*)"
}

which can be further simplified to:

{
  "name": "Element Not visible",
  "traceRegex": ".*(still not visible after)|(Element is not currently visible and may not be manipulated)|(was not found by text|CSS|XPath).*"
}