003_pages.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /// <reference types="Cypress" />
  2. context('Module pages', () => {
  3. it('should reset', () => {
  4. cy.installCMS();
  5. });
  6. it('should render data table', () => {
  7. cy.loginCMS();
  8. cy.visit('http://localhost:8080/cp/');
  9. cy.get('table#cp-table-pages thead tr').should('have.length', 1);
  10. cy.get('table#cp-table-pages thead tr th').should('have.length', 4);
  11. cy.get('table#cp-table-pages tbody tr').should('have.length', 3);
  12. cy.get('table#cp-table-pages tbody tr:nth-child(1) td').should('have.length', 4);
  13. });
  14. it('should render data form', () => {
  15. cy.loginCMS();
  16. cy.visit('http://localhost:8080/cp/index/add/');
  17. cy.get('.data-form.index-add input[type=text]').should('have.length', 4);
  18. cy.get('.data-form.index-add textarea').should('have.length', 2);
  19. cy.get('.data-form.index-add input[type=checkbox]').should('have.length', 1);
  20. });
  21. it('should not add new page', () => {
  22. cy.loginCMS();
  23. cy.visit('http://localhost:8080/cp/index/add/');
  24. cy.get('#add-edit-button').click();
  25. cy.actionWait();
  26. cy.get('.data-form.index-add div.sys-messages').should('exist');
  27. });
  28. it('should add new page', () => {
  29. cy.loginCMS();
  30. cy.visit('http://localhost:8080/cp/index/add/');
  31. cy.get('.data-form.index-add input[name=name]').clear().type('Some test page');
  32. cy.get('.data-form.index-add textarea[name=content]').clear().type('Some test content');
  33. cy.get('.data-form.index-add input[name=meta_title]').clear().type('Page meta title');
  34. cy.get('.data-form.index-add input[name=meta_keywords]').clear().type('Page meta keywords');
  35. cy.get('.data-form.index-add textarea[name=meta_description]').clear().type('Page meta description');
  36. cy.get('.data-form.index-add label[for=lbl_active]').click();
  37. cy.get('#add-edit-button').click();
  38. cy.actionWait();
  39. });
  40. it('should render added page', () => {
  41. cy.loginCMS();
  42. cy.visit('http://localhost:8080/cp/');
  43. cy.get('table#cp-table-pages tbody tr').should('have.length', 4);
  44. cy.get('table#cp-table-pages tbody tr:nth-child(1) td:nth-child(1)').should('contain', 'Some test page');
  45. cy.get('table#cp-table-pages tbody tr:nth-child(1) td:nth-child(3) .svg-green').should('exist');
  46. });
  47. it('should delete added page', () => {
  48. cy.loginCMS();
  49. cy.visit('http://localhost:8080/cp/');
  50. cy.get('table#cp-table-pages tbody tr:nth-child(1) td:nth-child(4) a.ico.delete').click();
  51. cy.actionWait();
  52. cy.get('table#cp-table-pages tbody tr').should('have.length', 3);
  53. });
  54. });