import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import React from 'react'
import BuilderClientPage from '@/components/BuilderClientPage'
import I18nProvider from '@/components/I18nProvider'
import en from '@/messages/en.json'

describe('Buttons naming/aria-label consistency (smoke)', () => {
  it('renders primary action buttons with stable accessible names', () => {
    render(
      <I18nProvider locale="en" messages={en as unknown as Record<string, string>}>
        <BuilderClientPage />
      </I18nProvider>
    )

    // Sidebar/toolbar actions
    expect(screen.getByRole('button', { name: 'Add Hero' })).toBeInTheDocument()
    expect(screen.getByRole('button', { name: 'Add FAQ' })).toBeInTheDocument()
    expect(screen.getByRole('button', { name: 'Add CTA' })).toBeInTheDocument()

    // Export button
    expect(screen.getByRole('button', { name: 'Export ZIP' })).toBeInTheDocument()

    // Preview viewport toggle buttons have explicit aria-labels as names
    expect(screen.getByRole('button', { name: 'Desktop' })).toBeInTheDocument()
    expect(screen.getByRole('button', { name: 'Mobile' })).toBeInTheDocument()
  })
})
