Home Protractor + Cucumber + NodeJs - How to change default language of the feature
Reply: 0

Protractor + Cucumber + NodeJs - How to change default language of the feature

esborges
1#
esborges Published in 2017-11-14 16:04:06Z

How to change default language of the feature. I put the information "#language: pt" and didn't work. The message error is: Unhandled rejection TypeError: Dado is not a function.

Feature:

#language: pt
#encoding: iso-8859-1
Funcionalidade: Angular Task List
  Como um usuário básico
  Eu quero acessar
  Para verificar o site

  Cenário: Protractor and Cucumber Test
    Dado Eu vou para "https://angularjs.org/"
    Quando Eu adiono "Be Awesome"
    Quando Eu clico no botão adicionar
    Entao Eu verifico a operação

The step definition file.

stepDefinitions.js

// features/step_definitions/stepDefinitions.js
var seleniumWebdriver = require('selenium-webdriver');
var {defineSupportCode} = require('cucumber');
var angularPage = require('../pages/homePage.js');
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');

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

defineSupportCode(function({Dado, Quando, Entao, setDefaultTimeout}) {
  setDefaultTimeout(100 * 1000);
  Dado('Eu vou para {stringInDoubleQuotes}', function (site, next) {
    angularPage.go(site);
    expect(browser.getTitle()).to.eventually.equal('AngularJS — Superheroic JavaScript MVW Framework').and.notify(next);
  });

  Quando('Eu adiono {stringInDoubleQuotes}', function (task, next) {
    angularPage.addTask(task);
    next();
  });

  Quando('Eu clico no botão adicionar', function (next) {
    angularPage.submitTask();
    next();
  });

  Entao('Eu verifico a operação', function (next) {
    var todoList = angularPage.angularHomepage.todoList;
    expect(todoList.count()).to.eventually.equal(3);
    expect(todoList.get(2).getText()).to.eventually.equal('Be Awesome').and.notify(next);
  });
});

The console error.

Issue

D:\projetos\protractor\cucumber-protractor-harness-master>protractor cucumber.conf.js
(node:7576) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[12:18:03] I/launcher - Running 1 instances of WebDriver
[12:18:03] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
Unhandled rejection TypeError: Dado is not a function
    at D:\projetos\protractor\cucumber-protractor-harness-master\features\step_definitions\stepDefinitions.js:13:3
    at D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\cucumber\lib\support_code_library\builder.js:77:12
    at Array.forEach (<anonymous>)
    at Object.build (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\cucumber\lib\support_code_library\builder.js:76:7)
    at Cli.getSupportCodeLibrary (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\cucumber\lib\cli\index.js:137:32)
    at Cli.<anonymous> (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\cucumber\lib\cli\index.js:144:39)
    at Generator.next (<anonymous>)
    at Generator.tryCatcher (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\util.js:16:23)
    at PromiseSpawn._promiseFulfilled (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\generators.js:97:49)
    at Promise._settlePromise (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\promise.js:574:26)
    at Promise._settlePromise0 (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (D:\projetos\protractor\cucumber-protractor-harness-master\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:789:20)

When I run the test an issue is caught.

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304527 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO