<commit_before>﻿import Login = require("../../Helpers/LoginHelper");
import LocalDataProcessing = require("../../PageObjects/Local-admin/LocalDataProcessing.po");
import TestFixtureWrapper = require("../../Utility/TestFixtureWrapper");
import NavigationBarHelper = require("../../object-wrappers/navigationBarWrapper");
import SystemCatalogHelper = require("../../Helpers/SystemCatalogHelper");
import SystemUsageHelper = require("../../Helpers/SystemUsageHelper");
import LocalItSystemNavigation = require("../../Helpers/SideNavigation/LocalItSystemNavigation");
import SystemTabGDPR = require("../../PageObjects/it-system/Usage/Tabs/ItSystemUsageGDPR.po");

describe("Local admin is able to toggle DataProcessing", () => {

    var loginHelper = new Login();
    var dpPageHelper = new LocalDataProcessing();
    var testFixture = new TestFixtureWrapper();
    var naviHelper = new NavigationBarHelper();
    var systemName = createItSystemName(1);

    beforeAll((doneFunc) => {
        testFixture.enableLongRunningTest();
        loginHelper.loginAsGlobalAdmin()
            .then(() => SystemCatalogHelper.createSystem(systemName))
            .then(() => SystemCatalogHelper.createLocalSystem(systemName))
            .then(() => loginHelper.logout())
            .then(() => loginHelper.loginAsLocalAdmin())
            .thenFinally(doneFunc);
    });

    afterAll(() => {
        testFixture.cleanupState();
        testFixture.disableLongRunningTest();
    });

    it("Option to toggle DataProcessing is visible", () => {
        dpPageHelper.getPage()
            .then(() => expect((dpPageHelper.getToggleDataProcessingCheckbox()).isPresent()).toBe(true));
    });

    it("Is able to toggle DataProcessing checkbox", () => {
        var isDataProcessingEnabled;
        dpPageHelper.getPage()
            .then(async () => isDataProcessingEnabled = await dpPageHelper.getToggleDataProcessingCheckbox().isSelected())
            .then(() => checkSystemGdprPageDataProcessingVisibility(isDataProcessingEnabled, systemName))
            .then(() => dpPageHelper.getPage())
            .then(() => expectCheckboxValueToBe(isDataProcessingEnabled))
            .then(() => expectSystemGdprDataProcessingViewToBe(isDataProcessingEnabled))<commit_msg>thenFinally is part of an old version of selenium webdriver. This is deprecated as we are using a newer version. We might need to also update the @types to allow the IDE to recognize the new types<commit_after>﻿import Login = require("../../Helpers/LoginHelper");
import LocalDataProcessing = require("../../PageObjects/Local-admin/LocalDataProcessing.po");
import TestFixtureWrapper = require("../../Utility/TestFixtureWrapper");
import NavigationBarHelper = require("../../object-wrappers/navigationBarWrapper");
import SystemCatalogHelper = require("../../Helpers/SystemCatalogHelper");
import SystemUsageHelper = require("../../Helpers/SystemUsageHelper");
import LocalItSystemNavigation = require("../../Helpers/SideNavigation/LocalItSystemNavigation");
import SystemTabGDPR = require("../../PageObjects/it-system/Usage/Tabs/ItSystemUsageGDPR.po");

describe("Local admin is able to toggle DataProcessing", () => {

    var loginHelper = new Login();
    var dpPageHelper = new LocalDataProcessing();
    var testFixture = new TestFixtureWrapper();
    var naviHelper = new NavigationBarHelper();
    var systemName = createItSystemName(1);

    beforeAll((doneFunc) => {
        testFixture.enableLongRunningTest();
        loginHelper.loginAsGlobalAdmin()
            .then(() => SystemCatalogHelper.createSystem(systemName))
            .then(() => SystemCatalogHelper.createLocalSystem(systemName))
            .then(() => loginHelper.logout())
            .then(() => loginHelper.loginAsLocalAdmin())
            .finally(doneFunc);
    });

    afterAll(() => {
        testFixture.cleanupState();
        testFixture.disableLongRunningTest();
    });

    it("Option to toggle DataProcessing is visible", () => {
        dpPageHelper.getPage()
            .then(() => expect((dpPageHelper.getToggleDataProcessingCheckbox()).isPresent()).toBe(true));
    });

    it("Is able to toggle DataProcessing checkbox", () => {
        var isDataProcessingEnabled;
        dpPageHelper.getPage()
            .then(async () => isDataProcessingEnabled = await dpPageHelper.getToggleDataProcessingCheckbox().isSelected())
            .then(() => checkSystemGdprPageDataProcessingVisibility(isDataProcessingEnabled, systemName))
            .then(() => dpPageHelper.getPage())
            .then(() => expectCheckboxValueToBe(isDataProcessingEnabled))
            .then(() => expectSystemGdprDataProcessingViewToBe(isDataProcessingEnabled))
{'fraction_non_alphanumeric': 0.13902490951671279, 'fraction_numerical': 0.0004258037044922291, 'mean_word_length': 3.7889908256880735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '6545189', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1169, 'n_words': 227}