Files
ChannelTests-TS/test/config/Browserstack/BrowserstackApi.ts
Alexander Zinn 9e063550c2 Add Browserstack API integration and supported browser type
* Created `BrowserstackApi` class for interacting with the Browserstack API, including a method to fetch supported browsers.
* Introduced `SupportedBrowser` type to define the structure of browser data returned from the API.
* Updated `TestRunner` to instantiate and run the test execution process, enabling command line options logging.
2025-08-18 18:05:29 -04:00

20 lines
706 B
TypeScript

import SupportedBrowser from "./SupportedBrowser";
export class BrowserstackApi {
private readonly _baseUrl: string = 'https://api.browserstack.com/5';
private readonly _authorizationHeader: string;
constructor(username: string, accessKey: string) {
this._authorizationHeader = `Basic ${Buffer.from(`${username}:${accessKey}`).toString('base64')}`;
}
public async getSupportedBrowsers(): Promise<SupportedBrowser[]> {
const response = await fetch(`${this._baseUrl}/browsers?flat=true`, {
headers: {
'Authorization': this._authorizationHeader
}
});
return response.json() as Promise<SupportedBrowser[]>;
}
}