OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Reuse results of random generation function as "const"

  • Thread starter Thread starter thomas diana
  • Start date Start date
T

thomas diana

Guest
Newbie question here, For Cypress test of a web project, I generated a random name for an item creation. I want to "store" the resultat as "const" in order to check that folder is created. Here is my function:

Code:
    function testFolderName() {
      var text = "";
      var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_"

      for (var i = 0; i < 10; i++)
        text += possible.charAt(Math.floor(Math.random() * possible.length));

      return text;
    }

In the next cy.get I want to check the folder list contains a folder with random folder name that have been generated. But I have no idea where to start with.

<p>Newbie question here,
For Cypress test of a web project, I generated a random name for an item creation. I want to "store" the resultat as "const" in order to check that folder is created.
Here is my function:</p>
<pre><code> function testFolderName() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_"

for (var i = 0; i < 10; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));

return text;
}
</code></pre>
<p>In the next cy.get I want to check the folder list contains a folder with random folder name that have been generated. But I have no idea where to start with.</p>
 
Top