-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.4-dev' into verify-request-links
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
describe('Test that field contact API endpoint', () => { | ||
afterEach(() => cy.task('queryDB', 'DELETE FROM #__fields')); | ||
|
||
it('can deliver a list of fields', () => { | ||
cy.db_createField({ title: 'automated test field', context: 'com_contact.contact' }) | ||
.then(() => cy.api_get('/fields/contacts/contact')) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test field')); | ||
}); | ||
|
||
it('can create a field', () => { | ||
cy.api_post('/fields/contacts/contact', { | ||
title: 'automated test field', | ||
access: 1, | ||
context: 'com_contact.contact', | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'contact field', | ||
language: '*', | ||
name: 'contact-field', | ||
note: '', | ||
params: { | ||
class: '', | ||
display: '2', | ||
display_readonly: '2', | ||
hint: '', | ||
label_class: '', | ||
label_render_class: '', | ||
layout: '', | ||
prefix: '', | ||
render_class: '', | ||
show_on: '', | ||
showlabel: '1', | ||
suffix: '', | ||
}, | ||
required: 0, | ||
state: 1, | ||
type: 'text', | ||
}) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test field')); | ||
}); | ||
|
||
it('can update a field', () => { | ||
cy.db_createField({ title: 'automated test field', context: 'com_contact.contact' }) | ||
.then((id) => cy.api_patch(`/fields/contacts/contact/${id}`, { title: 'updated automated test field' })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'updated automated test field')); | ||
}); | ||
|
||
it('can delete a field', () => { | ||
cy.db_createField({ title: 'automated test field', state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/contacts/contact/${id}`)); | ||
}); | ||
}); |