43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
describe('NewsView', () => {
|
|
before(() => {
|
|
cy.resetDB();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.login('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.setConfirmDialog();
|
|
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');
|
|
});
|
|
});
|