Skip to content

Commit 65da463

Browse files
Kaushik1216laoneo
andauthored
Adding more test for categories (#40733)
* Adding more test for categories * Update Categories.cy.js * Update Categories.cy.js * Create category to delete through the form --------- Co-authored-by: Allon Moritz <[email protected]>
1 parent 1811f78 commit 65da463

File tree

1 file changed

+54
-0
lines changed
  • tests/System/integration/administrator/components/com_categories

1 file changed

+54
-0
lines changed

tests/System/integration/administrator/components/com_categories/Categories.cy.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,58 @@ describe('Test in backend that the categories list', () => {
2121

2222
cy.contains('New Category');
2323
});
24+
25+
it('can publish the test category', () => {
26+
cy.db_createCategory({ title: 'Test category', published: 0 }).then(() => {
27+
cy.reload();
28+
cy.searchForItem('Test category');
29+
cy.checkAllResults();
30+
cy.clickToolbarButton('Action');
31+
cy.contains('Publish').click();
32+
cy.on('window:confirm', () => true);
33+
34+
cy.get('#system-message-container').contains('Category published.').should('exist');
35+
});
36+
});
37+
38+
it('can unpublish the test category', () => {
39+
cy.db_createCategory({ title: 'Test category', published: 1 }).then(() => {
40+
cy.reload();
41+
cy.searchForItem('Test category');
42+
cy.checkAllResults();
43+
cy.clickToolbarButton('Action');
44+
cy.contains('Unpublish').click();
45+
cy.on('window:confirm', () => true);
46+
47+
cy.get('#system-message-container').contains('Category unpublished.').should('exist');
48+
});
49+
});
50+
51+
it('can trash the test category', () => {
52+
cy.db_createCategory({ title: 'Test category' }).then(() => {
53+
cy.reload();
54+
cy.searchForItem('Test category');
55+
cy.checkAllResults();
56+
cy.clickToolbarButton('Action');
57+
cy.contains('Trash').click();
58+
cy.on('window:confirm', () => true);
59+
60+
cy.get('#system-message-container').contains('Category trashed.').should('exist');
61+
});
62+
});
63+
64+
it('can delete the test category', () => {
65+
// The category needs to be created through the form so proper assets are created
66+
cy.visit('/administrator/index.php?option=com_categories&task=category.add&extension=com_content');
67+
cy.get('#jform_title').type('Test category');
68+
cy.get('#jform_published').select('Trashed');
69+
cy.clickToolbarButton('Save & Close');
70+
cy.setFilter('published', 'Trashed');
71+
cy.searchForItem('Test category');
72+
cy.checkAllResults();
73+
cy.clickToolbarButton('empty trash');
74+
cy.on('window:confirm', () => true);
75+
76+
cy.get('#system-message-container').contains('Category deleted.').should('exist');
77+
});
2478
});

0 commit comments

Comments
 (0)