-
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.
Showing
5 changed files
with
118 additions
and
60 deletions.
There are no files selected for viewing
Binary file added
BIN
+7.87 KB
...ess-visual-screenshots/baseline/Password.cy.tsx-default-password-with-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.22 KB
...s-visual-screenshots/baseline/Password.cy.tsx-default-password-with-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.25 KB
cypress-visual-screenshots/baseline/Password.cy.tsx-default-password.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,118 @@ | ||
import '../../../src/global.css'; | ||
import { Password } from '../../../src/components'; | ||
import { compareSnapshot } from '../../compareSnapshot'; | ||
|
||
describe('Component | Integration | Password', function () { | ||
describe('Input', () => { | ||
describe('default password', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Password /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render', () => { | ||
cy.get('[data-testid="password-input"]').should('exist'); | ||
}); | ||
|
||
it('should focus on click', () => { | ||
cy.get('[data-testid="password-input"]').focus().should('be.focused'); | ||
}); | ||
|
||
it('should receive typed input', () => { | ||
cy.get('[data-testid="password-input"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content') | ||
.clear(); | ||
}); | ||
|
||
it('should hide typed input', () => { | ||
cy.get('[data-testid="password-input"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content'); | ||
cy.get('[data-testid="password-input"]').should('have.attr', 'type'); | ||
cy.get('[data-testid="password-input"]') | ||
.invoke('attr', 'type') | ||
.should('eq', 'password'); | ||
}); | ||
|
||
it('should show typed input', () => { | ||
cy.get('[data-testid="password-input"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content'); | ||
|
||
cy.get('[data-testid="password-icon"]').should('exist').click(); | ||
|
||
cy.get('[data-testid="password-input"]') | ||
.invoke('attr', 'type') | ||
.should('eq', 'text'); | ||
}); | ||
|
||
it('should show typed input', () => { | ||
cy.get('[data-testid="password-input"]') | ||
.type('typed content') | ||
.should('have.value', 'typed content'); | ||
|
||
cy.get('[data-testid="password-icon"]').should('exist').click(); | ||
|
||
cy.get('[data-testid="password-input"]') | ||
.invoke('attr', 'type') | ||
.should('eq', 'text'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'default-password'); | ||
}); | ||
}); | ||
|
||
describe('default password with error', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Password error={'error'} /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render', () => { | ||
cy.get('[data-testid="password-input"]').should('exist'); | ||
}); | ||
|
||
it('should display error message', () => { | ||
cy.get('[data-testid="input-field-message"]') | ||
.should('exist') | ||
.contains('error'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'default-password-with-error'); | ||
}); | ||
}); | ||
|
||
describe('default password with warning', () => { | ||
beforeEach(() => { | ||
cy.mount( | ||
<div className="theme-dark"> | ||
<Password warning={'warning'} /> | ||
</div>, | ||
); | ||
}); | ||
|
||
it('should render', () => { | ||
cy.get('[data-testid="password-input"]').should('exist'); | ||
}); | ||
|
||
it('should display warning message', () => { | ||
cy.get('[data-testid="input-field-message"]') | ||
.should('exist') | ||
.contains('warning'); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
compareSnapshot(cy, 'default-password-with-warning'); | ||
}); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.