Skip to content

Commit

Permalink
fix: chromedriver version updater (#4269)
Browse files Browse the repository at this point in the history
* Fix chromedriver version get

* Try getting version after tests

* Find where Get chromedriver version works

* Allow any chromedriver version >100

* Disable tests

* Tweak

* Tweak 2

* Try v 101

* Tweask 4

* Try second latest

* Revert version spec change

* Cleanup
  • Loading branch information
BruceHaley authored Jun 25, 2022
1 parent b97a692 commit c9b8818
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions testing/browser-functional/browser-tests-build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,27 @@ steps:
$dist = npm dist-tag ls $packageName;
$next = $dist.Where({$_.StartsWith("latest:")});
[string]$latestVersion = $next.Split(':')[-1].Trim();
Write-Host "$packageName latest = $latestVersion";
$packageName;
$latestVersion;
"##vso[task.setvariable variable=LatestVersion;]$latestVersion";
displayName: 'Get latest chromedriver version number from npmjs.com'
$splitVersion = $latestVersion.Split(".");
$splitVersion[0] = $splitVersion[0] - 1;
$secondLatestVersion = $splitVersion -Join ".";
Write-Host "$packageName second latest = $secondLatestVersion";
"##vso[task.setvariable variable=DriverVersion;]$secondLatestVersion";
displayName: 'Get second latest chromedriver version number from npmjs.com'

- task: PowerShell@2
inputs:
targetType: inline
script: |
# This lets the pipeline automatically keep up with Chrome browser releases.
# New Chrome browser releases happen about every 4 weeks.
# This lets the pipeline automatically keep up with Chrome browser upgrades.
# Chrome browser upgrades on ADO agents lag behind chromedriver upgrades, so
# if we use the second latest chromedriver, that should keep the tests working.
$path = "$(System.DefaultWorkingDirectory)/testing/browser-functional/package.json";
$package = 'chromedriver';
$newVersion = "$(LatestVersion)";
$newVersion = "$(DriverVersion)";
$find = "$package`": `"\S*`"";
$replace = "$package`": `"$newVersion`"";
Expand All @@ -68,7 +73,7 @@ steps:
$content -Replace "$find", "$replace" | Set-Content $_.FullName;
'-------------'; get-content $_.FullName; '==================='
}
displayName: 'Upgrade chromedriver reference to latest version'
displayName: 'Upgrade chromedriver reference to second latest version'

- task: NodeTool@0
displayName: use node 12.x
Expand Down

0 comments on commit c9b8818

Please sign in to comment.