Skip to content

Commit

Permalink
Update chromium
Browse files Browse the repository at this point in the history
Check if chrome update fixes windows testing issue

Refer
#2732 (comment)

Signed-off-by: Zabil Cheriya Maliackal <[email protected]>
  • Loading branch information
zabil committed Jul 16, 2024
1 parent 9be5f8d commit 358f33a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,29 @@
},
"taiko": {
"browser": {
"version": "126.0.6468.0",
"revision": "1298436",
"version": "128.0.6597.0",
"revision": "1327306",
"downloads": {
"chrome": [
{
"platform": "linux64",
"url": "https://storage.googleapis.com/chrome-for-testing-public/126.0.6468.0/linux64/chrome-linux64.zip"
"url": "https://storage.googleapis.com/chrome-for-testing-public/128.0.6597.0/linux64/chrome-linux64.zip"
},
{
"platform": "mac-arm64",
"url": "https://storage.googleapis.com/chrome-for-testing-public/126.0.6468.0/mac-arm64/chrome-mac-arm64.zip"
"url": "https://storage.googleapis.com/chrome-for-testing-public/128.0.6597.0/mac-arm64/chrome-mac-arm64.zip"
},
{
"platform": "mac-x64",
"url": "https://storage.googleapis.com/chrome-for-testing-public/126.0.6468.0/mac-x64/chrome-mac-x64.zip"
"url": "https://storage.googleapis.com/chrome-for-testing-public/128.0.6597.0/mac-x64/chrome-mac-x64.zip"
},
{
"platform": "win32",
"url": "https://storage.googleapis.com/chrome-for-testing-public/126.0.6468.0/win32/chrome-win32.zip"
"url": "https://storage.googleapis.com/chrome-for-testing-public/128.0.6597.0/win32/chrome-win32.zip"
},
{
"platform": "win64",
"url": "https://storage.googleapis.com/chrome-for-testing-public/126.0.6468.0/win64/chrome-win64.zip"
"url": "https://storage.googleapis.com/chrome-for-testing-public/128.0.6597.0/win64/chrome-win64.zip"
}
]
}
Expand Down
24 changes: 12 additions & 12 deletions scripts/updateChromium.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeFileSync, readFileSync } from 'fs';
import { execSync } from 'child_process';
import path from 'path';
import { execSync } from 'node:child_process';
import { readFileSync, writeFileSync } from 'node:fs';
import path from 'node:path';

const PACKAGE_JSON_PATH = path.join(__dirname, '..', 'package.json');

Expand All @@ -20,15 +20,15 @@ interface ChromeReleaseInfo {
}

class ChromeUpdater {
private static readPackageJSON(): any {
private readPackageJSON() {
return JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf-8'));
}

private static writePackageJSON(content: any): void {
private writePackageJSON(content: ChromeReleaseInfo): void {
writeFileSync(PACKAGE_JSON_PATH, `${JSON.stringify(content, null, 2)}\n`);
}

public static async updateChromeVersion(): Promise<void> {
public async updateChromeVersion(): Promise<void> {
try {
const latestVersion = await this.fetchLatestChromeVersion();
const currentVersion = this.getCurrentChromeVersion();
Expand All @@ -52,12 +52,12 @@ class ChromeUpdater {
}
}

private static getCurrentChromeVersion(): ChromeReleaseInfo {
private getCurrentChromeVersion(): ChromeReleaseInfo {
const packageJSON = this.readPackageJSON();
return packageJSON.taiko.browser as ChromeReleaseInfo;
}

private static updatePackageJSON(releaseInfo: ChromeReleaseInfo): void {
private updatePackageJSON(releaseInfo: ChromeReleaseInfo): void {
const packageJSON = this.readPackageJSON();
const filteredReleaseInfo: ChromeReleaseInfo = {
version: releaseInfo.version,
Expand All @@ -68,21 +68,21 @@ class ChromeUpdater {
this.writePackageJSON(packageJSON);
}

private static async fetchLatestChromeVersion(): Promise<ChromeReleaseInfo> {
private async fetchLatestChromeVersion(): Promise<ChromeReleaseInfo> {
const response = await fetch(
'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json',
);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
const versions = data.versions as ChromeReleaseInfo[];
const data = (await response.json()) as { versions: ChromeReleaseInfo[] };
const versions = data.versions;
return versions.slice(-1)[0] as ChromeReleaseInfo;
}
}

async function main() {
await ChromeUpdater.updateChromeVersion();
await new ChromeUpdater().updateChromeVersion();
}

main();

0 comments on commit 358f33a

Please sign in to comment.