<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.exalttech.trex.ui;

import com.exalttech.trex.ui.matchers.ComboBoxMatchers;
import com.exalttech.trex.ui.matchers.RadioButtonMatchers;
import javafx.scene.Node;
import org.testfx.api.FxAssert;
import org.testfx.framework.junit.ApplicationTest;
import org.testfx.matcher.base.NodeMatchers;
import org.testfx.matcher.control.ListViewMatchers;
import org.testfx.matcher.control.TableViewMatchers;
import org.testfx.matcher.control.TextInputControlMatchers;
import org.testfx.util.WaitForAsyncUtils;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * UI test services
 * @author GeorgeKH
 */
public abstract class UITestsServices extends ApplicationTest{
    

   
    /**
     * Find node
     * @param <T>
     * @param query
     * @return 
     */
    public <T extends Node> T find(final String query) {
        return (T) lookup(query).queryAll().iterator().next();
    }
    
    /**
     * Wait for node to be exists 
     * @param nodeID 
     */
    public void waitForNode(String nodeID) {
        try {
            WaitForAsyncUtils.waitFor(500, TimeUnit.SECONDS, () -> NodeMatchers.isVisible().matches((Node)find(nodeID)));
        } catch (TimeoutException ex) {
            throw new RuntimeException(ex);
        }
    }
    
    /**
     * Verify text exists
     * @param selector
     * @param text 
     */
    public void verifyTextExists(String selector, String text){
         FxAssert.verifyThat(selector, NodeMatchers.hasText(text));
    }
    
    /**
     * Verify node visible<commit_msg>Fixed UITestsServices compilation error<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.exalttech.trex.ui;

import com.exalttech.trex.ui.matchers.ComboBoxMatchers;
import com.exalttech.trex.ui.matchers.RadioButtonMatchers;
import javafx.scene.Node;
import org.testfx.api.FxAssert;
import org.testfx.framework.junit.ApplicationTest;
import org.testfx.matcher.base.NodeMatchers;
import org.testfx.matcher.control.ListViewMatchers;
import org.testfx.matcher.control.TableViewMatchers;
import org.testfx.matcher.control.TextInputControlMatchers;
import org.testfx.matcher.control.TextMatchers;
import org.testfx.util.WaitForAsyncUtils;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * UI test services
 * @author GeorgeKH
 */
public abstract class UITestsServices extends ApplicationTest{
    

   
    /**
     * Find node
     * @param <T>
     * @param query
     * @return 
     */
    public <T extends Node> T find(final String query) {
        return (T) lookup(query).queryAll().iterator().next();
    }
    
    /**
     * Wait for node to be exists 
     * @param nodeID 
     */
    public void waitForNode(String nodeID) {
        try {
            WaitForAsyncUtils.waitFor(500, TimeUnit.SECONDS, () -> NodeMatchers.isVisible().matches((Node)find(nodeID)));
        } catch (TimeoutException ex) {
            throw new RuntimeException(ex);
        }
    }
    
    /**
     * Verify text exists
     * @param selector
     * @param text 
     */
    public void verifyTextExists(String selector, String text){
         FxAssert.verifyThat(selector, TextMatchers.hasText(text));
    }
    
    /**
     * Verify node visible
{'fraction_non_alphanumeric': 0.10516093229744729, 'fraction_numerical': 0.001664816870144284, 'mean_word_length': 3.0873015873015874, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '370439', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1063, 'n_words': 248}