Skip to content

Commit

Permalink
test: split tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gioboa committed Jan 8, 2024
1 parent bf1e852 commit 80abca5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,70 +78,3 @@ test('iframe 1', async ({ page }) => {
const testOnLoadNoSrc = page.locator('#testOnLoadNoSrc');
await expect(testOnLoadNoSrc).toHaveText('onload');
});

test('iframe 2', async ({ page }) => {
await page.goto('/tests/platform/iframe/');

await page.waitForSelector('.testMemberNames');
const testMemberNames = page.locator('#testMemberNames');
await expect(testMemberNames).toHaveText('1985');

await page.waitForSelector('.testParentMemberNames');
const testParentMemberNames = page.locator('#testParentMemberNames');
await expect(testParentMemberNames).toHaveText('1985 1885');

await page.waitForSelector('.testNoDeadlock');
const testNoDeadlock = page.locator('#testNoDeadlock');
await expect(testNoDeadlock).toHaveText('99');

await page.waitForSelector('.testWWGlobalNotShared');
const testWWGlobalNotShared = page.locator('#testWWGlobalNotShared');
await expect(testWWGlobalNotShared).toHaveText('true');

await page.waitForSelector('.testFrameElement');
const testFrameElement = page.locator('#testFrameElement');
await expect(testFrameElement).toHaveText('frameElement');

await page.waitForSelector('.testSyncSetAttr');
const testSyncSetAttr = page.locator('#testSyncSetAttr');
await expect(testSyncSetAttr).toHaveText('88');

await page.waitForSelector('.testNativeFetch');
const testNativeFetch = page.locator('#testNativeFetch');
await expect(testNativeFetch).toHaveText('true');

await page.waitForSelector('.testPostMessage');
const testPostMessage = page.locator('#testPostMessage');
await expect(testPostMessage).toHaveText('message 99 true');

await page.waitForSelector('.testCrossOrigin');
const testCrossOrigin = page.locator('#testCrossOrigin');
await expect(testCrossOrigin).toHaveText('message 88 https://partytown.builder.io true');

// TODO!
// await page.waitForSelector('.testLocation');
// const testLocation = page.locator('#testLocation');
// await expect(testLocation).toHaveText('/tests/platform/iframe/location2.html');

await page.waitForSelector('.testSrcChange');
const testSrcChange1 = page.locator('#testSrcChange1');
await expect(testSrcChange1).toHaveText('src-change1');
const testSrcChange2 = page.locator('#testSrcChange2');
await expect(testSrcChange2).toHaveText('src-change2');

await page.waitForSelector('.testGetByTagName');
const testGetByTagName = page.locator('#testGetByTagName');
await expect(testGetByTagName).toHaveText('#document');

await page.waitForSelector('.testGetIframeSrc');
const testGetIframeSrc = page.locator('#testGetIframeSrc');
await expect(testGetIframeSrc).toHaveText('/tests/platform/iframe/content.html');

await page.waitForSelector('.testWindowFrames');
const testWindowFrames = page.locator('#testWindowFrames');
await expect(testWindowFrames).toHaveText('window-frames');

await page.waitForSelector('.testSetJavascriptSrc');
const testSetJavascriptSrc = page.locator('#testSetJavascriptSrc');
await expect(testSetJavascriptSrc).toHaveText('javascript:void(0);');
});
68 changes: 68 additions & 0 deletions tests/platform/iframe/iframe2.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { expect, test } from '@playwright/test';

test('iframe 2', async ({ page }) => {
await page.goto('/tests/platform/iframe/');

await page.waitForSelector('.testMemberNames');
const testMemberNames = page.locator('#testMemberNames');
await expect(testMemberNames).toHaveText('1985');

await page.waitForSelector('.testParentMemberNames');
const testParentMemberNames = page.locator('#testParentMemberNames');
await expect(testParentMemberNames).toHaveText('1985 1885');

await page.waitForSelector('.testNoDeadlock');
const testNoDeadlock = page.locator('#testNoDeadlock');
await expect(testNoDeadlock).toHaveText('99');

await page.waitForSelector('.testWWGlobalNotShared');
const testWWGlobalNotShared = page.locator('#testWWGlobalNotShared');
await expect(testWWGlobalNotShared).toHaveText('true');

await page.waitForSelector('.testFrameElement');
const testFrameElement = page.locator('#testFrameElement');
await expect(testFrameElement).toHaveText('frameElement');

await page.waitForSelector('.testSyncSetAttr');
const testSyncSetAttr = page.locator('#testSyncSetAttr');
await expect(testSyncSetAttr).toHaveText('88');

await page.waitForSelector('.testNativeFetch');
const testNativeFetch = page.locator('#testNativeFetch');
await expect(testNativeFetch).toHaveText('true');

await page.waitForSelector('.testPostMessage');
const testPostMessage = page.locator('#testPostMessage');
await expect(testPostMessage).toHaveText('message 99 true');

await page.waitForSelector('.testCrossOrigin');
const testCrossOrigin = page.locator('#testCrossOrigin');
await expect(testCrossOrigin).toHaveText('message 88 https://partytown.builder.io true');

// TODO!
// await page.waitForSelector('.testLocation');
// const testLocation = page.locator('#testLocation');
// await expect(testLocation).toHaveText('/tests/platform/iframe/location2.html');

await page.waitForSelector('.testSrcChange');
const testSrcChange1 = page.locator('#testSrcChange1');
await expect(testSrcChange1).toHaveText('src-change1');
const testSrcChange2 = page.locator('#testSrcChange2');
await expect(testSrcChange2).toHaveText('src-change2');

await page.waitForSelector('.testGetByTagName');
const testGetByTagName = page.locator('#testGetByTagName');
await expect(testGetByTagName).toHaveText('#document');

await page.waitForSelector('.testGetIframeSrc');
const testGetIframeSrc = page.locator('#testGetIframeSrc');
await expect(testGetIframeSrc).toHaveText('/tests/platform/iframe/content.html');

await page.waitForSelector('.testWindowFrames');
const testWindowFrames = page.locator('#testWindowFrames');
await expect(testWindowFrames).toHaveText('window-frames');

await page.waitForSelector('.testSetJavascriptSrc');
const testSetJavascriptSrc = page.locator('#testSetJavascriptSrc');
await expect(testSetJavascriptSrc).toHaveText('javascript:void(0);');
});

0 comments on commit 80abca5

Please sign in to comment.