describe('Packages Tab', function () {

  beforeEach(function () {
    cy.configureCluster({
      mesos: '1-task-healthy',
      universePackages: true
    });
  });

  it('should display correct error message for invalid repo uri', function () {
    cy
      .route({
        method: 'POST',
        url: /package\/search/,
        status: 400,
        response: {type: 'RepositoryUriSyntax', name: 'Invalid'}
      })
      .visitUrl({url: '/universe', logIn: true});

    cy
      .get('.page-content p.inverse.text-align-center')
      .should('contain', 'The URL for Invalid (repository) is not valid, or its host did not resolve. You might need to change the URL of Invalid. You can do that on the Repositories Settings page, uninstall it, and add the correct URL.');
  });

  it('should display correct message for \'no index\' error', function () {
    cy
      .route({
        method: 'POST',
        url: /package\/search/,
        status: 400,
        response: {type: 'IndexNotFound', name: 'Invalid'}
      })
      .visitUrl({url: '/universe', logIn: true});

    cy
      .get('.page-content p.inverse.text-align-center')
      .should('contain', 'The index file is missing in Invalid (repository). You might need to change the URL of Invalid. You can do that on the Repositories Settings page, uninstall it, and add the correct URL.');
  });

  it('should display correct message for missing package file', function () {
    cy
      .route({
        method: 'POST',
        url: /package\/search/,
        status: 400,
        response: {type: 'PackageFileMissing', name: 'Invalid'}
      })
      .visitUrl({url: '/universe', logIn: true});

    cy
      .get('.page-content p.inverse.text-align-center')
      .should('contain', 'The package file is missing in Invalid (repository). You might need to change the URL of Invalid. You can do that on the Repositories Settings page, uninstall it, and add the correct URL.');
  });

  it('should use default repository name if not provided', function () {
    cy
      .route({
        method: 'POST',
        url: /package\/search/,
        status: 400,
        response: {type: 'PackageFileMissing'}
      })
      .visitUrl({url: '/universe', logIn: true});

    cy
      .get('.page-content p.inverse.text-align-center')
      .should('contain', 'The package file is missing in a repository (repository). You might need to change the URL of a repository. You can do that on the Repositories Settings page, uninstall it, and add the correct URL.');
  });

  it('should default error message for missing package file', function () {
    cy
      .route({
        method: 'POST',
        url: /package\/search/,
        status: 400,
        response: {message: 'Some other error'}
      })
      .visitUrl({url: '/universe', logIn: true});

    cy
      .get('.page-content h3')
      .should('contain', 'Cannot Connect With The Server');
  });

  context('searching', function () {
    beforeEach(function () {
      cy.visitUrl({url: '/universe', logIn: true});
      cy.get('input').type('cass');
    });

    it('should hide selected panels', function () {
      cy.get('.panel').should(function ($panels) {
        expect($panels.length).to.equal(0);
      });
    });

    it('should should only cassandra in table', function () {
      cy.get('tr').should(function ($rows) {
        expect($rows.length).to.equal(4);
      });
    });
  });

  context('selected packages', function () {
    beforeEach(function () {
      cy.visitUrl({url: '/universe', logIn: true});
      cy.get('.panel').as('panels');
    });

    it('should have the first package as selected', function () {
      cy.get('@panels').should(function ($panels) {
        expect($panels.length).to.equal(1);
      });
    });
  });

});

@@ -395,32 +395,94 @@
  name: 'Invalid'
+, message: 'The url for Invalid does not have correct syntax.'
 %7D%0A      %7D)%0A     
@@ -564,35 +564,33 @@
 ent 
-p.inverse.text-align-center
+.text-overflow-break-word
 ')%0A 
@@ -618,19 +618,19 @@
 ', 'The 
-URL
+url
  for Inv
@@ -638,107 +638,36 @@
 lid 
-(repository) is not valid, or its host did not resolve. You might need to change the URL of Invalid
+does not have correct syntax
 . Yo
@@ -668,34 +668,29 @@
 ax. You can 
-do that on
+go to
  the Reposit
@@ -712,47 +712,41 @@
 page
-, uninstall it, and add the correct URL
+ to change installed repositories
 .');
@@ -977,32 +977,82 @@
  name: 'Invalid'
+, message: 'The index file is missing in Invalid.'
 %7D%0A      %7D)%0A     
@@ -1134,35 +1134,33 @@
 ent 
-p.inverse.text-align-center
+.text-overflow-break-word
 ')%0A 
@@ -1224,156 +1224,87 @@
 alid
- (repository). You might need to change the URL of Invalid. You can do that on the Repositories Settings page, uninstall it, and add the correct URL
+. You can go to the Repositories Settings page to change installed repositories
 .');
@@ -1550,16 +1550,68 @@
 Invalid'
+, message: 'The package file is missing in Invalid.'
 %7D%0A      
@@ -1701,35 +1701,33 @@
 ent 
-p.inverse.text-align-center
+.text-overflow-break-word
 ')%0A 
@@ -1793,156 +1793,87 @@
 alid
- (repository). You might need to change the URL of Invalid. You can do that on the Repositories Settings page, uninstall it, and add the correct URL
+. You can go to the Repositories Settings page to change installed repositories
 .');
@@ -2097,16 +2097,73 @@
 Missing'
+, message: 'The package file is missing in a repository.'
 %7D%0A      
@@ -2253,35 +2253,33 @@
 ent 
-p.inverse.text-align-center
+.text-overflow-break-word
 ')%0A 
@@ -2350,161 +2350,87 @@
 tory
- (repository). You might need to change the URL of a repository. You can do that on the Repositories Settings page, uninstall it, and add the correct URL
+. You can go to the Repositories Settings page to change installed repositories
 .');
@@ -2757,10 +2757,29 @@
 ent 
+.
 h3
+.text-align-center
 ')%0A 
@@ -2807,38 +2807,24 @@
 ', '
-Cannot Connect With The Server
+An Error Occured
 ');%0A

Fix packages tab integration tests