forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from Arquisoft/pablo
Test MainPage y cambios del primer prototipo
- Loading branch information
Showing
7 changed files
with
20,490 additions
and
12 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { render, fireEvent, screen, act } from '@testing-library/react'; | ||
import axios from 'axios'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
import MainPage from './MainPage'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
|
||
const mockAxios = new MockAdapter(axios); | ||
|
||
describe('MainPage component', () => { | ||
beforeEach(() => { | ||
mockAxios.reset(); | ||
}); | ||
|
||
it('muestra la página principal correctamente', async () => { | ||
|
||
render(<Router> | ||
<MainPage /> | ||
</Router>); | ||
|
||
const element1 = screen.getByText(/¡Bienvenido a/); | ||
const element2 = screen.getByText(/WIQ 2024!/); | ||
const newGameButton = screen.getByRole('button', { name: 'Nuevo juego' }); | ||
const historicalQuestionsButton = screen.getByRole('button', { name: 'Histórico de preguntas' }); | ||
const historialUserDataButton = screen.getByRole('button', { name: 'Histórico del usuario' }); | ||
const registerUsersButton = screen.getByRole('button', { name: 'Usuarios registrados' }); | ||
|
||
// Verifica si el elemento se encuentra en el DOM | ||
expect(element1).toBeInTheDocument(); | ||
expect(element2).toBeInTheDocument(); | ||
|
||
// Simulate user input | ||
await act(async () => { | ||
fireEvent.click(newGameButton); | ||
fireEvent.click(historicalQuestionsButton); | ||
fireEvent.click(historialUserDataButton); | ||
fireEvent.click(registerUsersButton); | ||
}); | ||
}); | ||
}); | ||
|
||
|