0
這是我對登錄表單的第一個角度/量角器測試。在運行測試時,它將一次測試一個表單域而沒有問題,但是當添加第二個域來測試時,它總是超時。有沒有測試表單域的祕密,我不知道?角度/量角器超時與多個表單域
'use strict';
describe('Login', function() {
beforeEach(function() {
// URL is relative to baseUrl specified in config/test/protractor-e2e.conf.js
browser.get('');
// browser.get('');
// var account = browser.findElement(by.css('#sign-in-account'));
// var username = browser.findElement(by.css('#sign-in-username'));
// var password = browser.findElement(by.css('#sign-in-password'));
// var submit = browser.findElement(by.css('.button-primary'));
// submit.click();
});
it('should redirect user to first module they have access to after successful login', function() {
// Should successfully register a user
element(by.name('account')).sendKeys('test');
element(by.name('username')).sendKeys('[email protected]');
// element(by.name('password')).sendKeys('1234');
// element(by.css('.button-primary')).click();
// Should move to register page
// expect(browser.getCurrentUrl()).toContain('silpada.kineticsupply.com/module/analytics');
// Should show the first name where the lock icon was
// expect(element(by.name('account')).getText()).toContain('test');
}, 50000);
});
/*
* config/test/protractor-e2e.conf.js
*
* Protractor end-to-end testing configuration
*/
exports.config = {
// ----- How to setup Selenium -----
//
// There are three ways to specify how to use Selenium. Specify one of the
// following:
//
// 1. seleniumServerJar - to start Selenium Standalone locally.
// 2. seleniumAddress - to connect to a Selenium server which is already
// running.
// 3. sauceUser/sauceKey - to use remote Selenium servers via SauceLabs.
// The location of the selenium standalone server .jar file.
seleniumServerJar: null,
// The port to start the selenium server on, or null if the server should
// find its own unused port.
seleniumPort: null,
// Chromedriver location is used to help the selenium standalone server
// find chromedriver. This will be passed to the selenium jar as
// the system property webdriver.chrome.driver. If null, selenium will
// attempt to find chromedriver using PATH.
chromeDriver: null,
// Additional command line options to pass to selenium. For example,
// if you need to change the browser timeout, use
// seleniumArgs: ['-browserTimeout=60'],
seleniumArgs: [],
// If sauceUser and sauceKey are specified, seleniumServerJar will be ignored.
// The tests will be run remotely using SauceLabs.
sauceUser: null,
sauceKey: null,
// The address of a running selenium server. If specified, Protractor will
// connect to an already running instance of selenium. This usually looks like
seleniumAddress: 'http://localhost:4444/wd/hub',
// ----- What tests to run -----
//
// Spec patterns are relative to the location of this config.
specs: [
'./e2e/**/login.js'
],
// ----- Capabilities to be passed to the webdriver instance ----
//
// For a full list of available capabilities, see
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// and
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
capabilities: {
'browserName': 'chrome'
},
// A base URL for your application under test. Calls to protractor.get()
// with relative paths will be prepended with this.
//baseUrl: 'http://localhost:8081',
baseUrl: 'http://silpada.kineticsupply.com',
allScriptsTimeout:30000,
// Selector for the element housing the angular app - this defaults to
// body, but is necessary if ng-app is on a descendant of <body>
rootElement: 'body',
// A callback function called once protractor is ready and available, and
// before the specs are executed
// You can specify a file containing code to run by setting onPrepare to
// the filename string.
onPrepare: function() {
// At this point, global 'protractor' object will be set up, and jasmine
// will be available. For example, you can add a Jasmine reporter with:
// jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
// 'outputdir/', true, true));
},
// ----- Options to be passed to minijasminenode -----
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
}
};
<div id="sign-in-container">
<div id="sign-in">
<div class="logoContainer">
<!-- <img src="/assets/img/silpada_logo.png" style="display:block;padding:2rem 0;margin:auto;" alt=""> -->
<img ng-src="{{clientLogo}}" style="display:block;padding:2rem 0;margin:auto;" alt="">
</div>
<div ng-hide="catchResponses" alerts></div>
<form id="sign-in-form" name="authForm" ng-submit="login(credentials)">
<input
id="sign-in-account"
name="account"
type="text"
placeholder="Account ID"
ng-model="credentials.account"
required />
<input
id="sign-in-username"
name="username"
type="text"
placeholder="Username"
ng-model="credentials.username"
required />
<input
id="sign-in-password"
name="password"
type="password"
placeholder="Password"
ng-model="credentials.password"
required />
<button ng-disabled="authForm.$invalid || authenticating()" class="button-primary" type="submit">Login <i style="float:right; font-size:1.5rem;" class="fa fa-cog fa-spin" ng-show="authenticating()"></i></button>
<div id="reset-password"><a href="" ng-click="modal()">Forgot password?</a></div>
</form>
</div>
請您發表您的堆棧跟蹤? –
請同時發佈您的HTML代碼。 –
我已添加其他代碼。 –