-
Notifications
You must be signed in to change notification settings - Fork 18
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 #919 from takenet/developer
Developer
- Loading branch information
Showing
32 changed files
with
1,091 additions
and
248 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ node_modules | |
dist | ||
www | ||
loader | ||
cypress | ||
# don't lint nyc coverage output | ||
coverage | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'create-react-app', | ||
bundler: 'webpack', | ||
}, | ||
}, | ||
}); |
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,95 @@ | ||
import { BdsInput } from '../dist/blip-ds-react'; | ||
|
||
describe('Teste de Renderização Input', () => { | ||
// Teste de Renderização | ||
it('deve renderizar o input com o label correto', () => { | ||
cy.mount(<BdsInput label="Label" />); | ||
cy.get('bds-input').should('have.attr', 'label', 'Label'); | ||
}); | ||
it('deve renderizar o input com o icon correto', () => { | ||
cy.mount(<BdsInput icon="edit" />); | ||
cy.get('bds-input').should('have.attr', 'icon', 'edit'); | ||
}); | ||
it('deve renderizar o input com o placeholder correto', () => { | ||
cy.mount(<BdsInput placeholder="Digite aqui..." />); | ||
cy.get('bds-input').should('have.attr', 'placeholder', 'Digite aqui...'); | ||
}); | ||
it('deve renderizar o input com o helperMessage correto', () => { | ||
cy.mount(<BdsInput helperMessage="Mensagem de ajuda" />); | ||
cy.get('bds-input').should('have.attr', 'helper-message', 'Mensagem de ajuda'); | ||
}); | ||
}); | ||
|
||
describe('Teste de Interação Input', () => { | ||
// Teste de Interação de Focus | ||
it('deve permitir que o usuário focalize o input', () => { | ||
cy.mount(<BdsInput value="" dataTest="bds-input" />); | ||
cy.get('bds-input').click(); | ||
cy.get('bds-input').should('have.focus'); | ||
}); | ||
|
||
// Teste de Interação de Digitação | ||
it('deve permitir que o usuário digite no input', () => { | ||
cy.mount(<BdsInput value="" dataTest="bds-input" />); | ||
|
||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Hello, Cypress!'); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').should('have.value', 'Hello, Cypress!'); | ||
}); | ||
}); | ||
|
||
describe('Teste de Eventos Input', () => { | ||
// Teste de Evento onChange | ||
it('deve chamar o evento onChange ao digitar', () => { | ||
cy.mount(<BdsInput value="" onBdsChange={cy.stub().as('bdsChange')} dataTest="bds-input" />); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Cypress'); | ||
cy.get('@bdsChange').should('have.been.called'); | ||
}); | ||
// Teste de Evento onInput | ||
it('deve chamar o evento onInput ao digitar', () => { | ||
cy.mount(<BdsInput value="" onBdsInput={cy.stub().as('bdsInput')} dataTest="bds-input" />); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Cypress'); | ||
cy.get('@bdsInput').should('have.been.called'); | ||
}); | ||
// Teste de Evento onBlur | ||
it('deve chamar o evento onBlur', () => { | ||
cy.mount(<BdsInput value="" onBdsOnBlur={cy.stub().as('bdsBlur')} dataTest="bds-input" />); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Cypress'); | ||
cy.realPress('Tab'); | ||
cy.get('@bdsBlur').should('have.been.called'); | ||
}); | ||
// Teste de Evento onFocus | ||
it('deve chamar o evento onFocus', () => { | ||
cy.mount(<BdsInput value="" onBdsFocus={cy.stub().as('bdsFocus')} dataTest="bds-input" />); | ||
cy.get('bds-input').click(); | ||
cy.get('@bdsFocus').should('have.been.called'); | ||
}); | ||
// Teste de Evento onSubmit | ||
it('deve chamar o evento onSubmit', () => { | ||
cy.mount(<BdsInput value="" onBdsSubmit={cy.stub().as('bdsSubmit')} dataTest="bds-input" />); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Cypress{enter}'); | ||
cy.get('@bdsSubmit').should('have.been.called'); | ||
}); | ||
// Teste de Evento onBdsKeyDownBackspace | ||
it('deve chamar o evento onBdsKeyDownBackspace', () => { | ||
cy.mount(<BdsInput value="" onBdsKeyDownBackspace={cy.stub().as('bdsKeyDownBackspace')} dataTest="bds-input" />); | ||
cy.get('bds-input').shadow().find('[data-test="bds-input"]').type('Cypress{backspace}'); | ||
cy.get('@bdsKeyDownBackspace').should('have.been.called'); | ||
}); | ||
}); | ||
|
||
describe('Teste de Acessibilidade Input', () => { | ||
// Teste de Acessibilidade com Tab | ||
it('deve ser possível navegar para o input usando a tecla Tab', () => { | ||
cy.mount( | ||
<> | ||
<button>Botão anterior</button> | ||
<BdsInput /> | ||
</>, | ||
); | ||
cy.get('button').first().focus(); | ||
cy.wait(50); | ||
cy.realPress('Tab'); | ||
cy.wait(50); | ||
cy.get('bds-input').should('have.focus'); | ||
}); | ||
}); |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Binary file added
BIN
+17.8 KB
...hots/Input.cy.tsx/An uncaught error was detected outside of a test (failed).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,37 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
// This example commands.ts shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } |
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,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>Components App</title> | ||
</head> | ||
<body> | ||
<div data-cy-root></div> | ||
</body> | ||
</html> |
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,45 @@ | ||
// *********************************************************** | ||
// This example support/component.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
import { mount } from 'cypress/react18'; | ||
|
||
import { defineCustomElements } from '../dist/esm/loader'; | ||
|
||
import 'cypress-real-events'; | ||
|
||
// Augment the Cypress namespace to include type definitions for | ||
// your custom command. | ||
// Alternatively, can be defined in cypress/support/component.d.ts | ||
// with a <reference path="./component" /> at the top of your spec. | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount; | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('mount', mount); | ||
|
||
// Example use: | ||
// cy.mount(<MyComponent />) | ||
|
||
defineCustomElements(window); |
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,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["es5", "dom"], | ||
"types": ["cypress", "node", "cypress-real-events"], | ||
"jsx": "react-jsx" | ||
}, | ||
"include": ["**/*.ts", "**/*.tsx"] | ||
} |
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
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
Oops, something went wrong.