Created
September 16, 2022 03:24
-
-
Save glendaviesnz/be9210061eb7bb1b549f1136886665fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initial page load's url | |
// Change port number to your local WP instance. | |
function url() { | |
return "http://localhost:4759/wp-admin/site-editor.php?postType=wp_template&postId=twentytwentytwo%2F%2Ffront-page"; | |
} | |
// The setup method doesn't seem to get called | |
// async function setup(page) { | |
// await page.$eval("#user_login", (el) => (el.value = "admin")); | |
// await page.$eval("#user_pass", (el) => (el.value = "password")); | |
// await page.click("#wp-submit"); | |
// } | |
function cookies() { | |
return [ | |
{ | |
name: "wordpress_...", | |
value: "", | |
domain: "localhost", | |
}, | |
{ name: "wp-settings-time-1", value: "1663213847", domain: "localhost" }, | |
{ | |
name: "wordpress_...", | |
value: "", | |
domain: "localhost", | |
}, | |
{ | |
name: "wordpress_logged_in_...", | |
value: "", | |
domain: "localhost", | |
}, | |
{ | |
name: "wordpress_test_cookie", | |
value: "WP%20Cookie%20check", | |
domain: "localhost", | |
}, | |
{ | |
name: "wp-settings-1", | |
value: "libraryContent%3Dbrowse", | |
domain: "localhost", | |
}, | |
]; | |
} | |
// action where you suspect the memory leak might be happening | |
async function action(page) { | |
await page.click(".edit-site-navigation-toggle__button"); | |
const [templatesNav] = await page.$x("//span[contains(., 'Templates')]"); | |
await templatesNav.click(); | |
const [siteEditor] = await page.$x("//span[contains(., 'Site')]"); | |
await siteEditor.click(); | |
} | |
// how to go back to the state before action | |
async function back(page) { | |
const [siteEditor] = await page.$x("//span[contains(., 'Site')]"); | |
await siteEditor.click(); | |
} | |
module.exports = { back, action, url, cookies }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment