<commit_before>/* global by, element */

'use strict';

var authentication = require('../authentication/authentication');
var common = require('../common/common');
var topologyEditorCommon = require('../topology/topology_editor_common');
var topologyTemplates = require('../topology/topology_templates_common');
var applications = require('../applications/applications');

describe('Applications management :', function() {
  /* Before each spec in the tests suite */
  beforeEach(function() {
    common.before();
    authentication.login('applicationManager');
  });

  /* After each spec in the tests suite(s) */
  afterEach(function() {
    // Logout action
    common.after();
  });

  xit('should be able to go to application search page at ' + common.appSearchUrl + ' and create new application', function() {
    console.log('################# should be able to go to application search page at ' + common.appSearchUrl + ' and create new application');
    applications.createApplication('Alien', 'Great Application');
    // Go to the app details page
    expect(browser.element(by.binding('application.name')).getText()).toEqual('Alien');
    expect(browser.element(by.binding('application.description')).getText()).toEqual('Great Application');
  });

  xit('should create first a topology template with 3 node templates (COMPUTE, JAVA, TOMCATRPM) and an application based on this template', function() {
    console.log('################# should create first a topology template with 3 node templates (COMPUTE, JAVA, TOMCATRPM) and an application based on this template');
    // Login as architect to create a topology template
    authentication.reLogin('architect');

    // create a topology template with one Compute, 1 Java and 1 Tomcat RPM
    topologyTemplates.createTopologyTemplateWithNodesAndRelationships(topologyEditorCommon.topologyTemplates.template4);

    // create a new application with this template as model
    authentication.reLogin('applicationManager');
    // template at index 2 is the first and only one created (index 1 equals is the default, no template)
    applications.createApplication('JavaTomcatWarApplication', 'Simple application with one compute, one template and all that around java...', 2);

    // check the created topology application (count nodes, count relationship..)
    applications.goToApplicationDetailPage('JavaTomcatWarApplication', true);

    // check relationship count
    // check relationship count
    element(by.id('rect_JavaRPM')).click();
    browser.waitForAngular();
    var relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(2);
    element(by.id('rect_Compute_2')).click();
    browser.waitForAngular();
    relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(0);
    element(by.id('rect_Compute')).click();
    browser.waitForAngular();
    relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(0);
  });

  xit('should be able to delete an application from the search list and the application\'s detail page', function() {
    console.log('################# should be able to delete an application from the search list and the application\'s detail page');
    applications.createApplication('Alien_1', 'Great Application 1');
    applications.createApplication('Alien_2', 'Great Application 2');
    applications.createApplication('Alien_3', 'Great Application 3');
    applications.goToApplicationListPage('main', 'applications');
    // delete application from the search list
    var appElement = element(by.id('app_Alien_1'));
    common.ptor.actions().mouseMove(appElement).perform();
    browser.sleep(1000); // one second so the turn annimation ends.
    common.deleteWithConfirm('delete-app_Alien_1', true);
    expect(appElement.isPresent()).toBe(false);

    // cancel a delete action
    appElement = element(by.id('app_Alien_3'));
    common.ptor.actions().mouseMove(appElement).perform();
    browser.sleep(1000); // one second so the turn annimation ends.
    common.deleteWithConfirm('delete-app_Alien_3', false);<commit_msg>ALIEN-500 : Rights management in Application view UI Test - correction<commit_after>/* global by, element */

'use strict';

var authentication = require('../authentication/authentication');
var common = require('../common/common');
var topologyEditorCommon = require('../topology/topology_editor_common');
var topologyTemplates = require('../topology/topology_templates_common');
var applications = require('../applications/applications');

describe('Applications management :', function() {
  /* Before each spec in the tests suite */
  beforeEach(function() {
    common.before();
    authentication.login('applicationManager');
  });

  /* After each spec in the tests suite(s) */
  afterEach(function() {
    // Logout action
    common.after();
  });

  it('should be able to go to application search page at ' + common.appSearchUrl + ' and create new application', function() {
    console.log('################# should be able to go to application search page at ' + common.appSearchUrl + ' and create new application');
    applications.createApplication('Alien', 'Great Application');
    // Go to the app details page
    expect(browser.element(by.binding('application.name')).getText()).toEqual('Alien');
    expect(browser.element(by.binding('application.description')).getText()).toEqual('Great Application');
  });

  it('should create first a topology template with 3 node templates (COMPUTE, JAVA, TOMCATRPM) and an application based on this template', function() {
    console.log('################# should create first a topology template with 3 node templates (COMPUTE, JAVA, TOMCATRPM) and an application based on this template');
    // Login as architect to create a topology template
    authentication.reLogin('architect');

    // create a topology template with one Compute, 1 Java and 1 Tomcat RPM
    topologyTemplates.createTopologyTemplateWithNodesAndRelationships(topologyEditorCommon.topologyTemplates.template4);

    // create a new application with this template as model
    authentication.reLogin('applicationManager');
    // template at index 2 is the first and only one created (index 1 equals is the default, no template)
    applications.createApplication('JavaTomcatWarApplication', 'Simple application with one compute, one template and all that around java...', 2);

    // check the created topology application (count nodes, count relationship..)
    applications.goToApplicationDetailPage('JavaTomcatWarApplication', true);

    // check relationship count
    // check relationship count
    element(by.id('rect_JavaRPM')).click();
    browser.waitForAngular();
    var relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(2);
    element(by.id('rect_Compute_2')).click();
    browser.waitForAngular();
    relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(0);
    element(by.id('rect_Compute')).click();
    browser.waitForAngular();
    relationships = element.all(by.repeater('(relationshipName,relationshipDefinition) in selectedNodeTemplate.relationships'));
    expect(relationships.count()).toBe(0);
  });

  it('should be able to delete an application from the search list and the application\'s detail page', function() {
    console.log('################# should be able to delete an application from the search list and the application\'s detail page');
    applications.createApplication('Alien_1', 'Great Application 1');
    applications.createApplication('Alien_2', 'Great Application 2');
    applications.createApplication('Alien_3', 'Great Application 3');
    applications.goToApplicationListPage('main', 'applications');
    // delete application from the search list
    var appElement = element(by.id('app_Alien_1'));
    common.ptor.actions().mouseMove(appElement).perform();
    browser.sleep(1000); // one second so the turn annimation ends.
    common.deleteWithConfirm('delete-app_Alien_1', true);
    expect(appElement.isPresent()).toBe(false);

    // cancel a delete action
    appElement = element(by.id('app_Alien_3'));
    common.ptor.actions().mouseMove(appElement).perform();
    browser.sleep(1000); // one second so the turn annimation ends.
    common.deleteWithConfirm('delete-app_Alien_3', false);
{'fraction_non_alphanumeric': 0.13101482326111744, 'fraction_numerical': 0.007183580387685291, 'mean_word_length': 4.914362778152394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2762017', 'n_tokens_mistral': 2294, 'n_tokens_neox': 2230, 'n_words': 651}