-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
139ab8d
commit 3feee84
Showing
5 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+9.45 KB
...sual-screenshots/baseline/Input.cy.tsx-regular-input-with-content-and-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.62 KB
...-screenshots/baseline/Input.cy.tsx-regular-input-with-placeholder-and-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.04 KB
...creenshots/baseline/Input.cy.tsx-regular-input-with-placeholder-and-warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.98 KB
...ess-visual-screenshots/baseline/Input.cy.tsx-regular-input-with-placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,133 @@ | ||
import '../../../src/global.css'; | ||
import React from 'react'; | ||
Check failure on line 2 in cypress/component/integration/Input.cy.tsx GitHub Actions / build (16.x)
Check failure on line 2 in cypress/component/integration/Input.cy.tsx GitHub Actions / build (18.x)
Check failure on line 2 in cypress/component/integration/Input.cy.tsx GitHub Actions / build / build (16.x)
Check failure on line 2 in cypress/component/integration/Input.cy.tsx GitHub Actions / build / build (18.x)
Check failure on line 2 in cypress/component/integration/Input.cy.tsx GitHub Actions / build (16.x)
|
||
import { Input } from '../../../src/components'; | ||
import { compareSnapshot } from '../../compareSnapshot'; | ||
|
||
describe('Component | Integration | Input', function () { | ||
describe('Input', () => { | ||
describe('regular input with placeholder', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Input placeholder={'placeholder'} /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render and have placeholder', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.should('exist') | ||
.and('have.attr', 'placeholder'); | ||
}); | ||
|
||
it('should focus on click', () => { | ||
cy.get('[data-testid="input-field"]').click().should('be.focused'); | ||
}); | ||
|
||
it('should receive typed input', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content') | ||
.clear() | ||
.should('have.attr', 'placeholder'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'regular-input-with-placeholder'); | ||
}); | ||
}); | ||
|
||
describe('regular input with placeholder and error', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Input placeholder={'placeholder'} error={'error'} /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render and have placeholder', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.should('exist') | ||
.and('have.attr', 'placeholder'); | ||
}); | ||
|
||
it('should display error message', () => { | ||
cy.get('[data-testid="input-field-message"]').contains('error'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'regular-input-with-placeholder-and-error'); | ||
}); | ||
}); | ||
|
||
describe('regular input with content and error', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Input | ||
placeholder={'placeholder'} | ||
value={'wrong content'} | ||
error={'error'} | ||
/> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render and have placeholder', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.should('exist') | ||
.and('have.attr', 'placeholder'); | ||
}); | ||
|
||
it('should wrong content displayed', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.should('exist') | ||
.and('have.value', 'wrong content'); | ||
}); | ||
|
||
it('should display error message', () => { | ||
cy.get('[data-testid="input-field-message"]').contains('error'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'regular-input-with-content-and-error'); | ||
}); | ||
}); | ||
|
||
describe('regular input with placeholder and warning', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Input placeholder={'placeholder'} warning={'warning'} /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render placeholder and warning', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.should('exist') | ||
.and('have.attr', 'placeholder'); | ||
cy.get('[data-testid="input-field-message"]').contains('warning'); | ||
}); | ||
|
||
it('should receive typed input and render warning', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content'); | ||
cy.get('[data-testid="input-field-message"]').contains('warning'); | ||
}); | ||
|
||
it('should render warning with no content', () => { | ||
cy.get('[data-testid="input-field"]') | ||
.clear() | ||
.should('have.attr', 'placeholder'); | ||
|
||
cy.get('[data-testid="input-field-message"]').should('exist'); | ||
}); | ||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'regular-input-with-placeholder-and-warning'); | ||
}); | ||
}); | ||
}); | ||
}); |