Untitled
unknown
plain_text
20 days ago
5.4 kB
7
Indexable
Never
import { fireEvent, screen } from '@testing-library/react'; import renderWithRouter from './helpers/renderWithRouter'; import App from '../App'; const DECORATION = 'text-decoration: line-through solid rgb(0, 0, 0);'; test('verifica se o checkbox é riscado ao ser selecionado na tela Meals', async () => { renderWithRouter(<App />, { route: '/' }); const email = screen.getByTestId('email-input'); const password = screen.getByTestId('password-input'); const button = screen.getByTestId('login-submit-btn'); fireEvent.change(email, { target: { value: 'user@trybe.com' } }); fireEvent.change(password, { target: { value: '1234567' } }); fireEvent.click(button); renderWithRouter(<App />, { route: '/meals/52977' }); const startRecipe = screen.getByTestId('start-recipe-btn'); fireEvent.click(startRecipe); const checkbox0 = screen.getByTestId('0-ingredient-step'); fireEvent.click(checkbox0); expect(checkbox0).toHaveAttribute('style', DECORATION); const checkbox1 = screen.getByTestId('1-ingredient-step'); fireEvent.click(checkbox1); expect(checkbox1).toHaveAttribute('style', DECORATION); const checkbox2 = screen.getByTestId('2-ingredient-step'); fireEvent.click(checkbox2); expect(checkbox2).toHaveAttribute('style', DECORATION); const checkbox3 = screen.getByTestId('3-ingredient-step'); fireEvent.click(checkbox3); expect(checkbox3).toHaveAttribute('style', DECORATION); const checkbox4 = screen.getByTestId('4-ingredient-step'); fireEvent.click(checkbox4); expect(checkbox4).toHaveAttribute('style', DECORATION); const checkbox5 = screen.getByTestId('5-ingredient-step'); fireEvent.click(checkbox5); expect(checkbox5).toHaveAttribute('style', DECORATION); const checkbox6 = screen.getByTestId('6-ingredient-step'); fireEvent.click(checkbox6); expect(checkbox6).toHaveAttribute('style', DECORATION); const checkbox7 = screen.getByTestId('7-ingredient-step'); fireEvent.click(checkbox7); expect(checkbox7).toHaveAttribute('style', DECORATION); const checkbox8 = screen.getByTestId('8-ingredient-step'); fireEvent.click(checkbox8); expect(checkbox8).toHaveAttribute('style', DECORATION); const checkbox9 = screen.getByTestId('9-ingredient-step'); fireEvent.click(checkbox9); expect(checkbox9).toHaveAttribute('style', DECORATION); const checkbox10 = screen.getByTestId('10-ingredient-step'); fireEvent.click(checkbox10); expect(checkbox10).toHaveAttribute('style', DECORATION); const checkbox11 = screen.getByTestId('11-ingredient-step'); fireEvent.click(checkbox11); expect(checkbox11).toHaveAttribute('style', DECORATION); const checkbox12 = screen.getByTestId('12-ingredient-step'); fireEvent.click(checkbox12); expect(checkbox12).toHaveAttribute('style', DECORATION); }); test('verifica se o checkbox é riscado ao ser selecionado na tela Drinks', async () => { renderWithRouter(<App />, { route: '/' }); const email = screen.getByTestId('email-input'); const password = screen.getByTestId('password-input'); const button = screen.getByTestId('login-submit-btn'); fireEvent.change(email, { target: { value: 'user@trybe.com' } }); fireEvent.change(password, { target: { value: '1234567' } }); fireEvent.click(button); renderWithRouter(<App />, { route: '/drinks/15997' }); const startRecipe = screen.getByTestId('start-recipe-btn'); fireEvent.click(startRecipe); const checkbox0 = screen.getByTestId('0-ingredient-step'); fireEvent.click(checkbox0); expect(checkbox0).toHaveAttribute('style', DECORATION); const checkbox1 = screen.getByTestId('1-ingredient-step'); fireEvent.click(checkbox1); expect(checkbox1).toHaveAttribute('style', DECORATION); const checkbox2 = screen.getByTestId('2-ingredient-step'); fireEvent.click(checkbox2); expect(checkbox2).toHaveAttribute('style', DECORATION); const checkbox3 = screen.getByTestId('3-ingredient-step'); fireEvent.click(checkbox3); expect(checkbox3).toHaveAttribute('style', DECORATION); const checkbox4 = screen.getByTestId('4-ingredient-step'); fireEvent.click(checkbox4); expect(checkbox4).toHaveAttribute('style', DECORATION); const checkbox5 = screen.getByTestId('5-ingredient-step'); fireEvent.click(checkbox5); expect(checkbox5).toHaveAttribute('style', DECORATION); const checkbox6 = screen.getByTestId('6-ingredient-step'); fireEvent.click(checkbox6); expect(checkbox6).toHaveAttribute('style', DECORATION); const checkbox7 = screen.getByTestId('7-ingredient-step'); fireEvent.click(checkbox7); expect(checkbox7).toHaveAttribute('style', DECORATION); const checkbox8 = screen.getByTestId('8-ingredient-step'); fireEvent.click(checkbox8); expect(checkbox8).toHaveAttribute('style', DECORATION); const checkbox9 = screen.getByTestId('9-ingredient-step'); fireEvent.click(checkbox9); expect(checkbox9).toHaveAttribute('style', DECORATION); const checkbox10 = screen.getByTestId('10-ingredient-step'); fireEvent.click(checkbox10); expect(checkbox10).toHaveAttribute('style', DECORATION); const checkbox11 = screen.getByTestId('11-ingredient-step'); fireEvent.click(checkbox11); expect(checkbox11).toHaveAttribute('style', DECORATION); const checkbox12 = screen.getByTestId('12-ingredient-step'); fireEvent.click(checkbox12); expect(checkbox12).toHaveAttribute('style', DECORATION); });