Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe('Test that the Catagories of com_contact ', () => {
it('can display a list of categories of contacts in menu item', () => {
cy.db_createCategory({ title: 'automated test category 1', extension: 'com_contact' })
.then((id) => cy.db_createContact({ name: 'automated test contact 1', catid: id }))
.then(() => cy.db_createCategory({ title: 'automated test category 2', extension: 'com_contact' }))
.then(async (id) => {
await cy.db_createContact({ name: 'automated test contact 2', catid: id });
await cy.db_createContact({ name: 'automated test contact 3', catid: id });
})
.then(() => {
cy.visit('index.php?option=com_contact&view=categories');

cy.contains('automated test category 1');
cy.contains('automated test category 2');
cy.get(':nth-child(2) > .page-header > .badge').contains('Contact Count: 1');
cy.get(':nth-child(3) > .page-header > .badge').contains('Contact Count: 2');
});
});
});
20 changes: 20 additions & 0 deletions tests/System/support/commands/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,26 @@ Cypress.Commands.add('db_createUser', (userData) => {
});
});

Cypress.Commands.add('db_createCategory', (category) => {
const defaultCategoryOptions = {
title: 'test category',
alias: 'test-category',
path: '',
extension: 'com_content',
published: 1,
access: 1,
params: '',
parent_id: 1,
level: 1,
metadata: '',
metadesc: '',
created_time: '2023-01-01 20:00:00',
modified_time: '2023-01-01 20:00:00',
};

return cy.task('queryDB', createInsertQuery('categories', { ...defaultCategoryOptions, ...category })).then(async (info) => info.insertId);
});

Cypress.Commands.add('db_getUserId', () => {
cy.task('queryDB', `SELECT id FROM #__users WHERE username = '${Cypress.env('username')}'`)
.then((id) => {
Expand Down