小编Oll*_*ohn的帖子

从单元测试 Angular 5 & Karma/Jasmine 访问 `declare`d 变量

我正在尝试对一个组件进行单元测试,该组件具有使用declare关键字声明的变量,并且它有几个方法,然后在组件中稍后调用,如下所示:

import {
  Component,
  OnInit
} from '@angular/core';
import {
  AlertController,
  App,
  Events,
  Platform
} from "ionic-angular";

declare
let PushNotification: any;

@Component({
  selector: 'push',
  template: ``
})
export class PushComponent implements OnInit {

  nav: any;
  _push: any;

  constructor() {}

  ngOnInit() {

    // ...

    this._push = PushNotification.init({
      android: {
        senderID: '...'
      },
      ios: {
        alert: "true",
        badge: false,
        sound: 'false'
      },
      windows: {}
    });

    /**
     * On Registration, we want to register the device with BE
     */
    this._push.on('registration', (data) …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing karma-runner karma-jasmine angular

6
推荐指数
0
解决办法
973
查看次数

使用webdriver-manager为Protractor测试明确设置geckodriver版本

我试图同时运行在Chrome和Firefox我的量角器的测试,并已明确告知它与chromedriver的V2.30运行,但试图使用旧版本geckodriver时(运行webdriver-manager update --versions.firefox=0.17.0,webdriver-manager update --versions.gecko=0.17.0webdriver-manager update --versions.geckodriver=0.17.0),它仍然安装最新版本(撰写本文时为0.18.0).

有没有办法为Firefox安装特定版本的驱动程序?如果是,那是什么?

firefox selenium jasmine protractor

4
推荐指数
1
解决办法
1997
查看次数