Ich benutze eine Spring-Boot-Anwendung. Es hat Schluck. Während die app ist, gehe ich in das Verzeichnis, dasGulp Winkelmesser kann Test ausführen, während Winkelmesser progractor.conf.js gibt Fehler
[email protected]:~/hb-xx/gateway$ ls
bower.json gateway.iml gulp gulpfile.js
logs mvnw mvnw.cmd node_modules package.json pom.xml README.md src target
und führen Sie diesen Befehl e2e tst
[email protected]:~/hb-xx/gateway$ gulp protractor
[21:35:55] Using gulpfile ~/hb-xx/gateway/gulpfile.js
[21:35:55] Starting 'protractor'...
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Started
..
2 specs, 0 failures
Finished in 23.814 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
[21:36:20] Finished 'protractor' after 24 s
Es Tests läuft gut zu laufen hat.
Aber ich möchte App nicht für jedes Mal machen, ich möchte Tests ausführen, also habe ich Winkelmesser auf meine lokale Maschine heruntergeladen, um es manuell auszuführen.
Also gehe ich Verzeichnis, in dem conf
ist:
[email protected]:~/hb-xx/gateway/src/test/javascript$ ls
e2e karma.conf.js protractor.conf.js spec testcaner
dann Testlauf:
[email protected]:~/hb-xx/gateway/src/test/javascript$ protractor protractor.conf.js
[21:36:24] I/direct - Using ChromeDriver directly...
[21:36:24] I/launcher - Running 1 instances of WebDriver
Started
FF
Failures:
1) Login module should fail to login with wrong password
Message:
Failed: WebElementCondition did not resolve to a WebElement: [object Object]
Stack:
TypeError: WebElementCondition did not resolve to a WebElement: [object Object]
at TypeError (native)
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:722:17
at ManagedPromise.invokeCallback_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Run it("should fail to login with wrong password") in control flow
at Object.<anonymous> (/usr/lib/node_modules/protractor/node_modules/jasminewd2/index.js:79:14)
From asynchronous test:
Error
at Suite.<anonymous> (/home/vegan/hb-xx/gateway/src/test/javascript/e2e/account/login/loginControllerSpec.js:13:9)
at Object.<anonymous> (/home/vegan/hb-xx/gateway/src/test/javascript/e2e/account/login/loginControllerSpec.js:8:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
2) Login module should be able to login as a cta
Message:
Failed: WebElementCondition did not resolve to a WebElement: [object Object]
Stack:
TypeError: WebElementCondition did not resolve to a WebElement: [object Object]
at TypeError (native)
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:722:17
at ManagedPromise.invokeCallback_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Run it("should be able to login as a cta") in control flow
at Object.<anonymous> (/usr/lib/node_modules/protractor/node_modules/jasminewd2/index.js:79:14)
From asynchronous test:
Error
at Suite.<anonymous> (/home/vegan/hb-xx/gateway/src/test/javascript/e2e/account/login/loginControllerSpec.js:26:9)
at Object.<anonymous> (/home/vegan/hb-xx/gateway/src/test/javascript/e2e/account/login/loginControllerSpec.js:8:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
2 specs, 2 failures
Finished in 17.017 seconds
[21:36:42] I/launcher - 0 instance(s) of WebDriver still running
[21:36:42] I/launcher - chrome #01 failed 2 test(s)
[21:36:42] I/launcher - overall: 2 failed spec(s)
[21:36:42] E/launcher - Process exited with error code 1
ich habe 2 kleine Klassen
'use strict';
var LoginPageObject = require('./loginControllerPageObject');
describe(
'Login module', function() {
var loginPageObject = new LoginPageObject();
it(
'should fail to login with wrong password', function() {
loginPageObject.login('wrong','123');
expect(
loginPageObject.loginTextLocator.getText()
).toMatch(loginPageObject.loginText);
}
);
it(
'should be able to login as a admin', function() {
loginPageObject.login('admin','asd-**326SMmasdsa);
}
);
}
);
und andere Klasse
'use strict';
var CommonPageObject = require('../commonPageObject');
var LoginPageObject = function() {
var commonPageObject = new CommonPageObject();
this.login = element(by.css('[data-menu-item="login"]'));
this.username = element(by.model('vm.model.username'));
this.password = element(by.model('vm.model.password'));
this.loginButton = element(by.css('[aria-label="login.button"]'));
this.loginTextLocator = element(by.css('[class="md-headline ng-scope"]'));
this.loginText = /Giriş/;
this.baseUrl=commonPageObject.baseUrl;
this.login = function(name,password) {
this.get();
browser.driver.wait(protractor.until
.elementIsVisible(element(by.css('header'))));
this.setName(name);
this.setPassword(password);
this.loginButton.click();
};
this.get = function() {
browser.get(commonPageObject.baseUrl+'/#account/login');
};
this.setName = function(name) {
this.username.clear().sendKeys(name);
};
this.setPassword = function(password) {
this.password.clear().sendKeys(password);
};
};
module.exports = LoginPageObject;
und andere Klasse
'use strict';
var CommonPageObject = function() {
this.baseUrl = "http://xxx:8080";//i am changing this to another website while not using local
};
module.exports = CommonPageObject;
Ich habe versucht, diese
protractor.until
geändert browser.until oder driver.until
this.get();
browser.driver.wait(protractor.until
.elementIsVisible(element(by.css('header'))));
aber
gibt Fehler für
essage:
Failed: Cannot read property 'elementIsVisible' of undefined
Stack:
TypeError: Cannot read property 'elementIsVisible' of undefined
at null.login (/home/vegan/hb-productupload/gateway/src/test/javascript/e2e/account/login/loginControllerPageObject.js:29:13)
this lien
.elementIsVisible(element(by.css('header'))));