003_pages.js 2.6 KB

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