forked from jsnbuchanan/crowd-funder-for-time-pwa
Moved common functions to testUtils
This commit is contained in:
@@ -1,23 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { importUser } 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;
|
||||
}
|
||||
import { importUser, createUniqueStringsArray } from './testUtils';
|
||||
|
||||
test('Create 10 new projects', async ({ page }) => {
|
||||
test.slow(); // Extend the test timeout
|
||||
@@ -32,7 +14,7 @@ test('Create 10 new projects', async ({ page }) => {
|
||||
const finalDescriptions = [];
|
||||
|
||||
// Create an array of unique strings
|
||||
const uniqueStrings = createUniqueStringsArray(projectCount);
|
||||
const uniqueStrings = await createUniqueStringsArray(projectCount);
|
||||
|
||||
// Populate arrays with titles and descriptions
|
||||
for (let i = 0; i < projectCount; i++) {
|
||||
|
||||
Reference in New Issue
Block a user