Skip to content

test: add more image test#1682

Merged
Mister-Hope merged 3 commits intometeorlxy-markdown-to-vuefrom
image-test
Mar 10, 2026
Merged

test: add more image test#1682
Mister-Hope merged 3 commits intometeorlxy-markdown-to-vuefrom
image-test

Conversation

@Mister-Hope
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 10, 2026 00:18
@Mister-Hope Mister-Hope merged commit 8d886ce into meteorlxy-markdown-to-vue Mar 10, 2026
@Mister-Hope Mister-Hope deleted the image-test branch March 10, 2026 00:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the markdown image E2E fixtures to cover additional asset-resolution cases (bare specifier aliasing and Vue :src bindings) in the VuePress E2E site.

Changes:

  • Adds new <img> cases in the markdown fixture, including a bare src="image-alias.png" and :src bindings backed by <script setup> imports.
  • Adds an alias entry for image-alias.png in the E2E VuePress config.
  • Updates the Playwright E2E test assertions for the images page.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
e2e/tests/markdown/images.spec.ts Updates image count and expected alt assertions for the images page E2E test.
e2e/docs/markdown/images/images.md Adds more image usage patterns to validate alias and imported asset behavior.
e2e/docs/.vuepress/config.ts Adds a new alias mapping intended to support the new bare image-alias.png reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

await page.goto('markdown/images/images.html')

await expect(imagesLocator).toHaveCount(6)
await expect(imagesLocator).toHaveCount(9)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

images.md currently contains 9 <img> elements inside .e2e-theme-content (3 from Markdown image syntax + 6 explicit <img> tags). Updating the expectation from 6 to 78 looks incorrect and will make the test fail or become extremely brittle. Consider asserting the expected count (9) or removing the exact count assertion and instead asserting the presence of the specific images you care about.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +26
await expect(imagesLocator).toHaveCount(9)
await expect(imagesLocator.nth(0)).toHaveAttribute('alt', 'logo-public')
await expect(imagesLocator.nth(1)).toHaveAttribute('alt', 'logo-relative')
await expect(imagesLocator.nth(2)).toHaveAttribute('alt', 'logo-alias')
await expect(imagesLocator.nth(3)).toHaveAttribute('alt', 'img-logo-public')
await expect(imagesLocator.nth(4)).toHaveAttribute('alt', 'img-logo-relative')
await expect(imagesLocator.nth(5)).toHaveAttribute('alt', 'img-logo-alias')
await expect(imagesLocator.nth(6)).toHaveAttribute(
'alt',
'img-logo-alias-ext',
)
await expect(imagesLocator.nth(7)).toHaveAttribute(
'alt',
'img-logo-alias-path',
)
await expect(imagesLocator.nth(8)).toHaveAttribute(
'alt',
'img-logo-relative-path',
)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test assertions rely on fixed nth() ordering, but images.md now renders additional images (including a second alt="img-logo-alias"), so the indices after nth(4) shift. This makes the new nth(6) / nth(7) assertions likely off-by-one and fragile. Prefer targeting the elements by alt/src selectors (or update indices + add an assertion for the extra img-logo-alias image).

Suggested change
await expect(imagesLocator).toHaveCount(9)
await expect(imagesLocator.nth(0)).toHaveAttribute('alt', 'logo-public')
await expect(imagesLocator.nth(1)).toHaveAttribute('alt', 'logo-relative')
await expect(imagesLocator.nth(2)).toHaveAttribute('alt', 'logo-alias')
await expect(imagesLocator.nth(3)).toHaveAttribute('alt', 'img-logo-public')
await expect(imagesLocator.nth(4)).toHaveAttribute('alt', 'img-logo-relative')
await expect(imagesLocator.nth(5)).toHaveAttribute('alt', 'img-logo-alias')
await expect(imagesLocator.nth(6)).toHaveAttribute(
'alt',
'img-logo-alias-ext',
)
await expect(imagesLocator.nth(7)).toHaveAttribute(
'alt',
'img-logo-alias-path',
)
await expect(imagesLocator.nth(8)).toHaveAttribute(
'alt',
'img-logo-relative-path',
)
await expect(imagesLocator).toHaveCount(10)
await expect(page.getByAltText('logo-public')).toHaveCount(1)
await expect(page.getByAltText('logo-relative')).toHaveCount(1)
await expect(page.getByAltText('logo-alias')).toHaveCount(1)
await expect(page.getByAltText('img-logo-public')).toHaveCount(1)
await expect(page.getByAltText('img-logo-relative')).toHaveCount(1)
await expect(page.getByAltText('img-logo-alias')).toHaveCount(2)
await expect(page.getByAltText('img-logo-alias-ext')).toHaveCount(1)
await expect(page.getByAltText('img-logo-alias-path')).toHaveCount(1)
await expect(page.getByAltText('img-logo-relative-path')).toHaveCount(1)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants