003_pages.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.visitCMS('/cp/');
  9. cy.get('table.data-table thead tr').should('have.length', 1);
  10. cy.get('table.data-table thead tr th').should('have.length', 4);
  11. cy.get('table.data-table tbody tr').should('have.length', 3);
  12. cy.get('table.data-table 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.visitCMS('/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.visitCMS('/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.visitCMS('/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]').parent().find('.pell-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.visitCMS('/cp/');
  47. cy.get('table.data-table tbody tr').should('have.length', 4);
  48. cy.get('table.data-table tbody tr td').should('contain', 'Some test page');
  49. cy.contains('table#cp-table-pages tbody tr td a', 'Some test page').parentsUntil('tr').parent().find('.svg-green').should('exist');
  50. cy.logoutCMS();
  51. });
  52. it('should render added page in edit form', () => {
  53. cy.loginCMS();
  54. cy.visitCMS('/cp/');
  55. cy.contains('table.data-table tbody tr 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]').parent().find('.pell-content').should(($editor) => {
  59. expect($editor).to.have.text('Some test content');
  60. });
  61. cy.get('.data-form.index-modify input[name=meta_title]').should('have.value', 'Page meta title');
  62. cy.get('.data-form.index-modify input[name=meta_keywords]').should('have.value', 'Page meta keywords');
  63. cy.get('.data-form.index-modify textarea[name=meta_description]').should('have.value', 'Page meta description');
  64. cy.get('.data-form.index-modify input[name=active]').should('be.checked');
  65. cy.logoutCMS();
  66. });
  67. it('should delete added page', () => {
  68. cy.loginCMS();
  69. cy.visitCMS('/cp/');
  70. cy.contains('table.data-table tbody tr td a', 'Some test page').parentsUntil('tr').parent().find('td a.ico.delete').click();
  71. cy.actionWait();
  72. cy.get('table.data-table tbody tr').should('have.length', 3);
  73. cy.logoutCMS();
  74. });
  75. });