-
-
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.
- Loading branch information
Showing
4 changed files
with
182 additions
and
106 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 |
---|---|---|
@@ -1,8 +1,33 @@ | ||
describe('Test that content categories API endpoint', () => { | ||
describe('Test that contact categories API endpoint', () => { | ||
afterEach(() => cy.task('queryDB', "DELETE FROM #__categories WHERE title = 'automated test contact category'")); | ||
|
||
it('can display a list of categories', () => { | ||
cy.db_createCategory({ title: 'automated test category', extension: 'com_contact' }) | ||
cy.db_createCategory({ title: 'automated test contact category', extension: 'com_contact' }) | ||
.then((id) => cy.db_createContact({ name: 'automated test contact', catid: id })) | ||
.then(() => cy.api_get('/contacts/categories')) | ||
.then((response) => cy.api_responseContains(response, 'title', 'automated test category')); | ||
.then((response) => cy.api_responseContains(response, 'title', 'automated test contact category')); | ||
}); | ||
|
||
it('can display a single category', () => { | ||
cy.db_createCategory({ title: 'automated test contact category', extension: 'com_contact' }) | ||
.then((id) => cy.api_get(`/contacts/categories/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test contact category')); | ||
}); | ||
|
||
it('can create a category', () => { | ||
cy.api_post('/contacts/categories', { title: 'automated test contact category' }) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test contact category')); | ||
}); | ||
|
||
it('can update a category', () => { | ||
cy.db_createCategory({ title: 'automated test contact category', extension: 'com_contact' }) | ||
.then((id) => cy.api_patch(`/contacts/categories/${id}`, { title: 'updated automated test contact category' })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'updated automated test contact category')); | ||
}); | ||
}); |
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
112 changes: 61 additions & 51 deletions
112
tests/System/integration/api/com_contact/Field_Group.cy.js
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 |
---|---|---|
@@ -1,59 +1,69 @@ | ||
describe('Test that group field contact API endpoint', () => { | ||
afterEach(() => cy.task('queryDB', 'DELETE FROM #__fields_groups')); | ||
|
||
it('can deliver a list of group fields', () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', context: 'com_contact.contact' }) | ||
.then(() => cy.api_get('/fields/groups/contacts/contact')) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test group field')); | ||
}); | ||
['contact', 'mail', 'categories'].forEach((context) => { | ||
it(`can deliver a list of group fields (${context})`, () => { | ||
cy.db_createFieldGroup({ title: `automated test group field contacts ${context}`, context: `com_contact.${context}` }) | ||
.then(() => cy.api_get(`/fields/groups/contacts/${context}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', `automated test group field contacts ${context}`)); | ||
}); | ||
|
||
it.only('can create a group field', () => { | ||
cy.api_post('/fields/groups/contacts/contact', { | ||
title: 'automated test group field', | ||
access: 1, | ||
context: 'com_contact.contact', | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'contact group field', | ||
language: '*', | ||
name: 'contact-group_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 group field')); | ||
}); | ||
it(`can deliver a single group field (${context})`, () => { | ||
cy.db_createFieldGroup({ title: `automated test group field contacts ${context}`, context: `com_contact.${context}` }) | ||
.then((id) => cy.api_get(`/fields/groups/contacts/${context}/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `automated test group field contacts ${context}`)); | ||
}); | ||
|
||
it('can update a group field', () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', access: 1, context: 'com_contact.contact' }) | ||
.then((id) => cy.api_patch(`/fields/groups/contacts/contact/${id}`, { title: 'updated automated test group field', context: 'com_contact.contact' })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'updated automated test group field')); | ||
}); | ||
it(`can create a group field (${context})`, () => { | ||
cy.api_post(`/fields/groups/contacts/${context}`, { | ||
title: `automated test group field contacts ${context}`, | ||
access: 1, | ||
context: `com_contact.${context}`, | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'contact group field', | ||
language: '*', | ||
name: 'contact-group_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 group field contacts ${context}`)); | ||
}); | ||
|
||
it(`can update a group field (${context})`, () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', access: 1, context: `com_contact.${context}` }) | ||
.then((id) => cy.api_patch(`/fields/groups/contacts/${context}/${id}`, { title: `updated automated test group field ${context}` })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `updated automated test group field ${context}`)); | ||
}); | ||
|
||
it('can delete a group field', () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/groups/contacts/contact/${id}`)); | ||
it(`can delete a group field (${context})`, () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', context: `com_contact.${context}`, state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/groups/contacts/${context}/${id}`)); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,59 +1,69 @@ | ||
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')); | ||
}); | ||
['contact', 'mail', 'categories'].forEach((context) => { | ||
it(`can deliver a list of fields (${context})`, () => { | ||
cy.db_createField({ title: `automated test field contacts ${context}`, context: `com_contact.${context}` }) | ||
.then(() => cy.api_get(`/fields/contacts/${context}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', `automated test field contacts ${context}`)); | ||
}); | ||
|
||
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 deliver a single field (${context})`, () => { | ||
cy.db_createField({ title: `automated test field contacts ${context}`, context: `com_contact.${context}` }) | ||
.then((id) => cy.api_get(`/fields/contacts/${context}/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `automated test field contacts ${context}`)); | ||
}); | ||
|
||
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 create a field (${context})`, () => { | ||
cy.api_post(`/fields/contacts/${context}`, { | ||
title: `automated test field contacts ${context}`, | ||
access: 1, | ||
context: `com_contact.${context}`, | ||
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 contacts ${context}`)); | ||
}); | ||
|
||
it(`can update a field (${context})`, () => { | ||
cy.db_createField({ title: 'automated test field', context: `com_contact.${context}` }) | ||
.then((id) => cy.api_patch(`/fields/contacts/${context}/${id}`, { title: `updated automated test field ${context}` })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `updated automated test field ${context}`)); | ||
}); | ||
|
||
it('can delete a field', () => { | ||
cy.db_createField({ title: 'automated test field', state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/contacts/contact/${id}`)); | ||
it(`can delete a field (${context})`, () => { | ||
cy.db_createField({ title: 'automated test field', context: `com_contact.${context}`, state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/contacts/${context}/${id}`)); | ||
}); | ||
}); | ||
}); |