<commit_before>/*
 * Copyright 2017 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.autonomy.abc.dashboards;

import com.hp.autonomy.frontend.selenium.config.TestConfig;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import java.time.format.DateTimeFormatter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CurrentTimeWidgetITCase extends DashboardITCase {
    private static final Pattern AM = Pattern.compile("am", Pattern.LITERAL);
    private static final Pattern PM = Pattern.compile("pm", Pattern.LITERAL);

    public CurrentTimeWidgetITCase(final TestConfig config) {

        super(config, 1, "Current Time Date Dashboard");
    }

    @Test
    public void testTimeFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentTime = webElement.findElement(By.cssSelector(".current-time")).getText();
        final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("hh:mma z");
        dateTimeFormatter.parse(PM.matcher(AM.matcher(currentTime).replaceAll(Matcher.quoteReplacement("AM"))).replaceAll(Matcher.quoteReplacement("PM")));
    }

    @Test
    public void testDayFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentDay = webElement.findElement(By.cssSelector(".day")).getText();
        final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("EEEE");
        dateTimeFormatter.parse(currentDay);
    }

    @Test
    public void testDateFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentDate = webElement.findElement(By.cssSelector(".date")).getText();
        final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MMM dd, uuuu");<commit_msg>Fixed date format expectations in current time widget IT.<commit_after>/*
 * Copyright 2017 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.autonomy.abc.dashboards;

import com.hp.autonomy.frontend.selenium.config.TestConfig;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

public class CurrentTimeWidgetITCase extends DashboardITCase {
    public CurrentTimeWidgetITCase(final TestConfig config) {
        super(config, 1, "Current Time Date Dashboard");
    }

    @Test
    public void testTimeFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentTime = webElement.findElement(By.cssSelector(".current-time")).getText();
        final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm z");
        dateTimeFormatter.parse(currentTime);
    }

    @Test
    public void testDayFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentDay = webElement.findElement(By.cssSelector(".day")).getText();

        final DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder()
                .parseCaseInsensitive()
                .appendPattern("EEEE")
                .toFormatter();

        dateTimeFormatter.parse(currentDay);
    }

    @Test
    public void testDateFormat() {
        final WebElement webElement = page.getWidgets().get(0);
        final String currentDate = webElement.findElement(By.cssSelector(".date")).getText();

        final DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder()
                .parseCaseInsensitive()
                .appendPattern("MMM dd, uuuu")
                .toFormatter();

{'fraction_non_alphanumeric': 0.10313216195569137, 'fraction_numerical': 0.004074357015533486, 'mean_word_length': 3.8078335373317014, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7666264', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1015, 'n_words': 251}