Last active
February 19, 2019 22:49
-
-
Save AleksandraZuchewicz/eaf9a1c9527aabfdae6177526ffb5614 to your computer and use it in GitHub Desktop.
Cashback lottery automated testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature('Lottery test'); | |
Scenario('test stickers distribution', async (I) => { | |
const letters = ["0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; | |
I.amOnPage("https://www.somecashbacksite.co.uk/search/merchants/?letter=A"); | |
I.wait(180); // Have a time to log in and do Captcha manually | |
// Infinetely wander through website | |
while(true) { | |
// Go through letters | |
for (let currentLetter = 0; currentLetter < letters.length; currentLetter++) { | |
let currentPage = 1; | |
// Go through pages | |
while (true) { | |
I.amOnPage("https://www.somecashbacksite.co.uk/search/merchants/?letter=" + letters[currentLetter] + "&page=" + currentPage); | |
I.wait(2); | |
let numberOfLetterElements = await I.grabNumberOfVisibleElements('.gecko-col-logo-bd'); | |
if (numberOfLetterElements == 0) { | |
break; | |
} | |
// Go through current page list | |
for (let elementNumber = 1; elementNumber <= numberOfLetterElements; elementNumber++) { | |
I.scrollTo(".gecko-data-table-account-overview tbody tr:nth-child(" + elementNumber + ") a", 0, 100); | |
I.click(".gecko-data-table-account-overview tbody tr:nth-child(" + elementNumber + ") a"); | |
I.wait(4); | |
let numberOfBirds = await I.grabNumberOfVisibleElements("#birdClick"); | |
let isBirdVisible = numberOfBirds > 0; | |
if (isBirdVisible) { | |
I.click("#birdClick"); | |
I.wait(10); | |
} | |
I.amOnPage("https://www.somecashbacksite.co.uk/search/merchants/?letter=" + letters[currentLetter] + "&page=" + currentPage); | |
I.wait(2); | |
} | |
currentPage++; | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment