New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix browser version in spec reporter #5390
Conversation
``` [chrome windows #0-0] Spec: C:\Git\integration-tests\bolt\integration-tests\checkout\specs\magento2\front\cart\xxx.ts [chrome windows #0-0] Running: chrome on windows [chrome windows #0-0] Session ID: 5afa1aa20220c2e4a26ca039c9149f33 [chrome windows #0-0] [chrome windows #0-0] A [chrome windows #0-0] ✓ A [chrome windows #0-0] [chrome windows #0-0] 1 passing (239ms) ``` After: ``` [chrome 81.0.4044.138 windows #0-0] Spec: C:\Git\integration-tests\bolt\integration-tests\checkout\specs\magento2\front\cart\xxx.ts [chrome 81.0.4044.138 windows #0-0] Running: chrome (v81.0.4044.138) on windows [chrome 81.0.4044.138 windows #0-0] Session ID: b4b86051d1fca73c0c2d3dca6f01f80c [chrome 81.0.4044.138 windows #0-0] [chrome 81.0.4044.138 windows #0-0] A [chrome 81.0.4044.138 windows #0-0] ✓ A [chrome 81.0.4044.138 windows #0-0] [chrome 81.0.4044.138 windows #0-0] 1 passing (242ms) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to change the line to:
const version = capss.browserVersion || caps.version || '(unknown)'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some confusion, let's clear that up right away to prevent this in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a question, if my suspicion is correct then we can simplify it a little further by always taking the OS except when a device is used, in which case it will take the platform or platformName :)
Great and easy fix btw, thanks for the contribution 👍 |
|
||
// Mobile capabilities | ||
if (device) { | ||
const program = (caps.app || '').replace('sauce-storage:', '') || caps.browserName | ||
const executing = program ? `executing ${program}` : '' | ||
|
||
version = caps.platformVersion | ||
platform = caps.platformName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep the definiton of platform and version at one place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough, the comments you added add more value than this!
Co-authored-by: Christian Bromann <github@christian-bromann.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed something in my suggestion. Also can we add a test to check support for BS invalid caps: browser_version
and os
Co-authored-by: Christian Bromann <github@christian-bromann.com>
@christian-bromann updated your platform to: const platform = caps.os ? (caps.os + ' ' + caps.osVersion) : caps.platformName || caps.platform So no undefined in platform anymore
|
@unickq would you mind to add a test where you use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last remark for me
@christian-bromann this test already exists here I think (all the way at the bottom)? EDIT: those tests are actually failing atm since the version seems to be undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing
And like Christian said, for any changed functionality we should add some tests |
Sure I'll try to do this when I get my mac. |
@unickq that's strange, it worked fine last time I tried on my Windows machine using vscode. I have changed the integrated terminal to be git bash but that's about it. then run:
NOTE: make sure you have NodeJS 10 or 12 I'd say |
Thanks for help @erwinheitzman VS integrated powershell didn't work. But external did. Can you please confirm I'm doing right things with the tests? |
Can you please update the tests to use proper capabilities to actually test the change? |
And it looks like we can never reach that branch, because const platform = caps.platformName || caps.platform || (caps.os ? caps.os + ' ' + caps.os_version : '(unknown)') returns (unknown) if nothing else is available. Doesn't it mean lines 417-421 needs to be updated to if (!verbose) {
return (browser + ' ' + (version || '') + ' ' + (platform)).trim()
}
return browser + (version ? ` (v${version})` : '') + (` on ${platform}`) and no additional coverage tests are needed? |
@unickq please work with various capabilities to test different report outputs. Currently we only work with one capability but we could use multiple to ensure that these changes are included in the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not have unknown
in the test snapshot and instead use an actual capability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thank you for your patience with us. I wanted to make sure we get this right.
Before:
After:
Proposed changes
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers