Skip to content

Commit 37e40ae

Browse files
committed
Ignore template spec at creation step
1 parent fe5702f commit 37e40ae

File tree

61 files changed

+1069
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1069
-35
lines changed

examples/action-chatgpt/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

examples/action/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

examples/config-babel/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

examples/config-stylelint/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

examples/content-css-module/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-css-module'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name content_script-box', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('body > div.content_script-box')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h1 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h1 = page.locator('body > div.content_script-box > h1')
26+
await test.expect(h1).toHaveText('Change the background-color ⬇')
27+
})
28+
29+
test('should exist a default color value', async ({page}) => {
30+
await page.goto('https://extension.js.org/')
31+
const h1 = page.locator('body > div.content_script-box > h1')
32+
const color = await page.evaluate(
33+
(locator) => {
34+
return window.getComputedStyle(locator!).getPropertyValue('color')
35+
},
36+
await h1.elementHandle()
37+
)
38+
await test.expect(color).toEqual('rgb(51, 51, 51)')
39+
})

examples/content-extension-config/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-extension-config'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name extension-root', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('#extension-root')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h2 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h2 = page.locator('#extension-root h2')
26+
await test
27+
.expect(h2)
28+
.toHaveText(
29+
'This is a content script running React, TypeScript, and Tailwind.css'
30+
)
31+
})
32+
33+
test('should exist a default color value', async ({page}) => {
34+
await page.goto('https://extension.js.org/')
35+
const h2 = page.locator('#extension-root h2')
36+
const color = await page.evaluate(
37+
(locator) => {
38+
return window.getComputedStyle(locator!).getPropertyValue('color')
39+
},
40+
await h2.elementHandle()
41+
)
42+
await test.expect(color).toEqual('rgb(255, 255, 255)')
43+
})
44+
45+
test('should load all images successfully', async ({page}) => {
46+
await page.goto('https://extension.js.org/')
47+
const images = page.locator('#extension-root img')
48+
const imageElements = await images.all()
49+
50+
const results: boolean[] = []
51+
52+
for (const image of imageElements) {
53+
const naturalWidth = await page.evaluate(
54+
(img) => {
55+
return img ? (img as HTMLImageElement).naturalWidth : 0
56+
},
57+
await image.elementHandle()
58+
)
59+
60+
const naturalHeight = await page.evaluate(
61+
(img) => {
62+
return img ? (img as HTMLImageElement).naturalHeight : 0
63+
},
64+
await image.elementHandle()
65+
)
66+
67+
const loadedSuccessfully = naturalWidth > 0 && naturalHeight > 0
68+
results.push(loadedSuccessfully)
69+
}
70+
71+
await test.expect(results.every((result) => result)).toBeTruthy()
72+
})

examples/content-less/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-less'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name content_script-box', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('body > div.content_script-box')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h1 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h1 = page.locator('body > div.content_script-box > h1')
26+
await test.expect(h1).toHaveText('Change the background-color ⬇')
27+
})
28+
29+
test('should exist a default color value', async ({page}) => {
30+
await page.goto('https://extension.js.org/')
31+
const h1 = page.locator('body > div.content_script-box > h1')
32+
const color = await page.evaluate(
33+
(locator) => {
34+
return window.getComputedStyle(locator!).getPropertyValue('color')
35+
},
36+
await h1.elementHandle()
37+
)
38+
await test.expect(color).toEqual('rgb(51, 51, 51)')
39+
})

examples/content-main-world/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-main-world'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name content_script-box', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('body > div.content_script-box')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h1 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h1 = page.locator('body > div.content_script-box > h1')
26+
await test.expect(h1).toHaveText('Main World')
27+
})
28+
29+
test('should exist a default color value', async ({page}) => {
30+
await page.goto('https://extension.js.org/')
31+
const h1 = page.locator('body > div.content_script-box > h1')
32+
const color = await page.evaluate(
33+
(locator) => {
34+
return window.getComputedStyle(locator!).getPropertyValue('color')
35+
},
36+
await h1.elementHandle()
37+
)
38+
await test.expect(color).toEqual('rgb(51, 51, 51)')
39+
})

examples/content-preact/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-preact'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name extension-root', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('#extension-root')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h2 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h2 = page.locator('#extension-root h2')
26+
await test
27+
.expect(h2)
28+
.toHaveText(
29+
'This is a content script running Preact, TypeScript, and Tailwind.css.'
30+
)
31+
})
32+
33+
test('should exist a default color value', async ({page}) => {
34+
await page.goto('https://extension.js.org/')
35+
const h2 = page.locator('#extension-root h2')
36+
const color = await page.evaluate(
37+
(locator) => {
38+
return window.getComputedStyle(locator!).getPropertyValue('color')
39+
},
40+
await h2.elementHandle()
41+
)
42+
await test.expect(color).toEqual('rgb(255, 255, 255)')
43+
})
44+
45+
test('should load all images successfully', async ({page}) => {
46+
await page.goto('https://extension.js.org/')
47+
const images = page.locator('#extension-root img')
48+
const imageElements = await images.all()
49+
50+
const results: boolean[] = []
51+
52+
for (const image of imageElements) {
53+
const naturalWidth = await page.evaluate(
54+
(img) => {
55+
return img ? (img as HTMLImageElement).naturalWidth : 0
56+
},
57+
await image.elementHandle()
58+
)
59+
60+
const naturalHeight = await page.evaluate(
61+
(img) => {
62+
return img ? (img as HTMLImageElement).naturalHeight : 0
63+
},
64+
await image.elementHandle()
65+
)
66+
67+
const loadedSuccessfully = naturalWidth > 0 && naturalHeight > 0
68+
results.push(loadedSuccessfully)
69+
}
70+
71+
await test.expect(results.every((result) => result)).toBeTruthy()
72+
})

examples/content-react-svgr/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

examples/content-react/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import path from 'path'
2+
import {execSync} from 'child_process'
3+
import {extensionFixtures} from '../extension-fixtures'
4+
5+
const exampleDir = 'examples/content-react'
6+
const pathToExtension = path.join(__dirname, `dist/chrome`)
7+
const test = extensionFixtures(pathToExtension, true)
8+
9+
test.beforeAll(async () => {
10+
execSync(`pnpm extension build ${exampleDir}`, {
11+
cwd: path.join(__dirname, '..')
12+
})
13+
})
14+
15+
test('should exist an element with the class name extension-root', async ({
16+
page
17+
}) => {
18+
await page.goto('https://extension.js.org/')
19+
const div = page.locator('#extension-root')
20+
await test.expect(div).toBeVisible()
21+
})
22+
23+
test('should exist an h2 element with specified content', async ({page}) => {
24+
await page.goto('https://extension.js.org/')
25+
const h2 = page.locator('#extension-root h2')
26+
await test
27+
.expect(h2)
28+
.toHaveText(
29+
'This is a content script running React, TypeScript, and Tailwind.css'
30+
)
31+
})
32+
33+
test('should exist a default color value', async ({page}) => {
34+
await page.goto('https://extension.js.org/')
35+
const h2 = page.locator('#extension-root h2')
36+
const color = await page.evaluate(
37+
(locator) => {
38+
return window.getComputedStyle(locator!).getPropertyValue('color')
39+
},
40+
await h2.elementHandle()
41+
)
42+
await test.expect(color).toEqual('rgb(255, 255, 255)')
43+
})
44+
45+
test('should load all images successfully', async ({page}) => {
46+
await page.goto('https://extension.js.org/')
47+
const images = page.locator('#extension-root img')
48+
const imageElements = await images.all()
49+
50+
const results: boolean[] = []
51+
52+
for (const image of imageElements) {
53+
const naturalWidth = await page.evaluate(
54+
(img) => {
55+
return img ? (img as HTMLImageElement).naturalWidth : 0
56+
},
57+
await image.elementHandle()
58+
)
59+
60+
const naturalHeight = await page.evaluate(
61+
(img) => {
62+
return img ? (img as HTMLImageElement).naturalHeight : 0
63+
},
64+
await image.elementHandle()
65+
)
66+
67+
const loadedSuccessfully = naturalWidth > 0 && naturalHeight > 0
68+
results.push(loadedSuccessfully)
69+
}
70+
71+
await test.expect(results.every((result) => result)).toBeTruthy()
72+
})

examples/content-sass-module/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# extension.js
3131
extension-env.d.ts
32-
template.spec.ts

0 commit comments

Comments
 (0)