003_pages.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 in list', () => {
  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 render added page in edit form', () => {
  53. cy.loginCMS();
  54. cy.visit('http://localhost:8080/cp/');
  55. cy.contains('table#cp-table-pages tbody tr:nth-child(1) td a', 'Some test page').click();
  56. cy.get('.data-form.index-modify input[name=name]').should('have.value', 'Some test page');
  57. cy.get('.data-form.index-modify input[name=alias]').should('have.value', '/some-test-page/');
  58. cy.get('.data-form.index-modify textarea[name=content]').should('have.value', 'Some test content');
  59. cy.get('.data-form.index-modify input[name=meta_title]').should('have.value', 'Page meta title');
  60. cy.get('.data-form.index-modify input[name=meta_keywords]').should('have.value', 'Page meta keywords');
  61. cy.get('.data-form.index-modify textarea[name=meta_description]').should('have.value', 'Page meta description');
  62. cy.get('.data-form.index-modify input[name=active]').should('be.checked');
  63. cy.logoutCMS();
  64. });
  65. it('should delete added page', () => {
  66. cy.loginCMS();
  67. cy.visit('http://localhost:8080/cp/');
  68. cy.get('table#cp-table-pages tbody tr:nth-child(1) td:nth-child(4) a.ico.delete').click();
  69. cy.actionWait();
  70. cy.get('table#cp-table-pages tbody tr').should('have.length', 3);
  71. cy.logoutCMS();
  72. });
  73. });