diff --git a/maps/tests/index.html b/maps/tests/index.html index 370d99e6..9adba52d 100644 --- a/maps/tests/index.html +++ b/maps/tests/index.html @@ -216,7 +216,7 @@ Success Failure Pending - Test a iframe opened by a script can use Iframe API + Test a iframe opened by a script can use Iframe API (already automated in E2E tests) diff --git a/tests/tests/iframe_script.spec.ts b/tests/tests/iframe_script.spec.ts new file mode 100644 index 00000000..ab4e17ae --- /dev/null +++ b/tests/tests/iframe_script.spec.ts @@ -0,0 +1,16 @@ +import { expect, test } from '@playwright/test'; +import { login } from './utils/roles'; + +test.describe('Iframe API', () => { + test('can be called from an iframe loading a script', async ({ + page, + }) => { + await page.goto( + 'http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Metadata/cowebsiteAllowApi.json' + ); + + await login(page); + + await expect(page.locator('p.other-text')).toHaveText('The iframe opened by a script works !', {useInnerText: true}); + }); +});