Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -204,32 +204,22 @@ test.describe('ServiceDocPanel', () => {

const docPanel = page.getByTestId('service-requirements');
const codeBlock = docPanel.locator('pre').first();
const copyButtonWrapper = docPanel.locator('.code-copy-button').first();
const copyButton = docPanel.getByTestId('code-block-copy-icon').first();

// Hover code block to reveal the button
await codeBlock.hover();
await expect(copyButton).toBeVisible();

// Verify initial state
await expect(copyButtonWrapper).toHaveAttribute('data-copied', 'false');

// Click and verify copied state + tooltip
await copyButton.hover();
await copyButton.click();

await expect(copyButtonWrapper).toHaveAttribute('data-copied', 'true');
await expect(page.getByRole('tooltip')).toBeVisible();

// Verify clipboard is non-empty
const clipboardText = await page.evaluate(() =>
navigator.clipboard.readText()
);

expect(clipboardText.length).toBeGreaterThan(0);

// Verify state resets after 2s timer
await expect(copyButtonWrapper).toHaveAttribute('data-copied', 'false');
});
});
});
Loading