Skip to content

Commit 220b73f

Browse files
authored
fix: 5070 issue (#5071)
1 parent e090eb9 commit 220b73f

File tree

5 files changed

+80
-2
lines changed

5 files changed

+80
-2
lines changed

lib/mocha/gherkin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ module.exports = (text, file) => {
107107
)
108108
continue
109109
}
110-
if (child.scenario && (currentLanguage ? currentLanguage.contexts.ScenarioOutline.includes(child.scenario.keyword) : child.scenario.keyword === 'Scenario Outline')) {
110+
if (child.scenario && (currentLanguage ? currentLanguage.contexts.ScenarioOutline === child.scenario.keyword : child.scenario.keyword === 'Scenario Outline')) {
111111
for (const examples of child.scenario.examples) {
112112
const fields = examples.tableHeader.cells.map(c => c.value)
113113
for (const example of examples.tableBody) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
exports.config = {
2+
tests: './*_no_test.js',
3+
timeout: 10000,
4+
output: '../output',
5+
helpers: {
6+
BDD: {
7+
require: '../support/bdd_helper.js',
8+
},
9+
},
10+
gherkin: {
11+
features: './features/examples.pt-br.feature',
12+
steps: ['./features/step_definitions/my_steps.pt-br.js'],
13+
},
14+
include: {},
15+
bootstrap: false,
16+
mocha: {},
17+
name: 'sandbox',
18+
translation: 'pt-BR',
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#language: pt
2+
3+
@i18n
4+
Funcionalidade: Teste de Cenário e Esquema do Cenário
5+
6+
Cenário: Cenário simples
7+
Dado que inicio meu teste
8+
Quando faço algo
9+
Então acontece alguma coisa
10+
11+
@i18n
12+
Esquema do Cenário: Cenário com exemplos
13+
Dado que estou com o usuário "<usuário>"
14+
Quando faço algo com o usuário
15+
Então acontece alguma coisa
16+
Exemplos:
17+
| usuário |
18+
| Um |
19+
| Dois |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const I = actor()
2+
3+
Given('que inicio meu teste', function () {
4+
// Simula início do teste
5+
})
6+
7+
When('faço algo', function () {
8+
// Simula ação
9+
})
10+
11+
Then('acontece alguma coisa', function () {
12+
// Simula verificação
13+
})
14+
15+
Given('que estou com o usuário {string}', function (usuario) {
16+
// Simula usuário
17+
})
18+
19+
When('faço algo com o usuário', function () {
20+
// Simula ação com usuário
21+
})
22+
23+
Then('acontece alguma coisa', function () {
24+
// Simula verificação
25+
})

test/runner/bdd_test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {
356356

357357
it('should run feature files in NL', done => {
358358
exec(config_run_config('codecept.bdd.nl.js') + ' --steps --grep "@i18n"', (err, stdout, stderr) => {
359-
console.log(stdout)
360359
stdout.should.include('On Gegeven: ik heb een product met een prijs van 10$ in mijn winkelwagen')
361360
stdout.should.include('On En: de korting voor bestellingen van meer dan $20 is 10 %')
362361
stdout.should.include('On Wanneer: ik naar de kassa ga')
@@ -373,5 +372,21 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {
373372
done()
374373
})
375374
})
375+
376+
it('should run feature files in PT-BR', done => {
377+
exec(config_run_config('codecept.bdd.pt-br.js') + ' --steps --grep "@i18n"', (err, stdout, stderr) => {
378+
stdout.should.include('On Dado: que inicio meu teste')
379+
stdout.should.include('On Quando: faço algo')
380+
stdout.should.include('On Então: acontece alguma coisa')
381+
stdout.should.include('On Dado: que estou com o usuário "um"')
382+
stdout.should.include('On Quando: faço algo com o usuário')
383+
stdout.should.include('On Dado: que estou com o usuário "dois"')
384+
stdout.should.include('Cenário simples')
385+
stdout.should.include('Cenário com exemplos')
386+
stdout.should.match(/OK \| 3 passed/)
387+
assert(!err)
388+
done()
389+
})
390+
})
376391
})
377392
})

0 commit comments

Comments
 (0)