e68db848dc
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>
17 lines
469 B
JavaScript
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
|
|
};
|