Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
39e48d11a5 | ||
|
44450b918f | ||
|
8161e77c7a | ||
|
2bd1b9529c | ||
|
3d0e47cd34 | ||
|
490c196f49 | ||
|
e3c79d66d3 |
19
.vscode/launch.json
vendored
Normal file
19
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
|
||||||
|
// Pointez pour afficher la description des attributs existants.
|
||||||
|
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Test Cypress via NPM",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "npm",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"run-script",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@ -1,3 +1,11 @@
|
|||||||
{
|
{
|
||||||
"git.ignoreLimitWarning": true
|
"git.ignoreLimitWarning": true,
|
||||||
|
"conventionalCommits.scopes": [
|
||||||
|
"#1",
|
||||||
|
"#2",
|
||||||
|
"#3",
|
||||||
|
"#4",
|
||||||
|
"#5",
|
||||||
|
"#6"
|
||||||
|
]
|
||||||
}
|
}
|
11
README.md
11
README.md
@ -1,13 +1,6 @@
|
|||||||
# Tests @ Trusk (Partie 3)
|
# Tests @ Trusk
|
||||||
|
|
||||||
> Identifier le mauvais code de Cypress et proposer des améliorations
|
|
||||||
|
|
||||||
Ce projet d'automatisation avait besoin d'un certain nettoyage. Je me suis permis de faire des retours sous forme de tickets accessibles dans l'onglet [Tickets / Issues](https://git.blanchelune.i234.me/Trusk/Partie-3/issues). Mais surtout, je me suis permis d'implémenter certaines de ces suggestions au sein d'une nouvelle branche appelée `refacto`. Avant que vous n'alliez inspecter son code, sachez qu'il existe la Pull Request [#5 Fix various issues in the current Milestone](https://git.blanchelune.i234.me/Trusk/Partie-3/pulls/5) qui reprends les commits de ces modifications. Chaque changements que j'ai implementé sur cette pull request est associé à un ticket. Il est donc tres facile de voir mes modifications du code pour chaque suggestions que j'ai formulé (le cas échéant, je n'ai pas tout implémenté), et inversement. Une fois approuvée, la Demande d'ajout pourrait-être fusionnée sur la branche principale.
|
|
||||||
|
|
||||||
Comme quoi, un logiciel d'automatisation est une forme de projet de développement applicatif à lui seul.
|
|
||||||
|
|
||||||
Vous pouvez voir les autres parties du test d'entretien en cliquant sur le [Groupe Trusk](https://git.blanchelune.i234.me/Trusk).
|
|
||||||
|
|
||||||
|
Ceci est un projet exemple pour l'utilisation de [Cypress](https://www.cypress.io/)
|
||||||
|
|
||||||
## Installer les dépendences
|
## Installer les dépendences
|
||||||
|
|
||||||
|
@ -1 +1,6 @@
|
|||||||
{}
|
{
|
||||||
|
"baseUrl": "http://localhost:3000",
|
||||||
|
"env" : {
|
||||||
|
"logoutUrl": "/ok.html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
25
cypress/fixtures/userSet.json
Normal file
25
cypress/fixtures/userSet.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"valid-admin": {
|
||||||
|
"email": "adrian@trusk.com",
|
||||||
|
"password": "adrian@trusk.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"invalid-admin": {
|
||||||
|
"email": "adrian@trusk.com",
|
||||||
|
"password": "adrian"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unexisting-user": {
|
||||||
|
"email": "adrian.pothuaud@trusk.com",
|
||||||
|
"password": "badpassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"malformed-email": {
|
||||||
|
"email": "adrian-trusk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -1,45 +1,77 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
it('Should work as expected', () => {
|
describe('Should allow valid user and block the rest', () => {
|
||||||
cy.visit('http://localhost:3000')
|
|
||||||
// title
|
beforeEach(function() {
|
||||||
cy.title().should('eq', 'QA @ Trusk')
|
// Changed theses should as required conditions to perform other tests
|
||||||
// elements
|
cy.visit('/')
|
||||||
cy.get('h1').should('be.visible')
|
// title
|
||||||
cy.get('p').should('be.visible')
|
cy.title().should('eq', 'QA @ Trusk')
|
||||||
cy.get('label').should('be.visible')
|
// elements
|
||||||
cy.get('input').should('be.visible')
|
cy.get('#hello').should('be.visible')
|
||||||
cy.get('button').should('be.visible')
|
cy.get('#guess').should('be.visible')
|
||||||
// submit empty
|
cy.get('#email-label').should('be.visible')
|
||||||
cy.get('input').first().clear()
|
cy.get('#email-input').should('be.visible')
|
||||||
cy.get('input').last().clear()
|
cy.get('#password-label').should('be.visible')
|
||||||
cy.get('button').click()
|
cy.get('#password-input').should('be.visible')
|
||||||
cy.contains('Renseignes une adresse e-mail!').should('be.visible')
|
cy.get('#submit').should('be.visible')
|
||||||
cy.contains('Renseignes un mot de passe!').should('be.visible')
|
|
||||||
// submit invalid email
|
});
|
||||||
cy.get('input').first().clear().type('adrian-trusk')
|
|
||||||
cy.get('button').click()
|
it('Prevent submiting empty credentials', function() {
|
||||||
cy.contains('Renseignes une adresse e-mail valide!').should('be.visible')
|
// submit empty
|
||||||
// submit wrong email
|
cy.get('#email-input').clear()
|
||||||
cy.get('input').first().clear().type('adrian.pothuaud@trusk.com')
|
cy.get('#password-input').clear()
|
||||||
cy.get('button').click()
|
cy.get('#submit').click()
|
||||||
cy.contains('Renseignes la bonne adresse e-mail!').should('be.visible')
|
cy.contains('Renseignes une adresse e-mail!').should('be.visible')
|
||||||
// submit bad password
|
cy.contains('Renseignes un mot de passe!').should('be.visible')
|
||||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
});
|
||||||
cy.get('input').last().clear().type('adrian')
|
|
||||||
cy.get('button').click()
|
|
||||||
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
it('Prevent submiting malformed email', function() {
|
||||||
// submit valid credentials
|
// submit invalid email
|
||||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
cy.get('#email-input').clear().type('adrian-trusk')
|
||||||
cy.get('input').last().clear().type('adrian@trusk.com')
|
cy.get('#password-input').clear()
|
||||||
cy.get('button').click()
|
cy.get('#submit').click()
|
||||||
cy.contains('Salut testeur !').should('be.visible')
|
cy.contains('Renseignes une adresse e-mail valide!').should('be.visible')
|
||||||
// get back
|
});
|
||||||
cy.contains('Retour').click()
|
|
||||||
cy.title().should('eq', 'QA @ Trusk')
|
it('Prevent submiting an unexisting user', function() {
|
||||||
cy.get('h1').should('be.visible')
|
// submit wrong email
|
||||||
cy.get('p').should('be.visible')
|
cy.get('#email-input').clear().type('adrian.pothuaud@trusk.com')
|
||||||
cy.get('label').should('be.visible')
|
cy.get('#password-input').clear().type('badpassword')
|
||||||
cy.get('input').should('be.visible')
|
cy.get('#submit').click()
|
||||||
cy.get('button').should('be.visible')
|
cy.contains('Renseignes la bonne adresse e-mail!').should('be.visible')
|
||||||
})
|
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Prevent submiting invalid password of an existing user', function() {
|
||||||
|
// submit bad password
|
||||||
|
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||||
|
cy.get('#password-input').clear().type('adrian')
|
||||||
|
cy.get('#submit').click()
|
||||||
|
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Allow connect a user in the system with right credentials', function() {
|
||||||
|
// submit valid credentials
|
||||||
|
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||||
|
cy.get('#password-input').clear().type('adrian@trusk.com')
|
||||||
|
cy.get('#submit').click()
|
||||||
|
cy.contains('Salut testeur !').should('be.visible')
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skip('Allow to disconnect a connected user', function() {
|
||||||
|
// cy.visit("ok.html")
|
||||||
|
// get back
|
||||||
|
cy.contains('Retour').click()
|
||||||
|
cy.title().should('eq', 'QA @ Trusk')
|
||||||
|
cy.get('h1').should('be.visible')
|
||||||
|
cy.get('p').should('be.visible')
|
||||||
|
cy.get('label').should('be.visible')
|
||||||
|
cy.get('input').should('be.visible')
|
||||||
|
cy.get('#submit').should('be.visible')
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -3,7 +3,8 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodemon index.js"
|
"start": "nodemon index.js",
|
||||||
|
"test": "cypress open"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cypress": "^8.3.0",
|
"cypress": "^8.3.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user