'use strict';
/* globals  describe, beforeEach, it, expect, browser, beforeAll, afterAll */


var utils = require('../../lib/utils');
var User = require('./product-catalog.user');

describe('AdminApp - Admin Product Catalog', function() {
  var user1;
  var productName;



  beforeEach(function() {
    productName = 'AT620/14';
    user1 = new User();
    return user1.gotToCatalog()
      .then(function() {
        return user1.showPageContainingProductByProductName(productName);
      });
  });

  it('when a user click on "Edit Insights" of "AT620/14", then the url contains "/insights/edit?productId=5415e36606199ce8296741cc" ', function() {

    user1.wait(2).then(function() {
        return user1.openProductPanelByProductName(productName);
      })
      .then(function() {
        return user1.clickOnEditInsights();
      })
      .then(function() {
        return user1.wait(2);
      })
      .then(function() {
        return browser.getCurrentUrl();
      })
      .then(function(url) {
        expect(url).toContain('/insights/5415e36606199ce8296741cc');
      });
  });



});