<commit_before>﻿import InterfaceCatalogPage = require("../PageObjects/it-system/Interfaces/itSystemInterface.po");
import Select2 = require("./Select2Helper");

class InterfaceCatalogHelper {
    private static interfacePage = new InterfaceCatalogPage();

    public static createInterface(name: string) {
        console.log(`Creating interface with name ${name}`);
        return this.interfacePage.getPage()
            .then(() => this.interfacePage.getCreateInterfaceButton().click())
            .then(() => expect(this.interfacePage.getInterfaceNameInputField().isPresent()))
            .then(() => this.interfacePage.getInterfaceNameInputField().sendKeys(name))
            .then(() => this.interfacePage.getSaveInterfaceButton().click())
            .then(() => console.log("Interface created"));
    }

    public static bindInterfaceToSystem(systemName: string, interfaceName: string) {
        console.log(`Binding interface with name ${interfaceName} to system with name ${systemName}`);
        return this.gotoSpecificInterface(interfaceName)
            .then(() => Select2.searchFor(systemName, "s2id_interface-exposed-by"))
            .then(() => Select2.waitForDataAndSelect())
            .then(() => console.log("Interface bound to system"));;
    }
    
    public static waitForKendoGrid() {
        console.log("Waiting for kendo grid to be ready");
        return this.interfacePage.waitForKendoGrid();
    }

    public static gotoSpecificInterface(name : string) {
        console.log(`Navigating to interface with name ${name}`);
        return this.interfacePage.getPage()
            .then(() => this.findSpecificInterfaceInNameColumn(name).click());
    }

    private static findSpecificInterfaceInNameColumn(name: string) {
        console.log(`Finding interface with name : ${name}`);
        return element(by.xpath('//*/tbody/*/td/a[text()="' + name + '" and @data-element-type="InterfaceName"]'));<commit_msg>fix flaky tests which dont wait for kendo<commit_after>﻿import InterfaceCatalogPage = require("../PageObjects/it-system/Interfaces/itSystemInterface.po");
import Select2 = require("./Select2Helper");

class InterfaceCatalogHelper {
    private static interfacePage = new InterfaceCatalogPage();

    public static createInterface(name: string) {
        console.log(`Creating interface with name ${name}`);
        return this.interfacePage.getPage()
            .then(() => this.interfacePage.getCreateInterfaceButton().click())
            .then(() => expect(this.interfacePage.getInterfaceNameInputField().isPresent()))
            .then(() => this.interfacePage.getInterfaceNameInputField().sendKeys(name))
            .then(() => this.interfacePage.getSaveInterfaceButton().click())
            .then(() => console.log("Interface created"));
    }

    public static bindInterfaceToSystem(systemName: string, interfaceName: string) {
        console.log(`Binding interface with name ${interfaceName} to system with name ${systemName}`);
        return this.gotoSpecificInterface(interfaceName)
            .then(() => Select2.searchFor(systemName, "s2id_interface-exposed-by"))
            .then(() => Select2.waitForDataAndSelect())
            .then(() => console.log("Interface bound to system"));;
    }

    public static waitForKendoGrid() {
        console.log("Waiting for kendo grid to be ready");
        return this.interfacePage.waitForKendoGrid();
    }

    public static gotoSpecificInterface(name: string) {
        console.log(`Navigating to interface with name ${name}`);
        return this.interfacePage.getPage()
            .then(() => this.waitForKendoGrid())
            .then(() => this.findSpecificInterfaceInNameColumn(name).click());
    }

    private static findSpecificInterfaceInNameColumn(name: string) {
        console.log(`Finding interface with name : ${name}`);
        return element(by.xpath('//*/tbody/*/td/a[text()="' + name + '" and @data-element-type="InterfaceName"]'));
{'fraction_non_alphanumeric': 0.14112903225806453, 'fraction_numerical': 0.0025201612903225806, 'mean_word_length': 3.5411899313501145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '1458750', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1013, 'n_words': 214}