aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e')
-rw-r--r--client/e2e/src/po/login.po.ts4
-rw-r--r--client/e2e/src/suites-local/signup.e2e-spec.ts6
-rw-r--r--client/e2e/src/utils/hooks.ts2
-rw-r--r--client/e2e/src/utils/mock-smtp.ts17
-rw-r--r--client/e2e/wdio.local-test.conf.ts26
-rw-r--r--client/e2e/wdio.local.conf.ts14
6 files changed, 42 insertions, 27 deletions
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index f1d13a2b0..30469cf1b 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -60,6 +60,10 @@ export class LoginPage {
60 } 60 }
61 61
62 loginOnPeerTube2 () { 62 loginOnPeerTube2 () {
63 if (!process.env.PEERTUBE2_E2E_PASSWORD) {
64 throw new Error('PEERTUBE2_E2E_PASSWORD env is missing for user e2e on peertube2.cpy.re')
65 }
66
63 return this.login({ username: 'e2e', password: process.env.PEERTUBE2_E2E_PASSWORD, url: 'https://peertube2.cpy.re/login' }) 67 return this.login({ username: 'e2e', password: process.env.PEERTUBE2_E2E_PASSWORD, url: 'https://peertube2.cpy.re/login' })
64 } 68 }
65 69
diff --git a/client/e2e/src/suites-local/signup.e2e-spec.ts b/client/e2e/src/suites-local/signup.e2e-spec.ts
index 7c822a6e6..ad0cc218e 100644
--- a/client/e2e/src/suites-local/signup.e2e-spec.ts
+++ b/client/e2e/src/suites-local/signup.e2e-spec.ts
@@ -244,9 +244,9 @@ describe('Signup', () => {
244 244
245 before(async () => { 245 before(async () => {
246 // FIXME: typings are wrong, get returns a promise 246 // FIXME: typings are wrong, get returns a promise
247 emailPort = await browser.sharedStore.get('emailPort') as unknown as number 247 emailPort = await (browser.sharedStore.get(browser.config.baseUrl + '-emailPort') as unknown as Promise<number>)
248 248
249 MockSMTPServer.Instance.collectEmails(emailPort, emails) 249 await MockSMTPServer.Instance.collectEmails(emailPort, emails)
250 }) 250 })
251 251
252 describe('Direct registration', function () { 252 describe('Direct registration', function () {
@@ -404,7 +404,7 @@ describe('Signup', () => {
404 }) 404 })
405 }) 405 })
406 406
407 before(() => { 407 after(() => {
408 MockSMTPServer.Instance.kill() 408 MockSMTPServer.Instance.kill()
409 }) 409 })
410 }) 410 })
diff --git a/client/e2e/src/utils/hooks.ts b/client/e2e/src/utils/hooks.ts
index e57584b44..1daff5fcc 100644
--- a/client/e2e/src/utils/hooks.ts
+++ b/client/e2e/src/utils/hooks.ts
@@ -32,7 +32,7 @@ async function beforeLocalSession (config: { baseUrl: string }, capabilities: {
32 32
33 config.baseUrl = 'http://localhost:900' + appInstance 33 config.baseUrl = 'http://localhost:900' + appInstance
34 34
35 await setValue('emailPort', emailPort) 35 await setValue(config.baseUrl + '-emailPort', emailPort)
36} 36}
37 37
38async function onBrowserStackPrepare () { 38async function onBrowserStackPrepare () {
diff --git a/client/e2e/src/utils/mock-smtp.ts b/client/e2e/src/utils/mock-smtp.ts
index 614477d7d..be6f8b259 100644
--- a/client/e2e/src/utils/mock-smtp.ts
+++ b/client/e2e/src/utils/mock-smtp.ts
@@ -1,11 +1,10 @@
1import { ChildProcess } from 'child_process'
2import MailDev from '@peertube/maildev' 1import MailDev from '@peertube/maildev'
3 2
4class MockSMTPServer { 3class MockSMTPServer {
5 4
6 private static instance: MockSMTPServer 5 private static instance: MockSMTPServer
7 private started = false 6 private started = false
8 private emailChildProcess: ChildProcess 7 private maildev: any
9 private emails: object[] 8 private emails: object[]
10 9
11 collectEmails (port: number, emailsCollection: object[]) { 10 collectEmails (port: number, emailsCollection: object[]) {
@@ -16,18 +15,20 @@ class MockSMTPServer {
16 return res(undefined) 15 return res(undefined)
17 } 16 }
18 17
19 const maildev = new MailDev({ 18 this.maildev = new MailDev({
20 ip: '127.0.0.1', 19 ip: '127.0.0.1',
21 smtp: port, 20 smtp: port,
22 disableWeb: true, 21 disableWeb: true,
23 silent: true 22 silent: true
24 }) 23 })
25 24
26 maildev.on('new', email => { 25 this.maildev.on('new', email => {
27 this.emails.push(email) 26 this.emails.push(email)
27
28 console.log('pushed email', email)
28 }) 29 })
29 30
30 maildev.listen(err => { 31 this.maildev.listen(err => {
31 if (err) return rej(err) 32 if (err) return rej(err)
32 33
33 this.started = true 34 this.started = true
@@ -38,11 +39,11 @@ class MockSMTPServer {
38 } 39 }
39 40
40 kill () { 41 kill () {
41 if (!this.emailChildProcess) return 42 if (!this.maildev) return
42 43
43 process.kill(this.emailChildProcess.pid) 44 this.maildev.close()
44 45
45 this.emailChildProcess = null 46 this.maildev = null
46 MockSMTPServer.instance = null 47 MockSMTPServer.instance = null
47 } 48 }
48 49
diff --git a/client/e2e/wdio.local-test.conf.ts b/client/e2e/wdio.local-test.conf.ts
index bc15123a0..3c19e4e9a 100644
--- a/client/e2e/wdio.local-test.conf.ts
+++ b/client/e2e/wdio.local-test.conf.ts
@@ -8,6 +8,12 @@ const prefs = {
8// Chrome headless does not support prefs 8// Chrome headless does not support prefs
9process.env.LANG = 'en' 9process.env.LANG = 'en'
10 10
11// https://github.com/mozilla/geckodriver/issues/1354#issuecomment-479456411
12process.env.MOZ_HEADLESS_WIDTH = '1280'
13process.env.MOZ_HEADLESS_HEIGHT = '1024'
14
15const windowSizeArg = `--window-size=${process.env.MOZ_HEADLESS_WIDTH},${process.env.MOZ_HEADLESS_HEIGHT}`
16
11module.exports = { 17module.exports = {
12 config: { 18 config: {
13 ...mainConfig, 19 ...mainConfig,
@@ -22,19 +28,19 @@ module.exports = {
22 browserName: 'chrome', 28 browserName: 'chrome',
23 acceptInsecureCerts: true, 29 acceptInsecureCerts: true,
24 'goog:chromeOptions': { 30 'goog:chromeOptions': {
25 args: [ '--disable-gpu', '--window-size=1280,1024' ], 31 args: [ '--disable-gpu', windowSizeArg ],
32 prefs
33 }
34 },
35 {
36 browserName: 'firefox',
37 'moz:firefoxOptions': {
38 binary: '/usr/bin/firefox-developer-edition',
39 args: [ '--headless', windowSizeArg ],
40
26 prefs 41 prefs
27 } 42 }
28 } 43 }
29 // {
30 // browserName: 'firefox',
31 // 'moz:firefoxOptions': {
32 // binary: '/usr/bin/firefox-developer-edition',
33 // args: [ '--headless', '--window-size=1280,1024' ],
34
35 // prefs
36 // }
37 // }
38 ], 44 ],
39 45
40 services: [ 'chromedriver', 'geckodriver', 'shared-store' ], 46 services: [ 'chromedriver', 'geckodriver', 'shared-store' ],
diff --git a/client/e2e/wdio.local.conf.ts b/client/e2e/wdio.local.conf.ts
index 27c6e867b..903235b86 100644
--- a/client/e2e/wdio.local.conf.ts
+++ b/client/e2e/wdio.local.conf.ts
@@ -1,11 +1,15 @@
1import { afterLocalSuite, beforeLocalSession, beforeLocalSuite } from './src/utils' 1import { afterLocalSuite, beforeLocalSession, beforeLocalSuite } from './src/utils'
2import { config as mainConfig } from './wdio.main.conf' 2import { config as mainConfig } from './wdio.main.conf'
3 3
4const prefs = { 4const prefs = { 'intl.accept_languages': 'en' }
5 'intl.accept_languages': 'en'
6}
7process.env.LANG = 'en' 5process.env.LANG = 'en'
8 6
7// https://github.com/mozilla/geckodriver/issues/1354#issuecomment-479456411
8process.env.MOZ_HEADLESS_WIDTH = '1280'
9process.env.MOZ_HEADLESS_HEIGHT = '1024'
10
11const windowSizeArg = `--window-size=${process.env.MOZ_HEADLESS_WIDTH},${process.env.MOZ_HEADLESS_HEIGHT}`
12
9module.exports = { 13module.exports = {
10 config: { 14 config: {
11 ...mainConfig, 15 ...mainConfig,
@@ -18,7 +22,7 @@ module.exports = {
18 { 22 {
19 browserName: 'chrome', 23 browserName: 'chrome',
20 'goog:chromeOptions': { 24 'goog:chromeOptions': {
21 args: [ '--headless', '--disable-gpu', '--window-size=1280,1024' ], 25 args: [ '--headless', '--disable-gpu', windowSizeArg ],
22 prefs 26 prefs
23 } 27 }
24 }, 28 },
@@ -26,7 +30,7 @@ module.exports = {
26 browserName: 'firefox', 30 browserName: 'firefox',
27 'moz:firefoxOptions': { 31 'moz:firefoxOptions': {
28 binary: '/usr/bin/firefox-developer-edition', 32 binary: '/usr/bin/firefox-developer-edition',
29 args: [ '--headless', '--window-size=1280,1024' ], 33 args: [ '--headless', windowSizeArg ],
30 34
31 prefs 35 prefs
32 } 36 }