当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser.driver.manage方法代码示例

本文整理汇总了TypeScript中protractor/globals.browser.driver.manage方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.driver.manage方法的具体用法?TypeScript browser.driver.manage怎么用?TypeScript browser.driver.manage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在protractor/globals.browser.driver的用法示例。


在下文中一共展示了browser.driver.manage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: describe

describe('angular-cli-project App', function() {

  let page: AngularCliProjectPage;
  let userEmail: string = "teacher@gmail.com";
  let userPass: string = "pass";
  let chatMessage: string = "This is a testing message for the chat";

  browser.driver.manage().window().maximize();

  beforeEach(() => {
    page = new AngularCliProjectPage();
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
  });


  it('should display title in the navbar', () => {
    page.navigateTo();

    // Check browser url (root)
    expect(browser.driver.getCurrentUrl()).toMatch('/');
    // The menu bar should display the title of the app
    expect(page.getLogoText()).toEqual('FullTeaching');
  });


  it('should reject wrong log in', () => {

    // Check browser url (root)
    expect(browser.driver.getCurrentUrl()).toMatch('/');

    // Open login modal
    browser.driver.findElement(by.id('download-button')).then(function(welcomeBtn) {
      welcomeBtn.click().then(function() {

        // Find form elements
        var userNameField = browser.driver.findElement(by.id('email'));
        var userPassField = browser.driver.findElement(by.id('password'));

        // Fill input fields
        userNameField.sendKeys('wrongemail@gmail.com');
        userPassField.sendKeys('pass');

        // Ensure fields contain what has been entered
        expect(userNameField.getAttribute('value')).toEqual('wrongemail@gmail.com');
        expect(userPassField.getAttribute('value')).toEqual('pass');

        browser.driver.findElement(by.id('log-in-btn')).then(function(loginBtn) {
          // Click to log in - waiting for Angular as it is manually bootstrapped.
          loginBtn.click().then(function() {
            browser.waitForAngular();

            // Error message appears warning about an invalid field
            expect(browser.driver.findElement(by.tagName('app-error-message')).getText()).toContain('Invalid field');
            //Route mustn't change
            expect(browser.driver.getCurrentUrl()).toMatch('/');

            // Clear field inputs
            userNameField.clear();
            userPassField.clear();
          });
        });
      });
    });
  });


  it('should log in', () => {

    // Check browser url (root)
    expect(browser.driver.getCurrentUrl()).toMatch('/');

    // Find form elements (login modal is already opened)
    var userNameField = browser.driver.findElement(by.id('email'));
    var userPassField = browser.driver.findElement(by.id('password'));

    // Fill input fields
    userNameField.sendKeys(userEmail);
    userPassField.sendKeys(userPass);

    // Ensure fields contain what has been entered
    expect(userNameField.getAttribute('value')).toEqual(userEmail);
    expect(userPassField.getAttribute('value')).toEqual(userPass);

    browser.driver.findElement(by.id('log-in-btn')).then(function(loginBtn) {
      // Click to log in - waiting for Angular as it is manually bootstrapped.
      loginBtn.click().then(function() {
        browser.waitForAngular();

        // Browser url must have changed to the dashboard route
        expect(browser.driver.getCurrentUrl()).toMatch('/courses');
      });
    });
  });


  it('should allow adding new courses', () => {

    // Check browser url (dashboard)
    expect(browser.driver.getCurrentUrl()).toMatch('/courses');

//.........这里部分代码省略.........
开发者ID:pabloFuente,项目名称:full-teaching,代码行数:101,代码来源:app.e2e-spec.ts


注:本文中的protractor/globals.browser.driver.manage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。