Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
11 changes: 11 additions & 0 deletions tests/System/integration/site/components/com_contact/Contact.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Test that the Contact Form', () => {
it('can display a Contact Form', () => {
cy.db_getUserId().then((id) => cy.db_createContact({ name: 'contact 1', user_id: id, featured: 1 }))
.then((contactId) => {
cy.visit(`index.php?option=com_contact&view=contact&id='${contactId}'`);

cy.contains('Contact Form');
cy.get('.m-0').should('exist');
});
});
});
10 changes: 10 additions & 0 deletions tests/System/support/commands/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,13 @@ Cypress.Commands.add('db_createUser', (userData) => {
return info.insertId;
});
});

Cypress.Commands.add('db_getUserId', () => {
cy.task('queryDB', `SELECT id FROM #__users WHERE username = '${Cypress.env('username')}'`)
.then((id) => {
if (id.length === 0) {
return 0;
}
return id[0].id;
});
});