diff --git a/src/components/common/VnForm.vue b/src/components/common/VnForm.vue
index bb78317c..cd1a329c 100644
--- a/src/components/common/VnForm.vue
+++ b/src/components/common/VnForm.vue
@@ -240,6 +240,7 @@ defineExpose({
flat
:disabled="!showBottomActions && !updatedColumns.length"
@click="submit()"
+ data-testid="formDefaultSaveButton"
>
{{ t('save') }}
diff --git a/src/pages/Admin/NewsDetails.vue b/src/pages/Admin/NewsDetails.vue
index 6d2cf784..d9b04c98 100644
--- a/src/pages/Admin/NewsDetails.vue
+++ b/src/pages/Admin/NewsDetails.vue
@@ -106,6 +106,7 @@ onMounted(async () => {
v-model="data.title"
:label="t('title')"
:clearable="false"
+ data-testid="newsTitleInput"
/>
{
option-value="name"
:options="newsTags"
class="col"
+ data-testid="newsTagSelect"
/>
getNews());
:to="{ name: 'adminNewsDetails' }"
rounded
no-caps
+ data-testid="addNewBtn"
>
{{ t('addNew') }}
@@ -74,6 +75,7 @@ onMounted(async () => getNews());
v-for="(newsItem, index) in news"
:key="index"
:to="{ name: 'adminNewsDetails', params: { id: newsItem.id } }"
+ data-testid="newsCard"
>
getNews());
() => deleteNew(newsItem.id, index)
)
"
+ data-testid="deleteNewBtn"
>
{{ t('remove') }}
diff --git a/src/test/cypress/integration/admin/NewsView.spec.js b/src/test/cypress/integration/admin/NewsView.spec.js
new file mode 100644
index 00000000..a487b141
--- /dev/null
+++ b/src/test/cypress/integration/admin/NewsView.spec.js
@@ -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');
+ });
+});
diff --git a/src/test/cypress/integration/orders/OrdersView.spec.js b/src/test/cypress/integration/orders/OrdersView.spec.js
index 54589f19..0caa4910 100644
--- a/src/test/cypress/integration/orders/OrdersView.spec.js
+++ b/src/test/cypress/integration/orders/OrdersView.spec.js
@@ -1,8 +1,4 @@
describe('PendingOrders', () => {
- before(() => {
- // cy.resetDB();
- });
-
beforeEach(() => {
cy.login('brucewayne');
cy.visit('/#/ecomerce/orders');