2015-01-25 2 views
1

Chrome에서 각도기 내에서 작동하는 오이 테스트 세트가 있습니다. 그러나 Firefox로 이동하면 페이지가로드되지만 Angular는 실행되지 않습니다. 따라서 각도가 완료되지 않으므로 값 대신 각도 태그 {{ }}이 표시되고 테스트가 중지됩니다. 수동으로 페이지를로드하거나 새로 고치거나 아무 것도하지 않으면 페이지가 작동합니다. 분도기에서 실행하면 Angular가 Firefox에서 실행되지 않습니다.
각도기 구성각도기 테스트를 실행할 때 각도 앱이 Firefox에서 제대로로드되지 않습니다.

exports.config = { 
    framework: 'cucumber', 
    cucumberOpts: { 
     format: 'progress', 
//  tags: '@dev', 
     require: 'test/e2e/features/step_definitions/steps.js' 
    }, 
    specs: [ 
     'test/e2e/features/**/*.feature' 
    ], 



    //framework: 'mocha', 
    //specs: [ 
    // 'test/e2e/**/*.spec.js' 
    //], 
    //mochaOpts: { 
    // enableTimeouts: false 
    //}, 

    plugins: [{ 
     path: 'node_modules/protractor/plugins/timeline', 

     // Output json and html will go in this folder. 
     outdir: 'assets/timelines' 

     // Optional - if sauceUser and sauceKey are specified, logs from 
     // SauceLabs will also be parsed after test invocation. 
     //sauceUser: 'Jane', 
     //sauceKey: 'abcdefg' 
    }], 

    onPrepare: function() { 
     process.env.PORT = 3001 
     require('./server') 
    }, 

    capabilities: { 
     'browserName' : 'firefox' 
    } 
    // 
    //multiplecapabilities: [{ 
    // 'browserName' : 'firefox' 
    //}, { 
    // 'browserName' : 'chrome' 
    //}] 
} 

작은 오이 기능 파일

Feature: Login to my account 
    As a Customer, 
    I want to login into my account, 
    so I can use the application 

Scenario: Authorize access for an active and valid account 
Given I have a valid and active account 
And I am logged out of the system 
And I request to authenticate myself 
When I provide my credentials 
Then I should have access to my account 

@negative 
Scenario: Deny access for an invalid account 
Given I have an invalid account 
And I am logged out of the system 
And I request to authenticate myself 
When I provide my credentials 
Then I should be denied access to my account 

작은 오이 단계 정의

var db = require('../../../../db') 
var User = require('../../../../server/models/user') 
var bcrypt = require('bcrypt') 
var chai = require('chai') 
chai.use(require('chai-as-promised')) 
var expect = chai.expect 

var username = 'user'; 
var pass = 'pass' 

var steps = function() { 

    this.Given(/^I have a valid and active account$/, function (callback) { 
     db.connection.db.dropDatabase() 
     var user = new User({username: username}) 
     bcrypt.hash(pass, 10, function (err, hash) { 
      if (err) { 
       return next(err) 
      } 
      user.password = hash 
      user.save(function (err) { 
       if (err) { 
        return next(err) 
       } 
      }) 
      callback(); 
     }) 
    }); 

    this.Given(/^I am logged out of the system$/, function (callback) { 
     browser.get('http://localhost:3001') 
     expect(element(by.css('nav .login'))).to.exist; 
     callback(); 
    }); 

    this.Given(/^I request to authenticate myself$/, function (callback) { 
     element(by.css('nav .login')).click() // fill out and submit registration form ' + 
     callback(); 
    }); 

    this.When(/^I provide my credentials$/, function (callback) { 
     element(by.model('username')).sendKeys(username) 
     element(by.model('password')).sendKeys(pass) 
     element(by.css('form .btn')).click() // submit a new post on the posts page 
     callback(); 
    }); 

    this.Then(/^I should have access to my account$/, function (callback) { 
     // Write code here that turns the phrase above into concrete actions 
     callback.pending(); 
    }); 

    this.Given(/^I have an invalid account$/, function (callback) { 
     db.connection.db.dropDatabase() 
     callback(); 
    }); 

    this.Then(/^I should be denied access to my account$/, function (callback) { 
     // Write code here that turns the phrase above into concrete actions 
     callback.pending(); 
    }); 
}; 

module.exports = steps; 

답변

관련 문제