import * as React from 'react';
import { loadEnv } from 'vite';
import { beforeEach, describe, expect, it } from 'vitest';
import { fireEvent, render, RenderResult, screen } from '../../utils/test-utils';
import { App } from './App';

describe.concurrent('App', () => {
  let app: RenderResult;

  beforeEach(() => {
    app = render(
      <App root={document} />
    );
  });

  it('New editor', async() => {
    const start = app.getByText(/Start from scratch/i);
    fireEvent.click(start);
  }, 10000);

  it('Load editor by file', () => {
    const load = app.getByText(/Load a configuration file/i);
    fireEvent.click(load);

    const goBack = app.getByText(/Go back/i);
    fireEvent.click(goBack);

    const load2 = app.getByText(/Load a configuration file/i);
    fireEvent.click(load2);

    const chooseFile = app.getByText(/Import Save/i);
    const inputFile: HTMLInputElement = document.querySelector('input[type="file"]') as HTMLInputElement;
  });
});
