Browse Source

Optimization

Vova Tkach 6 years ago
parent
commit
00728d09be

+ 9 - 9
cypress/integration/control-panel/001_module_index/003_pages.js

@@ -8,10 +8,10 @@ context('Module pages', () => {
   it('should render data table', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/');
-    cy.get('table#cp-table-pages thead tr').should('have.length', 1);
-    cy.get('table#cp-table-pages thead tr th').should('have.length', 4);
-    cy.get('table#cp-table-pages tbody tr').should('have.length', 3);
-    cy.get('table#cp-table-pages tbody tr:nth-child(1) td').should('have.length', 4);
+    cy.get('table.data-table thead tr').should('have.length', 1);
+    cy.get('table.data-table thead tr th').should('have.length', 4);
+    cy.get('table.data-table tbody tr').should('have.length', 3);
+    cy.get('table.data-table tbody tr:nth-child(1) td').should('have.length', 4);
     cy.logoutCMS();
   });
 
@@ -50,8 +50,8 @@ context('Module pages', () => {
   it('should render added page in list', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/');
-    cy.get('table#cp-table-pages tbody tr').should('have.length', 4);
-    cy.get('table#cp-table-pages tbody tr td').should('contain', 'Some test page');
+    cy.get('table.data-table tbody tr').should('have.length', 4);
+    cy.get('table.data-table tbody tr td').should('contain', 'Some test page');
     cy.contains('table#cp-table-pages tbody tr td a', 'Some test page').parentsUntil('tr').parent().find('.svg-green').should('exist');
     cy.logoutCMS();
   });
@@ -59,7 +59,7 @@ context('Module pages', () => {
   it('should render added page in edit form', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/');
-    cy.contains('table#cp-table-pages tbody tr td a', 'Some test page').click();
+    cy.contains('table.data-table tbody tr td a', 'Some test page').click();
     cy.get('.data-form.index-modify input[name=name]').should('have.value', 'Some test page');
     cy.get('.data-form.index-modify input[name=alias]').should('have.value', '/some-test-page/');
     cy.get('.data-form.index-modify textarea[name=content]').should('have.value', 'Some test content');
@@ -73,9 +73,9 @@ context('Module pages', () => {
   it('should delete added page', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/');
-    cy.contains('table#cp-table-pages tbody tr td a', 'Some test page').parentsUntil('tr').parent().find('td a.ico.delete').click();
+    cy.contains('table.data-table tbody tr td a', 'Some test page').parentsUntil('tr').parent().find('td a.ico.delete').click();
     cy.actionWait();
-    cy.get('table#cp-table-pages tbody tr').should('have.length', 3);
+    cy.get('table.data-table tbody tr').should('have.length', 3);
     cy.logoutCMS();
   });
 });

+ 10 - 12
cypress/integration/control-panel/002_module_blog/001_posts.js

@@ -8,10 +8,10 @@ context('Module blog posts', () => {
   it('should render data table', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/');
-    cy.get('table#cp-table-blog_posts thead tr').should('have.length', 1);
-    cy.get('table#cp-table-blog_posts thead tr th').should('have.length', 4);
-    cy.get('table#cp-table-blog_posts tbody tr').should('have.length', 3);
-    cy.get('table#cp-table-blog_posts tbody tr:nth-child(1) td').should('have.length', 4);
+    cy.get('table.data-table thead tr').should('have.length', 1);
+    cy.get('table.data-table thead tr th').should('have.length', 4);
+    cy.get('table.data-table tbody tr').should('have.length', 3);
+    cy.get('table.data-table tbody tr:nth-child(1) td').should('have.length', 4);
     cy.logoutCMS();
   });
 
@@ -49,16 +49,16 @@ context('Module blog posts', () => {
   it('should render added post in list', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/');
-    cy.get('table#cp-table-blog_posts tbody tr').should('have.length', 4);
-    cy.get('table#cp-table-blog_posts tbody tr td').should('contain', 'Some test post');
-    cy.contains('table#cp-table-blog_posts tbody tr td a', 'Some test post').parentsUntil('tr').parent().find('.svg-green').should('exist');
+    cy.get('table.data-table tbody tr').should('have.length', 4);
+    cy.get('table.data-table tbody tr td').should('contain', 'Some test post');
+    cy.contains('table.data-table tbody tr td a', 'Some test post').parentsUntil('tr').parent().find('.svg-green').should('exist');
     cy.logoutCMS();
   });
 
   it('should render added post in edit form', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/');
-    cy.contains('table#cp-table-blog_posts tbody tr:nth-child(1) td a', 'Some test post').click();
+    cy.contains('table.data-table tbody tr td a', 'Some test post').click();
     cy.get('.data-form.blog-modify input[name=name]').should('have.value', 'Some test post');
     cy.get('.data-form.blog-modify input[name=alias]').should('have.value', 'some-test-post');
     cy.get('.data-form.blog-modify select#lbl_cats').invoke('val').should('deep.equal', ['2', '7']);
@@ -70,11 +70,9 @@ context('Module blog posts', () => {
   it('should delete added post', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/');
-    cy.contains('table#cp-table-blog_posts tbody tr td a', 'Some test post').parentsUntil('tr').parent().within(() => {
-      cy.get('td a.ico.delete').click();
-    });
+    cy.contains('table.data-table tbody tr td a', 'Some test post').parentsUntil('tr').parent().find('td a.ico.delete').click();
     cy.actionWait();
-    cy.get('table#cp-table-blog_posts tbody tr').should('have.length', 3);
+    cy.get('table.data-table tbody tr').should('have.length', 3);
     cy.logoutCMS();
   });
 });

+ 14 - 18
cypress/integration/control-panel/002_module_blog/002_categories.js

@@ -8,10 +8,10 @@ context('Module blog categories', () => {
   it('should render data table', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.get('table#cp-table-blog_cats thead tr').should('have.length', 1);
-    cy.get('table#cp-table-blog_cats thead tr th').should('have.length', 2);
-    cy.get('table#cp-table-blog_cats tbody tr').should('have.length', 11);
-    cy.get('table#cp-table-blog_cats tbody tr:nth-child(1) td').should('have.length', 2);
+    cy.get('table.data-table thead tr').should('have.length', 1);
+    cy.get('table.data-table thead tr th').should('have.length', 2);
+    cy.get('table.data-table tbody tr').should('have.length', 11);
+    cy.get('table.data-table tbody tr:nth-child(1) td').should('have.length', 2);
     cy.logoutCMS();
   });
 
@@ -44,15 +44,15 @@ context('Module blog categories', () => {
   it('should render added category in list', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.get('table#cp-table-blog_cats tbody tr').should('have.length', 12);
-    cy.get('table#cp-table-blog_cats tbody tr td').should('contain', 'Some test category');
+    cy.get('table.data-table tbody tr').should('have.length', 12);
+    cy.get('table.data-table tbody tr td').should('contain', 'Some test category');
     cy.logoutCMS();
   });
 
   it('should render added category in edit form', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.contains('table#cp-table-blog_cats tbody tr td a', 'Some test category').click();
+    cy.contains('table.data-table tbody tr td a', 'Some test category').click();
     cy.get('.data-form.blog-categories-modify select[name=parent]').should('have.value', '0');
     cy.get('.data-form.blog-categories-modify input[name=name]').should('have.value', 'Some test category');
     cy.get('.data-form.blog-categories-modify input[name=alias]').should('have.value', 'some-test-category');
@@ -72,15 +72,15 @@ context('Module blog categories', () => {
   it('should render added child category in list', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.get('table#cp-table-blog_cats tbody tr').should('have.length', 13);
-    cy.get('table#cp-table-blog_cats tbody tr td').should('contain', '— Some test child category');
+    cy.get('table.data-table tbody tr').should('have.length', 13);
+    cy.get('table.data-table tbody tr td').should('contain', '— Some test child category');
     cy.logoutCMS();
   });
 
   it('should render added child category in edit form', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.contains('table#cp-table-blog_cats tbody tr td a', '— Some test child category').click();
+    cy.contains('table.data-table tbody tr td a', '— Some test child category').click();
     cy.get('.data-form.blog-categories-modify select[name=parent]').find(':selected').contains('Some test category')
     cy.get('.data-form.blog-categories-modify input[name=name]').should('have.value', 'Some test child category');
     cy.get('.data-form.blog-categories-modify input[name=alias]').should('have.value', 'some-test-child-category');
@@ -90,22 +90,18 @@ context('Module blog categories', () => {
   it('should delete added child category', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.contains('table#cp-table-blog_cats tbody tr td a', '— Some test child category').parentsUntil('tr').parent().within(() => {
-      cy.get('td a.ico.delete').click();
-    });
+    cy.contains('table.data-table tbody tr td a', '— Some test child category').parentsUntil('tr').parent().find('td a.ico.delete').click();
     cy.actionWait();
-    cy.get('table#cp-table-blog_cats tbody tr').should('have.length', 12);
+    cy.get('table.data-table tbody tr').should('have.length', 12);
     cy.logoutCMS();
   });
 
   it('should delete added category', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/blog/categories/');
-    cy.contains('table#cp-table-blog_cats tbody tr td a', 'Some test category').parentsUntil('tr').parent().within(() => {
-      cy.get('td a.ico.delete').click();
-    });
+    cy.contains('table.data-table tbody tr td a', 'Some test category').parentsUntil('tr').parent().find('td a.ico.delete').click();
     cy.actionWait();
-    cy.get('table#cp-table-blog_cats tbody tr').should('have.length', 11);
+    cy.get('table.data-table tbody tr').should('have.length', 11);
     cy.logoutCMS();
   });
 });