Lines of Code | 41 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
4 | import { GuestCustomerFlow as Base, SingleProductPage } from 'wc-e2e-page-objects'; |
||
5 | |||
6 | /** |
||
7 | * Internal dependencies |
||
8 | */ |
||
9 | import CartPage from './cart-page.js'; |
||
10 | import CheckoutPage from './checkout-page.js'; |
||
11 | |||
12 | export default class GuestCustomerFlow extends Base { |
||
13 | constructor( driver, args = {} ) { |
||
14 | super( driver, args ); |
||
15 | } |
||
16 | |||
17 | openCart() { |
||
18 | return this.open( { |
||
19 | object: CartPage, |
||
20 | path: '/cart' |
||
21 | } ); |
||
22 | } |
||
23 | |||
24 | openCheckout() { |
||
25 | return this.open( { |
||
26 | object: CheckoutPage, |
||
27 | path: '/checkout' |
||
28 | } ); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * TODO: Add this to wc-e2e-page-objects. |
||
33 | * |
||
34 | * @param {String} path - Single product path. |
||
35 | */ |
||
36 | fromProductPathAddToCart( path ) { |
||
37 | const product = this.open( { |
||
38 | object: SingleProductPage, |
||
39 | path: path |
||
40 | } ); |
||
41 | |||
42 | product.addToCart(); |
||
43 | } |
||
44 | } |
||
45 |