本文整理汇总了TypeScript中protractor.browser.ExpectedConditions类的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.ExpectedConditions类的具体用法?TypeScript browser.ExpectedConditions怎么用?TypeScript browser.ExpectedConditions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了browser.ExpectedConditions类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clickOnVideo
async clickOnVideo (videoName: string) {
const video = element(by.css('.videos .video-miniature .video-thumbnail[title="' + videoName + '"]'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
await video.click()
await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
}
示例2: clickOnFirstVideo
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()
// Don't know why but the expectation fails on Safari
await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
const textToReturn = videoName.getText()
await video.click()
await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
return textToReturn
}
示例3: waitWatchVideoName
waitWatchVideoName (videoName: string, isSafari: boolean) {
const elem = element(by.css('.video-info .video-info-name'))
if (isSafari) return browser.sleep(5000)
return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
}
示例4: validSecondUploadStep
async validSecondUploadStep (videoName: string) {
const nameInput = element(by.css('input#name'))
await nameInput.clear()
await nameInput.sendKeys(videoName)
await this.getSecondStepSubmitButton().click()
return browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
}
示例5: loginAsRootUser
async loginAsRootUser () {
await browser.get('/login')
element(by.css('input#username')).sendKeys('root')
element(by.css('input#password')).sendKeys('test1')
await browser.sleep(1000)
await element(by.css('form input[type=submit]')).click()
return browser.wait(browser.ExpectedConditions.urlContains('/videos/'))
}
示例6: pauseVideo
async pauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
if (isAutoplay === false) {
const playButton = element(by.css('.vjs-big-play-button'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
await playButton.click()
}
await browser.sleep(1000)
await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
const videojsEl = element(by.css('div.video-js'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
// On Android, we need to click twice on "play" (BrowserStack particularity)
if (isMobileDevice) {
await browser.sleep(3000)
await videojsEl.click()
}
await browser.sleep(7000)
return videojsEl.click()
}
示例7: uploadVideo
async uploadVideo () {
browser.setFileDetector(new FileDetector())
const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
const fileInputSelector = '.upload-video-container input[type=file]'
const parentFileInput = '.upload-video .button-file'
// Avoid sending keys on non visible element
await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
// await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`)
const elem = element(by.css(fileInputSelector))
await elem.sendKeys(fileToUpload)
// Wait for the upload to finish
await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton()))
}
示例8: goOnVideosList
async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
let url: string
// We did not upload a file on a mobile device
if (isMobileDevice === true || isSafari === true) {
url = 'https://peertube2.cpy.re/videos/local'
} else {
url = '/videos/recently-added'
}
await browser.get(url)
// Waiting the following element does not work on Safari...
if (isSafari === true) return browser.sleep(3000)
const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
}
示例9: navigateTo
async navigateTo () {
await element(by.css('.header .upload-button')).click()
return browser.wait(browser.ExpectedConditions.visibilityOf(element(by.css('.upload-video-container'))))
}