Last active
January 29, 2022 23:32
-
-
Save stephenkeep/19f88bc56d756ce8162634aced920263 to your computer and use it in GitHub Desktop.
Bupa Medical
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
const { | |
openBrowser, | |
goto, | |
scrollDown, | |
click, | |
write, | |
dropDown, | |
alert, | |
closeBrowser, | |
$, | |
accept, | |
} = require("taiko"); | |
const centres = [ | |
"Parramatta", | |
"Bondi Junction", | |
"Bankstown", | |
"Baulkham Hills", | |
"35 Clarence Street", | |
]; | |
const checkCentre = async (centre) => { | |
try { | |
await openBrowser(); | |
await goto( | |
"https://bmvs.onlineappointmentscheduling.net.au/oasis/Default.aspx" | |
); | |
// await overridePermissions("<url>", ["geolocation"]); | |
if (centre === "Parramatta") { | |
await alert(/.*/, async () => await accept()); | |
} | |
await scrollDown("Select a booking type"); | |
await click("New Individual booking"); | |
await click("postcode"); | |
await write("2072"); | |
await dropDown("State:").select("NSW"); | |
await click("Search"); | |
if (centre === "Bondi Junction") { | |
await alert(/.*/, async () => { | |
await waitFor(5000); | |
await alert(/.*/, async () => { | |
await waitFor(5000); | |
await accept(); | |
}); | |
await accept(); | |
}); | |
} | |
await click(centre); | |
await click("Next"); | |
await click("Medical Examination (501)"); | |
await click("Chest X-Ray (502)"); | |
await click("HIV test (707)"); | |
await click("Next"); | |
const date = await textBox({ | |
id: "ContentPlaceHolder1_SelectTime1_txtAppDate", | |
}).value(); | |
console.log(centre, date); | |
let rows = await $( | |
"table#ContentPlaceHolder1_SelectTime1_rblResults > tbody > tr" | |
).elements(); | |
for (row of rows) { | |
console.log(await row.text()); | |
} | |
await waitFor(1000); | |
await screenshot({ fullPage: true, path: `${centre}.png` }); | |
} catch (error) { | |
console.error(error); | |
} finally { | |
await closeBrowser(); | |
} | |
}; | |
(async () => { | |
for (const centre of centres) { | |
await checkCentre(centre); | |
} | |
})(); |
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
{ | |
"name": "appointment", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"taiko": "taiko", | |
"testy": "taiko test.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"taiko": "^1.2.8" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment