Skip to content

fix(gherkin): long text cuts off #3936

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
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/interfaces/gherkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function transformTable(table) {
let str = '';
for (const id in table.rows) {
const cells = table.rows[id].cells;
str += cells.map(c => c.value).map(c => c.slice(0, 15).padEnd(15)).join(' | ');
str += cells.map(c => c.value).map(c => c.padEnd(15)).join(' | ');
str += '\n';
}
return str;
Expand Down
9 changes: 9 additions & 0 deletions test/data/sandbox/features/tables.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ Feature: Checkout products
| Nuclear Bomb | Weapons | 100000 |
When I go to checkout
Then my order amount is $101205

Scenario: checkout 3 products with long name
Given I have products in my cart
| name | category | price |
| Harry Potter and the deathly hallows | Books | 5 |
| iPhone 5 | Smartphones | 1200 |
| Nuclear Bomb | Weapons | 100000 |
When I go to checkout
Then my order amount is $101205
10 changes: 10 additions & 0 deletions test/runner/bdd_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ describe('BDD Gherkin', () => {
});
});

it('should run feature with tables contain long text', (done) => {
exec(config_run_config('codecept.bdd.js') + ' --steps --grep "Checkout products"', (err, stdout, stderr) => { //eslint-disable-line
stdout.should.include('Given I have products in my cart');
stdout.should.include('name');
stdout.should.include('Harry Potter and the deathly hallows');
assert(!err);
done();
});
});

it('should run feature with long strings', (done) => {
exec(config_run_config('codecept.bdd.js') + ' --steps --grep "Checkout string"', (err, stdout, stderr) => { //eslint-disable-line
stdout.should.include('Given I have product described as');
Expand Down