<commit_before>package org.jboss.hal.testsuite.fragment.shared.modal;

import org.jboss.hal.testsuite.fragment.WindowFragment;
import org.jboss.hal.testsuite.fragment.WindowState;
import org.jboss.hal.testsuite.util.PropUtils;

/**
 * Created by jcechace on 21/02/14.
 */
public class ConfirmationWindow extends WindowFragment {
    public WindowState confirm() {
        return confirm(false);
    }

    /**
     * Server configuration changed popup message that server requires restart is expected
     * and should be closed by clicking Dismiss button.
     */
    public WindowState confirmAndDismissReloadRequiredMessage() {
        return confirm(true);
    }

    private WindowState confirm(boolean dismissExpectedRealoadWindow) {
        String confirmButtonLabel = PropUtils.get("modals.confirmation.confirm.label");
        clickButton(confirmButtonLabel);

        if (dismissExpectedRealoadWindow) {
            String dismissButtonLabel = PropUtils.get("modals.reload.required.dismiss.label");
            clickButton(dismissButtonLabel);
        }

        waitUntilClosed();
        closed = true;
        return new WindowState(this);
    }
}<commit_msg>Avoid 'Reload required' window dismissing logic duplication.<commit_after>package org.jboss.hal.testsuite.fragment.shared.modal;

import org.jboss.hal.testsuite.fragment.WindowFragment;
import org.jboss.hal.testsuite.fragment.WindowState;
import org.jboss.hal.testsuite.util.Console;
import org.jboss.hal.testsuite.util.PropUtils;

/**
 * Created by jcechace on 21/02/14.
 */
public class ConfirmationWindow extends WindowFragment {
    public WindowState confirm() {
        return confirm(false);
    }

    /**
     * Server configuration changed popup message that server requires restart is expected
     * and should be closed by clicking Dismiss button.
     */
    public WindowState confirmAndDismissReloadRequiredMessage() {
        return confirm(true);
    }

    private WindowState confirm(boolean dismissExpectedRealoadWindow) {
        String confirmButtonLabel = PropUtils.get("modals.confirmation.confirm.label");
        clickButton(confirmButtonLabel);

        if (dismissExpectedRealoadWindow) {
            Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent();
        }

        waitUntilClosed();
        closed = true;
        return new WindowState(this);
    }
}
{'fraction_non_alphanumeric': 0.08834665544804375, 'fraction_numerical': 0.005048380311316786, 'mean_word_length': 3.420074349442379, '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': '987496', 'n_tokens_mistral': 652, 'n_tokens_neox': 612, 'n_words': 139}