wpress setup by wpcli

This commit is contained in:
juliannyas 2018-04-02 16:16:37 -03:00
parent c6e2af8ce7
commit a9f5c7b302
13 changed files with 505 additions and 144 deletions

View File

@ -0,0 +1,225 @@
describe('Tainacan Plugin Test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
context('Collections', function(){
it('canceled collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book canceled')
cy.get('#tainacan-text-description').type('description book canceled')
cy.get('#button-cancel-collection-creation').click()
cy.url().should('contain', '/wp-admin/admin.php?page=tainacan_admin#/collections/')
cy.get('h1').should('contain', 'Collections Page')
cy.get('td').should('not.contain', 'Book canceled')
})
it('create collection with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book publish')
cy.get('#tainacan-text-description').type('description book publish')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book publish')
})
it('create collection with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book private')
cy.get('#tainacan-text-description').type('description book private')
cy.get('#tainacan-select-status').select('Private').should('have.value', 'private')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book private')
})
it('create collection with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book draft')
cy.get('#tainacan-text-description').type('description book draft')
cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book draft')
})
it('create collection with status trash', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book trash')
cy.get('#tainacan-text-description').type('description book trash')
cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book trash')
})
it('delete collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book delete')
cy.get('#tainacan-text-description').type('description book delete')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book delete')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card-body').should('contain', 'Do you really want to delete this collection?')
cy.get('.is-primary').click()
cy.get('.b-table').should('not.contain', 'Book delete')
})
})
context('Create many collections for verify persistence the datas', function(){
it('create many collections', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 1')
cy.get('#tainacan-text-description').type('description book 1')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 1')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 2')
cy.get('#tainacan-text-description').type('description book 2')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 2')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 3')
cy.get('#tainacan-text-description').type('description book 3')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 3')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 4')
cy.get('#tainacan-text-description').type('description book 4')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 4')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 5')
cy.get('#tainacan-text-description').type('description book 5')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 5')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 6')
cy.get('#tainacan-text-description').type('description book 6')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 6')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 7')
cy.get('#tainacan-text-description').type('description book 7')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 7')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 8')
cy.get('#tainacan-text-description').type('description book 8')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 8')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 9')
cy.get('#tainacan-text-description').type('description book 9')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 9')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 10')
cy.get('#tainacan-text-description').type('description book 10')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 10')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 11')
cy.get('#tainacan-text-description').type('description book 11')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 11')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 12')
cy.get('#tainacan-text-description').type('description book 12')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 12')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 13')
cy.get('#tainacan-text-description').type('description book 13')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 13')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 14')
cy.get('#tainacan-text-description').type('description book 14')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 14')
cy.get('#button-collection-creation').click()
cy.get('#tainacan-text-name').type('Book 15')
cy.get('#tainacan-text-description').type('description book 15')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book 15')
})
})
context('Check all collections', function(){
it('check if collections are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('.active-fields-area >').should('contain', 'Book publish')
.and('contain', 'Book private')
.and('contain', 'Book draft')
.and('contain', 'Book trash')
.and('contain', 'Book 1')
.and('contain', 'Book 2')
.and('contain', 'Book 3')
.and('contain', 'Book 4')
.and('contain', 'Book 5')
.and('contain', 'Book 6')
.and('contain', 'Book 7')
.and('contain', 'Book 8')
.and('contain', 'Book 9')
.and('contain', 'Book 10')
.and('contain', 'Book 11')
.and('contain', 'Book 12')
.and('contain', 'Book 13')
.and('contain', 'Book 14')
.and('contain', 'Book 15')
})
})
})

View File

@ -0,0 +1,276 @@
describe('Tainacan Plugin Test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
it('create collection for crud items', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
//cy.get('#button-collection-creation').click()
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book Items')
cy.get('#tainacan-text-description').type('description book items')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.breadcrumbs > :nth-child(2) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Book Items')
})
context('Items', function(){
it('canceled create item', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item canceled')
cy.get('#tainacan-textarea-description').type('Item canceled description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item canceled')
})
it('create item with status publish', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item publish')
cy.get('#tainacan-textarea-description').type('Item publish description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item publish')
})
it('create item with status private', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item private')
cy.get('#tainacan-textarea-description').type('Item private description')
cy.get('#status-select').select('Private').should('have.value', 'private')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item private')
})
it('create item with status draft', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item draft')
cy.get('#tainacan-textarea-description').type('Item draft description')
cy.get('#status-select').select('Draft').should('have.value', 'draft')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item draft')
})
it('create item with status trash', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item trash')
cy.get('#tainacan-textarea-description').type('Item trash description')
cy.get('#status-select').select('Trash').should('have.value', 'trash')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item trash')
})
it('delete item', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item delete')
cy.get('#tainacan-textarea-description').type('Item delete description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item delete')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card').should('have.class', 'animation-content')
cy.get('.is-primary').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('not.contain', 'Item delete')
})
})
context('Create many collections for verify persistence the datas', function(){
it('create many items', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 1')
cy.get('#tainacan-textarea-description').type('Item 1 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 1')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 2')
cy.get('#tainacan-textarea-description').type('Item 2 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 2')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 3')
cy.get('#tainacan-textarea-description').type('Item 3 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 3')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 4')
cy.get('#tainacan-textarea-description').type('Item 4 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 4')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 5')
cy.get('#tainacan-textarea-description').type('Item 5 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 5')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 6')
cy.get('#tainacan-textarea-description').type('Item 6 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 6')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 7')
cy.get('#tainacan-textarea-description').type('Item 7 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 7')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 8')
cy.get('#tainacan-textarea-description').type('Item 8 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 8')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 9')
cy.get('#tainacan-textarea-description').type('Item 9 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 9')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 10')
cy.get('#tainacan-textarea-description').type('Item 10 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 10')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 11')
cy.get('#tainacan-textarea-description').type('Item 11 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 11')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 12')
cy.get('#tainacan-textarea-description').type('Item 12 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 12')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 13')
cy.get('#tainacan-textarea-description').type('Item 13 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 13')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 14')
cy.get('#tainacan-textarea-description').type('Item 14 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 14')
//cy.get('#button-item-creation').click()
cy.get('.sub-header > :nth-child(1) > .button').click()
cy.get('#tainacan-text-title').type('Item 15')
cy.get('#tainacan-textarea-description').type('Item 15 description')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 15')
})
})
context('Check all items', function(){
it('check if collections are updated to page', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click()
cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items')
cy.get('.active-fields-area >').should('contain', 'Item publish')
.and('contain', 'Item private')
.and('contain', 'Item draft')
.and('contain', 'Item trash')
.and('contain', 'Item 1')
.and('contain', 'Item 2')
.and('contain', 'Item 3')
.and('contain', 'Item 4')
.and('contain', 'Item 5')
.and('contain', 'Item 6')
.and('contain', 'Item 7')
.and('contain', 'Item 8')
.and('contain', 'Item 9')
.and('contain', 'Item 10')
.and('contain', 'Item 11')
.and('contain', 'Item 12')
.and('contain', 'Item 13')
.and('contain', 'Item 14')
.and('contain', 'Item 15')
})
})
})

View File

@ -1,114 +0,0 @@
describe('Tainacan Plugin Test', function () {
beforeEach(() => {
cy.loginByUI()
})
context('Collections', function(){
it('clear DB', function(){
cy.clearDB()
})
it('canceled collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book cancelado')
cy.get('#tainacan-text-description').type('Descrição book cancelado')
cy.get('#button-cancel-collection-creation').click()
cy.url().should('contain', '/wp-admin/admin.php?page=tainacan_admin#/collections/')
cy.get('h1').should('contain', 'Collections Page')
cy.get('td').should('not.contain', 'Book cancelado')
})
it('create collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book 1')
cy.get('#tainacan-text-description').type('Descrição book 1')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('#primary-menu > .menu > .menu-header > .menu-list > li > .router-link-active > .icon > .mdi').click()
cy.get('.b-table').should('contain', 'Book 1')
})
it('delete collection', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book deletado')
cy.get('#tainacan-text-description').type('Descrição book deletado')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('#primary-menu > .menu > .menu-header > .menu-list > li > .router-link-active > .icon > .mdi').click()
cy.get('.b-table').should('contain', 'Book deletado')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card-body').should('contain', 'Do you really want to delete this collection?')
cy.get('.is-primary').click()
cy.get('.b-table').should('not.contain', 'Book deletado')
})
})
context('Items', function(){
it('canceled create item', function(){
cy.clearDB()
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book com items')
cy.get('#tainacan-text-description').type('Descrição book com items')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.b-table').should('contain', 'New Item')
cy.contains('New Item').click()
cy.get('#tainacan-text-title').type('Item cancelado')
cy.get('#tainacan-textarea-description').type('Item cancelado descrição')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-item-creation').click()
cy.get('.b-table').should('not.contain', 'Item cancelado')
})
it('create item', function(){
cy.clearDB()
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book com items')
cy.get('#tainacan-text-description').type('Descrição book com items')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.b-table').should('contain', 'New Item')
cy.contains('New Item').click()
cy.get('#tainacan-text-title').type('Item 1')
cy.get('#tainacan-textarea-description').type('Item 1 descrição')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('h1').should('contain', 'Item Page')
cy.get('.page-container').should('contain', 'Item 1')
})
it('delete item', function(){
cy.clearDB()
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections')
cy.get('h1').should('contain', 'Collections Page')
cy.contains('New Collection').click()
cy.get('#tainacan-text-name').type('Book 2')
cy.get('#tainacan-text-description').type('Descrição book 2')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-collection-creation').click()
cy.get('.b-table').should('contain', 'New Item')
cy.contains('New Item').click()
cy.get('#tainacan-text-title').type('Item 1')
cy.get('#tainacan-textarea-description').type('Item 1 descrição')
cy.get('#status-select').select('Publish').should('have.value', 'publish')
cy.get('#button-submit-item-creation').click()
cy.get('h1').should('contain', 'Item Page')
cy.get('#secondary-menu > .menu > :nth-child(2) > :nth-child(3) > .router-link-active').click()
cy.get('.b-table').should('contain', 'Item 1')
cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click()
cy.get('.modal-card-body').should('contain', 'Do you really want to delete this item?')
cy.get('.is-primary').click()
cy.get('.b-table').should('not.contain', 'Item 1')
})
})
})

View File

@ -1,23 +0,0 @@
describe('Configuration Plugin Test', function () {
beforeEach(() => {
cy.loginByUI()
})
context ('Configuration', function(){
it('plugins active', function () {
cy.visit('wp-admin/plugins.php')
cy.get('.subsubsub > .active > a').click()
cy.get('.wp-list-table').should('contain', 'Tainacan').and('contain', 'WP Cypress DB Cleaner')
})
it('WPress configuration', function(){
cy.contains('WPress').click()
cy.get('#default-api-namespace').clear()
cy.get('#default-api-namespace').type('tainacan/v2')
cy.get('#default-db-prefix').clear()
cy.get('#default-db-prefix').type('wptests_')
cy.get('#submit').click()
})
})
})

View File

@ -82,11 +82,5 @@ Cypress.Commands.add('loginByUI', () => {
})
Cypress.Commands.add('clearDB', () => {
cy.contains('WPress').click()
cy.get('#default-api-namespace').clear()
cy.get('#default-api-namespace').type('tainacan/v2')
cy.get('#default-db-prefix').clear()
cy.get('#default-db-prefix').type('wptests_')
cy.get('#submit').click()
cy.request('POST', '/wp-json/tainacan/v2/database')
})

View File

@ -13,7 +13,6 @@ source build-config.cfg
plugin_tainacan=`basename $wp_plugin_dir`
plugin_wpclear='wpress-db-cleaner'
test_db_prefix='wptests_'
cy_record_key='a15e6599-d240-4d98-b582-dea93a3008c0'
@ -30,6 +29,10 @@ wp core install --url=$wp_url --title=Test --admin_user=admin --admin_password=a
# Activate Tainacan
wp plugin activate $plugin_tainacan $plugin_wpclear
# Add options wpress plugin_wpclear
wp option add api_namespace tainacan/v2
wp option add wpress_prefix $test_db_prefix
# back to tainacan dev directory
cd -