Browse Source

Optimization

Vova Tkach 6 years ago
parent
commit
320b729953

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

@@ -51,15 +51,15 @@ context('Module pages', () => {
     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:nth-child(1) td:nth-child(1)').should('contain', 'Some test page');
-    cy.get('table#cp-table-pages tbody tr:nth-child(1) td:nth-child(3) .svg-green').should('exist');
+    cy.get('table#cp-table-pages 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();
   });
 
   it('should render added page in edit form', () => {
     cy.loginCMS();
     cy.visit('http://localhost:8080/cp/');
-    cy.contains('table#cp-table-pages tbody tr:nth-child(1) td a', 'Some test page').click();
+    cy.contains('table#cp-table-pages 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,7 @@ 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().within(() => {
-      cy.get('td a.ico.delete').click();
-    });
+    cy.contains('table#cp-table-pages 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.logoutCMS();

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

@@ -50,8 +50,8 @@ context('Module blog posts', () => {
     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:nth-child(1) td:nth-child(1)').should('contain', 'Some test post');
-    cy.get('table#cp-table-blog_posts tbody tr:nth-child(1) td:nth-child(3) .svg-green').should('exist');
+    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.logoutCMS();
   });