Lines of Code | 42 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
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§ion=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 |