-
-
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
161 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
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', () => { | ||
afterEach(() => cy.task('queryDB', "DELETE FROM #__categories WHERE title = 'automated test content category'")); | ||
|
||
it('can display a list of categories', () => { | ||
cy.db_createCategory({ title: 'automated test category', extension: 'com_content' }) | ||
cy.db_createCategory({ title: 'automated test content category', extension: 'com_content' }) | ||
.then((id) => cy.db_createArticle({ title: 'automated test article', catid: id })) | ||
.then(() => cy.api_get('/content/categories')) | ||
.then((response) => cy.api_responseContains(response, 'title', 'automated test category')); | ||
.then((response) => cy.api_responseContains(response, 'title', 'automated test content category')); | ||
}); | ||
|
||
it('can display a single category', () => { | ||
cy.db_createCategory({ title: 'automated test content category', extension: 'com_content' }) | ||
.then((id) => cy.api_get(`/content/categories/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test content category')); | ||
}); | ||
|
||
it('can create a category', () => { | ||
cy.api_post('/content/categories', { title: 'automated test content category' }) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test content category')); | ||
}); | ||
|
||
it('can update a category', () => { | ||
cy.db_createCategory({ title: 'automated test content category', extension: 'com_content' }) | ||
.then((id) => cy.api_patch(`/content/categories/${id}`, { title: 'updated automated test content category' })) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', 'updated automated test content category')); | ||
}); | ||
}); |
115 changes: 63 additions & 52 deletions
115
tests/System/integration/api/com_content/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,70 @@ | ||
describe('Test that group field article API endpoint', () => { | ||
describe('Test that group field content API endpoint', () => { | ||
afterEach(() => cy.task('queryDB', 'DELETE FROM #__fields_groups')); | ||
|
||
it('can deliver a list of group fields', () => { | ||
cy.db_createFieldGroup({ title: 'automated test field group', context: 'com_content.article' }) | ||
.then(() => cy.api_get('/fields/groups/content/articles')) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test field group')); | ||
}); | ||
['article', 'categories'].forEach((context) => { | ||
const endpoint = context === 'article' ? 'articles' : context; | ||
it(`can deliver a list of group fields (${context})`, () => { | ||
cy.db_createFieldGroup({ title: `automated test group field content ${context}`, context: `com_content.${context}` }) | ||
.then(() => cy.api_get(`/fields/groups/content/${endpoint}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', `automated test group field content ${context}`)); | ||
}); | ||
|
||
it('can create a group field', () => { | ||
cy.api_post('/fields/groups/content/articles', { | ||
title: 'automated test group field', | ||
access: 1, | ||
context: 'com_content.article', | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'content group field', | ||
language: '*', | ||
name: 'content-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 content ${context}`, context: `com_content.${context}` }) | ||
.then((id) => cy.api_get(`/fields/groups/content/${endpoint}/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `automated test group field content ${context}`)); | ||
}); | ||
|
||
it('can update a group field', () => { | ||
cy.db_createFieldGroup({ title: 'automated test field group', access: 1, context: 'com_content.article' }) | ||
.then((id) => cy.api_patch(`/fields/groups/content/articles/${id}`, { title: 'updated automated test group field', context: 'com_content.article' })) | ||
.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/content/${endpoint}`, { | ||
title: `automated test group field content ${context}`, | ||
access: 1, | ||
context: `com_content.${context}`, | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'content group field', | ||
language: '*', | ||
name: 'content-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 content ${context}`)); | ||
}); | ||
|
||
it(`can update a group field (${context})`, () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', access: 1, context: `com_content.${context}` }) | ||
.then((id) => cy.api_patch(`/fields/groups/content/${endpoint}/${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/content/articles/${id}`)); | ||
it(`can delete a group field (${context})`, () => { | ||
cy.db_createFieldGroup({ title: 'automated test group field', context: `com_content.${context}`, state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/groups/content/${endpoint}/${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,70 @@ | ||
describe('Test that field article API endpoint', () => { | ||
describe('Test that field content API endpoint', () => { | ||
afterEach(() => cy.task('queryDB', 'DELETE FROM #__fields')); | ||
|
||
it('can deliver a list of fields', () => { | ||
cy.db_createField({ title: 'automated test field' }) | ||
.then(() => cy.api_get('/fields/content/articles')) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', 'automated test field')); | ||
}); | ||
['article', 'categories'].forEach((context) => { | ||
const endpoint = context === 'article' ? 'articles' : context; | ||
it(`can deliver a list of fields (${context})`, () => { | ||
cy.db_createField({ title: `automated test field content ${context}`, context: `com_content.${context}` }) | ||
.then(() => cy.api_get(`/fields/content/${endpoint}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes') | ||
.its('title') | ||
.should('include', `automated test field content ${context}`)); | ||
}); | ||
|
||
it('can create a field', () => { | ||
cy.api_post('/fields/content/articles', { | ||
title: 'automated test field', | ||
access: 1, | ||
context: 'com_content.article', | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'content field', | ||
language: '*', | ||
name: 'content-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 content ${context}`, context: `com_content.${context}` }) | ||
.then((id) => cy.api_get(`/fields/content/${endpoint}/${id}`)) | ||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes') | ||
.its('title') | ||
.should('include', `automated test field content ${context}`)); | ||
}); | ||
|
||
it('can update a field', () => { | ||
cy.db_createField({ title: 'automated test field', access: 1 }) | ||
.then((id) => cy.api_patch(`/fields/content/articles/${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/content/${endpoint}`, { | ||
title: `automated test field content ${context}`, | ||
access: 1, | ||
context: `com_content.${context}`, | ||
default_value: '', | ||
description: '', | ||
group_id: 0, | ||
label: 'content field', | ||
language: '*', | ||
name: `content-field-${context}`, | ||
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 content ${context}`)); | ||
}); | ||
|
||
it(`can update a field (${context})`, () => { | ||
cy.db_createField({ title: 'automated test field', context: `com_content.${context}`, access: 1 }) | ||
.then((id) => cy.api_patch(`/fields/content/${endpoint}/${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/content/articles/${id}`)); | ||
it(`can delete a field (${context})`, () => { | ||
cy.db_createField({ title: 'automated test field', context: `com_content.${context}`, state: -2 }) | ||
.then((id) => cy.api_delete(`/fields/content/${endpoint}/${id}`)); | ||
}); | ||
}); | ||
}); |