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

tests/e2e/lib/store-owner-flow.js   A

Size

Lines of Code 42

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A store-owner-flow.js ➔ ??? 0 3 1
1
/**
2
 * External dependencies
3
 */
4
import { StoreOwnerFlow as Base } from 'wc-e2e-page-objects';
5
6
/**
7
 * Internal dependencies
8
 */
9
import WPAdminWCSettingsCheckoutStripe from './wp-admin-wc-settings-checkout-stripe.js';
10
11
export default class StoreOwnerFlow extends Base {
12
	constructor( driver, args = {} ) {
13
		super( driver, args );
14
	}
15
16
	openStripeSettings() {
17
		return this.open( {
18
			path: '/wp-admin/admin.php?page=wc-settings&tab=checkout&section=stripe',
19
			object: WPAdminWCSettingsCheckoutStripe
20
		} );
21
	}
22
23
	setStripeSettings( args ) {
24
		args = Object.assign(
25
			{
26
				enable: true,
27
			},
28
			args
29
		);
30
31
		const settings = this.openStripeSettings();
32
		if ( args.enable ) {
33
			settings.checkEnable();
34
		}
35
36
		if ( args.testPublishableKey ) {
37
			settings.setTestPublishableKey( args.testPublishableKey );
38
		}
39
		if ( args.testPublishableSecret ) {
40
			settings.setTestPublishableSecret( args.testPublishableSecret );
41
		}
42
43
		return settings.saveChanges();
44
	}
45
}
46