Ich habe diese Kurzanleitung zur Installation dieses Testframeworks verwendet: https://github.com/codeception/codeceptjs/.codeceptjs - Fehler: Verbindung zum Selenserver nicht möglich/Für diesen Befehl ist eine Sitzungs-ID erforderlich, die jedoch nicht in der Antwortnutzlast gefunden wurde
Nach erfolgreicher Installation bearbeiten ich meine "mytest_test.js" mit folgenden Ergänzungen:
Feature('CodeceptJS Demonstration');
Scenario('test some forms', (I) => {
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation');
I.fillField('Email', '[email protected]');
I.fillField('Password', '123456');
I.checkOption('Active');
I.checkOption('Male');
I.click('Create User');
I.see('User is valid');
I.dontSeeInCurrentUrl('/documentation');
});
Danach begann ich meinen Test:
codeceptjs run --debug
Meine Ergebnisse sind:
C:\laragon\www\codeceptjs2 ([email protected]) 31.01.2017 10:46:30,41
λ codeceptjs run --debug
CodeceptJS v0.4.16
Using test root "C:\laragon\www\codeceptjs2"
CodeceptJS Demonstration --
test some forms
> Error: Couldn't connect to selenium server
* I am on page "http://simple-form-bootstrap.plataformatec.com.br/documentation"
> Screenshot has been saved to C:\laragon\www\codeceptjs2\output\test_some_forms.failed.png
> Error: A session id is required for this command but wasn't found in the response payload
Ich erhalte keine Screenshots im Ausgabeordner und dieses Framework funktioniert nicht und ich verstehe es nicht Warum.
package.json
{
"name": "codeceptjs2",
"version": "1.0.0",
"description": "",
"main": "mytest_test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"codeceptjs": "^0.4.16",
"selenium-webdriver": "^3.0.1",
"webdriverio": "^4.6.2"
}
}
codecept.json
{
"tests": "./*_test.js",
"timeout": 10000,
"output": "./output",
"helpers": {
"WebDriverIO": {
"url": "http://localhost",
"browser": "firefox"
}
},
"include": {
"I": "./steps_file.js"
},
"bootstrap": false,
"mocha": {},
"name": "codeceptjs2"
}
steps_file.js
'use strict';
// in this file you can append custom step methods to 'I' object
module.exports = function() {
return actor({
// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.
});
}
Ich habe einen neuen Ordner erstellt und wählte Nightmare mit dem Befehl 'codeceptjs init'. Dann habe ich mit 'npm install --save-dev albtraum' Albtraum installiert. In meinem Paket.json: '" Albtraum ":"^2.9.1 ". Wenn ich versuche, meine generierte Testdatei zu starten, bekomme ich sofort ein Windows Script Host - Popup-Fenster mit einem Kompilierungsfehler in Microsoft JScript. –
Ich habe Firefox und Google Treiber für dieses Framework installiert und jetzt funktioniert alles. Danke für den Hinweis mit Nightmare. Es läuft jetzt nachdem ich folgendes installiert habe: 'npm install -g Alptraum Alptraum-Upload'. Ich werde Ihre Antwort akzeptieren und würde mich freuen, wenn Sie meine Frage abstimmen könnten. Jemand hat es ohne Grund abgelehnt. –