Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
16 changes: 16 additions & 0 deletions tests/System/integration/site/components/com_contact/Form.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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(() => {
cy.task('queryDB', 'SELECT id FROM #__contact_details WHERE name = \'contact 1\'')
.then(async (contactId) => {
cy.visit(`index.php?option=com_contact&view=contact&id='${contactId[0].id}'`);
});

cy.contains('Contact Form');
cy.get('.m-0').should('exist');
});
});
});
});
8 changes: 8 additions & 0 deletions tests/System/support/commands/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,11 @@ 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(async (id) => {

return cy.wrap(id[0].id);
});
});