Cypress test for featured com_contact. (#40154)

* cypress_test_for_com_contact

* update_code_style

* updates
This commit is contained in:
rajputanuj31 2023-03-20 13:13:49 +05:30 committed by GitHub
parent cc123278e8
commit d3ba9d5408
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,18 @@
describe('Test that the front page', () => {
it('can display featured contact', () => {
cy.db_createContact({ name: 'automated test contact 1' })
.then(() => cy.db_createContact({ name: 'automated test contact 2' }))
.then(() => cy.db_createContact({ name: 'automated test contact 3' }))
.then(() => cy.db_createContact({ name: 'automated test contact 4' }))
.then(() => cy.db_createMenuItem({ title: 'automated test Contact', link: 'index.php?option=com_contact&view=featured', path: '?option=com_contact&view=featured' }))
.then(() => {
cy.visit('/');
cy.get('a:contains(automated test Contact)').click();
cy.contains('automated test contact 1');
cy.contains('automated test contact 2');
cy.contains('automated test contact 3');
cy.contains('automated test contact 4');
});
});
});

View File

@ -80,6 +80,28 @@ Cypress.Commands.add('db_createUser', (user) => {
});
});
Cypress.Commands.add('db_createContact',(contact)=>{
const defaultContactOptions = {
name: 'test contact',
alias: 'test-contact',
catid:2,
address: '',
country: '',
access: 1,
language: '*',
created: '2023-01-01 20:00:00',
modified: '2023-01-01 20:00:00',
metadesc: '',
metadata: '',
featured: 1,
published: 1,
params: ''
};
return cy.task('queryDB', createInsertQuery('contact_details', { ...defaultContactOptions, ...contact })).then((info) => info.insertId);
});
/**
* Returns an insert query for the given database and fields.
*