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: Add To Cart', async browser => {
let addHoodieToCart = await browser.findElement(By.xpath('//a[@data-product_id=39]'))
await addHoodieToCart.click()
})
step('Employee Directory Demo App: Hobbies Link', async browser => {
//Click on the text link item called 'Hobbies'
let obj_div_Hobbies = By.xpath("//div[contains(text(),'Hobbies')]")
await browser.wait(Until.elementIsVisible(obj_div_Hobbies))
let element1 = await browser.findElement(obj_div_Hobbies)
await element1.click()
//Verify that we are on the correct page by checking that 'Hobbies of Robert King' text is shown on the page
const pageTextVerify = By.visibleText("Hobbies of Robert King")
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
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('Bulletin Board Demo App: Click Item', async browser => {
//Search the bulletin board list and type in 'Cheap Boat'
let obj_itm_Boat = By.xpath("//span[contains(text(),'Cheap Boat')]")
await browser.wait(Until.elementIsVisible(obj_itm_Boat))
let element1 = await browser.findElement(obj_itm_Boat)
await element1.click()
//Verify that we are on the correct page by checking that 'Living close to a lake or the ocean?' text is shown on the page
const pageTextVerify = By.visibleText("Living close to a lake or the ocean?")
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})
step('Walkthrough Demo App: Select Invoice Item', async browser => {
let obj_span_milk = By.xpath("//span[contains(text(),'Canned Beans')]")
await browser.wait(Until.elementIsVisible(obj_span_milk))
let element1 = await browser.findElement(obj_span_milk)
await element1.click()
//Please rate this product
const pageTextVerify = By.visibleText('Please rate this product')
await browser.wait(Until.elementIsVisible(pageTextVerify))
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
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('JIRA: Create Issue - Enter Details', async browser => {
let btnCreate = await browser.findElement(
By.xpath("//span[contains(@aria-label, 'Create (c)')]"),
)
await btnCreate.click()
let pageTextVerify = By.visibleText('Create issue')
await browser.wait(Until.elementIsVisible(pageTextVerify))
await browser.takeScreenshot()
//#issuetype-field = BUG
let selIssueType = await browser.findElement(
By.xpath("//input[contains(@id, 'issuetype-field')]"),
)
await selIssueType.focus()
await browser.type(By.css('#issuetype-field'), 'Bug')
await browser.press(Key.ENTER)
//#summary
await browser.type(By.css('#summary'), 'There is a bug in the application')
//#description
await browser.type(
By.css('#description'),
'There is a bug in the application and this is the description',
)
//#priority-field
step('Employee Directory Demo App: Flip to Resume', async browser => {
//Click on the text link item called 'Flip to Resume'
let obj_itm_FlipToResume = By.xpath("//a[contains(text(),'Flip to Resume')]")
await browser.wait(Until.elementIsVisible(obj_itm_FlipToResume))
let element1 = await browser.findElement(obj_itm_FlipToResume)
await element1.click()
//Verify that we are on the correct page by checking that 'Information of Robert King' text is shown on the page
const pageTextVerify = By.visibleText("Information of Robert King")
await browser.wait(Until.elementIsVisible(pageTextVerify))
//Take a screenshot
await browser.takeScreenshot()
})
step('Sales Order Entry - Add Item', async browser => {
//Material
await browser.type(By.xpath("//input[contains(@id, 'Default::Material')]"), "TG11")
await browser.press(Key.TAB)
//Requested Quantity
await browser.type(By.xpath("//input[contains(@id, 'Default::RequestedQuantity')]"), "1")
await browser.press(Key.TAB)
//Requested Delivery Date
//await browser.type(By.xpath("//input[contains(@id, 'Default::RequestedDeliveryDate')]"), "01/16/2019")
//await browser.press(Key.TAB)
//click Add Item
let btnAddItem = await browser.findElement(By.xpath("//span[contains(@id, 'BtnAddToItems')]"))
await btnAddItem.click()
await browser.takeScreenshot()
})