chore: Move helper to E2E test (#37546)

This commit is contained in:
Tasso Evangelista 2025-11-18 13:36:46 -03:00 committed by GitHub
parent 9f77c721f1
commit 8a6cae6f14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 15 deletions

View File

@ -1,14 +0,0 @@
export const createToken = (): string => {
const array = new Uint8Array(16);
if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomValues) {
window.crypto.getRandomValues(array);
} else {
// Use Node.js crypto
const { randomBytes } = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
const buffer = randomBytes(16);
array.set(buffer);
}
return Array.from(array)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('');
};

View File

@ -1,11 +1,23 @@
import { randomBytes } from 'crypto';
import { faker } from '@faker-js/faker';
import { createToken } from '../../../client/lib/utils/createToken';
import { Users } from '../fixtures/userStates';
import { OmnichannelContacts } from '../page-objects/omnichannel-contacts-list';
import { OmnichannelSection } from '../page-objects/omnichannel-section';
import { test, expect } from '../utils/test';
const createToken = (): string => {
const array = new Uint8Array(16);
const buffer = randomBytes(16);
array.set(buffer);
return Array.from(array)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('');
};
const createContact = (generateToken = false) => ({
id: null,
name: `${faker.person.firstName()} ${faker.person.lastName()}`,