Skip to content

Commit

Permalink
fix: failed UT
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Oct 18, 2023
1 parent 8bac9c9 commit a740e1d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
exports.config = {
tests: './*_no_test.js',
timeout: 10000,
output: './output',
output: '../output',
helpers: {
BDD: {
require: './support/bdd_helper.js',
require: '../support/bdd_helper.js',
},
},
gherkin: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Funktionalität: Checkout-Prozess
Als Kunde
Möchte ich in der Lage sein, mehrere Produkte zu kaufen

@i18n @fail
@i18n
Szenariogrundriss: Bestellrabatt
Angenommen ich habe ein Produkt mit einem Preis von <price>$ in meinem Warenkorb
Und der Rabatt für Bestellungen über $20 beträgt 10 %
Expand Down
17 changes: 17 additions & 0 deletions test/data/sandbox/i18n/features/step_definitions/my_steps.de.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const I = actor();

Given('ich habe ein Produkt mit einem Preis von {int}$ in meinem Warenkorb', (price) => {
I.addItem(parseInt(price, 10));
});

Given('der Rabatt für Bestellungen über $\{int} beträgt {int} %', (maxPrice, discount) => { // eslint-disable-line
I.haveDiscountForPrice(maxPrice, discount);
});

When('ich zur Kasse gehe', () => {
I.checkout();
});

Then('sollte ich den Gesamtpreis von "{float}" $ sehen', (price) => {
I.seeSum(price);
});
6 changes: 6 additions & 0 deletions test/runner/bdd_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ When(/^I define a step with a \\( paren and a "(.*?)" string$/, () => {
});

describe('i18n', () => {
const codecept_dir = path.join(__dirname, '/../data/sandbox/i18n');
const config_run_config = config => `${codecept_run} --config ${codecept_dir}/${config}`;

before(() => {
process.chdir(codecept_dir);
});
it('should run feature files in DE', (done) => {
exec(config_run_config('codecept.bdd.de.js') + ' --steps --grep "@i18n"', (err, stdout, stderr) => { //eslint-disable-line
stdout.should.include('On Angenommen: ich habe ein produkt mit einem preis von 10$ in meinem warenkorb');
Expand Down

0 comments on commit a740e1d

Please sign in to comment.