-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partytown worker failing to initialize after passing non-serializable…
… objects to postMessage (#458) * add failing test case with Klaviyo base script tag * add filtering for non-serializable interfaces and main data request log * make objects serializable (not a fix) * fix: missing constructor * fix: picking up klaviyo object * fix: revert debug changes from GeorgiZhelev --------- Co-authored-by: Miško Hevery <[email protected]>
- Loading branch information
1 parent
3e8b049
commit e7eed80
Showing
4 changed files
with
592 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const elm = document.getElementById('testCurrentScriptSrc'); | ||
elm.textContent = document.currentScript.dataset.currentScript; | ||
|
||
const loc = document.getElementById('testCurrentScriptSrcLocation'); | ||
|
||
const currentScript = document.currentScript; | ||
const currentUrl = new URL(currentScript.src); | ||
loc.textContent = currentUrl.pathname; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('document', async ({ page }) => { | ||
await page.goto('/tests/platform/document/'); | ||
|
||
await page.waitForSelector('.completed'); | ||
|
||
const testGetElementById = page.locator('#testGetElementById'); | ||
await expect(testGetElementById).toHaveText('testGetElementById'); | ||
|
||
const testGetElementsByTagName = page.locator('#testGetElementsByTagName'); | ||
await expect(testGetElementsByTagName).toHaveText('Document'); | ||
|
||
const testGetElementsByTagNameHead = page.locator('#testGetElementsByTagNameHead'); | ||
await expect(testGetElementsByTagNameHead).toHaveText('[HEAD]'); | ||
|
||
const testGetElementsByClassName = page.locator('#testGetElementsByClassName'); | ||
await expect(testGetElementsByClassName).toHaveText('Document'); | ||
|
||
const testTitleGet = page.locator('#testTitleGet'); | ||
await expect(testTitleGet).toHaveText('Document'); | ||
|
||
const testTitleSet = page.locator('#testTitleSet'); | ||
await expect(testTitleSet).toHaveText('Document!!!'); | ||
|
||
const testCookie = page.locator('#testCookie'); | ||
await expect(testCookie).toHaveText('mph=88'); | ||
|
||
const testLocationGet = page.locator('#testLocationGet'); | ||
await expect(testLocationGet).toHaveText('/tests/platform/document/'); | ||
|
||
const testDefaultView = page.locator('#testDefaultView'); | ||
await expect(testDefaultView).toHaveText('window'); | ||
|
||
const testDocElement = page.locator('#testDocElement'); | ||
await expect(testDocElement).toHaveText('HTML HTMLHtmlElement'); | ||
|
||
const testHead = page.locator('#testHead'); | ||
await expect(testHead).toHaveText('HEAD HTMLHeadElement'); | ||
|
||
const testBody = page.locator('#testBody'); | ||
await expect(testBody).toHaveText('BODY HTMLBodyElement'); | ||
|
||
const testCompatMode = page.locator('#testCompatMode'); | ||
await expect(testCompatMode).toHaveText('CSS1Compat'); | ||
|
||
const testCurrentScript = page.locator('#testCurrentScript'); | ||
await expect(testCurrentScript).toHaveText('inlined'); | ||
|
||
const testCurrentScriptSrc = page.locator('#testCurrentScriptSrc'); | ||
const testCurrentScriptSrcLocation = page.locator('#testCurrentScriptSrcLocation'); | ||
await expect(testCurrentScriptSrc).toHaveText('src'); | ||
await expect(testCurrentScriptSrcLocation).toHaveText( | ||
'/tests/platform/document/current-script-src.js' | ||
); | ||
|
||
await page.waitForSelector('.testCurrentScriptNullAsync'); | ||
const testCurrentScriptNullAsync = page.locator('#testCurrentScriptNullAsync'); | ||
await expect(testCurrentScriptNullAsync).toHaveText('null'); | ||
|
||
const testHeadParentNode = page.locator('#testHeadParentNode'); | ||
await expect(testHeadParentNode).toHaveText('HTML HTML'); | ||
|
||
const testBodyParentNode = page.locator('#testBodyParentNode'); | ||
await expect(testBodyParentNode).toHaveText('HTML HTML'); | ||
|
||
const testDocumentElementParentNode = page.locator('#testDocumentElementParentNode'); | ||
await expect(testDocumentElementParentNode).toHaveText('#document null'); | ||
|
||
const testDocumentParentNode = page.locator('#testDocumentParentNode'); | ||
await expect(testDocumentParentNode).toHaveText('null null'); | ||
|
||
const testDocumentChildNodes = page.locator('#testDocumentChildNodes'); | ||
await expect(testDocumentChildNodes).toHaveText('2 [html(10), HTML(1)]'); | ||
|
||
const testDocumentForms = page.locator('#testDocumentForms'); | ||
await expect(testDocumentForms).toHaveText('0'); | ||
|
||
const testDocType = page.locator('#testDocType'); | ||
await expect(testDocType).toHaveText('10 html html false'); | ||
|
||
const testDocCstrName = page.locator('#testDocCstrName'); | ||
await expect(testDocCstrName).toHaveText('HTMLDocument'); | ||
|
||
const testReadyState = page.locator('#testReadyState'); | ||
await expect(testReadyState).toHaveText('complete'); | ||
|
||
const testCreateElementError = page.locator('#testCreateElementError'); | ||
await expect(testCreateElementError).toHaveText('errored'); | ||
|
||
const testCreateElementError_ = page.locator('#testCreateElementError_'); | ||
await expect(testCreateElementError_).toHaveText('no error'); | ||
|
||
const testCreateHTMLDocument = page.locator('#testCreateHTMLDocument'); | ||
await expect(testCreateHTMLDocument).toHaveText('88mph hidden BASE'); | ||
|
||
const testVisibilityState = page.locator('#testVisibilityState'); | ||
await expect(testVisibilityState).toHaveText('visible'); | ||
|
||
const testImages = page.locator('#testDocumentImages'); | ||
const pageUrl = new URL(page.url()); | ||
await expect(testImages).toHaveText(`${pageUrl.origin}/fake.jpg`); | ||
}); |
Oops, something went wrong.
e7eed80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
partytown – ./
partytown-builder-io.vercel.app
partytown.vercel.app
partytown-git-main-builder-io.vercel.app
partytown.builder.io