Search code examples
angularjsangular-scenario

How to assert the page title using AngularJS Scenario


I tried the following but got an error : expect undefined toBe "/"

    browser().navigateTo('/');
    expect(browser().location().url()).toBe("/");
    expect(document.title).toBe("something");

Page does have a title "something".


Solution

  • Since the test website runs in a frame, document.title would not work.

    However, you can use this:

    expect(element('title').text()).toBe("something");