playwright robustness: "can do many at once and get many prompts back, and interact with many" (#3524)

* playwright robustness

* try fix the close button
This commit is contained in:
Kurt Hutten
2024-08-19 22:38:17 +10:00
committed by GitHub
parent 7f50294936
commit d845e7c38d
2 changed files with 7 additions and 9 deletions

View File

@ -495,11 +495,13 @@ test.describe('Text-to-CAD tests', () => {
const generatingToastMessage = page.getByText( const generatingToastMessage = page.getByText(
`Generating parametric model...` `Generating parametric model...`
) )
await expect(generatingToastMessage.first()).toBeVisible({ timeout: 10000 }) await expect(generatingToastMessage.first()).toBeVisible({
timeout: 10_000,
})
const successToastMessage = page.getByText(`Text-to-CAD successful`) const successToastMessage = page.getByText(`Text-to-CAD successful`)
// We should have three success toasts. // We should have three success toasts.
await expect(successToastMessage).toHaveCount(3, { timeout: 15000 }) await expect(successToastMessage).toHaveCount(3, { timeout: 25_000 })
await expect(page.getByText('Copied')).not.toBeVisible() await expect(page.getByText('Copied')).not.toBeVisible()
@ -541,12 +543,7 @@ test.describe('Text-to-CAD tests', () => {
await expect(page.locator('.cm-content')).toContainText(`2x8`) await expect(page.locator('.cm-content')).toContainText(`2x8`)
// Find the toast close button. // Find the toast close button.
const closeButton = page const closeButton = page.locator('[data-negative-button="close"]').first()
.getByRole('status')
.locator('div')
.filter({ hasText: 'Text-to-CAD successfulPrompt' })
.first()
.getByRole('button', { name: 'Close' })
await expect(closeButton).toBeVisible() await expect(closeButton).toBeVisible()
await closeButton.click() await closeButton.click()
@ -699,7 +696,7 @@ async function sendPromptFromCommandBar(page: Page, promptStr: string) {
// Type the prompt. // Type the prompt.
await page.keyboard.type(promptStr) await page.keyboard.type(promptStr)
await page.waitForTimeout(1000) await page.waitForTimeout(200)
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
}) })
} }

View File

@ -251,6 +251,7 @@ export function ToastTextToCadSuccess({
iconStart={{ iconStart={{
icon: 'close', icon: 'close',
}} }}
data-negative-button={hasCopied ? 'close' : 'reject'}
name={hasCopied ? 'Close' : 'Reject'} name={hasCopied ? 'Close' : 'Reject'}
onClick={() => { onClick={() => {
if (!hasCopied) { if (!hasCopied) {