Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(quantic): added playwright tests and unit test for quantic generated answer component #4803

Merged
merged 9 commits into from
Dec 31, 2024
2 changes: 1 addition & 1 deletion packages/quantic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ npm run e2e:detailed
To run Playwright tests, run:

```bash
npm run e2e:playwright:
npm run e2e:playwright
```

To run Playwright tests only for the scratch org where LWS is enabled, run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export const GeneratedAnswerSelectors: GeneratedAnswerSelector = {
get: () => cy.get(generatedAnswerComponent),

generatedAnswerCard: () =>
GeneratedAnswerSelectors.get().find('[data-cy="generated-answer__card"]'),
GeneratedAnswerSelectors.get().find(
'[data-testid="generated-answer__card"]'
),
generatedAnswer: () =>
GeneratedAnswerSelectors.get().find('[data-cy="generated-answer__answer"]'),
likeButton: () =>
Expand All @@ -49,23 +51,23 @@ export const GeneratedAnswerSelectors: GeneratedAnswerSelector = {
),
citations: () =>
GeneratedAnswerSelectors.get().find(
'[data-cy="generated-answer__citations"]'
'[data-testid="generated-answer__citations"]'
),
citationTitle: (index: number) =>
GeneratedAnswerSelectors.get()
.find('[data-cy="generated-answer__citations"] .citation__title')
.find('[data-testid="generated-answer__citations"] .citation__title')
.eq(index),
citationLink: (index: number) =>
GeneratedAnswerSelectors.get()
.find('[data-cy="generated-answer__citations"] .citation__link')
.find('[data-testid="generated-answer__citations"] .citation__link')
.eq(index),
retryButton: () =>
GeneratedAnswerSelectors.get().find(
'[data-cy="generated-answer__retry-button"]'
'[data-testid="generated-answer__retry-button"]'
),
toggleGeneratedAnswerButton: () =>
GeneratedAnswerSelectors.get().find(
'c-quantic-generated-answer-toggle [data-cy="generated-answer__toggle-button"]'
'c-quantic-generated-answer-toggle [data-testid="generated-answer__toggle-button"]'
),
generatedAnswerContent: () =>
GeneratedAnswerSelectors.get().find(
Expand Down Expand Up @@ -96,38 +98,38 @@ export const GeneratedAnswerSelectors: GeneratedAnswerSelector = {
),
copyToClipboardButton: () =>
GeneratedAnswerSelectors.get().find(
'[data-cy="generated-answer__copy-to-clipboard"]'
'[data-testid="generated-answer__copy-to-clipboard"]'
),
citationTooltip: (index: number) =>
GeneratedAnswerSelectors.get()
.find('[data-cy="generated-answer__citations"] [data-cy="tooltip"]')
.find('[data-testid="generated-answer__citations"] [data-cy="tooltip"]')
.eq(index),
citationTooltipUri: (index: number) =>
GeneratedAnswerSelectors.get()
.find(
'[data-cy="generated-answer__citations"] [data-cy="citation__tooltip-uri"]'
'[data-testid="generated-answer__citations"] [data-cy="citation__tooltip-uri"]'
)
.eq(index),
citationTooltipTitle: (index: number) =>
GeneratedAnswerSelectors.get()
.find(
'[data-cy="generated-answer__citations"] [data-cy="citation__tooltip-title"]'
'[data-testid="generated-answer__citations"] [data-cy="citation__tooltip-title"]'
)
.eq(index),

citationTooltipText: (index: number) =>
GeneratedAnswerSelectors.get()
.find(
'[data-cy="generated-answer__citations"] [data-cy="citation__tooltip-text"]'
'[data-testid="generated-answer__citations"] [data-cy="citation__tooltip-text"]'
)
.eq(index),
disclaimer: () =>
GeneratedAnswerSelectors.get().find(
'[data-cy="generated-answer__disclaimer"]'
'[data-testid="generated-answer__disclaimer"]'
),
toggleCollapseButton: () =>
GeneratedAnswerSelectors.get().find(
'[data-cy="generated-answer__answer-toggle"]'
'[data-testid="generated-answer__answer-toggle"]'
),
generatingMessage: () =>
GeneratedAnswerSelectors.get().find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<div
class="slds-grid slds-grid_align-spread slds-grid_vertical-align-start slds-var-p-bottom_x-small feedback-modal-qna__question"
key={question.id}
data-testid={question.id}
>
<div class="slds-col slds-var-p-top_x-small">
{question.question}
Expand Down
Loading
Loading