-
Notifications
You must be signed in to change notification settings - Fork 79
Have displayName appear in test logs #183
Description
Hi!
Context
I'm using BrowserStack both for e2e testing and unit testing. I'd like use a common naming scheme for identifying platforms in the logs of both e2e and unit tests. To achieve this on the karma side, I'm setting the displayName property of elements in customLaunchers in the karma configuration (see this page for reference). I'm logging the test results via karma-json-reporter.
My issue
When I run tests locally, I see the displayName showing up in my logs as the name property of a browser. Below are some config and output snippets as illustration...
// In config
customLaunchers = {
local_local_chrome_local: {
base: 'Chrome',
displayName: 'local_local_chrome_local'
}
}
// In output
{
"browsers": {
"40995879": {
"id": "40995879",
"fullName": "local_local_chrome_local",
"name": "local_local_chrome_local",
When I run tests via the karma-browserstack-launcher, I don't get displayName in my logs. Below another config and output snippet to illustrate what I get instead.
// In config
customLaunchers = {
'android_11.0_Google Pixel 4_android': {
os: 'android',
os_version: '11.0',
browser: 'android',
device: 'Google Pixel 4',
browser_version: null,
real_mobile: true,
displayName: 'android_11.0_Google Pixel 4_android',
base: 'BrowserStack'
}
}
// In output
{
"browsers": {
"7827643": {
"id": "7827643",
"fullName": "Mozilla/5.0 (Linux; Android 11; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36",
"name": "Chrome 83.0.4103.106 (Android 11)",
What I tried so far
I tried adjusting your index.js. I found out that I could obtain the displayName as a property of args in this.start and use it to set the name used for the logs on BrowserStack by adjusting this line. I didn't manage to get it into the JSON logs though.
Help :)
Could you give me some pointers in how to get the displayName in the logs?
Thanks! Thomas