Skip to content
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: add mini browser version for non browser info case #641

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/appium-tizen-tv-driver/lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,18 @@ class TizenTVDriver extends BaseDriver {

/**
* Set chrome version v63.0.3239.0 as the minimal version
* for autodownload to use proper chromedriver version.
* Older than the chromedriver version could raise no Chrome binary found error,
* which no makes sense for TV automation usage.
* for autodownload to use proper chromedriver version if
* - the 'Browser' info does not have proper chrome version, or
* - older than the chromedriver version could raise no Chrome binary found error,
* which no makes sense for TV automation usage.
*
* @param {BrowserVersionInfo} browserVersionInfo
* @return {BrowserVersionInfo}
*/
fixChromeVersionForAutodownload(browserVersionInfo) {
const chromeVersion = VERSION_PATTERN.exec(browserVersionInfo.Browser ?? '');
if (!chromeVersion) {
browserVersionInfo.Browser = MIN_CHROME_VERSION;
return browserVersionInfo;
}

Expand Down Expand Up @@ -542,6 +544,7 @@ class TizenTVDriver extends BaseDriver {
result = await got.get(`http://${debuggerAddress}/json/version`).json();
log.info(`The response of http://${debuggerAddress}/json/version was ${JSON.stringify(result)}`);
result = this.fixChromeVersionForAutodownload(result);
log.info(`Fixed browser info is ${JSON.stringify(result)}`);
// To respect the executableDir.
executable = undefined;
} catch (err) {
Expand Down
19 changes: 19 additions & 0 deletions packages/appium-tizen-tv-driver/test/unit/driver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,25 @@ describe('TizenTVDriver', function () {
);
});

it('Set minimal chrome version with no browser', function () {
const browserInfo = {
'Browser': '',
'Protocol-Version': '1.2',
'User-Agent': 'Mozilla/5.0 (SMART-TV; LINUX; Tizen 4.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 TV Safari/537.36',
'WebKit-Version': '537.36 (@24d4006dbb9188e920764a35a60873d6a0157c12)'
};
expect(
driver.fixChromeVersionForAutodownload(browserInfo),
'to equal',
{
'Browser': 'Chrome/63.0.3239.0',
'Protocol-Version': '1.2',
'User-Agent': 'Mozilla/5.0 (SMART-TV; LINUX; Tizen 4.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 TV Safari/537.36',
'WebKit-Version': '537.36 (@24d4006dbb9188e920764a35a60873d6a0157c12)'
}
);
});

it('Use the given chrome version', function () {
const browserInfo = {
'Browser': 'Chrome/63.0.3239.0',
Expand Down