Ghost/ghost/core/test/e2e-browser/utils/helpers.js
Peter Zimon e68db848dc
AdminX: reroute settings-x to settings (#18360)
refs. https://github.com/TryGhost/Product/issues/3949

---------

Co-authored-by: Jono Mingard <reason.koan@gmail.com>
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2023-10-09 08:12:46 +01:00

17 lines
469 B
JavaScript

let uniqueId = 0;
const getUniqueName = (prefix = 'id') => {
uniqueId += 1;
// uniqueId is incremented to avoid conflicts when running tests in parallel,
// while Date.now() is used to avoid conflicts when running tests locally in
// the same session (e.g. using the Playwright UI)
return `${prefix} ${Date.now()}${uniqueId}`;
};
const getSlug = str => str.toLowerCase().split(' ').join('-');
module.exports = {
getUniqueName,
getSlug
};