I'm stuck in a problem. I have a set of end to end tests written with protractor.js and I made a little menu with inquire.js in which I'll select which tests I would like to run. The problem is, I really can't find any information on how to actually link those two projects together so the menu can call a test once selected. Here is a sample of a test and the menu I made:
This is my protractor test:
var session = require('../login.js');
describe('The customer view', function() {
var physicalPersonRegistration = {};
physicalPersonRegistration.loginTest = function() {
it('should Login', function() {
browser.ignoreSynchronization = true;
browser.get('http://localhost:8080/project');
session.username.sendKeys('admin');
session.password.sendKeys('admin');
session.submit.click();
browser.ignoreSynchronization = false;
});
};
//executing tests
physicalPersonRegistration.loginTest();
});
And this is my inquire.js menu:
var inquirer = require("inquirer");
var questions = [
{
type: "list",
name: "tests",
message: "Which test do you wish to run?",
choices: [
"Login Test",
"Run all Tests"
]
},
];
inquirer.prompt(questions, function(answers) {
console.log(answers);
});
The first thing to do is to determine what DOM elements you want to interact with. You can start by using the protractor element explorer. Use that to determine the kinds of locators to use. And then build your test around interacting with the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With