Nested tests, random select

Hello guys, i am writing some tests for our company website and I need help with 2 problems im not sure how deal with and i hope anyone can help me with it.

In the main test i have a nested auto generated test called “Select random” which all it does is it clicks random span on the right in the picture.

1st Problem:

I want to somehow make that test will be able to run multiple times. I know that under advanced options you can specify how many times u want the test to repeat but i would prefer to generate random number and then just simply run test that amount of times so for example if i get number 3 i want test to run 3 times so it selects 3 random spans.

2nd Problem:

When you click on the span some of the spans have additional popus that require information and data for you to fill out if you dont fill it out then you cant continue to next step. So what im thinking i should do is somehow write an if statement thats gonna check what span was clicked and if it has that popup then i want to fill out data with another test. In “code” version i want something like this to happen in my test:

1. Generate random number from 1 to 5 and run test that many times.
2. Generate random number from 1 to 5 (theres 5 spans only) and select 1 out of those 5 spans.
3. click random span

4. if(span1.isClicked) {
    run the test for span1 thats gonna fill all additional info
} else if (span2.isClicked) {
   run test2 thats gonna fill additional info for span2
} ...

I hope i made this clear enough and that anyone can help me with this problem.
Have a nice day

This topic was automatically closed after 180 days. New replies are no longer allowed.