-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Saucelabs): Migate to saucelabs
Removes all CBT config. Migrates to saucelabs Export specific configs for desktop/mobile legacy/latest configs BREAKING CHANGE: - CBT configuration removed - Some mobile legacy floor versions bumped
- Loading branch information
Showing
3 changed files
with
122 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,183 +1,121 @@ | ||
export type SupportMatrix = Record<string, Browser>; | ||
|
||
export interface Browser { | ||
export type Browser = MobileBrowser | DesktopBrowser; | ||
|
||
interface DesktopBrowser { | ||
base: "SauceLabs"; | ||
// Browser (e.g. IE, Chrome) | ||
browserName: string; | ||
// Browser version number and? bit version (e.g. 74x64) | ||
version: string; | ||
// Operating system and version (e.g. Windows 10) | ||
platform?: string; | ||
} | ||
|
||
interface MobileBrowser { | ||
base: "SauceLabs"; | ||
// Browser (e.g. IE, Chrome) | ||
browserName: string; | ||
// Browser version number and? bit version (e.g. 74x64) | ||
version?: string; | ||
version: string; | ||
// Operating system and version (e.g. Windows 10) | ||
platform?: string; | ||
// Mobile device (e.g. iPhone 4s) | ||
deviceName?: string; | ||
// Mobile platform version (e.g. 9.0) | ||
platformVersion?: string; | ||
// Mobile platform name (e.g. Android) | ||
platformName?: string; | ||
// Mobile device orientation (e.g landscape) | ||
deviceOrientation?: string; | ||
// Our addition | ||
desktop?: boolean; | ||
mobile?: boolean; | ||
legacy?: boolean; | ||
latest?: boolean; | ||
deviceName: string; | ||
// Portrait or landscape | ||
deviceOrientation: string; | ||
} | ||
|
||
/** | ||
* Export supported browsers | ||
*/ | ||
export const browsers: SupportMatrix = { | ||
// Latest Desktop | ||
const base = "SauceLabs"; | ||
|
||
export const latestDesktop: SupportMatrix = { | ||
chrome: { | ||
browserName: "Chrome", | ||
version: "77x64", | ||
platform: "Windows 10", | ||
desktop: true, | ||
latest: true, | ||
base, | ||
browserName: "chrome", | ||
version: "latest", | ||
}, | ||
firefox: { | ||
browserName: "Firefox", | ||
version: "69x64", | ||
platform: "Windows 10", | ||
desktop: true, | ||
latest: true, | ||
base, | ||
browserName: "firefox", | ||
version: "latest", | ||
}, | ||
safari: { | ||
browserName: "Safari", | ||
version: "12", | ||
platform: "Mac OSX 10.14", | ||
desktop: true, | ||
latest: true, | ||
base, | ||
browserName: "safari", | ||
version: "latest", | ||
}, | ||
edge: { | ||
browserName: "MicrosoftEdge", | ||
version: "18", | ||
platform: "Windows 10", | ||
desktop: true, | ||
latest: true, | ||
base, | ||
browserName: "microsoftedge", | ||
version: "latest", | ||
}, | ||
}; | ||
|
||
// Legacy Desktop | ||
export const legacyDesktop: SupportMatrix = { | ||
ie: { | ||
browserName: "Internet Explorer", | ||
base, | ||
browserName: "internet explorer", | ||
version: "11", | ||
platform: "Windows 10", | ||
desktop: true, | ||
legacy: true, | ||
platform: "Windows 8.1", | ||
}, | ||
"chrome-legacy": { | ||
browserName: "Chrome", | ||
version: "43", | ||
base, | ||
browserName: "chrome", | ||
version: "43.0", | ||
platform: "Windows 10", | ||
desktop: true, | ||
legacy: true, | ||
}, | ||
"firefox-legacy": { | ||
browserName: "Firefox", | ||
version: "48", | ||
base, | ||
browserName: "firefox", | ||
version: "48.0", | ||
platform: "Windows 10", | ||
desktop: true, | ||
legacy: true, | ||
}, | ||
}; | ||
|
||
// Latest Mobile | ||
"android-latest": { | ||
browserName: "Chrome", | ||
deviceName: "Pixel 3", | ||
platformVersion: "9.0", | ||
platformName: "Android", | ||
deviceOrientation: "portrait", | ||
mobile: true, | ||
legacy: true, | ||
}, | ||
export const latestMobile: SupportMatrix = { | ||
"ios-latest": { | ||
base, | ||
deviceOrientation: "portrait", | ||
deviceName: "iPhone X Simulator", | ||
browserName: "Safari", | ||
deviceName: "iPad 6th Generation Simulator", | ||
platformVersion: "12.0", | ||
platformName: "iOS", | ||
deviceOrientation: "landscape", | ||
mobile: true, | ||
legacy: true, | ||
version: "13.0", | ||
platform: "iOS", | ||
}, | ||
"android-latest": { | ||
base, | ||
deviceName: "Android GoogleAPI Emulator", | ||
deviceOrientation: "portrait", | ||
browserName: "Chrome", | ||
version: "5.1", | ||
platform: "Android", | ||
}, | ||
}; | ||
|
||
// Legacy Mobile | ||
export const legacyMobile: SupportMatrix = { | ||
"android-legacy": { | ||
browserName: "Chrome", | ||
deviceName: "Nexus 6", | ||
platformVersion: "5.0", | ||
platformName: "Android", | ||
base, | ||
browserName: "Browser", | ||
deviceName: "Android GoogleAPI Emulator", | ||
deviceOrientation: "portrait", | ||
mobile: true, | ||
legacy: true, | ||
version: "5.1", | ||
platform: "Android", | ||
}, | ||
"ios-legacy": { | ||
base, | ||
browserName: "Safari", | ||
deviceName: "iPhone 6s Plus Simulator", | ||
platformVersion: "9.3", | ||
platformName: "iOS", | ||
deviceName: "iPhone SE Simulator", | ||
deviceOrientation: "portrait", | ||
mobile: true, | ||
legacy: true, | ||
version: "10.3", | ||
platform: "iOS", | ||
}, | ||
}; | ||
|
||
export type CbtLauncher = DesktopLauncher | MobileLauncher; | ||
|
||
interface BuildInfo { | ||
name: string; | ||
build: string; | ||
} | ||
|
||
interface DesktopLauncher extends BuildInfo { | ||
browserName: string; | ||
base: "CrossBrowserTesting"; | ||
screenResolution: string; | ||
version: string; | ||
platform: string; | ||
} | ||
|
||
interface MobileLauncher extends BuildInfo { | ||
browserName: string; | ||
base: "CrossBrowserTesting"; | ||
deviceName: string; | ||
platformVersion: string; | ||
platformName: string; | ||
deviceOrientation: string; | ||
} | ||
|
||
const base = "CrossBrowserTesting"; | ||
const screenResolution = "1366x768"; | ||
|
||
interface ToCbtLaunchers { | ||
(matrix: SupportMatrix, buildInfo: BuildInfo): Record<string, CbtLauncher>; | ||
} | ||
|
||
/** | ||
* Returns a map of custom CBT launchers compatible with karma-cbt-launcher | ||
* given a browser support matrix and build information | ||
* Export supported browsers | ||
*/ | ||
export const toCbtLaunchers: ToCbtLaunchers = (matrix, buildInfo) => { | ||
const launchers: Record<string, CbtLauncher> = {}; | ||
Object.entries(matrix).forEach(([key, browser]) => { | ||
if (browser.mobile) { | ||
launchers[key] = { | ||
base, | ||
...buildInfo, | ||
browserName: browser.browserName, | ||
deviceName: browser.deviceName || "", | ||
platformVersion: browser.platformVersion || "", | ||
platformName: browser.platformName || "", | ||
deviceOrientation: browser.deviceOrientation || "", | ||
}; | ||
} else { | ||
launchers[key] = { | ||
base, | ||
screenResolution, | ||
...buildInfo, | ||
browserName: browser.browserName, | ||
version: browser.version || "", | ||
platform: browser.platform || "", | ||
}; | ||
} | ||
}); | ||
return launchers; | ||
export const browsers: SupportMatrix = { | ||
...latestDesktop, | ||
...legacyDesktop, | ||
...latestMobile, | ||
...legacyMobile, | ||
}; |
Oops, something went wrong.