Skip to content

Commit

Permalink
test(27085): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vanch3d committed Jan 9, 2025
1 parent 80d9c59 commit 287deef
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/// <reference types="cypress" />

import PolicyErrorReport from '@datahub/components/helpers/PolicyErrorReport.tsx'
import { DataHubNodeType } from '@datahub/types.ts'

describe('PolicyErrorReport', () => {
beforeEach(() => {
cy.viewport(800, 250)
cy.viewport(800, 400)
})

it('should renders properly', () => {
Expand Down Expand Up @@ -34,10 +32,36 @@ describe('PolicyErrorReport', () => {
cy.get('h2').first().click()
cy.getByTestId('report-error-fitView').first().should('be.visible')

cy.get('@onFitView').should('not.have.been.called')
cy.get('@onOpenConfig').should('not.have.been.called')

cy.getByTestId('report-error-fitView').first().click()
cy.get('@onFitView').should('have.been.calledWith', '123')

cy.getByTestId('report-error-config').first().click()
cy.get('@onOpenConfig').should('have.been.calledWith', '123')
})

it('should be accessible', () => {
cy.injectAxe()
cy.mountWithProviders(
<PolicyErrorReport
errors={[
{
title: DataHubNodeType.BEHAVIOR_POLICY,
status: 404,
type: 'error-type',
id: '456',
detail: 'the description',
},
]}
/>
)

cy.get('h2').first().click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(800) // Wait for accordion to expand (ugly)

cy.checkAccessibility()
})
})

0 comments on commit 287deef

Please sign in to comment.