Protractor with Cucumber does not run tests

0

Hello. I'm a beginner in cucumber protractor testing and I'm following some tutorials and in my case it does not work.

I run my test but it only generates the Gherkin-based code I wrote.

protractor protractor.config.js

Execution result:

C:\git\conciliacao-dev\webapp\src\main\angular>protractor protractor.config.js
[10:35:51] I/launcher - Running 1 instances of WebDriver
[10:35:51] I/direct - Using ChromeDriver directly...

DevTools listening on ws://127.0.0.1:50702/devtools/browser/0a064627-26d9-4685-8945-209c66f48b3b
UUU.UUU.UUU.UUU.UUU.

Warnings:

1) Scenario: Validação de acessos # test\features\login.feature:17
   ? Dado Eu acesso a tela inicial do sistema Conciliação
       Undefined. Implement with the following snippet:

         Given('Eu acesso a tela inicial do sistema Conciliação', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Quando eu informo o '"apresentacao"' e a '"apresentacao"'
       Undefined. Implement with the following snippet:

         When('eu informo o {string} e a {string}', function (string, string2) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Então apresentada a mensagem '"SELECIONE UMA EMPRESA:"'
       Undefined. Implement with the following snippet:

         Then('apresentada a mensagem {string}', function (string) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:26

2) Scenario: Validação de acessos # test\features\login.feature:18
   ? Dado Eu acesso a tela inicial do sistema Conciliação
       Undefined. Implement with the following snippet:

         Given('Eu acesso a tela inicial do sistema Conciliação', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Quando eu informo o '"apresentacao"' e a '"xpto123"'
       Undefined. Implement with the following snippet:

         When('eu informo o {string} e a {string}', function (string, string2) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Então apresentada a mensagem '"Usuário e/ou senha inválidos!"'
       Undefined. Implement with the following snippet:

         Then('apresentada a mensagem {string}', function (string) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:26

3) Scenario: Validação de acessos # test\features\login.feature:19
   ? Dado Eu acesso a tela inicial do sistema Conciliação
       Undefined. Implement with the following snippet:

         Given('Eu acesso a tela inicial do sistema Conciliação', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Quando eu informo o '"xpto123"' e a '"apresentacao"'
       Undefined. Implement with the following snippet:

         When('eu informo o {string} e a {string}', function (string, string2) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Então apresentada a mensagem '"Usuário e/ou senha inválidos!"'
       Undefined. Implement with the following snippet:

         Then('apresentada a mensagem {string}', function (string) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:26

4) Scenario: Validação de acessos # test\features\login.feature:20
   ? Dado Eu acesso a tela inicial do sistema Conciliação
       Undefined. Implement with the following snippet:

         Given('Eu acesso a tela inicial do sistema Conciliação', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Quando eu informo o '"xpto123"' e a '"xpto123"'
       Undefined. Implement with the following snippet:

         When('eu informo o {string} e a {string}', function (string, string2) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Então apresentada a mensagem '"Usuário e/ou senha inválidos!"'
       Undefined. Implement with the following snippet:

         Then('apresentada a mensagem {string}', function (string) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:26

5) Scenario: Validação de acessos # test\features\login.feature:21
   ? Dado Eu acesso a tela inicial do sistema Conciliação
       Undefined. Implement with the following snippet:

         Given('Eu acesso a tela inicial do sistema Conciliação', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Quando eu informo o '"pandata"' e a '"pandata"'
       Undefined. Implement with the following snippet:

         When('eu informo o {string} e a {string}', function (string, string2) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Então apresentada a mensagem '"Usuário informado não está autorizado a usar este aplicativo."'
       Undefined. Implement with the following snippet:

         Then('apresentada a mensagem {string}', function (string) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:26

5 scenarios (5 undefined)
15 steps (15 undefined)
0m00.008s
[10:35:57] I/launcher - 0 instance(s) of WebDriver still running
[10:35:57] I/launcher - chrome #01 passed
Cucumber HTML report e2e/tests_result/cucumber_report.html generated successfully.

Configuration file protractor.config.js

exports.config = {

  framework: 'custom',  // set to "custom" instead of cucumber.
  frameworkPath: require.resolve('protractor-cucumber-framework'),  // path relative to the current config file
  baseUrl: 'http://10.0.7.13:8080',
  directConnect: true,

  onPrepare: function () {
    browser.manage().timeouts().implicitlyWait(1000);
    browser.ignoreSynchronization = true;

  },

  specs: [
    'test/features/*.feature'     // Specs here are the cucumber feature files
  ],    
  capabilities: {
    browserName: 'chrome'
  },    
  // cucumber command line options
  cucumberOpts: {
    require: ['test/features/steps/*.step.js'],
    format: ['json:results.json'],
    profile: false,
    'no-source': true
  },    
  afterLaunch: function () {
    var reporter = require('cucumber-html-reporter');

    var options = {
      theme: 'bootstrap',
      jsonFile: 'results.json',
      output: 'e2e/tests_result/cucumber_report.html',
      reportSuiteAsScenarios: true,
      launchReport: true
    };    
    reporter.generate(options);    
  }        
};

Login.step.js

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');

chai.use(chaiAsPromised);
var expect = chai.expect;


const LoginPage = require('../../page/login_page');
const CompanyPage = require('../../page/company_page');

module.exports = function() {

    const company = new CompanyPage();
    const login_page = new LoginPage();

    this.Given('Eu acesso a tela inicial do sistema Conciliação', function (callback) {
        browser.get(login_page.path);
        return null;
    });

    this.When('eu informo o {string} e a {string}', function (user1, pass1, callback) {
        login_page.login(user1, pass1);
        callback();
    });

    this.Then('apresentada a mensagem {string}', function (msg1, callback) {
        login_page.verifyMsgSuccess('SELECIONE UMA EMPRESA:');
        callback();
    });

    this.Then('apresentada a mensagem {string}', function (msg2,callback) {
        login_page.verifyMsgError('Usuário e/ou senha inválidos!');
        callback();
    });

    this.Then('apresentada a mensagem {string}', function (msg3,callback) {
        login_page.verifyMsgError('Usuário e/ou senha inválidos!');
        callback();
    });

    this.Then('apresentada a mensagem {string}', function (msg4,callback) {
        login_page.verifyMsgError('Usuário e/ou senha inválidos!');
        callback();
    });

    this.Then('apresentada a mensagem {string}', function (msg5,callback) {
        login_page.verifyMsgError('Usuário informado não está autorizado a usar este aplicativo.');
        callback();
    });
};
    
asked by anonymous 01.11.2018 / 14:39

0 answers