artes 1.1.42 → 1.1.44

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.44",
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,28 @@ 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) => {
186
+ When('User types random fullname in {string}', async (input) => {
187
187
  const randomFullname = await random.person.fullName()
188
188
  await element(input).fill(randomFullname)
189
189
  })
190
190
 
191
- Given('User types random date between {int} and {int} in {string}', async (fromYear, toYear, input) => {
191
+ When('User types random date between {int} and {int} in {string}', async (fromYear, toYear, input) => {
192
192
  const year = Math.floor(Math.random() * (toYear - fromYear + 1)) + fromYear
193
193
  const month = Math.floor(Math.random() * 12) + 1
194
194
  const day = Math.floor(Math.random() * 28) + 1
195
195
  const pad = (num) => num.toString().padStart(2, '0')
196
196
  const dateStr = `${pad(day)}.${pad(month)}.${year}`
197
197
  await element(input).fill(dateStr)
198
+ })
199
+
200
+ When('User types date {int} days after today in {string}', async (day, input) => {
201
+ const now = new time();
202
+ const afterDate = now.add(day, 'day').format("DD-MM-YYYY");
203
+ await element(input).fill(afterDate)
204
+ })
205
+
206
+ When('User types date {int} days before today in {string}', async (day, input) => {
207
+ const now = new time();
208
+ const beforeDate = now.subtract(day, 'day').format("DD-MM-YYYY");
209
+ await element(input).fill(beforeDate)
198
210
  })
@@ -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);