forked from Ivasoft/geovisio-website
add some tests
This commit is contained in:
3
cypress.env.json
Normal file
3
cypress.env.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"api_url": "http://localhost:5000/"
|
||||
}
|
||||
25
cypress/e2e/about.cy.ts
Normal file
25
cypress/e2e/about.cy.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
describe('In the about page', () => {
|
||||
it('go to the login page', () => {
|
||||
cy.visit('partager-des-photos')
|
||||
cy.fixture('about').then((aboutData: aboutInterface) => {
|
||||
cy.contains(aboutData.textButtonAbout).click()
|
||||
})
|
||||
})
|
||||
it('go to the login page', () => {
|
||||
cy.visit('partager-des-photos')
|
||||
cy.fixture('about').then((aboutData: aboutInterface) => {
|
||||
cy.contains(aboutData.textButtonAbout).click()
|
||||
})
|
||||
})
|
||||
it('go to the cli page', () => {
|
||||
cy.visit('partager-des-photos')
|
||||
cy.fixture('about').then((aboutData: aboutInterface) => {
|
||||
cy.contains(aboutData.textButtonCli).click()
|
||||
})
|
||||
})
|
||||
})
|
||||
interface aboutInterface {
|
||||
textButtonAbout: string
|
||||
textButtonCli: string
|
||||
}
|
||||
export {}
|
||||
21
cypress/e2e/home.cy.ts
Normal file
21
cypress/e2e/home.cy.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
describe('In the home page', () => {
|
||||
it('click on the link in the header to go to the About page', () => {
|
||||
cy.visit('/')
|
||||
cy.fixture('home').then((homeData) => {
|
||||
cy.contains(homeData.textLinkAbout).click()
|
||||
cy.url().should('include', '/partager-des-photos')
|
||||
})
|
||||
})
|
||||
it('click on the link in the header to go to the Login page', () => {
|
||||
cy.visit('/')
|
||||
cy.fixture('home').then((homeData) => {
|
||||
cy.contains(homeData.textLinkLogin).click()
|
||||
cy.url().should(
|
||||
'include',
|
||||
'/realms/geovisio/protocol/openid-connect/auth'
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
||||
@@ -1,6 +1,26 @@
|
||||
describe('In the login page', () => {
|
||||
it('type in the form to login', () => {
|
||||
cy.visit('/')
|
||||
cy.visit(`${Cypress.env('api_url')}api/auth/login`)
|
||||
cy.get('#username').type('Elysee')
|
||||
cy.get('#password').type('my password')
|
||||
cy.fixture('upload').then((uploadData) => {
|
||||
cy.contains(uploadData.textLinkLogin).click()
|
||||
cy.visit('/')
|
||||
})
|
||||
})
|
||||
it('go to the register form and create an account', () => {
|
||||
cy.visit(`${Cypress.env('api_url')}api/auth/login`)
|
||||
cy.fixture('login').then((loginData) => {
|
||||
cy.contains(loginData.textLinkRegister).click()
|
||||
cy.get('#firstName').type('Tom')
|
||||
cy.get('#lastName').type('Tom')
|
||||
cy.get('#email').type('test@testss.com')
|
||||
cy.get('#username').type('Elysee124')
|
||||
cy.get('#password').type('my password1')
|
||||
cy.get('#password-confirm').type('my password1')
|
||||
cy.get('form').submit()
|
||||
cy.visit('/')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
9
cypress/e2e/tsconfig.json
Normal file
9
cypress/e2e/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": ["reflect-metadata", "jest", "cypress"],
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
23
cypress/e2e/upload.cy.ts
Normal file
23
cypress/e2e/upload.cy.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
describe('In the login page', () => {
|
||||
it('type in the form to login', () => {
|
||||
cy.visit(`${Cypress.env('api_url')}api/auth/login`)
|
||||
cy.fixture('upload').then((uploadData) => {
|
||||
cy.get('#username').type('elysee')
|
||||
cy.get('#password').type('my password')
|
||||
cy.contains(uploadData.textLinkLogin).click()
|
||||
cy.visit('/')
|
||||
cy.contains(uploadData.textLinkUpload).click()
|
||||
})
|
||||
cy.get('.input-file').selectFile(
|
||||
[
|
||||
'cypress/fixtures/images/image1.JPG',
|
||||
'cypress/fixtures/images/image2.JPG',
|
||||
'cypress/fixtures/images/image3.JPG'
|
||||
],
|
||||
{ force: true }
|
||||
)
|
||||
cy.get('button[type=submit]').click()
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
||||
4
cypress/fixtures/about.json
Normal file
4
cypress/fixtures/about.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"textButtonAbout": "Créer un compte",
|
||||
"textButtonCli": "Accéder à l'outil"
|
||||
}
|
||||
7
cypress/fixtures/home.json
Normal file
7
cypress/fixtures/home.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"addressToSearch": "97 boulevard Voltaire 75011 paris",
|
||||
"textAddressToSelect": "Boulevard Voltaire, Quartier de la Folie-Méricourt, Paris 11e Arrondissement, Paris, Île-de-France, France métropolitaine, 75011, France",
|
||||
"textLinkAbout": "À propos",
|
||||
"textLinkUpload": "Contribuer",
|
||||
"textLinkLogin": "Connexion"
|
||||
}
|
||||
BIN
cypress/fixtures/images/image1.JPG
Executable file
BIN
cypress/fixtures/images/image1.JPG
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 377 KiB |
BIN
cypress/fixtures/images/image2.JPG
Executable file
BIN
cypress/fixtures/images/image2.JPG
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 416 KiB |
BIN
cypress/fixtures/images/image3.JPG
Executable file
BIN
cypress/fixtures/images/image3.JPG
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 408 KiB |
3
cypress/fixtures/login.json
Normal file
3
cypress/fixtures/login.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"textLinkRegister": "Register"
|
||||
}
|
||||
5
cypress/fixtures/upload.json
Normal file
5
cypress/fixtures/upload.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textLinkLogin": "Sign In",
|
||||
"textLinkUpload": "Contribuer",
|
||||
"textButtonUpload": "Déposez des photos dans la zone ou"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 133 KiB |
@@ -42,6 +42,7 @@
|
||||
"devDependencies": {
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@rushstack/eslint-patch": "^1.1.4",
|
||||
"@types/jest": "^29.5.4",
|
||||
"@types/jsdom": "^20.0.1",
|
||||
"@types/node": "^18.11.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
||||
@@ -58,6 +59,7 @@
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-vue": "^9.8.0",
|
||||
"jest": "^29.6.4",
|
||||
"jsdom": "^20.0.3",
|
||||
"less": "^4.2.0",
|
||||
"less-loader": "^11.1.3",
|
||||
|
||||
@@ -55,7 +55,7 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const titleImg = computed<string>(() =>
|
||||
props.disabled ? t('general.header.contribute_text') : ''
|
||||
props.disabled ? t('general.header.about_text') : ''
|
||||
)
|
||||
function triggerButton() {
|
||||
if (props.disabled) return
|
||||
|
||||
Reference in New Issue
Block a user