File tree Expand file tree Collapse file tree 2 files changed +54
-5
lines changed Expand file tree Collapse file tree 2 files changed +54
-5
lines changed Original file line number Diff line number Diff line change 1+ import { faker } from '@faker-js/faker' ;
2+ import transform from '../transform.js' ;
3+
4+ /**
5+ * Use the `@faker-js/faker` package to generate fake data inside examples on your gherkin tests
6+ *
7+ * #### Usage
8+ *
9+ * To start please install `@faker-js/faker` package
10+ *
11+ * ```
12+ * npm install -D @faker-js/faker
13+ * ```
14+ *
15+ * ```
16+ * yarn add -D @faker-js/faker
17+ * ```
18+ *
19+ * Add this plugin to config file:
20+ *
21+ * ```js
22+ * plugins: {
23+ * fakerTransform: {
24+ * enabled: true
25+ * }
26+ * }
27+ * ```
28+ *
29+ * Add the faker API using a mustache string format inside examples tables in your gherkin scenario outline
30+ *
31+ * ```feature
32+ * Scenario Outline: ...
33+ * Given ...
34+ * When ...
35+ * Then ...
36+ * Examples:
37+ * | productName | customer | email | anythingMore |
38+ * | {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData |
39+ * ```
40+ *
41+ */
42+ export default function ( config ) {
43+ transform . addTransformerBeforeAll ( 'gherkin.examples' , value => {
44+ if ( typeof value === 'string' && value . length > 0 ) {
45+ return faker . helpers . fake ( value ) ;
46+ }
47+ return value ;
48+ } ) ;
49+ }
Original file line number Diff line number Diff line change 1- import Helper from '@ codeceptjs/helper'
2- import crypto from 'crypto'
3- import fs from 'fs'
1+ import Helper from 'codeceptjs/lib/ helper.js' ;
2+ import crypto from 'crypto' ;
3+ import fs from 'fs' ;
44
55class ScreenshotSessionHelper extends Helper {
66 constructor ( config ) {
7- super ( config )
8- this . outputPath = global . output_dir
7+ super ( config ) ;
8+ this . outputPath = global . output_dir ;
99 }
1010
1111 getSHA256Digests ( files = [ ] ) {
You can’t perform that action at this time.
0 commit comments