forked from QwikDev/partytown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7693e6
commit 53502c9
Showing
3 changed files
with
101 additions
and
0 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,92 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="Partytown Test Page" /> | ||
<title>No Partytown Script</title> | ||
<style> | ||
body { | ||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, | ||
Apple Color Emoji, Segoe UI Emoji; | ||
font-size: 12px; | ||
} | ||
h1 { | ||
margin: 0 0 15px 0; | ||
} | ||
ul { | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
a { | ||
display: block; | ||
padding: 16px 8px; | ||
} | ||
a:link, | ||
a:visited { | ||
text-decoration: none; | ||
color: blue; | ||
} | ||
a:hover { | ||
background-color: #eee; | ||
} | ||
strong a { | ||
display: inline-block; | ||
} | ||
li { | ||
display: flex; | ||
margin: 15px 0; | ||
} | ||
li strong, | ||
li code, | ||
li button, | ||
li a { | ||
white-space: nowrap; | ||
flex: 1; | ||
margin: 0 5px; | ||
padding: 0; | ||
} | ||
</style> | ||
<script> | ||
window.pageErrors = []; | ||
window.addEventListener('error', (ev) => { | ||
window.pageErrors.push(ev.message); | ||
}); | ||
</script> | ||
<script> | ||
partytown = { | ||
logCalls: true, | ||
logGetters: true, | ||
logSetters: true, | ||
logStackTraces: false, | ||
logScriptExecution: true, | ||
}; | ||
</script> | ||
<script src="/~partytown/debug/partytown.js"></script> | ||
</head> | ||
<body> | ||
<h1>No Partytown Script</h1> | ||
|
||
<p> | ||
Tests initializing Partytown, however, the page has no text/partytown scripts. Ensure there's | ||
no runtime errors. | ||
</p> | ||
|
||
<ul> | ||
<li> | ||
<strong>Page Errors</strong> | ||
<code id="testPageErrors">--</code> | ||
<script> | ||
// used for e2e testing a page w/out Partytown | ||
if (window.pageErrors.length > 0) { | ||
document.getElementById('testPageErrors').textContent = window.pageErrors.join('<br>'); | ||
} | ||
</script> | ||
</li> | ||
</ul> | ||
|
||
<hr /> | ||
<p><a href="/tests/">All Tests</a></p> | ||
</body> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
tests/platform/no-partytown-script/no-partytown-script.spec.ts
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 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('no-partytown-script', async ({ page }) => { | ||
await page.goto('/tests/platform/no-partytown-script/'); | ||
|
||
const testPageErrors = page.locator('#testPageErrors'); | ||
await expect(testPageErrors).toHaveText('--'); | ||
}); |