mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 01:39:37 +02:00
Save
This commit is contained in:
parent
507cedca1c
commit
aaae2910e7
2 changed files with 130 additions and 16 deletions
|
@ -2,25 +2,18 @@ import { NSFWPolicyType } from '@peertube/peertube-models'
|
||||||
import { browserSleep, go, setCheckboxEnabled } from '../utils'
|
import { browserSleep, go, setCheckboxEnabled } from '../utils'
|
||||||
|
|
||||||
export class AdminConfigPage {
|
export class AdminConfigPage {
|
||||||
async navigateTo (tab: 'instance-homepage' | 'basic-configuration' | 'instance-information' | 'live') {
|
async navigateTo (page: 'information' | 'live' | 'general' | 'homepage') {
|
||||||
const waitTitles = {
|
const url = '/admin/settings/config/' + page
|
||||||
'instance-homepage': 'INSTANCE HOMEPAGE',
|
|
||||||
'basic-configuration': 'APPEARANCE',
|
|
||||||
'instance-information': 'INSTANCE',
|
|
||||||
'live': 'LIVE'
|
|
||||||
}
|
|
||||||
|
|
||||||
const url = '/admin/settings/config/edit-custom#' + tab
|
|
||||||
|
|
||||||
if (await browser.getUrl() !== url) {
|
if (await browser.getUrl() !== url) {
|
||||||
await go('/admin/settings/config/edit-custom#' + tab)
|
await go(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
await $('h2=' + waitTitles[tab]).waitForDisplayed()
|
await $('a.active[href=' + url + ']').waitForDisplayed()
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateNSFWSetting (newValue: NSFWPolicyType) {
|
async updateNSFWSetting (newValue: NSFWPolicyType) {
|
||||||
await this.navigateTo('instance-information')
|
await this.navigateTo('information')
|
||||||
|
|
||||||
const elem = $(`#instanceDefaultNSFWPolicy-${newValue} + label`)
|
const elem = $(`#instanceDefaultNSFWPolicy-${newValue} + label`)
|
||||||
|
|
||||||
|
@ -32,25 +25,25 @@ export class AdminConfigPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateHomepage (newValue: string) {
|
async updateHomepage (newValue: string) {
|
||||||
await this.navigateTo('instance-homepage')
|
await this.navigateTo('homepage')
|
||||||
|
|
||||||
return $('#instanceCustomHomepageContent').setValue(newValue)
|
return $('#instanceCustomHomepageContent').setValue(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleSignup (enabled: boolean) {
|
async toggleSignup (enabled: boolean) {
|
||||||
await this.navigateTo('basic-configuration')
|
await this.navigateTo('general')
|
||||||
|
|
||||||
return setCheckboxEnabled('signupEnabled', enabled)
|
return setCheckboxEnabled('signupEnabled', enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleSignupApproval (required: boolean) {
|
async toggleSignupApproval (required: boolean) {
|
||||||
await this.navigateTo('basic-configuration')
|
await this.navigateTo('general')
|
||||||
|
|
||||||
return setCheckboxEnabled('signupRequiresApproval', required)
|
return setCheckboxEnabled('signupRequiresApproval', required)
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleSignupEmailVerification (required: boolean) {
|
async toggleSignupEmailVerification (required: boolean) {
|
||||||
await this.navigateTo('basic-configuration')
|
await this.navigateTo('general')
|
||||||
|
|
||||||
return setCheckboxEnabled('signupRequiresEmailVerification', required)
|
return setCheckboxEnabled('signupRequiresEmailVerification', required)
|
||||||
}
|
}
|
||||||
|
|
121
client/e2e/src/suites-local/page-crash.e2e-spec.ts
Normal file
121
client/e2e/src/suites-local/page-crash.e2e-spec.ts
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
import { AdminConfigPage } from '../po/admin-config.po'
|
||||||
|
import { LoginPage } from '../po/login.po'
|
||||||
|
import { MyAccountPage } from '../po/my-account.po'
|
||||||
|
import { SignupPage } from '../po/signup.po'
|
||||||
|
import { VideoPublishPage } from '../po/video-publish.po'
|
||||||
|
import { VideoWatchPage } from '../po/video-watch.po'
|
||||||
|
import { getScreenshotPath, go, isMobileDevice, isSafari, selectCustomSelect, waitServerUp } from '../utils'
|
||||||
|
|
||||||
|
// These tests help to notice crash with invalid translated strings
|
||||||
|
describe('Page crash', () => {
|
||||||
|
let videoPublishPage: VideoPublishPage
|
||||||
|
let loginPage: LoginPage
|
||||||
|
let videoWatchPage: VideoWatchPage
|
||||||
|
let adminConfigPage: AdminConfigPage
|
||||||
|
let myAccountPage: MyAccountPage
|
||||||
|
|
||||||
|
let lastLanguage = ''
|
||||||
|
|
||||||
|
const languages = [
|
||||||
|
'العربية',
|
||||||
|
'Català',
|
||||||
|
'Čeština',
|
||||||
|
'Deutsch',
|
||||||
|
'ελληνικά',
|
||||||
|
'Esperanto',
|
||||||
|
'Español',
|
||||||
|
'Euskara',
|
||||||
|
'فارسی',
|
||||||
|
'Suomi',
|
||||||
|
'Français',
|
||||||
|
'Gàidhlig',
|
||||||
|
'Galego',
|
||||||
|
'Hrvatski',
|
||||||
|
'Magyar',
|
||||||
|
'Íslenska',
|
||||||
|
'Italiano',
|
||||||
|
'日本語',
|
||||||
|
'Taqbaylit',
|
||||||
|
'Norsk bokmål',
|
||||||
|
'Nederlands',
|
||||||
|
'Norsk nynorsk',
|
||||||
|
'Occitan',
|
||||||
|
'Polski',
|
||||||
|
'Português (Brasil)',
|
||||||
|
'Português (Portugal)',
|
||||||
|
'Pусский',
|
||||||
|
'Slovenčina',
|
||||||
|
'Shqip',
|
||||||
|
'Svenska',
|
||||||
|
'ไทย',
|
||||||
|
'Toki Pona',
|
||||||
|
'Türkçe',
|
||||||
|
'украї́нська мо́ва',
|
||||||
|
'Tiếng Việt',
|
||||||
|
'简体中文(中国)',
|
||||||
|
'繁體中文(台灣)'
|
||||||
|
]
|
||||||
|
|
||||||
|
async function testForAllLanguages (action: () => Promise<void>) {
|
||||||
|
for (const language of languages) {
|
||||||
|
lastLanguage = language
|
||||||
|
|
||||||
|
await go('/')
|
||||||
|
|
||||||
|
await $('.settings-button').waitForClickable()
|
||||||
|
await $('.settings-button').click()
|
||||||
|
|
||||||
|
await selectCustomSelect('language', language)
|
||||||
|
|
||||||
|
await action()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
await waitServerUp()
|
||||||
|
|
||||||
|
myAccountPage = new MyAccountPage()
|
||||||
|
adminConfigPage = new AdminConfigPage()
|
||||||
|
loginPage = new LoginPage(isMobileDevice())
|
||||||
|
videoPublishPage = new VideoPublishPage()
|
||||||
|
videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari())
|
||||||
|
|
||||||
|
await browser.maximizeWindow()
|
||||||
|
|
||||||
|
await loginPage.loginAsRootUser()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should set a homepage', async function () {
|
||||||
|
await testForAllLanguages(async () => {
|
||||||
|
await adminConfigPage.updateHomepage('My custom homepage content')
|
||||||
|
|
||||||
|
// All tests
|
||||||
|
await go('/home')
|
||||||
|
|
||||||
|
await $('*=My custom homepage content').waitForDisplayed()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should upload and watch a video', async function () {
|
||||||
|
await testForAllLanguages(async () => {
|
||||||
|
await videoPublishPage.navigateTo()
|
||||||
|
await videoPublishPage.uploadVideo('video3.mp4')
|
||||||
|
await videoPublishPage.validSecondStep('video')
|
||||||
|
|
||||||
|
await videoPublishPage.clickOnWatch()
|
||||||
|
await videoWatchPage.waitWatchVideoName('video')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should go on client pages and not crash', async function () {
|
||||||
|
await testForAllLanguages(async () => {
|
||||||
|
await go('/videos/overview')
|
||||||
|
|
||||||
|
await $('h1*=Home').waitForDisplayed()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
after(async () => {
|
||||||
|
await browser.saveScreenshot(getScreenshotPath(`after-page-crash-test-${lastLanguage}.png`))
|
||||||
|
})
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue