Browse Source

Optimization

Vova Tkach 6 years ago
parent
commit
62f3b9de38

+ 1 - 1
cypress/integration/control-panel/001_module_index/001_install_mysql.spec.js

@@ -3,7 +3,7 @@
 context('Install MySQL, create first user and login', () => {
   it('should do redirect to cp panel', () => {
     cy.resetCMS();
-    cy.visit('http://localhost:8080/');
+    cy.visitCMS('/');
     cy.url().should('eq', 'http://localhost:8080/cp/');
   });
 

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

@@ -7,7 +7,7 @@ context('Module pages', () => {
 
   it('should render data table', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/');
+    cy.visitCMS('/cp/');
     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);
@@ -17,7 +17,7 @@ context('Module pages', () => {
 
   it('should render data form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/index/add/');
+    cy.visitCMS('/cp/index/add/');
     cy.get('.data-form.index-add input[type=text]').should('have.length', 4);
     cy.get('.data-form.index-add textarea').should('have.length', 2);
     cy.get('.data-form.index-add input[type=checkbox]').should('have.length', 1);
@@ -26,7 +26,7 @@ context('Module pages', () => {
 
   it('should not add new page', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/index/add/');
+    cy.visitCMS('/cp/index/add/');
     cy.get('#add-edit-button').click();
     cy.actionWait();
     cy.get('.data-form.index-add div.sys-messages').should('exist');
@@ -35,7 +35,7 @@ context('Module pages', () => {
 
   it('should add new page', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/index/add/');
+    cy.visitCMS('/cp/index/add/');
     cy.get('.data-form.index-add input[name=name]').clear().type('Some test page');
     cy.get('.data-form.index-add textarea[name=content]').clear().type('Some test content');
     cy.get('.data-form.index-add input[name=meta_title]').clear().type('Page meta title');
@@ -49,7 +49,7 @@ context('Module pages', () => {
 
   it('should render added page in list', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/');
+    cy.visitCMS('/cp/');
     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');
@@ -58,7 +58,7 @@ context('Module pages', () => {
 
   it('should render added page in edit form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/');
+    cy.visitCMS('/cp/');
     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/');
@@ -72,7 +72,7 @@ context('Module pages', () => {
 
   it('should delete added page', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/');
+    cy.visitCMS('/cp/');
     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.data-table tbody tr').should('have.length', 3);

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

@@ -7,7 +7,7 @@ context('Module blog posts', () => {
 
   it('should render data table', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/');
+    cy.visitCMS('/cp/blog/');
     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);
@@ -17,7 +17,7 @@ context('Module blog posts', () => {
 
   it('should render data form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/add/');
+    cy.visitCMS('/cp/blog/add/');
     cy.get('.data-form.blog-add input[type=text]').should('have.length', 2);
     cy.get('.data-form.blog-add select').should('have.length', 1);
     cy.get('.data-form.blog-add textarea').should('have.length', 1);
@@ -27,7 +27,7 @@ context('Module blog posts', () => {
 
   it('should not add new post', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/add/');
+    cy.visitCMS('/cp/blog/add/');
     cy.get('#add-edit-button').click();
     cy.actionWait();
     cy.get('.data-form.blog-add div.sys-messages').should('exist');
@@ -36,7 +36,7 @@ context('Module blog posts', () => {
 
   it('should add new post', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/add/');
+    cy.visitCMS('/cp/blog/add/');
     cy.get('.data-form.blog-add input[name=name]').clear().type('Some test post');
     cy.get('.data-form.blog-add select#lbl_cats').select(['Health and food', '— — Natural']).invoke('val').should('deep.equal', ['2', '7']);
     cy.get('.data-form.blog-add textarea[name=content]').clear().type('Some test content');
@@ -48,7 +48,7 @@ context('Module blog posts', () => {
 
   it('should render added post in list', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/');
+    cy.visitCMS('/cp/blog/');
     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');
@@ -57,7 +57,7 @@ context('Module blog posts', () => {
 
   it('should render added post in edit form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/');
+    cy.visitCMS('/cp/blog/');
     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');
@@ -69,7 +69,7 @@ context('Module blog posts', () => {
 
   it('should delete added post', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/');
+    cy.visitCMS('/cp/blog/');
     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.data-table tbody tr').should('have.length', 3);

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

@@ -7,7 +7,7 @@ context('Module blog categories', () => {
 
   it('should render data table', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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);
@@ -17,7 +17,7 @@ context('Module blog categories', () => {
 
   it('should render data form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories-add/');
+    cy.visitCMS('/cp/blog/categories-add/');
     cy.get('.data-form.blog-categories-add select').should('have.length', 1);
     cy.get('.data-form.blog-categories-add input[type=text]').should('have.length', 2);
     cy.logoutCMS();
@@ -25,7 +25,7 @@ context('Module blog categories', () => {
 
   it('should not add new category', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories-add/');
+    cy.visitCMS('/cp/blog/categories-add/');
     cy.get('#add-edit-button').click();
     cy.actionWait();
     cy.get('.data-form.blog-categories-add div.sys-messages').should('exist');
@@ -34,7 +34,7 @@ context('Module blog categories', () => {
 
   it('should add new category', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories-add/');
+    cy.visitCMS('/cp/blog/categories-add/');
     cy.get('.data-form.blog-categories-add input[name=name]').clear().type('Some test category');
     cy.get('#add-edit-button').click();
     cy.actionWait();
@@ -43,7 +43,7 @@ context('Module blog categories', () => {
 
   it('should render added category in list', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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();
@@ -51,7 +51,7 @@ context('Module blog categories', () => {
 
   it('should render added category in edit form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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');
@@ -61,7 +61,7 @@ context('Module blog categories', () => {
 
   it('should add new child category', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories-add/');
+    cy.visitCMS('/cp/blog/categories-add/');
     cy.get('.data-form.blog-categories-add select[name=parent]').select('Some test category');
     cy.get('.data-form.blog-categories-add input[name=name]').clear().type('Some test child category');
     cy.get('#add-edit-button').click();
@@ -71,7 +71,7 @@ context('Module blog categories', () => {
 
   it('should render added child category in list', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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();
@@ -79,7 +79,7 @@ context('Module blog categories', () => {
 
   it('should render added child category in edit form', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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');
@@ -89,7 +89,7 @@ context('Module blog categories', () => {
 
   it('should delete added child category', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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.data-table tbody tr').should('have.length', 12);
@@ -98,7 +98,7 @@ context('Module blog categories', () => {
 
   it('should delete added category', () => {
     cy.loginCMS();
-    cy.visit('http://localhost:8080/cp/blog/categories/');
+    cy.visitCMS('/cp/blog/categories/');
     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.data-table tbody tr').should('have.length', 11);