Fix for cypress randomstrings
This commit is contained in:
parent
f6b219772d
commit
0a50672ab6
@ -1,15 +1,16 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
const fns = require('../support/functions');
|
||||
|
||||
describe('Settings endpoints', () => {
|
||||
let token;
|
||||
let settingName = 'cypressSetting_' + fns.generateRandomString(12);
|
||||
let settingName;
|
||||
|
||||
before(() => {
|
||||
cy.getToken().then((tok) => {
|
||||
token = tok;
|
||||
});
|
||||
cy.randomString(12).then((str) => {
|
||||
settingName = 'cypressSetting_' + str;
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to create new setting', function() {
|
||||
|
@ -1,16 +1,17 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
const fns = require('../support/functions');
|
||||
|
||||
describe('Users endpoints', () => {
|
||||
let token;
|
||||
let uniqueEmail = 'jc_' + fns.generateRandomString(10) + '@example.com';
|
||||
let myUserID = 0;
|
||||
let uniqueEmail;
|
||||
let myUserID = 0;
|
||||
|
||||
before(() => {
|
||||
cy.getToken().then((tok) => {
|
||||
token = tok;
|
||||
});
|
||||
cy.randomString(10).then((str) => {
|
||||
uniqueEmail = 'jc_' + str + '@example.com';
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to get yourself', function() {
|
||||
|
@ -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:
|
||||
*
|
||||
|
@ -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;
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user