UNPKG

@wordpress/e2e-test-utils

Version:
49 lines (48 loc) 2.04 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var activate_theme_exports = {}; __export(activate_theme_exports, { activateTheme: () => activateTheme }); module.exports = __toCommonJS(activate_theme_exports); var import_switch_user_to_admin = require("./switch-user-to-admin"); var import_switch_user_to_test = require("./switch-user-to-test"); var import_visit_admin_page = require("./visit-admin-page"); var import_is_current_url = require("./is-current-url"); async function activateTheme(slug) { await (0, import_switch_user_to_admin.switchUserToAdmin)(); await (0, import_visit_admin_page.visitAdminPage)("themes.php"); const activateButton = await page.$( `div[data-slug="${slug}"] .button.activate` ); if (!activateButton) { await (0, import_switch_user_to_test.switchUserToTest)(); return; } await page.click(`div[data-slug="${slug}"] .button.activate`); if (!(0, import_is_current_url.isCurrentURL)("themes.php")) { await (0, import_visit_admin_page.visitAdminPage)("themes.php"); } await page.waitForSelector(`div[data-slug="${slug}"].active`); await (0, import_switch_user_to_test.switchUserToTest)(); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { activateTheme }); //# sourceMappingURL=activate-theme.js.map