test(web): Fix failing web test in 'Web Tests' GitHub Action (#32481)

This commit is contained in:
akashseth-ifp
2026-02-24 10:31:30 +05:30
committed by GitHub
parent 2162cd1a69
commit a0ddaed6d3
3 changed files with 7 additions and 15 deletions

View File

@@ -2,7 +2,7 @@ import type { ReactNode } from 'react'
import type { IConfigVarProps } from './index'
import type { ExternalDataTool } from '@/models/common'
import type { PromptVariable } from '@/models/debug'
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import * as React from 'react'
import { vi } from 'vitest'
import Toast from '@/app/components/base/toast'
@@ -237,7 +237,8 @@ describe('ConfigVar', () => {
expect(actionButtons).toHaveLength(2)
fireEvent.click(actionButtons[0])
const saveButton = await screen.findByRole('button', { name: 'common.operation.save' })
const editDialog = await screen.findByRole('dialog')
const saveButton = within(editDialog).getByRole('button', { name: 'common.operation.save' })
fireEvent.click(saveButton)
await waitFor(() => {

View File

@@ -323,14 +323,8 @@ describe('CustomizeModal', () => {
expect(screen.getByText('appOverview.overview.appInfo.customize.title')).toBeInTheDocument()
})
// Find the close button by navigating from the heading to the close icon
// The close icon is an SVG inside a sibling div of the title
const heading = screen.getByRole('heading', { name: /customize\.title/i })
const closeIcon = heading.parentElement!.querySelector('svg')
// Assert - closeIcon must exist for the test to be valid
expect(closeIcon).toBeInTheDocument()
fireEvent.click(closeIcon!)
const closeButton = screen.getByTestId('modal-close-button')
fireEvent.click(closeButton)
expect(onClose).toHaveBeenCalledTimes(1)
})
})

View File

@@ -714,6 +714,7 @@ describe('CommonCreateModal', () => {
describe('Manual Properties Change', () => {
it('should call updateBuilder when manual properties change', async () => {
const builder = createMockSubscriptionBuilder()
const detailWithManualSchema = createMockPluginDetail({
declaration: {
trigger: {
@@ -729,11 +730,7 @@ describe('CommonCreateModal', () => {
})
mockUsePluginStore.mockReturnValue(detailWithManualSchema)
render(<CommonCreateModal {...defaultProps} createType={SupportedCreationMethods.MANUAL} />)
await waitFor(() => {
expect(mockCreateBuilder).toHaveBeenCalled()
})
render(<CommonCreateModal {...defaultProps} createType={SupportedCreationMethods.MANUAL} builder={builder} />)
const input = screen.getByTestId('form-field-webhook_url')
fireEvent.change(input, { target: { value: 'https://example.com/webhook' } })