diff --git a/packages/e2e-tests/specs/editor/various/taxonomies.test.js b/packages/e2e-tests/specs/editor/various/taxonomies.test.js index ef651386211e5..551187d654dd9 100644 --- a/packages/e2e-tests/specs/editor/various/taxonomies.test.js +++ b/packages/e2e-tests/specs/editor/various/taxonomies.test.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { random } from 'lodash'; - /** * WordPress dependencies */ @@ -19,6 +14,12 @@ import { const TAG_TOKEN_SELECTOR = '.components-form-token-field__token-text span:not(.components-visually-hidden)'; +function generateRandomNumber() { + // Using `Math.random()` directly is fine in this testing context. + // eslint-disable-next-line no-restricted-syntax + return Math.round( 1 + Math.random() * ( Number.MAX_SAFE_INTEGER - 1 ) ); +} + describe( 'Taxonomies', () => { const canCreatTermInTaxonomy = ( taxonomy ) => { return page.evaluate( ( _taxonomy ) => { @@ -152,7 +153,7 @@ describe( 'Taxonomies', () => { // Click the tag input field. await tagInput.click(); - const tagName = "tag'-" + random( 1, Number.MAX_SAFE_INTEGER ); + const tagName = "tag'-" + generateRandomNumber(); // Type the category name in the field. await tagInput.type( tagName ); @@ -211,7 +212,7 @@ describe( 'Taxonomies', () => { // Click the tag input field. await tagInput.click(); - const tagName = 'tag-' + random( 1, Number.MAX_SAFE_INTEGER ); + const tagName = 'tag-' + generateRandomNumber(); // Type the category name in the field. await tagInput.type( tagName );