Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions e2e/react-start/css-modules/tests/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,40 +222,45 @@ test.describe('CSS styles in SSR (dev mode)', () => {
}) => {
// Start from home
await page.goto(buildUrl(baseURL!, '/'))
await page.waitForTimeout(1000)

// Verify initial styles
// Verify initial styles with retry to handle potential Vite dep optimization reload
const globalElement = page.getByTestId('global-styled')
await expect(globalElement).toBeVisible()
let backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })

// Navigate to modules page
await page.getByTestId('nav-modules').click()
// Use glob pattern to match with or without basepath
await page.waitForURL('**/modules')

// Verify CSS modules styles
// Verify CSS modules styles with retry to handle potential Vite dep optimization reload
const card = page.getByTestId('module-card')
await expect(card).toBeVisible()
backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
await expect(async () => {
await expect(card).toBeVisible()
const backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
}).toPass({ timeout: 10000 })

// Navigate back to home
await page.getByTestId('nav-home').click()
// Match home URL with or without trailing slash and optional query string
// Matches: /, /?, /my-app, /my-app/, /my-app?foo=bar
await page.waitForURL(/\/([^/]*)(\/)?($|\?)/)

// Verify global styles still work
await expect(globalElement).toBeVisible()
backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
// Verify global styles still work with retry
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })
})
})
43 changes: 24 additions & 19 deletions e2e/solid-start/css-modules/tests/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,40 +194,45 @@ test.describe('CSS styles in SSR (dev mode)', () => {
}) => {
// Start from home
await page.goto(buildUrl(baseURL!, '/'))
await page.waitForTimeout(1000)

// Verify initial styles
// Verify initial styles with retry to handle potential Vite dep optimization reload
const globalElement = page.getByTestId('global-styled')
await expect(globalElement).toBeVisible()
let backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })

// Navigate to modules page
await page.getByTestId('nav-modules').click()
// Use glob pattern to match with or without basepath
await page.waitForURL('**/modules')

// Verify CSS modules styles
// Verify CSS modules styles with retry to handle potential Vite dep optimization reload
const card = page.getByTestId('module-card')
await expect(card).toBeVisible()
backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
await expect(async () => {
await expect(card).toBeVisible()
const backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
}).toPass({ timeout: 10000 })

// Navigate back to home
await page.getByTestId('nav-home').click()
// Match home URL with or without trailing slash and optional query string
// Matches: /, /?, /my-app, /my-app/, /my-app?foo=bar
await page.waitForURL(/\/([^/]*)(\/)?($|\?)/)

// Verify global styles still work
await expect(globalElement).toBeVisible()
backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
// Verify global styles still work with retry
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })
})
})
43 changes: 24 additions & 19 deletions e2e/vue-start/css-modules/tests/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,40 +196,45 @@ test.describe('CSS styles in SSR (dev mode)', () => {
}) => {
// Start from home
await page.goto(buildUrl(baseURL!, '/'))
await page.waitForTimeout(1000)

// Verify initial styles
// Verify initial styles with retry to handle potential Vite dep optimization reload
const globalElement = page.getByTestId('global-styled')
await expect(globalElement).toBeVisible()
let backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })

// Navigate to modules page
await page.getByTestId('nav-modules').click()
// Use glob pattern to match with or without basepath
await page.waitForURL('**/modules')

// Verify CSS modules styles
// Verify CSS modules styles with retry to handle potential Vite dep optimization reload
const card = page.getByTestId('module-card')
await expect(card).toBeVisible()
backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
await expect(async () => {
await expect(card).toBeVisible()
const backgroundColor = await card.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(240, 253, 244)')
}).toPass({ timeout: 10000 })

// Navigate back to home
await page.getByTestId('nav-home').click()
// Match home URL with or without trailing slash and optional query string
// Matches: /, /?, /my-app, /my-app/, /my-app?foo=bar
await page.waitForURL(/\/([^/]*)(\/)?($|\?)/)

// Verify global styles still work
await expect(globalElement).toBeVisible()
backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
// Verify global styles still work with retry
await expect(async () => {
await expect(globalElement).toBeVisible()
const backgroundColor = await globalElement.evaluate(
(el) => getComputedStyle(el).backgroundColor,
)
expect(backgroundColor).toBe('rgb(59, 130, 246)')
}).toPass({ timeout: 10000 })
})
})
Loading