Skip to content

[OPIK-6802] [FE] test: add Prompt Library smoke tests for text and chat prompts - #7034

Merged
natagh23 merged 3 commits into
mainfrom
nata/OPIK-6802/prompts-library-tests
Jun 12, 2026
Merged

[OPIK-6802] [FE] test: add Prompt Library smoke tests for text and chat prompts#7034
natagh23 merged 3 commits into
mainfrom
nata/OPIK-6802/prompts-library-tests

Conversation

@natagh23

@natagh23 natagh23 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Details

Adds end-to-end smoke tests for the Prompt Library covering both text and chat prompt types via two creation paths: SDK and UI.

  • SDK path: seeds prompts via the Opik Python SDK driver; verifies they appear in the library
  • UI path: creates prompts through the Prompt Library UI (empty-state button and dropdown menu)
  • Both paths test: editing a prompt creates v2 with updated content; selecting v1 from version history restores original content
  • Adds data-testid attributes to PromptMessagesReadonly, VersionHistoryTimeline, and PromptTab for stable selector targeting
  • Extends the E2E backend client, Python SDK driver, and TypeScript SDK client with prompt creation/deletion endpoints
  • New POMs: prompts.page.ts (list + create via UI) and prompt-detail.page.ts (view, edit, version history)
  • New fixture: prompt.fixture.ts — seeds SDK prompts and registers cleanup for UI-created prompts

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-6802

AI-WATERMARK

AI-WATERMARK: yes

  • Tools: Claude Code
  • Model(s): claude-sonnet-4-6
  • Scope: assisted (POM generation, fixture scaffolding, data-testid discovery)
  • Human verification: full test run + manual review of selectors and assertions

Testing

Tests: tests_end_to_end/e2e/tests/prompts/prompt-library-smoke.spec.ts

4 scenarios:

  • SDK-seeded text prompt → visible in library, edit → v2, v1 restores original
  • SDK-seeded chat prompt → visible in library, edit → v2, v1 restores original
  • UI-created text prompt → detail page correct, edit → v2, v1 restores original
  • UI-created chat prompt → detail page correct, edit → v2, v1 restores original
cd tests_end_to_end/e2e
npx playwright test tests/prompts/prompt-library-smoke.spec.ts

Documentation

N/A

@github-actions github-actions Bot added python Pull requests that update Python code Frontend tests Including test files, or tests related like configuration. typescript *.ts *.tsx labels Jun 11, 2026
Comment thread tests_end_to_end/e2e/pom/prompts.page.ts
Comment thread tests_end_to_end/e2e/pom/prompt-detail.page.ts
@natagh23
natagh23 marked this pull request as ready for review June 11, 2026 17:07
@natagh23
natagh23 requested review from a team as code owners June 11, 2026 17:07
@natagh23
natagh23 force-pushed the nata/OPIK-6802/prompts-library-tests branch from 6becbe7 to dfc6a84 Compare June 12, 2026 09:18
Comment on lines +30 to +34
textPrompt: async ({ sdkClient, backendClient, project, testNamespace }, use, testInfo) => {
const name = `${testNamespace}-text-prompt`;
const created = await sdkClient.python.createTextPrompt({
name,
prompt: TEXT_TEMPLATE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The textPrompt and chatPrompt fixtures duplicate the create → attach → usebackendClient.deletePrompt flow, should we extract a shared helper that takes the SDK payload/callback and handles the boilerplate?

Severity

Want Baz to fix this for you? Activate Fixer

Comment on lines +13 to +17
const emptyStateBtn = this.page.getByRole('button', { name: 'Create a text prompt' });
if (await emptyStateBtn.isVisible()) {
await emptyStateBtn.click();
} else {
await this.page.getByRole('button', { name: 'Prompt' }).click();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

createTextPromptViaUI and createChatPromptViaUI duplicate the empty-state/dropdown flow plus waitForURL, should we extract helpers like openPromptCreationMenu(promptType) and waitForPromptNavigation()?

Severity

Want Baz to fix this for you? Activate Fixer

@natagh23
natagh23 merged commit 4289e0e into main Jun 12, 2026
11 checks passed
@natagh23
natagh23 deleted the nata/OPIK-6802/prompts-library-tests branch June 12, 2026 09:34
jverre pushed a commit that referenced this pull request Jun 12, 2026
…at prompts (#7034)

* add smoke tests for chat and text prompts (create via UI/SDK, edit, check new version)

* baz comment fixes

* fix prettier error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend python Pull requests that update Python code tests Including test files, or tests related like configuration. typescript *.ts *.tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants