2023-04-27 03:17:43 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
2023-04-27 02:53:52 +08:00
|
|
|
const e = require('../core/elements');
|
|
|
|
|
|
|
|
async function reopenChatSidebar(page) {
|
|
|
|
await page.waitAndClick(e.userListToggleBtn);
|
|
|
|
try {
|
|
|
|
await page.hasElement(e.hidePublicChat);
|
|
|
|
} catch {
|
|
|
|
await page.waitAndClick(e.chatButton);
|
|
|
|
await page.hasElement(e.hidePublicChat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-31 06:49:02 +08:00
|
|
|
async function checkScreenshots(layoutTest, description, maskedSelectors, screenshotName, screenshotNumber) {
|
2023-04-27 03:17:43 +08:00
|
|
|
const modPageWebcamsLocator = layoutTest.modPage.getLocator(maskedSelectors);
|
2024-07-31 06:49:02 +08:00
|
|
|
await expect(layoutTest.modPage.page, description).toHaveScreenshot(`moderator-${screenshotName}${screenshotNumber ? '-' + screenshotNumber : ''}.png`, {
|
2023-04-27 03:17:43 +08:00
|
|
|
mask: [modPageWebcamsLocator],
|
|
|
|
});
|
|
|
|
|
|
|
|
const userWebcamsLocator = layoutTest.userPage.getLocator(maskedSelectors);
|
2024-07-31 06:49:02 +08:00
|
|
|
await expect(layoutTest.userPage.page, description).toHaveScreenshot(`user-${screenshotName}${screenshotNumber ? '-' + screenshotNumber : ''}.png`, {
|
2023-04-27 03:17:43 +08:00
|
|
|
mask: [userWebcamsLocator],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-04-27 02:53:52 +08:00
|
|
|
exports.reopenChatSidebar = reopenChatSidebar;
|
2023-04-27 03:17:43 +08:00
|
|
|
exports.checkScreenshots = checkScreenshots;
|