generated from muratkeremozcan/react-cypress-ts-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #34 from cesarhenrq/qa
4908-feat--register-card
- Loading branch information
Showing
6 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
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,78 @@ | ||
import RegisterCard from './RegisterCard'; | ||
import GlobalStyle from '@styles/global'; | ||
|
||
describe('<RegisterCard />', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<> | ||
<GlobalStyle /> | ||
<RegisterCard /> | ||
</>, | ||
); | ||
}); | ||
|
||
it('should register card has margin-top: 2rem', () => { | ||
cy.getByCy('register-card').should('have.css', 'margin-top', '32px'); | ||
}); | ||
|
||
it('should register card has width: 16.875rem', () => { | ||
cy.getByCy('register-card').should('have.css', 'width', '270px'); | ||
}); | ||
|
||
it('should base card has padding-top: 2rem', () => { | ||
cy.getByCy('base-card').should('have.css', 'padding-top', '32px'); | ||
}); | ||
|
||
it('should base card has position: relative', () => { | ||
cy.getByCy('base-card').should('have.css', 'position', 'relative'); | ||
}); | ||
|
||
it('should link has color: purple-dark-secondary', () => { | ||
cy.getByCy('link').should('have.css', 'color', 'rgb(105, 80, 161)'); | ||
}); | ||
|
||
it('should circle has position: absolute', () => { | ||
cy.getByCy('circle').should('have.css', 'position', 'absolute'); | ||
}); | ||
|
||
it('should circle has top: -2rem', () => { | ||
cy.getByCy('circle').should('have.css', 'top', '-32px'); | ||
}); | ||
|
||
it('should circle has display: flex', () => { | ||
cy.getByCy('circle').should('have.css', 'display', 'flex'); | ||
}); | ||
|
||
it('should circle has justify-content: center', () => { | ||
cy.getByCy('circle').should('have.css', 'justify-content', 'center'); | ||
}); | ||
|
||
it('should circle has align-items: center', () => { | ||
cy.getByCy('circle').should('have.css', 'align-items', 'center'); | ||
}); | ||
|
||
it('should circle has background-color: purple-dark-secondary', () => { | ||
cy.getByCy('circle').should( | ||
'have.css', | ||
'background-color', | ||
'rgb(105, 80, 161)', | ||
); | ||
}); | ||
|
||
it('should circle has border-radius: 50%', () => { | ||
cy.getByCy('circle').should('have.css', 'border-radius', '50%'); | ||
}); | ||
|
||
it('should circle has width: 4rem', () => { | ||
cy.getByCy('circle').should('have.css', 'width', '64px'); | ||
}); | ||
|
||
it('should circle has height: 4rem', () => { | ||
cy.getByCy('circle').should('have.css', 'height', '64px'); | ||
}); | ||
|
||
it('should redirect to register page when click on link', () => { | ||
cy.getByCy('link').click(); | ||
cy.url().should('include', 'http://localhost:3000/__/'); | ||
}); | ||
}); |
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,33 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import RegisterCard from './RegisterCard'; | ||
|
||
describe('<RegisterCard />', () => { | ||
beforeEach(() => { | ||
render(<RegisterCard />); | ||
}); | ||
|
||
it('should be defined', () => { | ||
screen.getByTestId('register-card'); | ||
}); | ||
|
||
it('should render base card', () => { | ||
screen.getByTestId('base-card'); | ||
}); | ||
|
||
it('should render circle', () => { | ||
screen.getByTestId('circle'); | ||
}); | ||
|
||
it('should render text', () => { | ||
screen.getByTestId('text'); | ||
}); | ||
|
||
it('should render person icon', () => { | ||
screen.getByTestId('person-icon'); | ||
}); | ||
|
||
it('should render link', () => { | ||
screen.getByText('cadastro gratuito'); | ||
}); | ||
}); |
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,30 @@ | ||
import BaseCard from '@components/BaseCard'; | ||
import Text from '@components/Text'; | ||
import { Person } from '@assets/db.icons'; | ||
|
||
import * as S from './styles'; | ||
|
||
const RegisterCard = () => { | ||
const textLabel = ( | ||
<span> | ||
Faça seu{' '} | ||
<a href="http://localhost:3000/__/" data-cy="link"> | ||
cadastro gratuito | ||
</a>{' '} | ||
e encontre vagas de acordo com seu perfil. | ||
</span> | ||
); | ||
|
||
return ( | ||
<S.RegisterCard className="register-card" data-cy="register-card"> | ||
<BaseCard borderColor="white" padding="small"> | ||
<S.Circle className="circle" data-cy="circle"> | ||
<Person fill="yellow" width={24} height={24} /> | ||
</S.Circle> | ||
<Text label={textLabel} /> | ||
</BaseCard> | ||
</S.RegisterCard> | ||
); | ||
}; | ||
|
||
export default RegisterCard; |
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 @@ | ||
export { default } from './RegisterCard'; |
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,29 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const RegisterCard = styled.div` | ||
margin-top: 2rem; | ||
width: 16.875rem; | ||
.base-card { | ||
padding-top: 2rem; | ||
position: relative; | ||
.text { | ||
a { | ||
color: var(--purple-dark-secondary); | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const Circle = styled.div` | ||
position: absolute; | ||
top: -2rem; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: var(--purple-dark-secondary); | ||
border-radius: 50%; | ||
width: 4rem; | ||
height: 4rem; | ||
`; |
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