codeceptjs 3.7.0-beta.10 → 3.7.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/codecept.js +12 -10
- package/lib/command/gherkin/snippets.js +69 -69
- package/lib/command/run-multiple/chunk.js +48 -45
- package/lib/container.js +14 -9
- package/lib/mocha/gherkin.js +1 -1
- package/lib/plugin/auth.js +435 -0
- package/lib/plugin/autoLogin.js +3 -337
- package/lib/step/base.js +5 -0
- package/lib/step/comment.js +10 -0
- package/package.json +12 -13
- package/translations/de-DE.js +4 -3
- package/translations/fr-FR.js +4 -3
- package/translations/index.js +1 -0
- package/translations/it-IT.js +4 -3
- package/translations/ja-JP.js +4 -3
- package/translations/nl-NL.js +76 -0
- package/translations/pl-PL.js +4 -3
- package/translations/pt-BR.js +4 -3
- package/translations/ru-RU.js +4 -3
- package/translations/utils.js +9 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/promiseBasedTypes.d.ts +0 -152
- package/typings/types.d.ts +74 -153
package/lib/plugin/autoLogin.js
CHANGED
|
@@ -1,339 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const { fileExists } = require('../utils')
|
|
4
|
-
const container = require('../container')
|
|
5
|
-
const store = require('../store')
|
|
6
|
-
const recorder = require('../recorder')
|
|
7
|
-
const { debug } = require('../output')
|
|
8
|
-
const isAsyncFunction = require('../utils').isAsyncFunction
|
|
1
|
+
const auth = require('./auth')
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
fetch: I => I.grabCookie(),
|
|
12
|
-
check: () => {},
|
|
13
|
-
restore: (I, cookies) => {
|
|
14
|
-
I.amOnPage('/') // open a page
|
|
15
|
-
I.setCookie(cookies)
|
|
16
|
-
},
|
|
17
|
-
}
|
|
3
|
+
console.log('autoLogin plugin was renamed to auth plugin. Please update your config.')
|
|
18
4
|
|
|
19
|
-
|
|
20
|
-
saveToFile: false,
|
|
21
|
-
inject: 'login',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Logs user in for the first test and reuses session for next tests.
|
|
26
|
-
* Works by saving cookies into memory or file.
|
|
27
|
-
* If a session expires automatically logs in again.
|
|
28
|
-
*
|
|
29
|
-
* > For better development experience cookies can be saved into file, so a session can be reused while writing tests.
|
|
30
|
-
*
|
|
31
|
-
* #### Usage
|
|
32
|
-
*
|
|
33
|
-
* 1. Enable this plugin and configure as described below
|
|
34
|
-
* 2. Define user session names (example: `user`, `editor`, `admin`, etc).
|
|
35
|
-
* 3. Define how users are logged in and how to check that user is logged in
|
|
36
|
-
* 4. Use `login` object inside your tests to log in:
|
|
37
|
-
*
|
|
38
|
-
* ```js
|
|
39
|
-
* // inside a test file
|
|
40
|
-
* // use login to inject auto-login function
|
|
41
|
-
* Feature('Login');
|
|
42
|
-
*
|
|
43
|
-
* Before(({ login }) => {
|
|
44
|
-
* login('user'); // login using user session
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* // Alternatively log in for one scenario.
|
|
48
|
-
* Scenario('log me in', ( { I, login } ) => {
|
|
49
|
-
* login('admin');
|
|
50
|
-
* I.see('I am logged in');
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* #### Configuration
|
|
55
|
-
*
|
|
56
|
-
* * `saveToFile` (default: false) - save cookies to file. Allows to reuse session between execution.
|
|
57
|
-
* * `inject` (default: `login`) - name of the login function to use
|
|
58
|
-
* * `users` - an array containing different session names and functions to:
|
|
59
|
-
* * `login` - sign in into the system
|
|
60
|
-
* * `check` - check that user is logged in
|
|
61
|
-
* * `fetch` - to get current cookies (by default `I.grabCookie()`)
|
|
62
|
-
* * `restore` - to set cookies (by default `I.amOnPage('/'); I.setCookie(cookie)`)
|
|
63
|
-
*
|
|
64
|
-
* #### How It Works
|
|
65
|
-
*
|
|
66
|
-
* 1. `restore` method is executed. It should open a page and set credentials.
|
|
67
|
-
* 2. `check` method is executed. It should reload a page (so cookies are applied) and check that this page belongs to logged-in user. When you pass the second args `session`, you could perform the validation using passed session.
|
|
68
|
-
* 3. If `restore` and `check` were not successful, `login` is executed
|
|
69
|
-
* 4. `login` should fill in login form
|
|
70
|
-
* 5. After successful login, `fetch` is executed to save cookies into memory or file.
|
|
71
|
-
*
|
|
72
|
-
* #### Example: Simple login
|
|
73
|
-
*
|
|
74
|
-
* ```js
|
|
75
|
-
* autoLogin: {
|
|
76
|
-
* enabled: true,
|
|
77
|
-
* saveToFile: true,
|
|
78
|
-
* inject: 'login',
|
|
79
|
-
* users: {
|
|
80
|
-
* admin: {
|
|
81
|
-
* // loginAdmin function is defined in `steps_file.js`
|
|
82
|
-
* login: (I) => I.loginAdmin(),
|
|
83
|
-
* // if we see `Admin` on page, we assume we are logged in
|
|
84
|
-
* check: (I) => {
|
|
85
|
-
* I.amOnPage('/');
|
|
86
|
-
* I.see('Admin');
|
|
87
|
-
* }
|
|
88
|
-
* }
|
|
89
|
-
* }
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* #### Example: Multiple users
|
|
94
|
-
*
|
|
95
|
-
* ```js
|
|
96
|
-
* autoLogin: {
|
|
97
|
-
* enabled: true,
|
|
98
|
-
* saveToFile: true,
|
|
99
|
-
* inject: 'loginAs', // use `loginAs` instead of login
|
|
100
|
-
* users: {
|
|
101
|
-
* user: {
|
|
102
|
-
* login: (I) => {
|
|
103
|
-
* I.amOnPage('/login');
|
|
104
|
-
* I.fillField('email', 'user@site.com');
|
|
105
|
-
* I.fillField('password', '123456');
|
|
106
|
-
* I.click('Login');
|
|
107
|
-
* },
|
|
108
|
-
* check: (I) => {
|
|
109
|
-
* I.amOnPage('/');
|
|
110
|
-
* I.see('User', '.navbar');
|
|
111
|
-
* },
|
|
112
|
-
* },
|
|
113
|
-
* admin: {
|
|
114
|
-
* login: (I) => {
|
|
115
|
-
* I.amOnPage('/login');
|
|
116
|
-
* I.fillField('email', 'admin@site.com');
|
|
117
|
-
* I.fillField('password', '123456');
|
|
118
|
-
* I.click('Login');
|
|
119
|
-
* },
|
|
120
|
-
* check: (I) => {
|
|
121
|
-
* I.amOnPage('/');
|
|
122
|
-
* I.see('Admin', '.navbar');
|
|
123
|
-
* },
|
|
124
|
-
* },
|
|
125
|
-
* }
|
|
126
|
-
* }
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* #### Example: Keep cookies between tests
|
|
130
|
-
*
|
|
131
|
-
* If you decide to keep cookies between tests you don't need to save/retrieve cookies between tests.
|
|
132
|
-
* But you need to login once work until session expires.
|
|
133
|
-
* For this case, disable `fetch` and `restore` methods.
|
|
134
|
-
*
|
|
135
|
-
* ```js
|
|
136
|
-
* helpers: {
|
|
137
|
-
* WebDriver: {
|
|
138
|
-
* // config goes here
|
|
139
|
-
* keepCookies: true; // keep cookies for all tests
|
|
140
|
-
* }
|
|
141
|
-
* },
|
|
142
|
-
* plugins: {
|
|
143
|
-
* autoLogin: {
|
|
144
|
-
* users: {
|
|
145
|
-
* admin: {
|
|
146
|
-
* login: (I) => {
|
|
147
|
-
* I.amOnPage('/login');
|
|
148
|
-
* I.fillField('email', 'admin@site.com');
|
|
149
|
-
* I.fillField('password', '123456');
|
|
150
|
-
* I.click('Login');
|
|
151
|
-
* },
|
|
152
|
-
* check: (I) => {
|
|
153
|
-
* I.amOnPage('/dashboard');
|
|
154
|
-
* I.see('Admin', '.navbar');
|
|
155
|
-
* },
|
|
156
|
-
* fetch: () => {}, // empty function
|
|
157
|
-
* restore: () => {}, // empty funciton
|
|
158
|
-
* }
|
|
159
|
-
* }
|
|
160
|
-
* }
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* #### Example: Getting sessions from local storage
|
|
165
|
-
*
|
|
166
|
-
* If your session is stored in local storage instead of cookies you still can obtain sessions.
|
|
167
|
-
*
|
|
168
|
-
* ```js
|
|
169
|
-
* plugins: {
|
|
170
|
-
* autoLogin: {
|
|
171
|
-
* admin: {
|
|
172
|
-
* login: (I) => I.loginAsAdmin(),
|
|
173
|
-
* check: (I) => I.see('Admin', '.navbar'),
|
|
174
|
-
* fetch: (I) => {
|
|
175
|
-
* return I.executeScript(() => localStorage.getItem('session_id'));
|
|
176
|
-
* },
|
|
177
|
-
* restore: (I, session) => {
|
|
178
|
-
* I.amOnPage('/');
|
|
179
|
-
* I.executeScript((session) => localStorage.setItem('session_id', session), session);
|
|
180
|
-
* },
|
|
181
|
-
* }
|
|
182
|
-
* }
|
|
183
|
-
* }
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* #### Tips: Using async function in the autoLogin
|
|
187
|
-
*
|
|
188
|
-
* If you use async functions in the autoLogin plugin, login function should be used with `await` keyword.
|
|
189
|
-
*
|
|
190
|
-
* ```js
|
|
191
|
-
* autoLogin: {
|
|
192
|
-
* enabled: true,
|
|
193
|
-
* saveToFile: true,
|
|
194
|
-
* inject: 'login',
|
|
195
|
-
* users: {
|
|
196
|
-
* admin: {
|
|
197
|
-
* login: async (I) => { // If you use async function in the autoLogin plugin
|
|
198
|
-
* const phrase = await I.grabTextFrom('#phrase')
|
|
199
|
-
* I.fillField('username', 'admin'),
|
|
200
|
-
* I.fillField('password', 'password')
|
|
201
|
-
* I.fillField('phrase', phrase)
|
|
202
|
-
* },
|
|
203
|
-
* check: (I) => {
|
|
204
|
-
* I.amOnPage('/');
|
|
205
|
-
* I.see('Admin');
|
|
206
|
-
* },
|
|
207
|
-
* }
|
|
208
|
-
* }
|
|
209
|
-
* }
|
|
210
|
-
* ```
|
|
211
|
-
*
|
|
212
|
-
* ```js
|
|
213
|
-
* Scenario('login', async ( {I, login} ) => {
|
|
214
|
-
* await login('admin') // you should use `await`
|
|
215
|
-
* })
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* #### Tips: Using session to validate user
|
|
219
|
-
*
|
|
220
|
-
* Instead of asserting on page elements for the current user in `check`, you can use the `session` you saved in `fetch`
|
|
221
|
-
*
|
|
222
|
-
* ```js
|
|
223
|
-
* autoLogin: {
|
|
224
|
-
* enabled: true,
|
|
225
|
-
* saveToFile: true,
|
|
226
|
-
* inject: 'login',
|
|
227
|
-
* users: {
|
|
228
|
-
* admin: {
|
|
229
|
-
* login: async (I) => { // If you use async function in the autoLogin plugin
|
|
230
|
-
* const phrase = await I.grabTextFrom('#phrase')
|
|
231
|
-
* I.fillField('username', 'admin'),
|
|
232
|
-
* I.fillField('password', 'password')
|
|
233
|
-
* I.fillField('phrase', phrase)
|
|
234
|
-
* },
|
|
235
|
-
* check: (I, session) => {
|
|
236
|
-
* // Throwing an error in `check` will make CodeceptJS perform the login step for the user
|
|
237
|
-
* if (session.profile.email !== the.email.you.expect@some-mail.com) {
|
|
238
|
-
* throw new Error ('Wrong user signed in');
|
|
239
|
-
* }
|
|
240
|
-
* },
|
|
241
|
-
* }
|
|
242
|
-
* }
|
|
243
|
-
* }
|
|
244
|
-
* ```
|
|
245
|
-
*
|
|
246
|
-
* ```js
|
|
247
|
-
* Scenario('login', async ( {I, login} ) => {
|
|
248
|
-
* await login('admin') // you should use `await`
|
|
249
|
-
* })
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*/
|
|
253
|
-
module.exports = function (config) {
|
|
254
|
-
config = Object.assign(defaultConfig, config)
|
|
255
|
-
Object.keys(config.users).map(
|
|
256
|
-
u =>
|
|
257
|
-
(config.users[u] = {
|
|
258
|
-
...defaultUser,
|
|
259
|
-
...config.users[u],
|
|
260
|
-
}),
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
if (config.saveToFile) {
|
|
264
|
-
// loading from file
|
|
265
|
-
for (const name in config.users) {
|
|
266
|
-
const fileName = path.join(global.output_dir, `${name}_session.json`)
|
|
267
|
-
if (!fileExists(fileName)) continue
|
|
268
|
-
const data = fs.readFileSync(fileName).toString()
|
|
269
|
-
try {
|
|
270
|
-
store[`${name}_session`] = JSON.parse(data)
|
|
271
|
-
} catch (err) {
|
|
272
|
-
throw new Error(`Could not load session from ${fileName}\n${err}`)
|
|
273
|
-
}
|
|
274
|
-
debug(`Loaded user session for ${name}`)
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const loginFunction = async name => {
|
|
279
|
-
const userSession = config.users[name]
|
|
280
|
-
const I = container.support('I')
|
|
281
|
-
const cookies = store[`${name}_session`]
|
|
282
|
-
const shouldAwait = isAsyncFunction(userSession.login) || isAsyncFunction(userSession.restore) || isAsyncFunction(userSession.check)
|
|
283
|
-
|
|
284
|
-
const loginAndSave = async () => {
|
|
285
|
-
if (shouldAwait) {
|
|
286
|
-
await userSession.login(I)
|
|
287
|
-
} else {
|
|
288
|
-
userSession.login(I)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const cookies = await userSession.fetch(I)
|
|
292
|
-
if (!cookies) {
|
|
293
|
-
debug("Cannot save user session with empty cookies from auto login's fetch method")
|
|
294
|
-
return
|
|
295
|
-
}
|
|
296
|
-
if (config.saveToFile) {
|
|
297
|
-
debug(`Saved user session into file for ${name}`)
|
|
298
|
-
fs.writeFileSync(path.join(global.output_dir, `${name}_session.json`), JSON.stringify(cookies))
|
|
299
|
-
}
|
|
300
|
-
store[`${name}_session`] = cookies
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (!cookies) return loginAndSave()
|
|
304
|
-
|
|
305
|
-
recorder.session.start('check login')
|
|
306
|
-
if (shouldAwait) {
|
|
307
|
-
await userSession.restore(I, cookies)
|
|
308
|
-
await userSession.check(I, cookies)
|
|
309
|
-
} else {
|
|
310
|
-
userSession.restore(I, cookies)
|
|
311
|
-
userSession.check(I, cookies)
|
|
312
|
-
}
|
|
313
|
-
recorder.session.catch(err => {
|
|
314
|
-
debug(`Failed auto login for ${name} due to ${err}`)
|
|
315
|
-
debug('Logging in again')
|
|
316
|
-
recorder.session.start('auto login')
|
|
317
|
-
return loginAndSave()
|
|
318
|
-
.then(() => {
|
|
319
|
-
recorder.add(() => recorder.session.restore('auto login'))
|
|
320
|
-
recorder.catch(() => debug('continue'))
|
|
321
|
-
})
|
|
322
|
-
.catch(err => {
|
|
323
|
-
recorder.session.restore('auto login')
|
|
324
|
-
recorder.session.restore('check login')
|
|
325
|
-
recorder.throw(err)
|
|
326
|
-
})
|
|
327
|
-
})
|
|
328
|
-
recorder.add(() => {
|
|
329
|
-
recorder.session.restore('check login')
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
return recorder.promise()
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// adding this to DI container
|
|
336
|
-
const support = {}
|
|
337
|
-
support[config.inject] = loginFunction
|
|
338
|
-
container.append({ support })
|
|
339
|
-
}
|
|
5
|
+
module.exports = auth
|
package/lib/step/base.js
CHANGED
|
@@ -2,6 +2,7 @@ const color = require('chalk')
|
|
|
2
2
|
const Secret = require('../secret')
|
|
3
3
|
const { getCurrentTimeout } = require('../timeout')
|
|
4
4
|
const { ucfirst, humanizeString, serializeError } = require('../utils')
|
|
5
|
+
const recordStep = require('./record')
|
|
5
6
|
|
|
6
7
|
const STACK_LINE = 5
|
|
7
8
|
|
|
@@ -51,6 +52,10 @@ class Step {
|
|
|
51
52
|
throw new Error('Not implemented')
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
addToRecorder(args) {
|
|
56
|
+
return recordStep(this, args)
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
/**
|
|
55
60
|
* @returns {number|undefined}
|
|
56
61
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.12",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"publish-beta": "./runok.js publish:next-beta-version"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@codeceptjs/configure": "1.0.
|
|
77
|
+
"@codeceptjs/configure": "1.0.2",
|
|
78
78
|
"@codeceptjs/helper": "2.0.4",
|
|
79
79
|
"@cucumber/cucumber-expressions": "18",
|
|
80
80
|
"@cucumber/gherkin": "30",
|
|
@@ -94,8 +94,7 @@
|
|
|
94
94
|
"figures": "3.2.0",
|
|
95
95
|
"fn-args": "4.0.0",
|
|
96
96
|
"fs-extra": "11.3.0",
|
|
97
|
-
"
|
|
98
|
-
"glob": "^11.0.1",
|
|
97
|
+
"glob": ">=9.0.0 <12",
|
|
99
98
|
"fuse.js": "^7.0.0",
|
|
100
99
|
"html-minifier-terser": "7.2.0",
|
|
101
100
|
"inquirer": "6.5.2",
|
|
@@ -124,23 +123,23 @@
|
|
|
124
123
|
"@codeceptjs/expect-helper": "^0.2.2",
|
|
125
124
|
"@codeceptjs/mock-request": "0.3.1",
|
|
126
125
|
"@eslint/eslintrc": "3.2.0",
|
|
127
|
-
"@eslint/js": "9.
|
|
126
|
+
"@eslint/js": "9.19.0",
|
|
128
127
|
"@faker-js/faker": "9.4.0",
|
|
129
128
|
"@pollyjs/adapter-puppeteer": "6.0.6",
|
|
130
129
|
"@pollyjs/core": "5.1.0",
|
|
131
130
|
"@types/chai": "4.3.19",
|
|
132
131
|
"@types/inquirer": "9.0.7",
|
|
133
|
-
"@types/node": "22.
|
|
134
|
-
"@wdio/sauce-service": "9.
|
|
132
|
+
"@types/node": "22.12.0",
|
|
133
|
+
"@wdio/sauce-service": "9.7.1",
|
|
135
134
|
"@wdio/selenium-standalone-service": "8.15.0",
|
|
136
|
-
"@wdio/utils": "9.
|
|
135
|
+
"@wdio/utils": "9.6.4",
|
|
137
136
|
"@xmldom/xmldom": "0.9.7",
|
|
138
137
|
"chai": "^4.0.0",
|
|
139
138
|
"chai-as-promised": "7.1.2",
|
|
140
139
|
"chai-subset": "1.6.0",
|
|
141
140
|
"documentation": "14.0.3",
|
|
142
|
-
"electron": "34.0.
|
|
143
|
-
"eslint": "^9.
|
|
141
|
+
"electron": "34.0.1",
|
|
142
|
+
"eslint": "^9.19.0",
|
|
144
143
|
"eslint-plugin-import": "2.31.0",
|
|
145
144
|
"eslint-plugin-mocha": "10.5.0",
|
|
146
145
|
"expect": "29.7.0",
|
|
@@ -153,9 +152,9 @@
|
|
|
153
152
|
"jsdoc": "^3.6.11",
|
|
154
153
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
155
154
|
"json-server": "0.17.4",
|
|
156
|
-
"playwright": "1.
|
|
155
|
+
"playwright": "1.50.0",
|
|
157
156
|
"prettier": "^3.3.2",
|
|
158
|
-
"puppeteer": "24.1.
|
|
157
|
+
"puppeteer": "24.1.1",
|
|
159
158
|
"qrcode-terminal": "0.12.0",
|
|
160
159
|
"rosie": "2.1.1",
|
|
161
160
|
"runok": "0.9.3",
|
|
@@ -171,7 +170,7 @@
|
|
|
171
170
|
"typedoc-plugin-markdown": "4.4.1",
|
|
172
171
|
"typescript": "5.7.3",
|
|
173
172
|
"wdio-docker-service": "1.5.0",
|
|
174
|
-
"webdriverio": "^9.
|
|
173
|
+
"webdriverio": "^9.7.1",
|
|
175
174
|
"xml2js": "0.6.2",
|
|
176
175
|
"xpath": "0.0.34"
|
|
177
176
|
},
|
package/translations/de-DE.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'de'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'Ich',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'Szenario',
|
|
6
|
-
ScenarioOutline: 'Szenariogrundriss',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
},
|
|
8
9
|
actions: {
|
|
9
10
|
amOutsideAngularApp: 'befinde_mich_außerhalb_der_angular_app',
|
package/translations/fr-FR.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'fr'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'Je',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'Scénario',
|
|
6
|
-
ScenarioOutline: 'Plan du scénario',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
Before: 'Avant',
|
|
8
9
|
After: 'Après',
|
|
9
10
|
BeforeSuite: 'AvantLaSuite',
|
package/translations/index.js
CHANGED
package/translations/it-IT.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'it'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'io',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'lo_scenario',
|
|
6
|
-
ScenarioOutline: 'Schema dello scenario',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
Before: 'Prima',
|
|
8
9
|
After: 'Dopo',
|
|
9
10
|
BeforeSuite: 'Prima_della_suite',
|
package/translations/ja-JP.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'ja'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: '私は',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'シナリオ',
|
|
6
|
-
ScenarioOutline: 'シナリオアウトライン',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
},
|
|
8
9
|
actions: {
|
|
9
10
|
amOutsideAngularApp: 'Angularの外に出る',
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'nl'
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
I: 'Ik',
|
|
6
|
+
contexts: {
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
8
|
+
},
|
|
9
|
+
actions: {
|
|
10
|
+
amOutsideAngularApp: 'ben_buiten_angular_app',
|
|
11
|
+
amInsideAngularApp: 'ben_binnen_angular_app',
|
|
12
|
+
waitForElement: 'wacht_op_element',
|
|
13
|
+
waitForClickable: 'wacht_tot_klikbaar',
|
|
14
|
+
waitForVisible: 'wacht_tot_zichtbaar',
|
|
15
|
+
waitForEnabled: 'wacht_tot_ingeschakeld',
|
|
16
|
+
waitForInvisible: 'wacht_tot_onzichtbaar',
|
|
17
|
+
waitInUrl: 'wacht_in_url',
|
|
18
|
+
waitForText: 'wacht_op_tekst',
|
|
19
|
+
moveTo: 'beweeg_de_cursor_naar',
|
|
20
|
+
refresh: 'vernieuw_pagina',
|
|
21
|
+
refreshPage: 'vernieuw_pagina',
|
|
22
|
+
haveModule: 'heb_module',
|
|
23
|
+
resetModule: 'reset_module',
|
|
24
|
+
amOnPage: 'ben_op_pagina',
|
|
25
|
+
click: 'klik',
|
|
26
|
+
doubleClick: 'dubbelklik',
|
|
27
|
+
see: 'zie',
|
|
28
|
+
dontSee: 'zie_niet',
|
|
29
|
+
selectOption: 'selecteer_optie',
|
|
30
|
+
fillField: 'vul_veld_in',
|
|
31
|
+
pressKey: 'druk_op_toets',
|
|
32
|
+
triggerMouseEvent: 'trigger_een_muis_event',
|
|
33
|
+
attachFile: 'voeg_bestand_toe',
|
|
34
|
+
seeInField: 'zie_in_veld',
|
|
35
|
+
dontSeeInField: 'zie_niet_in_veld',
|
|
36
|
+
appendField: 'voeg_toe_aan_veld',
|
|
37
|
+
checkOption: 'vink_optie_aan',
|
|
38
|
+
seeCheckboxIsChecked: 'zie_dat_checkbox_aangevinkt_is',
|
|
39
|
+
dontSeeCheckboxIsChecked: 'zie_niet_dat_checkbox_aangevinkt_is',
|
|
40
|
+
grabTextFrom: 'pak_tekst_van',
|
|
41
|
+
grabValueFrom: 'pak_waarde_van',
|
|
42
|
+
grabAttributeFrom: 'pak_attribuut_van',
|
|
43
|
+
seeInTitle: 'zie_in_titel',
|
|
44
|
+
dontSeeInTitle: 'zie_niet_in_titel',
|
|
45
|
+
grabTitle: 'pak_titel',
|
|
46
|
+
seeElement: 'zie_element',
|
|
47
|
+
dontSeeElement: 'zie_element_niet',
|
|
48
|
+
seeInSource: 'zie_in_broncode',
|
|
49
|
+
dontSeeInSource: 'zie_niet_in_broncode',
|
|
50
|
+
executeScript: 'voer_script_uit',
|
|
51
|
+
executeAsyncScript: 'voer_asynchroon_script_uit',
|
|
52
|
+
seeInCurrentUrl: 'zie_in_huidige_url',
|
|
53
|
+
dontSeeInCurrentUrl: 'zie_niet_in_huidige_url',
|
|
54
|
+
seeCurrentUrlEquals: 'zie_dat_url_gelijk_is',
|
|
55
|
+
dontSeeCurrentUrlEquals: 'zie_dat_url_niet_gelijk_is',
|
|
56
|
+
saveScreenshot: 'sla_screenshot_op',
|
|
57
|
+
setCookie: 'stel_cookie_in',
|
|
58
|
+
clearCookie: 'verwijder_cookie',
|
|
59
|
+
seeCookie: 'zie_cookie',
|
|
60
|
+
dontSeeCookie: 'zie_cookie_niet',
|
|
61
|
+
grabCookie: 'pak_cookie',
|
|
62
|
+
resizeWindow: 'verander_venstergrootte',
|
|
63
|
+
wait: 'wacht',
|
|
64
|
+
haveHeader: 'gebruik_http_header',
|
|
65
|
+
clearField: 'wis_veld',
|
|
66
|
+
dontSeeElementInDOM: 'zie_element_niet_in_DOM',
|
|
67
|
+
moveCursorTo: 'beweeg_de_cursor_naar',
|
|
68
|
+
scrollTo: 'scroll_naar',
|
|
69
|
+
sendGetRequest: 'doe_een_get_verzoek',
|
|
70
|
+
sendPutRequest: 'doe_een_put_verzoek',
|
|
71
|
+
sendDeleteRequest: 'doe_een_delete_verzoek',
|
|
72
|
+
sendDeleteRequestWithPayload: 'doe_een_delete_verzoek_met_payload',
|
|
73
|
+
sendPostRequest: 'doe_een_post_verzoek',
|
|
74
|
+
switchTo: 'wissel_naar_iframe',
|
|
75
|
+
},
|
|
76
|
+
}
|
package/translations/pl-PL.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'pl'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'Ja',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'Scenariusz',
|
|
6
|
-
ScenarioOutline: 'Szablon scenariusza',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
},
|
|
8
9
|
actions: {
|
|
9
10
|
amOutsideAngularApp: 'jestem_poza_aplikacją_angular',
|
package/translations/pt-BR.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'pt'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'Eu',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'Cenário',
|
|
6
|
-
ScenarioOutline: 'Esquema do Cenário',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
Before: 'Antes',
|
|
8
9
|
After: 'Depois',
|
|
9
10
|
BeforeSuite: 'AntesDaSuite',
|
package/translations/ru-RU.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'ru'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: 'Я',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: 'Сценарий',
|
|
6
|
-
ScenarioOutline: 'Структура сценария',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
Before: 'Начало',
|
|
8
9
|
After: 'Конец',
|
|
9
10
|
BeforeSuite: 'Перед_всем',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports.gherkinTranslations = function (langCode) {
|
|
2
|
+
const gherkinLanguages = require('@cucumber/gherkin/src/gherkin-languages.json')
|
|
3
|
+
const { feature, scenario, scenarioOutline } = gherkinLanguages[langCode]
|
|
4
|
+
return {
|
|
5
|
+
Feature: feature[0],
|
|
6
|
+
Scenario: scenario[0],
|
|
7
|
+
ScenarioOutline: scenarioOutline[0],
|
|
8
|
+
}
|
|
9
|
+
}
|
package/translations/zh-CN.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'zh-CN'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: '我',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: '场景',
|
|
6
|
-
ScenarioOutline: '场景大纲',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
},
|
|
8
9
|
actions: {
|
|
9
10
|
amOutsideAngularApp: '在Angular应用外',
|
package/translations/zh-TW.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const { gherkinTranslations } = require('./utils')
|
|
2
|
+
const langCode = 'zh-TW'
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
5
|
I: '我',
|
|
3
6
|
contexts: {
|
|
4
|
-
|
|
5
|
-
Scenario: '場景',
|
|
6
|
-
ScenarioOutline: '場景大綱',
|
|
7
|
+
...gherkinTranslations(langCode),
|
|
7
8
|
},
|
|
8
9
|
actions: {
|
|
9
10
|
amOutsideAngularApp: '在Angular應用外',
|