量角器失败:运行testForAngular时出错:错误:拒绝访问属性的权限"调用"

时间:2017-06-09 10:11:47

标签: angular jasmine protractor

我从这个基本的量角器测试开始,检查菜单链接是否有效。每当我尝试运行测试时,我都会像这样error.SOmething计时。

  

量角器消息:失败:运行testForAngular时出错:错误:访问属性拒绝权限"调用"

firefox浏览器会打开基本网址,但不会点击菜单项链接。我遵循了tutorial/blog

我正在使用角度2.4.10,"打字稿":" 2.2.2"和"量角器":" 5.1.2"

//menu.js
    describe(‘menu check’, function () {
    beforeEach(function () {
    browser.get(‘http://localhost:8080/#/');
    browser.waitForAngular();
    });

    it(‘Should route to the view1page from menu’, function () {
    element(by.linkText('View1')).click();
    expect(browser.getCurrentUrl()).toMatch('http://localhost:8080/#/view1');
    });

    it(‘Should route to the view2 page from menu’, function () {
    element(by.linkText('View2')).click();
    expect(browser.getCurrentUrl()).toMatch('http://localhost:8080/#/view2');
    });
    });

//conf.js
exports.config = {
  framework: 'jasmine2',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['menu.js'],
  capabilities: {
    'browserName': 'firefox',

},
//allScriptsTimeout: 360000, 
// Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
   //defaultTimeoutInterval: 360000
  }
}

//app.component.ts
menuLinksLeft: Array<Link> = [
    { name: 'View1', url: '#/view1' },
    { name: 'View2', url: '#/view2' }
  ];

//app.component.html
<app-menu [leftLinks]="menuLinksLeft" [rightLinks]="menuLinksRight"></app-menu>

//When launched - In browser element
<a ng-reflect-href="#/view1" href="#/view1">View1</a>

0 个答案:

没有答案