当前位置: 首页>>代码示例>>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;未经允许,请勿转载。