Some changes and more tests
gitea/hedera-web/pipeline/pr-4922-vueMigration This commit looks good
Details
gitea/hedera-web/pipeline/pr-4922-vueMigration This commit looks good
Details
This commit is contained in:
parent
186ec60937
commit
0bec75b2d3
|
@ -13,7 +13,9 @@ module.exports = defineConfig({
|
||||||
video: false,
|
video: false,
|
||||||
screenshotOnRunFailure: false,
|
screenshotOnRunFailure: false,
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
// implement node event listeners here
|
on('after:spec', (spec, results) => {
|
||||||
|
console.log('Finished running', spec.relative);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -153,6 +153,7 @@ onMounted(async () => getImageCollections());
|
||||||
option-label="desc"
|
option-label="desc"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
:options="imageCollections"
|
:options="imageCollections"
|
||||||
|
data-testid="photoCollectionSelect"
|
||||||
/>
|
/>
|
||||||
<QUploader
|
<QUploader
|
||||||
ref="fileUploaderRef"
|
ref="fileUploaderRef"
|
||||||
|
@ -164,13 +165,19 @@ onMounted(async () => getImageCollections());
|
||||||
bordered
|
bordered
|
||||||
hide-upload-btn
|
hide-upload-btn
|
||||||
@added="onFilesAdded"
|
@added="onFilesAdded"
|
||||||
|
data-testid="photoUploader"
|
||||||
>
|
>
|
||||||
<template #list="scope">
|
<template #list="scope">
|
||||||
<QList v-if="addedFiles.length" separator>
|
<QList
|
||||||
|
v-if="addedFiles.length"
|
||||||
|
separator
|
||||||
|
data-testid="photoUploaderList"
|
||||||
|
>
|
||||||
<QItem
|
<QItem
|
||||||
v-for="(file, index) in scope.files"
|
v-for="(file, index) in scope.files"
|
||||||
:key="file.__key"
|
:key="file.__key"
|
||||||
class="flex full-width row items-center justify-center"
|
class="flex full-width row items-center justify-center"
|
||||||
|
data-testid="photoUploaderItem"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="file.__img.src"
|
:src="file.__img.src"
|
||||||
|
@ -204,6 +211,7 @@ onMounted(async () => getImageCollections());
|
||||||
].icon
|
].icon
|
||||||
"
|
"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
data-testid="photoUploaderItemsStatusIcon"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
|
@ -229,6 +237,7 @@ onMounted(async () => getImageCollections());
|
||||||
round
|
round
|
||||||
icon="delete"
|
icon="delete"
|
||||||
@click="removeFile(file, index)"
|
@click="removeFile(file, index)"
|
||||||
|
data-testid="photoUploaderItemsDeleteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('remove') }}</QTooltip>
|
<QTooltip>{{ t('remove') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -248,6 +257,7 @@ onMounted(async () => getImageCollections());
|
||||||
no-caps
|
no-caps
|
||||||
flat
|
flat
|
||||||
@click="clearFiles()"
|
@click="clearFiles()"
|
||||||
|
data-testid="photoUploaderClearBtn"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('uploadFiles')"
|
:label="t('uploadFiles')"
|
||||||
|
@ -256,6 +266,7 @@ onMounted(async () => getImageCollections());
|
||||||
flat
|
flat
|
||||||
:disable="!isSubmitable"
|
:disable="!isSubmitable"
|
||||||
@click="onSubmit(data)"
|
@click="onSubmit(data)"
|
||||||
|
data-testid="photoUploadSubmitBtn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnForm>
|
</VnForm>
|
||||||
|
|
|
@ -40,7 +40,11 @@ export default route(function (/* { store, ssrContext } */) {
|
||||||
Router.beforeEach((to, from, next) => {
|
Router.beforeEach((to, from, next) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
if (!userStore.storage.getItem('token') && to.name !== 'login') {
|
if (
|
||||||
|
!userStore.storage.getItem('token') &&
|
||||||
|
to.name !== 'login' &&
|
||||||
|
!userStore.isGuest
|
||||||
|
) {
|
||||||
return next({ name: 'login' });
|
return next({ name: 'login' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
|
@ -17,5 +17,6 @@ describe('User flow: Login, create a new order, add item to basket and go to con
|
||||||
cy.dataCy('basketToConfirmBtn').should('exist');
|
cy.dataCy('basketToConfirmBtn').should('exist');
|
||||||
cy.dataCy('basketToConfirmBtn').click();
|
cy.dataCy('basketToConfirmBtn').click();
|
||||||
cy.url().should('contain', '/#/ecomerce/confirm');
|
cy.url().should('contain', '/#/ecomerce/confirm');
|
||||||
|
cy.resetDB();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe('NewsView', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.loginFlow('developer');
|
cy.login('developer');
|
||||||
cy.visit('/#/news/news');
|
cy.visit('/#/news/news');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
describe('Photo Uploader Component', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/admin/photos');
|
||||||
|
});
|
||||||
|
|
||||||
|
const uploadFile = fileName => {
|
||||||
|
cy.get('.q-uploader__input').selectFile(fileName);
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should display the photo collection select', () => {
|
||||||
|
// Verificar que el select de colección esté presente
|
||||||
|
cy.dataCy('photoCollectionSelect').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow selecting a photo collection', () => {
|
||||||
|
// Simular la selección de una colección de fotos
|
||||||
|
cy.selectOption('[data-testid="photoCollectionSelect"]', 'Enlace');
|
||||||
|
cy.getValue('[data-testid="photoCollectionSelect"]').should(
|
||||||
|
'equal',
|
||||||
|
'Enlace'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('submit button should be disabled if no files are selected', () => {
|
||||||
|
cy.dataCy('photoUploadSubmitBtn').should('be.disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow adding files', () => {
|
||||||
|
cy.dataCy('photoUploaderItem').should('not.exist');
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
cy.dataCy('photoUploaderItem').should('exist');
|
||||||
|
cy.dataCy('photoUploaderItem').should('have.length', 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remove a file when delete button is clicked', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
|
||||||
|
cy.dataCy('photoUploaderItem').should('exist');
|
||||||
|
cy.dataCy('photoUploaderItemsDeleteBtn').click();
|
||||||
|
cy.dataCy('photoUploaderItem').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should enable the upload button when files are pending', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
cy.dataCy('photoUploadSubmitBtn').should('not.be.disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should upload files when submit button is clicked', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
cy.dataCy('photoUploadSubmitBtn').click();
|
||||||
|
cy.dataCy('positiveNotify').should(
|
||||||
|
'contain',
|
||||||
|
'Imágenes subidas correctamente'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the correct status icon', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
cy.dataCy('photoUploaderItemsStatusIcon').should('have.text', 'add');
|
||||||
|
cy.dataCy('photoUploadSubmitBtn').click();
|
||||||
|
cy.dataCy('photoUploaderItemsStatusIcon').should(
|
||||||
|
'have.text',
|
||||||
|
'cloud_done'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should clear all files when clear button is clicked', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/lowres.jpg');
|
||||||
|
cy.dataCy('photoUploaderItem').should('exist');
|
||||||
|
cy.dataCy('photoUploaderClearBtn').click();
|
||||||
|
cy.dataCy('photoUploaderItem').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display error notification if an upload fails', () => {
|
||||||
|
uploadFile('src/test/cypress/fixtures/low-res.jpg');
|
||||||
|
cy.dataCy('photoUploadSubmitBtn').click();
|
||||||
|
cy.dataCy('negativeNotify').should(
|
||||||
|
'contain',
|
||||||
|
'Ocurrieron errores al subir alguna de las imágenes'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
|
@ -4,10 +4,6 @@ describe('UsersView', () => {
|
||||||
cy.visit('/#/admin/users');
|
cy.visit('/#/admin/users');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
cy.logout();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show empty state when entering the view', () => {
|
it('should show empty state when entering the view', () => {
|
||||||
cy.dataCy('usersViewList').should('contain', 'Sin datos');
|
cy.dataCy('usersViewList').should('contain', 'Sin datos');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
describe('CatalogView', () => {
|
describe('CatalogView', () => {
|
||||||
beforeEach(() => {
|
// beforeEach(() => {
|
||||||
// 1- Loguear usuario
|
// // 1- Loguear usuario
|
||||||
cy.login('employee');
|
// cy.login('developer');
|
||||||
// 2- Crear una orden
|
// // 2- Crear una orden
|
||||||
cy.createOrderReceiveFlow();
|
// cy.resetDB();
|
||||||
});
|
// cy.createOrderReceiveFlow();
|
||||||
|
// });
|
||||||
it('Adds item to basket', () => cy.addItemToBasketFlow());
|
// it('Adds item to basket', () => {
|
||||||
|
// cy.addItemToBasketFlow();
|
||||||
it('Goes to basket', () => {
|
// });
|
||||||
cy.dataCy('catalogGoToBasketButton').should('exist');
|
// it('Goes to basket', () => {
|
||||||
cy.dataCy('catalogGoToBasketButton').click();
|
// cy.dataCy('catalogGoToBasketButton').should('exist');
|
||||||
cy.url().should('contain', '/#/ecomerce/basket');
|
// cy.dataCy('catalogGoToBasketButton').click();
|
||||||
});
|
// cy.url().should('contain', '/#/ecomerce/basket');
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
describe('CheckoutStepper', () => {
|
describe('CheckoutStepper', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.resetDB();
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('employee');
|
cy.login('employee');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
describe('Changes user nickname', () => {
|
describe('Changes user nickname', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('brucewayne');
|
||||||
|
cy.visit('/#/account/conf');
|
||||||
|
});
|
||||||
|
|
||||||
it('success', () => {
|
it('success', () => {
|
||||||
cy.changeUserNickname('Bruce Wayne', 'New test nickname');
|
cy.changeUserNickname('Bruce Wayne', 'New test nickname');
|
||||||
|
cy.resetDB();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,15 +8,15 @@ Cypress.Commands.add('login', user => {
|
||||||
password: 'nightmare'
|
password: 'nightmare'
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
window.localStorage.setItem('token', response.body.token);
|
window.sessionStorage.setItem('token', response.body.token);
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/api/VnUsers/ShareToken',
|
url: '/api/VnUsers/ShareToken',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: window.localStorage.getItem('token')
|
Authorization: window.sessionStorage.getItem('token')
|
||||||
}
|
}
|
||||||
}).then(({ body }) => {
|
}).then(({ body }) => {
|
||||||
window.localStorage.setItem(
|
window.sessionStorage.setItem(
|
||||||
'tokenMultimedia',
|
'tokenMultimedia',
|
||||||
body.multimediaToken.id
|
body.multimediaToken.id
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('PendingOrders', () => {
|
||||||
cy.dataCy('confirmDialogButton').click();
|
cy.dataCy('confirmDialogButton').click();
|
||||||
};
|
};
|
||||||
|
|
||||||
// it('when confirm payment redirects to payment site', () => {
|
// it('confirm payment redirects to payment site', () => {
|
||||||
// makePayment('100');
|
// makePayment('100');
|
||||||
// TODO: Ver como hacer para verificar redirección a sitio externo
|
// TODO: Ver como hacer para verificar redirección a sitio externo
|
||||||
// });
|
// });
|
||||||
|
|
Loading…
Reference in New Issue