Adding test to check custom menus
This commit is contained in:
parent
ed1efe12f2
commit
caf8a74ade
@ -1,7 +1,7 @@
|
||||
let menuIframeApi = undefined;
|
||||
|
||||
WA.ui.registerMenuCommand('custom callback menu', () => {
|
||||
WA.nav.openTab("https://workadventu.re/");
|
||||
WA.chat.sendChatMessage('Custom menu clicked', 'Mr Robot');
|
||||
})
|
||||
|
||||
WA.ui.registerMenuCommand('custom iframe menu', {iframe: 'customIframeMenu.html'});
|
||||
|
@ -224,7 +224,7 @@
|
||||
<input type="radio" name="test-custom-menu"> Success <input type="radio" name="test-custom-menu"> Failure <input type="radio" name="test-custom-menu" checked> Pending
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" class="testLink" data-testmap="Metadata/customMenu.json" target="_blank">Testing add a custom menu by scripting API</a>
|
||||
<a href="#" class="testLink" data-testmap="Metadata/customMenu.json" target="_blank">Testing add a custom menu by scripting API <i>(already automated in E2E tests)</i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -13,4 +13,26 @@ test.describe('Iframe API', () => {
|
||||
|
||||
await expect(page.locator('p.other-text')).toHaveText('The iframe opened by a script works !', {useInnerText: true});
|
||||
});
|
||||
|
||||
test('can add a custom menu by scripting API', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto(
|
||||
'http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Metadata/customMenu.json'
|
||||
);
|
||||
|
||||
await login(page);
|
||||
|
||||
await page.click('.menuIcon img:first-child');
|
||||
|
||||
await page.click('button:has-text("custom iframe menu")');
|
||||
|
||||
const iframeParagraph = page
|
||||
.frameLocator('.menu-submenu-container iframe')
|
||||
.locator('p');
|
||||
await expect(iframeParagraph).toHaveText('This is an iframe in a custom menu.');
|
||||
|
||||
await page.click('button:has-text("custom callback menu")');
|
||||
await expect(page.locator('p.other-text')).toHaveText('Custom menu clicked', {useInnerText: true});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user