<commit_before>package io.syndesis.qe.pages.connections.fragments.list;

import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

import io.syndesis.qe.fragments.common.list.CardList;
import io.syndesis.qe.fragments.common.list.actions.ListAction;
import io.syndesis.qe.fragments.common.menu.KebabMenu;
import io.syndesis.qe.pages.ModalDialogPage;
import io.syndesis.qe.utils.TestUtils;

import org.openqa.selenium.By;

import com.codeborne.selenide.SelenideElement;

public class ConnectionsList extends CardList {


    private static final class Element {
        public static final By TECH_PREVIEW = By.xpath("syndesis-card-tech-preview");
        public static final String CONNECTION_CARD = "div[data-testid=\"connection-card-%s-card\"]";
        public static String KEBAB_MENU_SELECTOR = "[id=\"connection-%s-menu\"]";

    }

    public ConnectionsList(By rootElement) {
        super(rootElement);
    }

    @Override
    public void invokeActionOnItem(String title, ListAction action) {

        switch (action) {
            case DELETE:
                KebabMenu kebabMenu = new KebabMenu($(kebabMenu(title)).shouldBe(visible));
                kebabMenu.open();
                kebabMenu.getItemElement("Delete").shouldBe(visible).click();
                TestUtils.sleepForJenkinsDelayIfHigher(3);
                new ModalDialogPage().getButton("Delete").shouldBe(visible).click();
                break;
            default:
                super.invokeActionOnItem(title, action);
        }
    }

    @Override
    public SelenideElement getItem(String title) {
        return $(By.cssSelector(String.format(Element.CONNECTION_CARD, title.toLowerCase().replaceAll(" ", "-"))));
    }

    @Override
    public SelenideElement getTitle(String title) {<commit_msg>[UI] fix gmail (and maybe more) connection creation in firefox on react UI<commit_after>package io.syndesis.qe.pages.connections.fragments.list;

import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

import io.syndesis.qe.fragments.common.list.CardList;
import io.syndesis.qe.fragments.common.list.actions.ListAction;
import io.syndesis.qe.fragments.common.menu.KebabMenu;
import io.syndesis.qe.pages.ModalDialogPage;
import io.syndesis.qe.utils.TestUtils;

import org.openqa.selenium.By;

import com.codeborne.selenide.SelenideElement;

public class ConnectionsList extends CardList {


    private static final class Element {
        public static final By TECH_PREVIEW = By.xpath("syndesis-card-tech-preview");
        public static final String CONNECTION_CARD = "div[data-testid=\"connection-card-%s-card\"]";
        public static final String CONNECTION_TITLE = "h1[data-testid=\"connection-card-title\"]";
        public static String KEBAB_MENU_SELECTOR = "[id=\"connection-%s-menu\"]";

    }

    public ConnectionsList(By rootElement) {
        super(rootElement);
    }

    @Override
    public void invokeActionOnItem(String title, ListAction action) {

        switch (action) {
            case DELETE:
                KebabMenu kebabMenu = new KebabMenu($(kebabMenu(title)).shouldBe(visible));
                kebabMenu.open();
                kebabMenu.getItemElement("Delete").shouldBe(visible).click();
                TestUtils.sleepForJenkinsDelayIfHigher(3);
                new ModalDialogPage().getButton("Delete").shouldBe(visible).click();
                break;
            case CLICK:
                getItem(title)
                    .find(By.cssSelector(Element.CONNECTION_TITLE))
                    .shouldBe(visible)
                    .click();
                break;
            default:
                super.invokeActionOnItem(title, action);
        }
    }

    @Override
    public SelenideElement getItem(String title) {
        return $(By.cssSelector(String.format(Element.CONNECTION_CARD,
            title.toLowerCase().replaceAll(" ", "-"))));
    }

    @Override
    public SelenideElement getTitle(String title) {
{'fraction_non_alphanumeric': 0.11157738829918538, 'fraction_numerical': 0.0007405578869414959, 'mean_word_length': 2.914975845410628, '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': '424212', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1183, 'n_words': 205}