From d875e33f93909b1c97256f00cbde140b20f99f47 Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Wed, 21 Sep 2022 16:33:31 +0200 Subject: [PATCH] Add app test --- .env.test | 3 ++- src/Components/App/App.test.tsx | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Components/App/App.test.tsx diff --git a/.env.test b/.env.test index 71d0acc..58cf9aa 100644 --- a/.env.test +++ b/.env.test @@ -1,2 +1,3 @@ VITE_API_FETCH_URL=http://localhost:5000 -VITE_API_POST_URL=http://localhost:5000 \ No newline at end of file +VITE_API_SET_CONTAINER_LIST_URL=http://localhost:5000/SetContainerList +VITE_API_GET_FEEDBACK_URL=http://localhost:5000/GetFeedback \ No newline at end of file diff --git a/src/Components/App/App.test.tsx b/src/Components/App/App.test.tsx new file mode 100644 index 0000000..8afe829 --- /dev/null +++ b/src/Components/App/App.test.tsx @@ -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( + + ); + }); + + 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; + }); +});