Skip to content
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
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 ? child.scenario.keyword === currentLanguage.contexts.ScenarioOutline : child.scenario.keyword === 'Scenario Outline')) {
if (child.scenario && (currentLanguage ? currentLanguage.contexts.ScenarioOutline.includes(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
20 changes: 10 additions & 10 deletions test/data/sandbox/configs/translation/translation_test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Caratteristica('DevTo');
Funzionalità('DevTo')

Prima(() => {
console.log('Before');
});
console.log('Before')
})

lo_scenario('Simple translation test', () => {
console.log('Simple test');
});
Esempio('Simple translation test', () => {
console.log('Simple test')
})

Scenario('Simple translation test 2', () => {
console.log('Simple test 2');
});
console.log('Simple test 2')
})

Dopo(() => {
console.log('After');
});
console.log('After')
})
19 changes: 19 additions & 0 deletions test/data/sandbox/i18n/codecept.bdd.nl.js
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.nl.feature',
steps: ['./features/step_definitions/my_steps.nl.js'],
},
include: {},
bootstrap: false,
mocha: {},
name: 'sandbox',
translation: 'nl-NL',
}
16 changes: 16 additions & 0 deletions test/data/sandbox/i18n/features/examples.nl.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#language: nl
Functionaliteit: Checkout proces
Om producten te kopen
Als klant
Moet ik in staat zijn om meerdere producten te kopen

@i18n
Abstract Scenario: korting bestellen
Gegeven ik heb een product met een prijs van <price>$ in mijn winkelwagen
En de korting voor bestellingen van meer dan $20 is 10 %
Wanneer ik naar de kassa ga
Dan zou ik de totaalprijs van "<total>" $ moeten zien

Voorbeelden:
| price | total |
| 10 | 10.0 |
17 changes: 17 additions & 0 deletions test/data/sandbox/i18n/features/step_definitions/my_steps.nl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const I = actor()

Given('ik heb een product met een prijs van {int}$ in mijn winkelwagen', price => {
I.addItem(parseInt(price, 10))
})

Given('de korting voor bestellingen van meer dan ${int} is {int} %', (maxPrice, discount) => {
I.haveDiscountForPrice(maxPrice, discount)
})

When('ik naar de kassa ga', () => {
I.checkout()
})

Then('zou ik de totaalprijs van "{float}" $ moeten zien', price => {
I.seeSum(price)
})
20 changes: 20 additions & 0 deletions test/runner/bdd_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,25 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {
done()
})
})

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')
stdout.should.include('On Dan: zou ik de totaalprijs van "10.0" $ moeten zien')
stdout.should.include('On Gegeven: ik heb een product met een prijs van 10$ in mijn winkelwagen')
stdout.should.include('Ik add item 10')
stdout.should.include('On En: de korting voor bestellingen van meer dan $20 is 10 %')
stdout.should.include('Ik have discount for price 20, 10')
stdout.should.include('On Wanneer: ik naar de kassa ga')
stdout.should.include('Ik checkout')
stdout.should.include('On Dan: zou ik de totaalprijs van "10.0" $ moeten zien')
stdout.should.include('Ik see sum 10')
assert(!err)
done()
})
})
})
})
2 changes: 1 addition & 1 deletion test/unit/container_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Container', () => {
expect(container.translation()).to.be.instanceOf(Translation)
expect(container.translation().loaded).to.be.true
expect(container.translation().I).to.eql('io')
expect(container.translation().value('contexts').Feature).to.eql('Caratteristica')
expect(container.translation().value('contexts').Feature).to.eql('Funzionalità')
})

it('should create French translation', () => {
Expand Down
7 changes: 4 additions & 3 deletions translations/de-DE.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'de'

module.exports = {
I: 'Ich',
contexts: {
Feature: 'Funktionalität',
Scenario: 'Szenario',
ScenarioOutline: 'Szenariogrundriss',
...gherkinTranslations(langCode),
},
actions: {
amOutsideAngularApp: 'befinde_mich_außerhalb_der_angular_app',
Expand Down
7 changes: 4 additions & 3 deletions translations/fr-FR.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'fr'

module.exports = {
I: 'Je',
contexts: {
Feature: 'Fonctionnalité',
Scenario: 'Scénario',
ScenarioOutline: 'Plan du scénario',
...gherkinTranslations(langCode),
Before: 'Avant',
After: 'Après',
BeforeSuite: 'AvantLaSuite',
Expand Down
1 change: 1 addition & 0 deletions translations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ exports['pt-BR'] = require('./pt-BR')
exports['ru-RU'] = require('./ru-RU')
exports['zh-CN'] = require('./zh-CN')
exports['zh-TW'] = require('./zh-TW')
exports['nl-NL'] = require('./nl-NL')
7 changes: 4 additions & 3 deletions translations/it-IT.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'it'

module.exports = {
I: 'io',
contexts: {
Feature: 'Caratteristica',
Scenario: 'lo_scenario',
ScenarioOutline: 'Schema dello scenario',
...gherkinTranslations(langCode),
Before: 'Prima',
After: 'Dopo',
BeforeSuite: 'Prima_della_suite',
Expand Down
7 changes: 4 additions & 3 deletions translations/ja-JP.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'ja'

module.exports = {
I: '私は',
contexts: {
Feature: 'フィーチャ',
Scenario: 'シナリオ',
ScenarioOutline: 'シナリオアウトライン',
...gherkinTranslations(langCode),
},
actions: {
amOutsideAngularApp: 'Angularの外に出る',
Expand Down
76 changes: 76 additions & 0 deletions translations/nl-NL.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'nl'

module.exports = {
I: 'Ik',
contexts: {
...gherkinTranslations(langCode),
},
actions: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebo-zig may you help review this translation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Came to the conclusion that the Dutch language is a little bit strange after reviewing this 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah, I could imagine that as I asked help from chatgpt to translate them. Thanks for the review!

amOutsideAngularApp: 'ben_buiten_angular_app',
amInsideAngularApp: 'ben_binnen_angular_app',
waitForElement: 'wacht_op_element',
waitForClickable: 'wacht_tot_klikbaar',
waitForVisible: 'wacht_tot_zichtbaar',
waitForEnabled: 'wacht_tot_ingeschakeld',
waitForInvisible: 'wacht_tot_onzichtbaar',
waitInUrl: 'wacht_in_url',
waitForText: 'wacht_op_tekst',
moveTo: 'beweeg_de_cursor_naar',
refresh: 'vernieuw_pagina',
refreshPage: 'vernieuw_pagina',
haveModule: 'heb_module',
resetModule: 'reset_module',
amOnPage: 'ben_op_pagina',
click: 'klik',
doubleClick: 'dubbelklik',
see: 'zie',
dontSee: 'zie_niet',
selectOption: 'selecteer_optie',
fillField: 'vul_veld_in',
pressKey: 'druk_op_toets',
triggerMouseEvent: 'trigger_een_muis_event',
attachFile: 'voeg_bestand_toe',
seeInField: 'zie_in_veld',
dontSeeInField: 'zie_niet_in_veld',
appendField: 'voeg_toe_aan_veld',
checkOption: 'vink_optie_aan',
seeCheckboxIsChecked: 'zie_dat_checkbox_aangevinkt_is',
dontSeeCheckboxIsChecked: 'zie_niet_dat_checkbox_aangevinkt_is',
grabTextFrom: 'pak_tekst_van',
grabValueFrom: 'pak_waarde_van',
grabAttributeFrom: 'pak_attribuut_van',
seeInTitle: 'zie_in_titel',
dontSeeInTitle: 'zie_niet_in_titel',
grabTitle: 'pak_titel',
seeElement: 'zie_element',
dontSeeElement: 'zie_element_niet',
seeInSource: 'zie_in_broncode',
dontSeeInSource: 'zie_niet_in_broncode',
executeScript: 'voer_script_uit',
executeAsyncScript: 'voer_asynchroon_script_uit',
seeInCurrentUrl: 'zie_in_huidige_url',
dontSeeInCurrentUrl: 'zie_niet_in_huidige_url',
seeCurrentUrlEquals: 'zie_dat_url_gelijk_is',
dontSeeCurrentUrlEquals: 'zie_dat_url_niet_gelijk_is',
saveScreenshot: 'sla_screenshot_op',
setCookie: 'stel_cookie_in',
clearCookie: 'verwijder_cookie',
seeCookie: 'zie_cookie',
dontSeeCookie: 'zie_cookie_niet',
grabCookie: 'pak_cookie',
resizeWindow: 'verander_venstergrootte',
wait: 'wacht',
haveHeader: 'gebruik_http_header',
clearField: 'wis_veld',
dontSeeElementInDOM: 'zie_element_niet_in_DOM',
moveCursorTo: 'beweeg_de_cursor_naar',
scrollTo: 'scroll_naar',
sendGetRequest: 'doe_een_get_verzoek',
sendPutRequest: 'doe_een_put_verzoek',
sendDeleteRequest: 'doe_een_delete_verzoek',
sendDeleteRequestWithPayload: 'doe_een_delete_verzoek_met_payload',
sendPostRequest: 'doe_een_post_verzoek',
switchTo: 'wissel_naar_iframe',
},
}
7 changes: 4 additions & 3 deletions translations/pl-PL.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'pl'

module.exports = {
I: 'Ja',
contexts: {
Feature: 'Funkcja',
Scenario: 'Scenariusz',
ScenarioOutline: 'Szablon scenariusza',
...gherkinTranslations(langCode),
},
actions: {
amOutsideAngularApp: 'jestem_poza_aplikacją_angular',
Expand Down
7 changes: 4 additions & 3 deletions translations/pt-BR.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'pt'

module.exports = {
I: 'Eu',
contexts: {
Feature: 'Funcionalidade',
Scenario: 'Cenário',
ScenarioOutline: 'Esquema do Cenário',
...gherkinTranslations(langCode),
Before: 'Antes',
After: 'Depois',
BeforeSuite: 'AntesDaSuite',
Expand Down
7 changes: 4 additions & 3 deletions translations/ru-RU.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'ru'

module.exports = {
I: 'Я',
contexts: {
Feature: 'Цель',
Scenario: 'Сценарий',
ScenarioOutline: 'Структура сценария',
...gherkinTranslations(langCode),
Before: 'Начало',
After: 'Конец',
BeforeSuite: 'Перед_всем',
Expand Down
9 changes: 9 additions & 0 deletions translations/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports.gherkinTranslations = function (langCode) {
const gherkinLanguages = require('@cucumber/gherkin/src/gherkin-languages.json')
const { feature, scenario, scenarioOutline } = gherkinLanguages[langCode]
return {
Feature: feature[0],
Scenario: scenario[0],
ScenarioOutline: scenarioOutline[0],
}
}
7 changes: 4 additions & 3 deletions translations/zh-CN.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'zh-CN'

module.exports = {
I: '我',
contexts: {
Feature: '功能',
Scenario: '场景',
ScenarioOutline: '场景大纲',
...gherkinTranslations(langCode),
},
actions: {
amOutsideAngularApp: '在Angular应用外',
Expand Down
7 changes: 4 additions & 3 deletions translations/zh-TW.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { gherkinTranslations } = require('./utils')
const langCode = 'zh-TW'

module.exports = {
I: '我',
contexts: {
Feature: '功能',
Scenario: '場景',
ScenarioOutline: '場景大綱',
...gherkinTranslations(langCode),
},
actions: {
amOutsideAngularApp: '在Angular應用外',
Expand Down
Loading