artes 1.1.42 → 1.1.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.1.42",
3
+ "version": "1.1.45",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- const { When, random, element, selector } = require("../helper/imports/commons");
1
+ const { When, random, element, selector, time } = require("../helper/imports/commons");
2
2
  const { keyboard, frame } = require("../helper/stepFunctions/exporter");
3
3
 
4
4
  // User presses a key on a specific selector
@@ -183,16 +183,30 @@ When('User types random alphanumeric in range from {int} to {int} in {string}',
183
183
  await element(input).fill(randomWords)
184
184
  })
185
185
 
186
- Given('User types random fullname in {string}', async (input) => {
187
- const randomFullname = await random.person.fullName()
188
- await element(input).fill(randomFullname)
186
+ When('User types random fullname in {string}', async (input) => {
187
+ const randomFirstName = await random.person.firstName()
188
+ const randomLastName = await random.person.lastName()
189
+
190
+ await element(input).fill(`${randomFirstName} ${randomLastName}`)
189
191
  })
190
192
 
191
- Given('User types random date between {int} and {int} in {string}', async (fromYear, toYear, input) => {
193
+ When('User types random date between {int} and {int} in {string}', async (fromYear, toYear, input) => {
192
194
  const year = Math.floor(Math.random() * (toYear - fromYear + 1)) + fromYear
193
195
  const month = Math.floor(Math.random() * 12) + 1
194
196
  const day = Math.floor(Math.random() * 28) + 1
195
197
  const pad = (num) => num.toString().padStart(2, '0')
196
198
  const dateStr = `${pad(day)}.${pad(month)}.${year}`
197
199
  await element(input).fill(dateStr)
200
+ })
201
+
202
+ When('User types date {int} days after today in {string}', async (day, input) => {
203
+ const now = new time();
204
+ const afterDate = now.add(day, 'day').format("DD-MM-YYYY");
205
+ await element(input).fill(afterDate)
206
+ })
207
+
208
+ When('User types date {int} days before today in {string}', async (day, input) => {
209
+ const now = new time();
210
+ const beforeDate = now.subtract(day, 'day').format("DD-MM-YYYY");
211
+ await element(input).fill(beforeDate)
198
212
  })
@@ -1,6 +1,7 @@
1
- const { When } = require("../helper/imports/commons");
1
+ const { When, element, selector } = require("../helper/imports/commons");
2
2
  const { mouse, frame } = require("../helper/stepFunctions/exporter");
3
3
 
4
+
4
5
  // User clicks on a selector
5
6
  When("User clicks {string}", async function (selector) {
6
7
  await mouse.click(selector);