Run protractor.js test from inquirer.js menu

I am stuck in a problem. I have a set of end-to-end tests written with protractor.js, and I made a small menu with inquire.js in which I choose which tests I would like to run. The problem is that I really cannot find any information on how to actually link the two projects together so that the menu can call up the test after it is selected. Here is a sample test and menu that 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); }); 
+5
source share
1 answer

The first thing to do is determine which DOM elements you want to interact with. You can start using a protector conductor . Use this to determine the types of locators. And then create your test around interaction with the browser.

+1
source

Source: https://habr.com/ru/post/1238124/


All Articles