Improve E2E tests

This commit is contained in:
Chocobozzz 2020-05-11 09:41:39 +02:00
parent 81c647ff19
commit 60c8b8a5d7
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 6 deletions

View File

@ -12,7 +12,9 @@ exports.config = {
'browserstack.user': process.env.BROWSERSTACK_USER,
'browserstack.key': process.env.BROWSERSTACK_KEY,
'browserstack.local': true,
project: 'PeerTube'
'browserstack.console': 'info',
project: 'PeerTube',
name: 'Bstack-[Protractor] Parallel Test'
},
multiCapabilities: [

View File

@ -14,7 +14,7 @@ export class VideoWatchPage {
await browser.get(url)
// Waiting the following element does not work on Safari...
if (isSafari === true) return browser.sleep(3000)
if (isSafari) return browser.sleep(3000)
const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
@ -84,13 +84,12 @@ export class VideoWatchPage {
}
async clickOnFirstVideo () {
const video = element.all(by.css('.videos .video-miniature .video-thumbnail')).first()
const videoName = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
// Don't know why but the expectation fails on Safari
await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
const textToReturn = videoName.getText()
const textToReturn = video.getText()
await video.click()
await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
@ -106,7 +105,7 @@ export class VideoWatchPage {
}
async goOnP2PMediaLoaderEmbed () {
return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader')
return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50')
}
async clickOnUpdate () {

View File

@ -53,6 +53,10 @@ describe('Videos workflow', () => {
if (await isSafari()) {
console.log('Safari detected.')
}
if (!await isMobileDevice()) {
await browser.driver.manage().window().maximize()
}
})
it('Should log in', async () => {