tainacan/cypress/integration/repository/category_spec.js

108 lines
5.3 KiB
JavaScript

describe('Category test', function () {
beforeEach(() => {
cy.loginByUI()
})
it('clear DB', function(){
cy.clearDB()
})
context('CRUD Taxonomies', function(){
it('canceled create category', function(){
cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
cy.location('hash').should('eq', '#/categories')
//cy.get('#button-category-creation').click()
cy.get('.button').click()
cy.location('hash').should('eq', '#/categories/new')
cy.get('#tainacan-text-name').type('Category canceled')
cy.get('#tainacan-text-description').type('description category canceled')
cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
cy.get('#button-cancel-category-creation').click()
cy.location('hash').should('eq', '#/categories/')
cy.get('td').should('not.contain', 'Book canceled')
})
// it('create category with status publish', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category publish')
// cy.get('#tainacan-text-description').type('description category publish')
// cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category publish')
// })
//
// it('create category with status private', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category private')
// cy.get('#tainacan-text-description').type('description category private')
// cy.get('#tainacan-select-status').select('Private').should('have.value', 'private')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category private')
// })
//
// it('create category with status draft', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category draft')
// cy.get('#tainacan-text-description').type('description category draft')
// cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('not.contain', 'Category draft')
// })
//
// it('create category with status draft', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category trash')
// cy.get('#tainacan-text-description').type('description category trash')
// cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('not.contain', 'Category trash')
// })
//
// it('create category color', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// //cy.get('#button-category-creation').click()
// cy.get('.button').click()
// cy.location('hash').should('eq', '#/categories/new')
// cy.get('#tainacan-text-name').type('Category color')
// cy.get('#tainacan-text-description').type('description category color')
// cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish')
// cy.get('#button-submit-category-creation').click()
// cy.location('hash').should('eq', '#/categories/')
// cy.get('td').should('contain', 'Category color')
// })
//
// it('delete category color', function(){
// cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories')
// cy.location('hash').should('eq', '#/categories')
// cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click()
// cy.get('.b-table').should('contain', 'Category trash')
// 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', 'Category trash')
// })
})
})