forked from verdnatura/hedera-web
Add news view tests
This commit is contained in:
parent
cb1542937a
commit
186ec60937
|
@ -240,6 +240,7 @@ defineExpose({
|
||||||
flat
|
flat
|
||||||
:disabled="!showBottomActions && !updatedColumns.length"
|
:disabled="!showBottomActions && !updatedColumns.length"
|
||||||
@click="submit()"
|
@click="submit()"
|
||||||
|
data-testid="formDefaultSaveButton"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('save') }}</QTooltip>
|
<QTooltip>{{ t('save') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -106,6 +106,7 @@ onMounted(async () => {
|
||||||
v-model="data.title"
|
v-model="data.title"
|
||||||
:label="t('title')"
|
:label="t('title')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
data-testid="newsTitleInput"
|
||||||
/>
|
/>
|
||||||
<div class="row justify-between q-gutter-x-md">
|
<div class="row justify-between q-gutter-x-md">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -115,12 +116,14 @@ onMounted(async () => {
|
||||||
option-value="name"
|
option-value="name"
|
||||||
:options="newsTags"
|
:options="newsTags"
|
||||||
class="col"
|
class="col"
|
||||||
|
data-testid="newsTagSelect"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.priority"
|
v-model="data.priority"
|
||||||
:label="t('priority')"
|
:label="t('priority')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
class="col"
|
class="col"
|
||||||
|
data-testid="newsPriorityInput"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<QEditor
|
<QEditor
|
||||||
|
|
|
@ -64,6 +64,7 @@ onMounted(async () => getNews());
|
||||||
:to="{ name: 'adminNewsDetails' }"
|
:to="{ name: 'adminNewsDetails' }"
|
||||||
rounded
|
rounded
|
||||||
no-caps
|
no-caps
|
||||||
|
data-testid="addNewBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('addNew') }}</QTooltip>
|
<QTooltip>{{ t('addNew') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -74,6 +75,7 @@ onMounted(async () => getNews());
|
||||||
v-for="(newsItem, index) in news"
|
v-for="(newsItem, index) in news"
|
||||||
:key="index"
|
:key="index"
|
||||||
:to="{ name: 'adminNewsDetails', params: { id: newsItem.id } }"
|
:to="{ name: 'adminNewsDetails', params: { id: newsItem.id } }"
|
||||||
|
data-testid="newsCard"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VnImg
|
<VnImg
|
||||||
|
@ -106,6 +108,7 @@ onMounted(async () => getNews());
|
||||||
() => deleteNew(newsItem.id, index)
|
() => deleteNew(newsItem.id, index)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
data-testid="deleteNewBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('remove') }}</QTooltip>
|
<QTooltip>{{ t('remove') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
describe('NewsView', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.resetDB();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.loginFlow('developer');
|
||||||
|
cy.visit('/#/news/news');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete a new', () => {
|
||||||
|
cy.dataCy('newsCard').should('exist');
|
||||||
|
cy.dataCy('newsCard').should('have.length', 3);
|
||||||
|
cy.dataCy('newsCard')
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.dataCy('deleteNewBtn').click();
|
||||||
|
});
|
||||||
|
cy.dataCy('confirmDialogButton').should('exist');
|
||||||
|
cy.dataCy('confirmDialogButton').click();
|
||||||
|
cy.dataCy('positiveNotify').should('contain', 'Datos guardados');
|
||||||
|
cy.dataCy('newsCard').should('have.length', 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a new', () => {
|
||||||
|
cy.dataCy('addNewBtn').should('exist');
|
||||||
|
cy.dataCy('addNewBtn').click();
|
||||||
|
cy.dataCy('formDefaultSaveButton').should('exist');
|
||||||
|
cy.dataCy('formDefaultSaveButton').should('be.disabled');
|
||||||
|
cy.dataCy('newsTitleInput').should('exist');
|
||||||
|
cy.get('input[data-testid="newsTitleInput"]').type('Test new');
|
||||||
|
cy.dataCy('newsTagSelect').should('exist');
|
||||||
|
cy.selectOption('[data-testid="newsTagSelect"]', 'Curso');
|
||||||
|
cy.dataCy('newsPriorityInput').should('exist');
|
||||||
|
cy.get('input[data-testid="newsPriorityInput"]').type('2');
|
||||||
|
cy.dataCy('formDefaultSaveButton').should('not.be.disabled');
|
||||||
|
cy.dataCy('formDefaultSaveButton').click();
|
||||||
|
cy.dataCy('positiveNotify').should('contain', 'Datos guardados');
|
||||||
|
cy.dataCy('newsCard').should('exist');
|
||||||
|
cy.dataCy('newsCard').should('contain', 'Test new');
|
||||||
|
cy.dataCy('newsCard').should('contain', '2');
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,8 +1,4 @@
|
||||||
describe('PendingOrders', () => {
|
describe('PendingOrders', () => {
|
||||||
before(() => {
|
|
||||||
// cy.resetDB();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('brucewayne');
|
cy.login('brucewayne');
|
||||||
cy.visit('/#/ecomerce/orders');
|
cy.visit('/#/ecomerce/orders');
|
||||||
|
|
Loading…
Reference in New Issue