|
@ -1,35 +1,5 @@ |
|
|
import { test, expect } from '@playwright/test'; |
|
|
import { test, expect } from '@playwright/test'; |
|
|
import { importUser } from './testUtils'; |
|
|
import { importUser, createUniqueStringsArray, createRandomNumbersArray } from './testUtils'; |
|
|
|
|
|
|
|
|
// Function to generate a random string of specified length
|
|
|
|
|
|
function generateRandomString(length) { |
|
|
|
|
|
return Math.random().toString(36).substring(2, 2 + length); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Function to create an array of unique strings
|
|
|
|
|
|
function createUniqueStringsArray(count) { |
|
|
|
|
|
const stringsArray = []; |
|
|
|
|
|
const stringLength = 16; |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < count; i++) { |
|
|
|
|
|
let randomString = generateRandomString(stringLength); |
|
|
|
|
|
stringsArray.push(randomString); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return stringsArray; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Function to create an array of two-digit non-zero numbers
|
|
|
|
|
|
function createRandomNumbersArray(count) { |
|
|
|
|
|
const numbersArray = []; |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < count; i++) { |
|
|
|
|
|
let randomNumber = Math.floor(Math.random() * 99) + 1; |
|
|
|
|
|
numbersArray.push(randomNumber); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return numbersArray; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test('Record 10 new gifts', async ({ page }) => { |
|
|
test('Record 10 new gifts', async ({ page }) => { |
|
|
test.slow(); // Extend the test timeout
|
|
|
test.slow(); // Extend the test timeout
|
|
@ -43,8 +13,8 @@ test('Record 10 new gifts', async ({ page }) => { |
|
|
const finalNumbers = []; |
|
|
const finalNumbers = []; |
|
|
|
|
|
|
|
|
// Create arrays for field input
|
|
|
// Create arrays for field input
|
|
|
const uniqueStrings = createUniqueStringsArray(giftCount); |
|
|
const uniqueStrings = await createUniqueStringsArray(giftCount); |
|
|
const randomNumbers = createRandomNumbersArray(giftCount); |
|
|
const randomNumbers = await createRandomNumbersArray(giftCount); |
|
|
|
|
|
|
|
|
// Populate array with titles
|
|
|
// Populate array with titles
|
|
|
for (let i = 0; i < giftCount; i++) { |
|
|
for (let i = 0; i < giftCount; i++) { |
|
|