當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript protractor.browser.ExpectedConditions類代碼示例

本文整理匯總了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/'))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:7,代碼來源:video-watch.po.ts

示例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
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:13,代碼來源:video-watch.po.ts

示例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))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:7,代碼來源:video-watch.po.ts

示例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/'))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:9,代碼來源:video-upload.po.ts

示例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/'))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:12,代碼來源:login.po.ts

示例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()
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:23,代碼來源:video-watch.po.ts

示例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()))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:18,代碼來源:video-upload.po.ts

示例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))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:18,代碼來源:video-watch.po.ts

示例9: navigateTo

  async navigateTo () {
    await element(by.css('.header .upload-button')).click()

    return browser.wait(browser.ExpectedConditions.visibilityOf(element(by.css('.upload-video-container'))))
  }
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:5,代碼來源:video-upload.po.ts


注:本文中的protractor.browser.ExpectedConditions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。