|
| 1 | +/* eslint-env node */ |
| 2 | + |
| 3 | +const path = require(`path`); |
| 4 | + |
| 5 | +process.env.CHROME_BIN = require(`puppeteer`).executablePath(); |
| 6 | +process.env.FIREFOX_BIN = require(`playwright`).firefox.executablePath(); |
| 7 | +const SAUCE = parseInt(process.env.SAUCE, 10) >= 1; |
| 8 | + |
| 9 | +// Check out https://saucelabs.com/platforms for all browser/platform combos |
| 10 | +const sauceLaunchers = { |
| 11 | + sl_chrome_latest: { |
| 12 | + base: `SauceLabs`, |
| 13 | + browserName: `chrome`, |
| 14 | + browserVersion: `latest`, |
| 15 | + platformName: `macOS 12`, |
| 16 | + 'sauce:options': { |
| 17 | + extendedDebugging: true, |
| 18 | + }, |
| 19 | + }, |
| 20 | + sl_chrome_old: { |
| 21 | + base: `SauceLabs`, |
| 22 | + browserName: `chrome`, |
| 23 | + browserVersion: `90`, |
| 24 | + platformName: `macOS 10.13`, |
| 25 | + 'sauce:options': { |
| 26 | + extendedDebugging: true, |
| 27 | + }, |
| 28 | + }, |
| 29 | + sl_firefox_latest: { |
| 30 | + base: `SauceLabs`, |
| 31 | + browserName: `firefox`, |
| 32 | + browserVersion: `latest`, |
| 33 | + platformName: `macOS 12`, |
| 34 | + 'sauce:options': { |
| 35 | + extendedDebugging: true, |
| 36 | + }, |
| 37 | + }, |
| 38 | + sl_firefox_old: { |
| 39 | + base: `SauceLabs`, |
| 40 | + browserName: `firefox`, |
| 41 | + browserVersion: `91`, |
| 42 | + platformName: `macOS 10.13`, |
| 43 | + 'sauce:options': { |
| 44 | + extendedDebugging: true, |
| 45 | + }, |
| 46 | + }, |
| 47 | + sl_safari_latest: { |
| 48 | + base: `SauceLabs`, |
| 49 | + browserName: `safari`, |
| 50 | + browserVersion: `latest`, |
| 51 | + platformName: `macOS 12`, |
| 52 | + }, |
| 53 | + sl_safari_old: { |
| 54 | + base: `SauceLabs`, |
| 55 | + browserName: `safari`, |
| 56 | + browserVersion: `13`, |
| 57 | + platformName: `macOS 10.13`, |
| 58 | + }, |
| 59 | + sl_edge_latest: { |
| 60 | + base: `SauceLabs`, |
| 61 | + browserName: `MicrosoftEdge`, |
| 62 | + browserVersion: `latest`, |
| 63 | + platformName: `Windows 10`, |
| 64 | + }, |
| 65 | + sl_edge_old: { |
| 66 | + base: `SauceLabs`, |
| 67 | + browserName: `MicrosoftEdge`, |
| 68 | + browserVersion: `90`, |
| 69 | + platformName: `Windows 10`, |
| 70 | + }, |
| 71 | +}; |
| 72 | + |
| 73 | +const sauceBrowsers = Object.keys(sauceLaunchers); |
| 74 | + |
| 75 | +// shared config for all unit tests |
| 76 | +module.exports = function (config) { |
| 77 | + config.set({ |
| 78 | + frameworks: [`mocha`], |
| 79 | + preprocessors: { |
| 80 | + '**/*.js': [`sourcemap`], |
| 81 | + }, |
| 82 | + basePath: path.resolve(__dirname, `test/browser/build`), |
| 83 | + retryLimit: 2, |
| 84 | + files: [`bundle.js`], |
| 85 | + client: { |
| 86 | + clientDisplayNone: true, |
| 87 | + mocha: { |
| 88 | + timeout: 30000, // 300s |
| 89 | + }, |
| 90 | + }, |
| 91 | + sauceLabs: { |
| 92 | + public: `team`, |
| 93 | + build: `panel ${process.env.GITHUB_REF || `local`} build ${process.env.GITHUB_RUN_NUMBER || ``}`, |
| 94 | + testName: `Panel tests`, |
| 95 | + }, |
| 96 | + plugins: [ |
| 97 | + require(`karma-mocha`), |
| 98 | + require(`karma-spec-reporter`), |
| 99 | + require(`karma-chrome-launcher`), |
| 100 | + require(`karma-firefox-launcher`), |
| 101 | + require(`karma-sauce-launcher`), |
| 102 | + require(`karma-sourcemap-loader`), |
| 103 | + ], |
| 104 | + browsers: SAUCE ? sauceBrowsers : [`ChromeHeadless`, `Firefox`], |
| 105 | + reporters: SAUCE ? [`spec`, `saucelabs`] : [`spec`], |
| 106 | + singleRun: true, |
| 107 | + customLaunchers: { |
| 108 | + ...sauceLaunchers, |
| 109 | + ChromeHeadless: { |
| 110 | + base: `Chrome`, |
| 111 | + flags: [ |
| 112 | + `--headless`, |
| 113 | + `--disable-gpu`, |
| 114 | + `--disable-dev-shm-usage`, |
| 115 | + `--remote-debugging-port=9222`, |
| 116 | + `--window-size=1280,800`, |
| 117 | + `--no-sandbox`, |
| 118 | + ], |
| 119 | + }, |
| 120 | + FirefoxHeadless: { |
| 121 | + base: `Firefox`, |
| 122 | + flags: [`-headless`], |
| 123 | + }, |
| 124 | + }, |
| 125 | + }); |
| 126 | +}; |
0 commit comments