Add app test

This commit is contained in:
Eric NGUYEN 2022-09-21 16:33:31 +02:00
parent cfdbbb7085
commit d875e33f93
2 changed files with 36 additions and 1 deletions

View file

@ -1,2 +1,3 @@
VITE_API_FETCH_URL=http://localhost:5000
VITE_API_POST_URL=http://localhost:5000
VITE_API_SET_CONTAINER_LIST_URL=http://localhost:5000/SetContainerList
VITE_API_GET_FEEDBACK_URL=http://localhost:5000/GetFeedback

View file

@ -0,0 +1,34 @@
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;
});
});