-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts automatizados nivel junior #1
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// implement node event listeners here | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
describe('API Test', () => { | ||
|
||
it('Verifica o código de status 200', () => { | ||
|
||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cy.request({ | ||
method: 'GET', | ||
url: 'http://localhost:3001/customers' | ||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}).then((response) => { | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
}); | ||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,140 @@ | ||||||
describe('Teste E2E EngageSphere', () => { | ||||||
beforeEach(() => { | ||||||
cy.visit('http://localhost:3000') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.contains('button', 'Accept').click(); | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
|
||||||
it('Mantém os filtros ao voltar da visualização de detalhes do cliente', () => { | ||||||
cy.get('select[data-testid="size-filter"]').select('Very Large Enterprise') | ||||||
cy.get('button[aria-label="View company: Lowe Co"]').click() | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button').contains('Back').should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.contains('button', 'Back').click(); | ||||||
cy.contains('Below is our customer list.').should('be.visible') | ||||||
cy.get('select[data-testid="size-filter"]').should('have.value', 'Very Large Enterprise'); | ||||||
}) | ||||||
|
||||||
it('Retorna à lista de clientes ao clicar no botão "Voltar"', () => { | ||||||
cy.get('button[aria-label="View company: Lowe Co"]').click(); | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button').contains('Back').should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.contains('button', 'Back').click(); | ||||||
cy.contains('Below is our customer list.').should('be.visible') | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
it('Exibie o rodapé com o texto e links corretos', () => { | ||||||
cy.get('[data-testid="footer"]').should('be.visible') | ||||||
|
||||||
cy.get('[data-testid="footer"] a').eq(0).should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('[data-testid="footer"] a').eq(0).should('have.attr', 'href', 'https://hotmart.com/pt-br/club/cypress-playground-ate-a-nuvem'); | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
cy.get('[data-testid="footer"] a').eq(1).should('be.visible') | ||||||
cy.get('[data-testid="footer"] a').eq(1).should('have.attr', 'href', 'https://udemy.com/user/walmyr'); | ||||||
|
||||||
cy.get('[data-testid="footer"] a').eq(2).should('be.visible') | ||||||
cy.get('[data-testid="footer"] a').eq(2).should('have.attr', 'href', 'https://talkingabouttesting.com'); | ||||||
|
||||||
cy.get('[data-testid="footer"] a').eq(3).should('be.visible') | ||||||
cy.get('[data-testid="footer"] a').eq(3).should('have.attr', 'href', 'https://youtube.com/@talkingabouttesting'); | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
|
||||||
it('Exibe a saudação "Hi, there" quando nenhum nome é fornecido', () => { | ||||||
cy.get('h2').should('contain', 'Hi there!') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
|
||||||
it('Exibe a saudação "Hi, Joe" quando o nome é fornecido', () => { | ||||||
const name = 'Joe' | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('#name').type(name) | ||||||
cy.get('h2').should('contain', 'Hi ' + name + '!') | ||||||
}) | ||||||
|
||||||
it('Exibe o cabeçalho com um título, alternador de tema e um campo de entrada de texto', () => { | ||||||
cy.get('h1').should('be.visible') | ||||||
cy.get('h1').should('contain', 'EngageSphere') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button[class="ThemeToggle_button__GzIuj"]').should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('#name').should('be.visible') | ||||||
}) | ||||||
|
||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
it('Abre e fecha o messenger', () => { | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').should('be.visible') | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').click() | ||||||
cy.get('h2').should('contain', 'How can we help you?') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Veja uma alternativa mais simples.
Suggested change
A propósito, perceba a verificação pela visibilidade do elemento. |
||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
}) | ||||||
|
||||||
it('Garante que todos os campos do messenger são obrigatórios e que o primeiro está focado', () => { | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').click() | ||||||
|
||||||
//Não consegui verificar se o foco está nesse campo, utilizei o focus forçado para passar esse teste | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('#messenger-name').focus().should('have.focus') | ||||||
|
||||||
cy.get('h2').should('contain', 'How can we help you?') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mesmo que um dos comentários anteriores. |
||||||
cy.get('#messenger-name').should('have.attr', 'required'); | ||||||
cy.get('#email').should('have.attr', 'required'); | ||||||
cy.get('#message').should('have.attr', 'required'); | ||||||
}) | ||||||
|
||||||
it('Mostra e oculta uma mensagem de sucesso ao enviar o formulário do messenger com sucesso', () => { | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').should('be.visible') | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').should('be.visible') | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').click() | ||||||
cy.get('h2').should('contain', 'How can we help you?') | ||||||
cy.get('input[id="messenger-name"]').type('Seu Madruga') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('#email').type('madruguinha@gmail.com') | ||||||
cy.get('#message').type('chiforinfola') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😆 chiforinfola |
||||||
cy.get('button[type="submit"]').click() | ||||||
cy.get('div[role="alert"].Messenger_success__GOoJk') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
.should('be.visible') | ||||||
.and('contain', 'Your message has been sent.') | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.wait(3000) | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('div[role="alert"].Messenger_success__GOoJk').should('not.exist') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
|
||||||
it('Limpa todos os campos do formulário do messenger ao preenchê-los, fechar o messenger e abri-lo novamente', () => { | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').should('be.visible') | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').should('be.visible') | ||||||
cy.get('div[class="Messenger_box__qUF2H"]').click() | ||||||
cy.get('h2').should('contain', 'How can we help you?') | ||||||
cy.get('input[id="messenger-name"]').type('Seu Madruga') | ||||||
cy.get('#email').type('madruguinha@gmail.com') | ||||||
cy.get('#message').type('chiforinfola') | ||||||
cy.get('input[id="messenger-name"]').clear() | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('#email').clear() | ||||||
cy.get('#message').clear() | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
cy.get('button[class="Messenger_openCloseButton__6O7-y"]').click() | ||||||
//validando se os campos foram limpos | ||||||
cy.get('input[id="messenger-name"]').should('have.value', '') | ||||||
cy.get('#email').should('have.value', '') | ||||||
cy.get('#message').should('have.value', '') | ||||||
}) | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
describe('Testes em Viewport Móvel', () => { | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
beforeEach(() => { | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.viewport('iphone-6') | ||||||
cy.visit('http://localhost:3000') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.contains('button', 'Accept').click() | ||||||
}); | ||||||
|
||||||
it('Mostra as colunas Nome da Empresa e Ação, e oculta as colunas ID, Indústria, Número de Funcionários e Tamanho em um viewport móvel', () => { | ||||||
|
||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('th').contains('Company name').should('be.visible') | ||||||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
cy.get('th').contains('Action').should('be.visible') | ||||||
cy.get('th').contains('ID').should('not.be.visible') | ||||||
cy.get('th').contains('Industry').should('not.be.visible') | ||||||
cy.get('th').contains('Number of employees').should('not.be.visible') | ||||||
cy.get('th').contains('Size').should('not.be.visible') | ||||||
}); | ||||||
}); |
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// This example commands.js 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) => { ... }) |
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js 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') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"name": "frontend", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"frontend": "file:", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aqui tambem, eu removeria esse dependencia pois ela nao se enquadra na seguinte definicao: dependencies: São os pacotes essenciais que o projeto precisa para funcionar em produção. Esses módulos são instalados quando o projeto é executado em ambientes finais, como servidores de produção ou em builds de lançamento. São usados diretamente pelo código do projeto durante a execução (ex.: React). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. De novo. Só resolva conversas onde a sugestão foi implementada. Como este não é o caso, o review do @ldasilvaNZ11 ainda vale. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eu apaguei, mas ele retorna, misteriosamente. Dei uma pesquisada parece algum plugin faz isso não sei dizer com certeza |
||
"lucide-react": "^0.447.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,8 @@ | |
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"dependencies": { | ||
gabriel-e2e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"EngageSphere-Test-Design-Masterclass-Turma-3": "file:" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aqui o mesmo principio se aplicaria novamente, nao seria necessario estabelecer isso como uma dependencia. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mesma coisa aqui. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eu apaguei, mas ele retorna, misteriosamente. Dei uma pesquisada parece algum plugin faz isso não sei dizer com certeza |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fala Gabriel, qual seria a necessidade dessa dependencia backend?
Acredito que ela não seja necessaria, pois a aplicacao nao necessitaria dela para rodar.
Aqui vai uma breve explicação:
No contexto de módulos npm, a principal diferença entre dependencies e devDependencies está no momento em que os pacotes são necessários:
dependencies: São os pacotes essenciais que o projeto precisa para funcionar em produção. Esses módulos são instalados quando o projeto é executado em ambientes finais, como servidores de produção ou em builds de lançamento. São usados diretamente pelo código do projeto durante a execução (ex.: React).
devDependencies: São pacotes usados apenas durante o desenvolvimento e testes do projeto. Incluem ferramentas como linters, frameworks de testes e geradores de documentação. Esses módulos não são necessários em produção e, portanto, não são instalados quando o projeto é implementado nesse ambiente, exceto se forem explicitamente requisitados.
Em resumo, dependencies são para a execução do projeto, enquanto devDependencies são para o desenvolvimento do mesmo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Só se resolver conversas que foram ajustadas.
Esta mudança não deveria ter ocorrido e portanto, recomendo reverter a mudança.
O mesmo vale para o arquivo
backend/package-lock.json
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eu apago, e essa linha simplesmente volta sozinha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outro aluno teve o mesmo problema devido a uma extensão da RedHad no VSCode.
Você possui tal extensão instalada? Caso sim, tente desisntalar e veja se resolve o problema.