Fix for cypress randomstrings

This commit is contained in:
Jamie Curnow
2023-01-09 08:58:32 +10:00
parent f6b219772d
commit 0a50672ab6
4 changed files with 20 additions and 18 deletions

View File

@ -11,6 +11,17 @@
import 'cypress-wait-until';
Cypress.Commands.add('randomString', (length) => {
var result = '';
var characters = 'ABCDEFGHIJK LMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
// cy.wrap(result);
});
/**
* Check the swagger schema:
*

View File

@ -1,11 +0,0 @@
module.exports = {
generateRandomString: function (length) {
var result = '';
var characters = 'ABCDEFGHIJK LMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
},
};