aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-03 10:27:04 +0200
committerChocobozzz <me@florianbigard.com>2021-09-03 16:35:18 +0200
commit6d210220be0875d63461829d83c6e3a59d05cf7a (patch)
tree60ec5b596ef06295b70ebb553920a39b549e0f13 /client/e2e/src/utils
parent2ede07153ce0282b116345dfee09bff902355a75 (diff)
downloadPeerTube-6d210220be0875d63461829d83c6e3a59d05cf7a.tar.gz
PeerTube-6d210220be0875d63461829d83c6e3a59d05cf7a.tar.zst
PeerTube-6d210220be0875d63461829d83c6e3a59d05cf7a.zip
Fix NSFW filter and add tests
Diffstat (limited to 'client/e2e/src/utils')
-rw-r--r--client/e2e/src/utils/common.ts47
-rw-r--r--client/e2e/src/utils/elements.ts7
-rw-r--r--client/e2e/src/utils/index.ts3
-rw-r--r--client/e2e/src/utils/urls.ts10
4 files changed, 67 insertions, 0 deletions
diff --git a/client/e2e/src/utils/common.ts b/client/e2e/src/utils/common.ts
new file mode 100644
index 000000000..eb5f6b450
--- /dev/null
+++ b/client/e2e/src/utils/common.ts
@@ -0,0 +1,47 @@
1async function browserSleep (amount: number) {
2 await browser.pause(amount)
3}
4
5function isMobileDevice () {
6 const platformName = (browser.capabilities['platformName'] || '').toLowerCase()
7
8 return platformName === 'android' || platformName === 'ios'
9}
10
11function isSafari () {
12 return browser.capabilities['browserName'] &&
13 browser.capabilities['browserName'].toLowerCase() === 'safari'
14}
15
16function isIOS () {
17 return isMobileDevice() && isSafari()
18}
19
20async function go (url: string) {
21 await browser.url(url)
22
23 // Hide notifications that could fail tests when hiding buttons
24 await browser.execute(() => {
25 const style = document.createElement('style')
26 style.innerHTML = 'p-toast { display: none }'
27 document.head.appendChild(style)
28 })
29}
30
31async function waitServerUp () {
32 await browser.waitUntil(async () => {
33 await go('/')
34 await browserSleep(500)
35
36 return $('<my-app>').isDisplayed()
37 }, { timeout: 20 * 1000 })
38}
39
40export {
41 isMobileDevice,
42 isSafari,
43 isIOS,
44 waitServerUp,
45 go,
46 browserSleep
47}
diff --git a/client/e2e/src/utils/elements.ts b/client/e2e/src/utils/elements.ts
new file mode 100644
index 000000000..cadc46cce
--- /dev/null
+++ b/client/e2e/src/utils/elements.ts
@@ -0,0 +1,7 @@
1function clickOnCheckbox (name: string) {
2 return $(`my-peertube-checkbox[inputname=${name}] label`).click()
3}
4
5export {
6 clickOnCheckbox
7}
diff --git a/client/e2e/src/utils/index.ts b/client/e2e/src/utils/index.ts
new file mode 100644
index 000000000..5da1ad517
--- /dev/null
+++ b/client/e2e/src/utils/index.ts
@@ -0,0 +1,3 @@
1export * from './common'
2export * from './elements'
3export * from './urls'
diff --git a/client/e2e/src/utils/urls.ts b/client/e2e/src/utils/urls.ts
new file mode 100644
index 000000000..664c65931
--- /dev/null
+++ b/client/e2e/src/utils/urls.ts
@@ -0,0 +1,10 @@
1const FIXTURE_URLS = {
2 WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e',
3
4 HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50',
5 HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a'
6}
7
8export {
9 FIXTURE_URLS
10}