Fixed publishing type selectors in playwright

refs https://github.com/TryGhost/Team/issues/2371

- The "data-test-*" selectors in playwright did not work with publishing channel selectors. This is a quick hack to enable working around it
This commit is contained in:
Naz 2022-12-08 14:38:59 +07:00
parent 9a99b81ea4
commit 739bda9bb8
No known key found for this signature in database

View File

@ -58,7 +58,16 @@ const publishPost = async (page, {type = 'publish', time} = {}) => {
// set the publish type
await page.locator('[data-test-setting="publish-type"] > button').click();
await page.locator(`[data-test-publish-type="${type}"]`).setChecked(true);
// NOTE: the if/else below should be reworked into data-test-publish style selectors
// await page.locator(`[data-test-publish-type="${type}"]`).setChecked(true);
if (type === 'publish') {
await page.getByText('Publish only').click();
} else if (type === 'publish+send') {
await page.getByText('Publish and email').click();
} else if (type === 'send') {
await page.getByText('Email only').click();
}
if (time) {
await page.locator('[data-test-setting="publish-at"] > button').click();