@wordpress/e2e-test-utils
Version:
End-To-End (E2E) test utils for WordPress.
30 lines (28 loc) • 876 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isThemeInstalled = isThemeInstalled;
var _switchUserToAdmin = require("./switch-user-to-admin");
var _visitAdminPage = require("./visit-admin-page");
var _switchUserToTest = require("./switch-user-to-test");
/**
* Internal dependencies
*/
/**
* Checks whether a theme exists on the site.
*
* @param {string} slug Theme slug to check.
* @return {boolean} Whether the theme exists.
*/
async function isThemeInstalled(slug) {
await (0, _switchUserToAdmin.switchUserToAdmin)();
await (0, _visitAdminPage.visitAdminPage)('themes.php');
await page.waitForSelector('h2', {
text: 'Add New Theme'
});
const found = await page.$(`[data-slug="${slug}"]`);
await (0, _switchUserToTest.switchUserToTest)();
return Boolean(found);
}
//# sourceMappingURL=theme-installed.js.map