wc-e2e-page-objects
Version:
WooCommerce Page Objects to be used on end-to-end tests with Selenium WebDriver
96 lines (68 loc) • 4.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _seleniumWebdriver = require('selenium-webdriver');
var _wpE2eWebdriver = require('wp-e2e-webdriver');
var _wpAdminWcSettings = require('./wp-admin-wc-settings');
var _wpAdminWcSettings2 = _interopRequireDefault(_wpAdminWcSettings);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* @module WPAdminWCSettingsCheckoutPayPal
*/
/**
* External dependencies
*/
/**
* Internal Dependencies
*/
var defaultArgs = {
url: '',
visit: true
};
var ENABLE_SELECTOR = _seleniumWebdriver.By.css('#woocommerce_paypal_enabled');
/**
* The admin Checkout: PayPal screen
*
* @extends WPAdminWCSettings
*/
var WPAdminWCSettingsCheckoutPayPal = function (_WPAdminWCSettings) {
_inherits(WPAdminWCSettingsCheckoutPayPal, _WPAdminWCSettings);
/**
* @param {WebDriver} driver - Instance of WebDriver.
* @param {object} args - Configuration arguments.
*/
function WPAdminWCSettingsCheckoutPayPal(driver) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, WPAdminWCSettingsCheckoutPayPal);
args = Object.assign(defaultArgs, args);
return _possibleConstructorReturn(this, (WPAdminWCSettingsCheckoutPayPal.__proto__ || Object.getPrototypeOf(WPAdminWCSettingsCheckoutPayPal)).call(this, driver, args));
}
/**
* Check box that enables this gateway.
*
* @return {Promise} Promise that evaluates to `true` if box is/gets checked successfully, `false` otherwise.
*/
_createClass(WPAdminWCSettingsCheckoutPayPal, [{
key: 'checkEnable',
value: function checkEnable() {
return _wpE2eWebdriver.WebDriverHelper.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.
*/
}, {
key: 'uncheckEnable',
value: function uncheckEnable() {
return _wpE2eWebdriver.WebDriverHelper.unsetCheckbox(this.driver, ENABLE_SELECTOR);
}
}]);
return WPAdminWCSettingsCheckoutPayPal;
}(_wpAdminWcSettings2.default);
exports.default = WPAdminWCSettingsCheckoutPayPal;
module.exports = exports['default'];