Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
step('The Flood Store: Click Hoodies', async browser => {
let lnkHoodies = await browser.findElement(By.partialLinkText('Hoodies'))
await lnkHoodies.click()
let pageTextVerify = By.visibleText('Hoodie with Logo')
await browser.wait(Until.elementIsVisible(pageTextVerify))
})
step('Shopping Cart Demo App: Step 3', async browser => {
//Click on the Step 3 button to progress to the next step
let obj_btn_Step3 = By.xpath("//bdi[contains(text(),'Step 3')]")
await browser.wait(Until.elementIsVisible(obj_btn_Step3))
let element1 = await browser.findElement(obj_btn_Step3)
await element1.click()
//Verify that we are on the correct page by checking that 'Details for Cash on Delivery' text is shown on the page
const pageTextVerify = By.visibleText("Details for Cash on Delivery")
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})
step('Master-Detail Demo App: Select Master', async browser => {
//Select worklist item 'Object 8'
let obj_span_WorklistItem = By.xpath("//span[contains(text(),'Object 8')]")
await browser.wait(Until.elementIsVisible(obj_span_WorklistItem))
let element1 = await browser.findElement(obj_span_WorklistItem)
await element1.click()
//Verify that we are on the correct page by checking that '' text is shown on the page
const pageTextVerify = By.visibleText('')
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})
step('Shopping Cart Demo App: Select TV Model', async browser => {
//Click on the text link item called 'Flat Watch HD37'
let obj_btn_HD37 = By.xpath("//span[contains(text(),'Flat Watch HD37')]")
await browser.wait(Until.elementIsVisible(obj_btn_HD37))
let element1 = await browser.findElement(obj_btn_HD37)
await element1.click()
//Verify that we are on the correct page by checking that '37-inch, 1366x768 Pixel' text is shown on the page
const pageTextVerify = By.visibleText("37-inch, 1366x768 Pixel")
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Click on the back navigation button
let obj_btn_Back = By.css('#container-cart---category--page-navButton-iconBtn')
await browser.wait(Until.elementIsVisible(obj_btn_Back))
let element2 = await browser.findElement(obj_btn_Back)
await element2.click()
//Take a screenshot
await browser.takeScreenshot()
})
step('Browse Orders Demo App: Processor Info', async browser => {
let obj_itm_ProcessorInfo = By.css('#container-orderbrowser---detail--iconTabFilterProcessor-icon')
await browser.wait(Until.elementIsVisible(obj_itm_ProcessorInfo))
let element1 = await browser.findElement(obj_itm_ProcessorInfo)
await element1.click()
const pageTextVerify = By.visibleText("Processor Information")
await browser.wait(Until.elementIsVisible(pageTextVerify))
await browser.takeScreenshot()
})
step('Master-Detail Demo App: Search', async browser => {
const page = browser.page
//Search the worklist and type in 'Object 8'
let obj_txt_Search = By.xpath("//input[contains(@placeholder, 'Search')]")
await browser.wait(Until.elementIsVisible(obj_txt_Search))
await browser.type(obj_txt_Search, "Object 8")
await page.keyboard.press('Enter')
//After typing in Object 19 - press the Enter key
const pageTextVerify = By.visibleText('Object 8')
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})
step('APF demo app: Search and Select Analysis Type', async browser => {
//__field5-I
let obj_txt_SearchAnalysisType = By.xpath("//input[contains(@placeholder, 'Search')]")
await browser.wait(Until.elementIsVisible(obj_txt_SearchAnalysisType))
await browser.type(obj_txt_SearchAnalysisType, "Revenue")
//Select first result called 'Revenue'
let obj_div_RevenueItem = By.xpath("//div[contains(text(),'Revenue')]")
await browser.wait(Until.elementIsVisible(obj_div_RevenueItem))
let element1 = await browser.findElement(obj_div_RevenueItem)
await element1.click()
//Select another result called
let obj_div_RevenueOverTime = By.xpath("//div[contains(text(),'Revenue over Time')]")
await browser.wait(Until.elementIsVisible(obj_div_RevenueOverTime))
let element2 = await browser.findElement(obj_div_RevenueOverTime)
await element2.click()
//Select Line Chart with Time Axis item
let obj_div_LineChartItem = By.xpath("//div[contains(text(),'Line Chart with Time Axis')]")
await browser.wait(Until.elementIsVisible(obj_div_LineChartItem))
let element3 = await browser.findElement(obj_div_LineChartItem)
await element3.click()
await browser.takeScreenshot()
})
step('The Flood Store: Proceed to Checkout', async browser => {
let lnkProceedToCheckout = By.css('#post-14 > div > div > div > div > div > a')
await browser.wait(Until.elementIsVisible(lnkProceedToCheckout))
let element = await browser.findElement(lnkProceedToCheckout)
await element.focus()
await element.click()
let pageTextVerify = By.visibleText('Returning customer?')
await browser.wait(Until.elementIsVisible(pageTextVerify))
})
step('1. Start', async browser => {
await browser.visit('https://challenge.flood.io', { waitUntil: 'networkidle2' })
let startButton = By.css('#new_challenger > input.btn')
await browser.wait(Until.elementIsVisible(startButton))
let el = await browser.findElement(startButton)
await el.focus()
await browser.takeScreenshot()
await el.click()
})
step('Worklist Demo App: Search Worklist', async browser => {
const page = browser.page
//Search the worklist and type in 'Object 19'
let obj_txt_SearchAnalysisType = By.xpath("//input[contains(@placeholder, 'Search')]")
await browser.wait(Until.elementIsVisible(obj_txt_SearchAnalysisType))
await browser.type(obj_txt_SearchAnalysisType, "Object 19")
//After typing in Object 19 - press the Enter key
await page.keyboard.press('Enter')
//Verify that we are on the correct page by checking that 'Object 19' text is shown on the page
const pageTextVerify = By.visibleText('Object 19')
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})