Skip to content

Commit

Permalink
convert tests to shae-ent
Browse files Browse the repository at this point in the history
  • Loading branch information
spearwolf committed Jul 14, 2024
1 parent 24b88d2 commit b83f7d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 35 deletions.
26 changes: 12 additions & 14 deletions packages/shadow-ents-e2e/pages/bundle.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
<body>
<script type="module" src="/src/bundle.ts"></script>
<main>
<shadow-local-env data-testid="localEnv0">
<shadow-entity data-testid="seBase0">
seBase0
<shadow-entity data-testid="seBase1">
seBase1
<shadow-entity data-testid="seBase3">seBase3</shadow-entity>
</shadow-entity>
<shadow-entity data-testid="seBase2">seBase2</shadow-entity>
</shadow-entity>
</shadow-local-env>
<shadow-worker data-testid="workerCtx0">
<shadow-entity data-testid="seBase4">seBase2</shadow-entity>
</shadow-worker>
<shae-worker local data-testid="localEnv0"></shae-worker>
<shae-worker ns="worker0" data-testid="workerCtx0"></shae-worker>
<shae-ent data-testid="seBase0">
seBase0
<shae-ent data-testid="seBase1">
seBase1
<shae-ent ns="worker0" data-testid="seBase4">seBase4</shae-ent>
<shae-ent data-testid="seBase3">seBase3</shae-ent>
</shae-ent>
<shae-ent data-testid="seBase2">seBase2</shae-ent>
</shae-ent>
</main>
<script>
customElements.whenDefined('shadow-entity').then(() => {
customElements.whenDefined('shae-ent').then(() => {
window.localEnv0 = document.querySelector('[data-testid="localEnv0"]');
window.seBase0 = document.querySelector('[data-testid="seBase0"]');
window.seBase1 = document.querySelector('[data-testid="seBase1"]');
Expand Down
25 changes: 4 additions & 21 deletions packages/shadow-ents-e2e/tests/bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test.describe('bundle', () => {
await page.goto('/pages/bundle.html');
});

test.describe('shadow-entity', () => {
test.describe('shae-ent', () => {
test('has element', async ({page}) => {
await expect(page.getByTestId('seBase0')).toBeAttached();
});
Expand All @@ -14,32 +14,15 @@ test.describe('bundle', () => {
expect(
await page.evaluate(() =>
customElements
.whenDefined('shadow-entity')
.whenDefined('shae-ent')
.then(() => true)
.catch(() => false),
),
).toBe(true);
});
});

test.describe('shadow-local-env', () => {
test('has element', async ({page}) => {
await expect(page.getByTestId('localEnv0')).toBeAttached();
});

test('custom element is defined', async ({page}) => {
expect(
await page.evaluate(() =>
customElements
.whenDefined('shadow-local-env')
.then(() => true)
.catch(() => false),
),
).toBe(true);
});
});

test.describe('shadow-worker', () => {
test.describe('shae-worker', () => {
test('has element', async ({page}) => {
await expect(page.getByTestId('workerCtx0')).toBeAttached();
});
Expand All @@ -48,7 +31,7 @@ test.describe('bundle', () => {
expect(
await page.evaluate(() =>
customElements
.whenDefined('shadow-worker')
.whenDefined('shae-worker')
.then(() => true)
.catch(() => false),
),
Expand Down

0 comments on commit b83f7d9

Please sign in to comment.