Skip to content

Commit cd2bffb

Browse files
test: remove comments
1 parent c72b7e8 commit cd2bffb

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

e2e/react-start/basic/tests/script-duplication.spec.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,97 +2,77 @@ import { expect, test } from '@playwright/test'
22

33
test.describe('Script Duplication Prevention', () => {
44
test('should not create duplicate scripts on SSR route', async ({ page }) => {
5-
// Navigate directly to scripts route (SSR scenario)
65
await page.goto('/scripts')
76

87
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
98

10-
// Count script tags with src="script.js"
119
const scriptCount = await page.evaluate(() => {
1210
return document.querySelectorAll('script[src="script.js"]').length
1311
})
1412

15-
// Should have exactly one script tag
1613
expect(scriptCount).toBe(1)
1714

18-
// Verify the script executed correctly
1915
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
2016
})
2117

2218
test('should not create duplicate scripts during client-side navigation', async ({
2319
page,
2420
}) => {
25-
// Start from home page
2621
await page.goto('/')
2722

28-
// Navigate to scripts route (client-side navigation)
2923
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
3024
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
3125

32-
// Count script tags after first navigation
3326
const firstNavCount = await page.evaluate(() => {
3427
return document.querySelectorAll('script[src="script.js"]').length
3528
})
3629
expect(firstNavCount).toBe(1)
3730

38-
// Navigate away from scripts route
3931
await page.getByRole('link', { name: 'Home' }).click()
4032
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
4133

42-
// Navigate back to scripts route
4334
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
4435
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
4536

46-
// Count script tags after second navigation - should still be 1
4737
const secondNavCount = await page.evaluate(() => {
4838
return document.querySelectorAll('script[src="script.js"]').length
4939
})
5040
expect(secondNavCount).toBe(1)
5141

52-
// Verify the script is still working
5342
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
5443
})
5544

5645
test('should not create duplicate scripts with multiple navigation cycles', async ({
5746
page,
5847
}) => {
59-
// Start from home page
6048
await page.goto('/')
6149

62-
// Navigate to scripts route multiple times
6350
for (let i = 0; i < 3; i++) {
64-
// Go to scripts
6551
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
6652
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
6753

68-
// Go back to home
6954
await page.getByRole('link', { name: 'Home' }).click()
7055
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
7156
}
7257

73-
// Final navigation to scripts
7458
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
7559
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
7660

77-
// Count script tags - should still be exactly 1
7861
const finalCount = await page.evaluate(() => {
7962
return document.querySelectorAll('script[src="script.js"]').length
8063
})
8164
expect(finalCount).toBe(1)
8265

83-
// Verify the script is still working
8466
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
8567
})
8668

8769
test('should not create duplicate inline scripts', async ({ page }) => {
88-
// Navigate directly to inline scripts route (SSR scenario)
8970
await page.goto('/inline-scripts')
9071

9172
await expect(
9273
page.getByTestId('inline-scripts-test-heading'),
9374
).toBeInViewport()
9475

95-
// Count specific inline scripts
9676
const script1Count = await page.evaluate(() => {
9777
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
9878
return scripts.filter(
@@ -111,28 +91,23 @@ test.describe('Script Duplication Prevention', () => {
11191
).length
11292
})
11393

114-
// Should have exactly one of each inline script
11594
expect(script1Count).toBe(1)
11695
expect(script2Count).toBe(1)
11796

118-
// Verify the scripts executed correctly
11997
expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)
12098
expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')
12199
})
122100

123101
test('should not create duplicate inline scripts during client-side navigation', async ({
124102
page,
125103
}) => {
126-
// Start from home page
127104
await page.goto('/')
128105

129-
// Navigate to inline scripts route (client-side navigation)
130106
await page.getByRole('link', { name: 'Inline Scripts' }).click()
131107
await expect(
132108
page.getByTestId('inline-scripts-test-heading'),
133109
).toBeInViewport()
134110

135-
// Count inline scripts after first navigation
136111
const firstNavScript1Count = await page.evaluate(() => {
137112
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
138113
return scripts.filter(
@@ -143,7 +118,6 @@ test.describe('Script Duplication Prevention', () => {
143118
})
144119
expect(firstNavScript1Count).toBe(1)
145120

146-
// Navigate away and back
147121
await page.getByRole('link', { name: 'Home' }).click()
148122
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
149123

@@ -152,7 +126,6 @@ test.describe('Script Duplication Prevention', () => {
152126
page.getByTestId('inline-scripts-test-heading'),
153127
).toBeInViewport()
154128

155-
// Count inline scripts after second navigation - should still be 1
156129
const secondNavScript1Count = await page.evaluate(() => {
157130
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
158131
return scripts.filter(

e2e/solid-start/basic/tests/script-duplication.spec.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,97 +2,74 @@ import { expect, test } from '@playwright/test'
22

33
test.describe('Script Duplication Prevention', () => {
44
test('should not create duplicate scripts on SSR route', async ({ page }) => {
5-
// Navigate directly to scripts route (SSR scenario)
65
await page.goto('/scripts')
76

87
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
98

10-
// Count script tags with src="script.js"
119
const scriptCount = await page.evaluate(() => {
1210
return document.querySelectorAll('script[src="script.js"]').length
1311
})
1412

15-
// Should have exactly one script tag
1613
expect(scriptCount).toBe(1)
17-
18-
// Verify the script executed correctly
1914
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
2015
})
2116

2217
test('should not create duplicate scripts during client-side navigation', async ({
2318
page,
2419
}) => {
25-
// Start from home page
2620
await page.goto('/')
2721

28-
// Navigate to scripts route (client-side navigation)
2922
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
3023
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
3124

32-
// Count script tags after first navigation
3325
const firstNavCount = await page.evaluate(() => {
3426
return document.querySelectorAll('script[src="script.js"]').length
3527
})
3628
expect(firstNavCount).toBe(1)
3729

38-
// Navigate away from scripts route
3930
await page.getByRole('link', { name: 'Home' }).click()
4031
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
4132

42-
// Navigate back to scripts route
4333
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
4434
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
4535

46-
// Count script tags after second navigation - should still be 1
4736
const secondNavCount = await page.evaluate(() => {
4837
return document.querySelectorAll('script[src="script.js"]').length
4938
})
5039
expect(secondNavCount).toBe(1)
51-
52-
// Verify the script is still working
5340
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
5441
})
5542

5643
test('should not create duplicate scripts with multiple navigation cycles', async ({
5744
page,
5845
}) => {
59-
// Start from home page
6046
await page.goto('/')
6147

62-
// Navigate to scripts route multiple times
6348
for (let i = 0; i < 3; i++) {
64-
// Go to scripts
6549
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
6650
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
6751

68-
// Go back to home
6952
await page.getByRole('link', { name: 'Home' }).click()
7053
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
7154
}
7255

73-
// Final navigation to scripts
7456
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
7557
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
7658

77-
// Count script tags - should still be exactly 1
7859
const finalCount = await page.evaluate(() => {
7960
return document.querySelectorAll('script[src="script.js"]').length
8061
})
8162
expect(finalCount).toBe(1)
82-
83-
// Verify the script is still working
8463
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
8564
})
8665

8766
test('should not create duplicate inline scripts', async ({ page }) => {
88-
// Navigate directly to inline scripts route (SSR scenario)
8967
await page.goto('/inline-scripts')
9068

9169
await expect(
9270
page.getByTestId('inline-scripts-test-heading'),
9371
).toBeInViewport()
9472

95-
// Count specific inline scripts
9673
const script1Count = await page.evaluate(() => {
9774
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
9875
return scripts.filter(
@@ -111,28 +88,22 @@ test.describe('Script Duplication Prevention', () => {
11188
).length
11289
})
11390

114-
// Should have exactly one of each inline script
11591
expect(script1Count).toBe(1)
11692
expect(script2Count).toBe(1)
117-
118-
// Verify the scripts executed correctly
11993
expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)
12094
expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')
12195
})
12296

12397
test('should not create duplicate inline scripts during client-side navigation', async ({
12498
page,
12599
}) => {
126-
// Start from home page
127100
await page.goto('/')
128101

129-
// Navigate to inline scripts route (client-side navigation)
130102
await page.getByRole('link', { name: 'Inline Scripts' }).click()
131103
await expect(
132104
page.getByTestId('inline-scripts-test-heading'),
133105
).toBeInViewport()
134106

135-
// Count inline scripts after first navigation
136107
const firstNavScript1Count = await page.evaluate(() => {
137108
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
138109
return scripts.filter(
@@ -143,7 +114,6 @@ test.describe('Script Duplication Prevention', () => {
143114
})
144115
expect(firstNavScript1Count).toBe(1)
145116

146-
// Navigate away and back
147117
await page.getByRole('link', { name: 'Home' }).click()
148118
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
149119

@@ -152,7 +122,6 @@ test.describe('Script Duplication Prevention', () => {
152122
page.getByTestId('inline-scripts-test-heading'),
153123
).toBeInViewport()
154124

155-
// Count inline scripts after second navigation - should still be 1
156125
const secondNavScript1Count = await page.evaluate(() => {
157126
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
158127
return scripts.filter(
@@ -163,7 +132,6 @@ test.describe('Script Duplication Prevention', () => {
163132
})
164133
expect(secondNavScript1Count).toBe(1)
165134

166-
// Verify the scripts are still working
167135
expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)
168136
expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')
169137
})

0 commit comments

Comments
 (0)