ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

138 lines
3.2 KiB

  1. import { onBrowserStackComplete, onBrowserStackPrepare } from './src/utils'
  2. import { config as mainConfig } from './wdio.main.conf'
  3. const user = process.env.BROWSERSTACK_USER
  4. const key = process.env.BROWSERSTACK_KEY
  5. if (!user) throw new Error('Miss browser stack user')
  6. if (!key) throw new Error('Miss browser stack key')
  7. function buildMainOptions (sessionName: string) {
  8. return {
  9. projectName: 'PeerTube',
  10. buildName: 'Main E2E - ' + new Date().toISOString(),
  11. sessionName,
  12. consoleLogs: 'info',
  13. networkLogs: true
  14. }
  15. }
  16. function buildBStackDesktopOptions (options: {
  17. sessionName: string
  18. resolution: string
  19. os?: string
  20. osVersion?: string
  21. }) {
  22. const { sessionName, resolution, os, osVersion } = options
  23. return {
  24. 'bstack:options': {
  25. ...buildMainOptions(sessionName),
  26. os,
  27. osVersion,
  28. resolution
  29. }
  30. }
  31. }
  32. function buildBStackMobileOptions (options: {
  33. sessionName: string
  34. deviceName: string
  35. osVersion: string
  36. }) {
  37. const { sessionName, deviceName, osVersion } = options
  38. return {
  39. 'bstack:options': {
  40. ...buildMainOptions(sessionName),
  41. realMobile: true,
  42. osVersion,
  43. deviceName
  44. }
  45. }
  46. }
  47. module.exports = {
  48. config: {
  49. ...mainConfig,
  50. user,
  51. key,
  52. maxInstances: 5,
  53. capabilities: [
  54. {
  55. browserName: 'Chrome',
  56. ...buildBStackDesktopOptions({ sessionName: 'Latest Chrome Desktop', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
  57. },
  58. {
  59. browserName: 'Firefox',
  60. browserVersion: '78', // Very old ESR
  61. ...buildBStackDesktopOptions({ sessionName: 'Firefox ESR Desktop', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
  62. },
  63. {
  64. browserName: 'Safari',
  65. browserVersion: '12.1',
  66. ...buildBStackDesktopOptions({ sessionName: 'Safari Desktop', resolution: '1280x1024' })
  67. },
  68. {
  69. browserName: 'Firefox',
  70. ...buildBStackDesktopOptions({ sessionName: 'Firefox Latest', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
  71. },
  72. {
  73. browserName: 'Edge',
  74. ...buildBStackDesktopOptions({ sessionName: 'Edge Latest', resolution: '1280x1024' })
  75. },
  76. {
  77. browserName: 'Chrome',
  78. ...buildBStackMobileOptions({ sessionName: 'Latest Chrome Android', deviceName: 'Samsung Galaxy S8', osVersion: '7.0' })
  79. },
  80. {
  81. browserName: 'Safari',
  82. ...buildBStackMobileOptions({ sessionName: 'Safari iPhone', deviceName: 'iPhone 8', osVersion: '13' })
  83. },
  84. {
  85. browserName: 'Safari',
  86. ...buildBStackMobileOptions({ sessionName: 'Safari iPad', deviceName: 'iPad 7th', osVersion: '13' })
  87. }
  88. ],
  89. host: 'hub-cloud.browserstack.com',
  90. connectionRetryTimeout: 240000,
  91. waitforTimeout: 20000,
  92. specs: [
  93. // We don't want to test "local" tests
  94. './src/suites-all/*.e2e-spec.ts'
  95. ],
  96. services: [
  97. [
  98. 'browserstack', { browserstackLocal: true }
  99. ]
  100. ],
  101. onWorkerStart: function (_cid, capabilities) {
  102. if (capabilities['bstack:options'].realMobile === true) {
  103. capabilities['bstack:options'].local = false
  104. }
  105. },
  106. onPrepare: onBrowserStackPrepare,
  107. onComplete: onBrowserStackComplete
  108. } as WebdriverIO.Config
  109. }