-
Notifications
You must be signed in to change notification settings - Fork 44
/
flood-store.pass.ts
111 lines (84 loc) 路 3.67 KB
/
flood-store.pass.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { step, TestSettings, Until, By, Key } from '@flood/element'
import * as assert from 'assert'
export const settings: TestSettings = {
loopCount: -1,
screenshotOnFailure: true,
description: 'The Flood Store - Detailed Tutorial',
actionDelay: 10,
stepDelay: 7,
disableCache: true,
clearCookies: true,
}
/**
* The Flood Store
* Version: 1.0
*/
export default () => {
step('The Flood Store: Home', async browser => {
await browser.visit('https://wordpress.loadtest.io')
let pageTextVerify = By.visibleText('Welcome to the Flood Store.')
await browser.wait(Until.elementIsVisible(pageTextVerify))
await browser.takeScreenshot()
})
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('The Flood Store: Add To Cart', async browser => {
let addHoodieToCart = await browser.findElement(By.xpath('//a[@data-product_id=39]'))
await addHoodieToCart.click()
})
step('The Flood Store: View Cart', async browser => {
await browser.visit('https://wordpress.loadtest.io/cart')
// let pageTextVerify1 = By.visibleText('Free shipping')
// await browser.wait(Until.elementIsVisible(pageTextVerify1))
let pageTextVerify2 = By.visibleText('Hoodie with Logo')
await browser.wait(Until.elementIsVisible(pageTextVerify2))
//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('The Flood Store: Checkout Data Entry', async browser => {
//let billingFirstName = await browser.findElement(By.id('billing_first_name'))
// Fill in text field - billing First Name
await browser.type(By.id('billing_first_name'), 'Jason')
// Fill in text field - billing First Name
await browser.type(By.id('billing_last_name'), 'Rizioz')
// Select from searchable dropdown - billing Country
await browser.selectByValue(By.id('billing_country'), 'Australia')
// Fill in text field - billing Address 1
await browser.type(By.id('billing_address_1'), '123 ABC Street')
// Fill in text field - billing City
await browser.type(By.id('billing_city'), 'Melbourne')
// Select from searchable dropdown - billing State
let element_state = await browser.findElement(By.id('billing_state'))
await browser.selectByValue(element_state, 'Victoria')
// Fill in text field - billing postcode
await browser.type(By.id('billing_postcode'), '3000')
// Fill in text field - billing phone
await browser.type(By.id('billing_phone'), '0400000123')
// Fill in text field - billing email
await browser.type(By.id('billing_email'), 'jason@flood.io')
await browser.takeScreenshot()
})
step('The Flood Store: Place Order', async browser => {
let btnPlaceOrder = By.xpath("//button[contains(@name, 'woocommerce_checkout_place_order')]")
await browser.wait(Until.elementIsVisible(btnPlaceOrder))
let element = await browser.findElement(btnPlaceOrder)
await element.focus()
await element.click()
//let pageTextVerify = By.visibleText("Thank you. Your order has been received.")
let pageTextVerify = By.visibleText('Order received')
await browser.wait(Until.elementIsVisible(pageTextVerify))
await browser.takeScreenshot()
})
}