Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: 5070 issue #5071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mocha/gherkin.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports = (text, file) => {
)
continue
}
if (child.scenario && (currentLanguage ? currentLanguage.contexts.ScenarioOutline.includes(child.scenario.keyword) : child.scenario.keyword === 'Scenario Outline')) {
if (child.scenario && (currentLanguage ? currentLanguage.contexts.ScenarioOutline === child.scenario.keyword : child.scenario.keyword === 'Scenario Outline')) {
for (const examples of child.scenario.examples) {
const fields = examples.tableHeader.cells.map(c => c.value)
for (const example of examples.tableBody) {
Expand Down
19 changes: 19 additions & 0 deletions test/data/sandbox/i18n/codecept.bdd.pt-br.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exports.config = {
tests: './*_no_test.js',
timeout: 10000,
output: '../output',
helpers: {
BDD: {
require: '../support/bdd_helper.js',
},
},
gherkin: {
features: './features/examples.pt-br.feature',
steps: ['./features/step_definitions/my_steps.pt-br.js'],
},
include: {},
bootstrap: false,
mocha: {},
name: 'sandbox',
translation: 'pt-BR',
}
19 changes: 19 additions & 0 deletions test/data/sandbox/i18n/features/examples.pt-br.feature
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#language: pt

@i18n
Funcionalidade: Teste de Cenário e Esquema do Cenário

Cenário: Cenário simples
Dado que inicio meu teste
Quando faço algo
Então acontece alguma coisa

@i18n
Esquema do Cenário: Cenário com exemplos
Dado que estou com o usuário "<usuário>"
Quando faço algo com o usuário
Então acontece alguma coisa
Exemplos:
| usuário |
| Um |
| Dois |
25 changes: 25 additions & 0 deletions test/data/sandbox/i18n/features/step_definitions/my_steps.pt-br.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const I = actor()

Given('que inicio meu teste', function () {
// Simula início do teste
})

When('faço algo', function () {
// Simula ação
})

Then('acontece alguma coisa', function () {
// Simula verificação
})

Given('que estou com o usuário {string}', function (usuario) {
// Simula usuário
})

When('faço algo com o usuário', function () {
// Simula ação com usuário
})

Then('acontece alguma coisa', function () {
// Simula verificação
})
17 changes: 16 additions & 1 deletion test/runner/bdd_test.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {

it('should run feature files in NL', done => {
exec(config_run_config('codecept.bdd.nl.js') + ' --steps --grep "@i18n"', (err, stdout, stderr) => {
console.log(stdout)
stdout.should.include('On Gegeven: ik heb een product met een prijs van 10$ in mijn winkelwagen')
stdout.should.include('On En: de korting voor bestellingen van meer dan 20ドル is 10 %')
stdout.should.include('On Wanneer: ik naar de kassa ga')
Expand All @@ -373,5 +372,21 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {
done()
})
})

it('should run feature files in PT-BR', done => {
exec(config_run_config('codecept.bdd.pt-br.js') + ' --steps --grep "@i18n"', (err, stdout, stderr) => {
stdout.should.include('On Dado: que inicio meu teste')
stdout.should.include('On Quando: faço algo')
stdout.should.include('On Então: acontece alguma coisa')
stdout.should.include('On Dado: que estou com o usuário "um"')
stdout.should.include('On Quando: faço algo com o usuário')
stdout.should.include('On Dado: que estou com o usuário "dois"')
stdout.should.include('Cenário simples')
stdout.should.include('Cenário com exemplos')
stdout.should.match(/OK \| 3 passed/)
assert(!err)
done()
})
})
})
})
Loading

AltStyle によって変換されたページ (->オリジナル) /