Skip to content

Fix copy dictation instructions button on agentic-authoring page#24362

Merged
pelikhan merged 1 commit intomainfrom
copilot/fix-copy-dictation-instructions-button
Apr 3, 2026
Merged

Fix copy dictation instructions button on agentic-authoring page#24362
pelikhan merged 1 commit intomainfrom
copilot/fix-copy-dictation-instructions-button

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

The Playwright test for the dictation copy button was broken in multiple ways, meaning the button on /guides/agentic-authoring/#dictation was untested and unvalidated.

Changes

  • Wrong test URL: /gh-aw/tools/creating-workflows//gh-aw/guides/agentic-authoring/ (page doesn't exist; dictation button lives on agentic-authoring)
  • Wrong content assertion: Fix text-to-speech errorsFix Speech-to-Text Errors (actual ## heading in SKILL.md)
  • Broken route intercept: **/*.instructions.md**/SKILL.md — previous pattern never matched the actual fetch target, making both error-case tests no-ops
  • Button label: "Copy full instructions""Copy dictation instructions" in agentic-authoring.mdx and custom-agent-for-aw.mdx — consistent with "Copy debug instructions" / "Copy agentic-chat instructions" on the same page

- Rename button label from 'Copy full instructions' to 'Copy dictation instructions'
- Fix Playwright test URL from non-existent /tools/creating-workflows/ to /guides/agentic-authoring/
- Fix content assertion from 'Fix text-to-speech errors' to 'Fix Speech-to-Text Errors'
- Fix route intercept patterns from **/*.instructions.md to **/SKILL.md
- Remove stale debug screenshot/console.log from test

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b142f158-b904-4978-8a06-05b0d92eabc2

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 3, 2026 19:55
Copilot AI review requested due to automatic review settings April 3, 2026 19:55
@pelikhan pelikhan merged commit e9a0cb7 into main Apr 3, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/fix-copy-dictation-instructions-button branch April 3, 2026 19:55
Copy link
Copy Markdown
Contributor

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

Fixes and re-validates the “Copy dictation instructions” button on /guides/agentic-authoring/#dictation by aligning Playwright coverage and docs labels with the actual page, content, and fetch target.

Changes:

  • Update the Playwright test to navigate to the correct page and assert the correct dictation prompt content.
  • Fix the route interception pattern so error-path tests actually intercept the SKILL.md fetch.
  • Rename the dictation button label in relevant MDX pages for consistency.
Show a summary per file
File Description
docs/tests/copy-button.spec.ts Updates URL, assertions, and route interception for the dictation copy button test coverage.
docs/src/content/docs/reference/custom-agent-for-aw.mdx Renames the dictation copy button label to match the intended UI wording.
docs/src/content/docs/guides/agentic-authoring.mdx Renames the dictation copy button label on the agentic-authoring guide.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (2)

docs/tests/copy-button.spec.ts:68

  • Same issue as above: hasText: 'Copy dictation instructions' makes the locator dependent on the initial label, but the button text changes to Error during this test. After the click the locator may no longer resolve to the element, causing assertions like toHaveText('Error') to fail. Prefer selecting by a stable attribute such as data-filepath.
    // Find the "Copy dictation instructions" button
    const copyButton = page.locator('.copy-entire-file-btn', {
      hasText: 'Copy dictation instructions',
    });

docs/tests/copy-button.spec.ts:123

  • Same issue as above in this test case: the locator’s hasText filter can prevent it from matching once the button transitions to Error, leading to flaky assertions. Use a stable selector (for example based on data-filepath) and keep text assertions on .btn-text only.
    // Find the "Copy dictation instructions" button
    const copyButton = page.locator('.copy-entire-file-btn', {
      hasText: 'Copy dictation instructions',
    });
  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment on lines +14 to 17
// Find the "Copy dictation instructions" button
const copyButton = page.locator('.copy-entire-file-btn', {
hasText: 'Copy full instructions',
hasText: 'Copy dictation instructions',
});
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The locator is filtered by hasText: 'Copy dictation instructions', but the button text changes to Copying…/Copied!/Error after clicking. Because Playwright locators are re-evaluated on each action/assertion, this locator can stop matching the button after the click, making the subsequent expectations flaky or fail. Use a stable selector (e.g., match data-filepath for the dictation SKILL.md) and assert the initial .btn-text separately.

This issue also appears in the following locations of the same file:

  • line 65
  • line 120

See below for a potential fix:

    // Find the dictation instructions copy button using a stable selector
    const copyButton = page.locator(
      '.copy-entire-file-btn[data-filepath*="dictation"][data-filepath$="SKILL.md"]'
    );

    // Ensure the button is visible
    await expect(copyButton).toBeVisible();
    await expect(copyButton.locator('.btn-text')).toHaveText(
      'Copy dictation instructions'
    );

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.

3 participants