e2e浏览器即时打开和关闭

时间:2016-07-09 05:16:18

标签: firebase protractor ionic2

我正在尝试测试我的应用并按照此链接http://lathonez.github.io/2016/ionic-2-e2e-testing/我将我的应用与firebase合并。一切都运行良好,但当我运行npm运行e2e浏览器打开并立即关闭我的终端弹出一个错误。

我点了这个链接http://lathonez.github.io/2016/ionic-2-e2e-testing/

enter image description here

其实我的问题是我无法在我的e2e浏览器中看到任何可以帮助我的操作

protractorconfig.js

 exports.config = {
        baseUrl: 'http://192.168.1.2:8100/',

        specs: [
           '../app/pages/home/home.e2e.ts',
           '../app/pages/Admin/admin.e2e.ts',
           //'../app/pages/Listing/lisitngPage.e2e.ts'

        ],

        exclude: [],

        framework: 'jasmine2',

        allScriptsTimeout: 110000,

        jasmineNodeOpts: {
            showTiming: true,
            showColors: true,
            isVerbose: false,
            includeStackTrace: false,
            defaultTimeoutInterval: 400000
        },

        directConnect: true,

        chromeOnly: true,

        capabilities: {
            'browserName': 'chrome',

            'chromeOptions': {
                'args': ['--disable-web-security']
              }
        },

        onPrepare: function() {
            var SpecReporter = require('jasmine-spec-reporter');

            jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));

            browser.ignoreSynchronization = false;
        },
        useAllAngular2AppRoots: true
    };

gulpfile.ts

import { join } from 'path';

const config: any = {
  gulp: require('gulp'),
  appDir: 'app',
  testDir: 'test',
  testDest: 'www/build/test',
  typingsDir: 'typings',
};

const imports: any = {
  gulp: require('gulp'),
  runSequence: require('run-sequence'),
  ionicGulpfile: require(join(process.cwd(), 'gulpfile.js')),
};

const gulp: any = imports.gulp;
const runSequence: any = imports.runSequence;

// just a hook into ionic's build
gulp.task('build-app', (done: Function) => {
  runSequence(
    'build',
    (<any>done)
  );
});

// compile E2E typescript into individual files, project directoy structure is replicated under www/build/test
gulp.task('build-e2e', ['clean-test'], () => {
  let typescript: any = require('gulp-typescript');
  let tsProject: any = typescript.createProject('tsconfig.json');
  let src: Array<any> = [
    join(config.typingsDir, '/index.d.ts'),
    join(config.appDir, '**/*e2e.ts'),
  ];
  let result: any = gulp.src(src)
    .pipe(typescript(tsProject));

  return result.js
    .pipe(gulp.dest(config.testDest));
});

// delete everything used in our test cycle here
gulp.task('clean-test', () => {

  let del: any = require('del');

  // You can use multiple globbing patterns as you would with `gulp.src`
  return del([config.testDest]).then((paths: Array<any>) => {
    console.log('Deleted', paths && paths.join(', ') || '-');
  });
});

// run jasmine unit tests using karma with PhantomJS2 in single run mode
gulp.task('karma', (done: Function) => {

  let karma: any = require('karma');
  let karmaOpts: {} = {
    configFile: join(process.cwd(), config.testDir, 'karma.config.js'),
    singleRun: true,
  };

  new karma.Server(karmaOpts, done).start();
});

// run jasmine unit tests using karma with Chrome, Karma will be left open in Chrome for debug
gulp.task('karma-debug', (done: Function) => {

  let karma: any = require('karma');
  let karmaOpts: {} = {
    configFile: join(process.cwd(), config.testDir, 'karma.config.js'),
    singleRun: false,
    browsers: ['Chrome'],
    reporters: ['mocha'],
  };

  new karma.Server(karmaOpts, done).start();
});

// run tslint against all typescript
gulp.task('lint', () => {

  let tslint: any = require('gulp-tslint');

  return gulp.src(join(config.appDir, '**/*.ts'))
    .pipe(tslint())
    .pipe(tslint.report('verbose'));
});

// build unit tests, run unit tests, remap and report coverage
gulp.task('unit-test', (done: Function) => {
  runSequence(
    ['lint', 'html'],
    'karma',
    (<any>done)
  );
});

0 个答案:

没有答案