Completed
Push — master ( 6d8164...bf7249 )
by Roy
03:26
created

tests/e2e/lib/guest-customer-flow.js   A

Size

Lines of Code 41

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
nc 1
dl 0
loc 41
rs 10
c 1
b 0
f 0
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A guest-customer-flow.js ➔ ??? 0 3 1
1
/**
2
 * External dependencies
3
 */
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