Skip to content

Commit 01b94fd

Browse files
authored
fix: long text cuts off (#3936)
1 parent 18be8a2 commit 01b94fd

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Diff for: lib/interfaces/gherkin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function transformTable(table) {
141141
let str = '';
142142
for (const id in table.rows) {
143143
const cells = table.rows[id].cells;
144-
str += cells.map(c => c.value).map(c => c.slice(0, 15).padEnd(15)).join(' | ');
144+
str += cells.map(c => c.value).map(c => c.padEnd(15)).join(' | ');
145145
str += '\n';
146146
}
147147
return str;

Diff for: test/data/sandbox/features/tables.feature

+9
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ Feature: Checkout products
1111
| Nuclear Bomb | Weapons | 100000 |
1212
When I go to checkout
1313
Then my order amount is $101205
14+
15+
Scenario: checkout 3 products with long name
16+
Given I have products in my cart
17+
| name | category | price |
18+
| Harry Potter and the deathly hallows | Books | 5 |
19+
| iPhone 5 | Smartphones | 1200 |
20+
| Nuclear Bomb | Weapons | 100000 |
21+
When I go to checkout
22+
Then my order amount is $101205

Diff for: test/runner/bdd_test.js

+10
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ describe('BDD Gherkin', () => {
112112
});
113113
});
114114

115+
it('should run feature with tables contain long text', (done) => {
116+
exec(config_run_config('codecept.bdd.js') + ' --steps --grep "Checkout products"', (err, stdout, stderr) => { //eslint-disable-line
117+
stdout.should.include('Given I have products in my cart');
118+
stdout.should.include('name');
119+
stdout.should.include('Harry Potter and the deathly hallows');
120+
assert(!err);
121+
done();
122+
});
123+
});
124+
115125
it('should run feature with long strings', (done) => {
116126
exec(config_run_config('codecept.bdd.js') + ' --steps --grep "Checkout string"', (err, stdout, stderr) => { //eslint-disable-line
117127
stdout.should.include('Given I have product described as');

0 commit comments

Comments
 (0)