pages/wp-admin/wp-admin-wc-settings-checkout-paypal.js

/**
 * @module WPAdminWCSettingsCheckoutPayPal
 */

/**
 * External dependencies
 */
import { By } from 'selenium-webdriver';
import { WebDriverHelper as helper } from 'wp-e2e-webdriver';

/**
 * Internal Dependencies
 */
import WPAdminWCSettings from './wp-admin-wc-settings';

const defaultArgs = {
	url: '',
	visit: true,
};

const ENABLE_SELECTOR = By.css( '#woocommerce_paypal_enabled' );

/**
 * The admin Checkout: PayPal screen
 *
 * @extends WPAdminWCSettings
 */
export default class WPAdminWCSettingsCheckoutPayPal extends WPAdminWCSettings {

	/**
 	* @param {WebDriver} driver   - Instance of WebDriver.
 	* @param {object}    args     - Configuration arguments.
	*/
	constructor( driver, args = {} ) {
		args = Object.assign( defaultArgs, args );
		super( driver, args );
	}

	/**
	* Check box that enables this gateway.
	*
 	* @return {Promise}   Promise that evaluates to `true` if box is/gets checked successfully, `false` otherwise.
	*/
	checkEnable() {
		return helper.setCheckbox( this.driver, ENABLE_SELECTOR );
	}

	/**
	* Uncheck box that enables this gateway.
	*
 	* @return {Promise}   Promise that evaluates to `true` if box is/gets unchecked successfully, `false` otherwise.
	*/
	uncheckEnable() {
		return helper.unsetCheckbox( this.driver, ENABLE_SELECTOR );
	}
}