-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
139 additions
and
20 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/components/CharacterLimitMainText/components/CharacterLimit.module.scss
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@use '~styles/global'; | ||
@use '../../styles/global.scss'; | ||
|
||
.inputContainer { | ||
width: 100%; | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@use '~styles/global.scss'; | ||
@use '../../styles/global.scss'; | ||
|
||
.wrapper { | ||
width: 100%; | ||
|
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,68 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
|
||
import MainComposer from './MainComposer'; | ||
|
||
test.describe('MainComposer', () => { | ||
test.describe('MediaInputs', () => { | ||
test('upload the image', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('src/assets/logo.png'); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
}); | ||
|
||
test('upload two images', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles(['src/assets/logo.png', 'src/assets/imagetest.jpg']); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
await expect( | ||
component.getByAltText('uploaded image imagetest.jpg') | ||
).toBeVisible(); | ||
}); | ||
|
||
test.describe('when the file is diferent from image or video', () => { | ||
test('doesnt select the file', async ({ mount }) => { | ||
const mediaSelected: string | null = null; | ||
|
||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('public/robots.txt'); | ||
|
||
await expect(mediaSelected).toBeNull(); | ||
}); | ||
}); | ||
|
||
test.describe('when add img and click on remove button', () => { | ||
test('remove image', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('src/assets/logo.png'); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
|
||
await component.getByRole('button', { name: 'X' }).click(); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).not.toBeVisible(); | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,18 +1,69 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
|
||
import MediaInputs from './MediaInput'; | ||
import MainComposer from './MainComposer'; | ||
i; | ||
|
||
jest.mock('nanoid', () => { | ||
return { | ||
nanoid: jest.fn(() => 'sua-string-especifica-aqui'), | ||
}; | ||
}); | ||
test.describe('MainComposer', () => { | ||
test.describe('MediaInputs', () => { | ||
test('upload the image', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('src/assets/logo.png'); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
}); | ||
|
||
test('upload two images', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles(['src/assets/logo.png', 'src/assets/imagetest.jpg']); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
await expect( | ||
component.getByAltText('uploaded image imagetest.jpg') | ||
).toBeVisible(); | ||
}); | ||
|
||
test.describe('when the file is diferent from image or video', () => { | ||
test('doesnt select the file', async ({ mount }) => { | ||
const mediaSelected: string | null = null; | ||
|
||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('public/robots.txt'); | ||
|
||
await expect(mediaSelected).toBeNull(); | ||
}); | ||
}); | ||
|
||
test.describe('when add img and click on remove button', () => { | ||
test('remove image', async ({ mount }) => { | ||
const component = await mount(<MainComposer />); | ||
|
||
await component | ||
.getByTestId('imageInput') | ||
.setInputFiles('src/assets/logo.png'); | ||
|
||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).toBeVisible(); | ||
|
||
describe('MediaInputs', () => { | ||
it('renders the media inputs', () => { | ||
render(<MediaInputs />); | ||
await component.getByRole('button', { name: 'X' }).click(); | ||
|
||
const manyMediaComponent = screen.getAllByTestId('manyMediaInputs'); | ||
expect(manyMediaComponent.length).toBeGreaterThan(0); | ||
await expect( | ||
component.getByAltText('uploaded image logo.png') | ||
).not.toBeVisible(); | ||
}); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.