Search in sources :

Example 96 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ActivitySteps method checkAllTimeOfStep.

/**
 * Check that time in step is between start and end time of request
 *
 * @param indexActivity from 1 , first activity = 1
 */
@Then("^check that all steps in the (\\w+). activity has valid time with (\\w+) second accuracy$")
public void checkAllTimeOfStep(int indexActivity, int accuracy) throws ParseException {
    int numberOfRow = activityTab.getActivityLogRows(indexActivity - 1).size();
    for (int indexRow = 0; indexRow < numberOfRow; indexRow++) {
        String timeLabel = activityTab.getColumnInRowInActivityLog(indexActivity - 1, indexRow, Activity.COLUMN.TIME);
        assertThat(timeLabel).matches("^\\d{1,2}/\\d{1,2}/\\d{4}, \\d{1,2}:\\d{1,2}:\\d{2} (AM|PM)$");
        Date dateOfStep = new SimpleDateFormat("MM/dd/yyyy, hh:mm:ss a").parse(timeLabel);
        checkDateIsMiddle(dateOfStep, accuracy);
    }
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Then(io.cucumber.java.en.Then)

Example 97 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ActivitySteps method checkDateAndTime.

/**
 * Check that activity date and time is between start and end time of request
 *
 * @param index from 1 , first activity = 1
 */
@Then("^check that (\\w+). activity date and time is valid with (\\w+) second accuracy$")
public void checkDateAndTime(int index, int accuracy) throws ParseException {
    refresh();
    String timeLabel = activityTab.getActivityTime(index - 1);
    String dateLabel = activityTab.getActivityDate(index - 1);
    assertThat(timeLabel).matches("^\\d{1,2}:\\d{2}:\\d{2} (AM|PM)$");
    assertThat(dateLabel).matches("^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$");
    Date activityDate = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a").parse(dateLabel + " " + timeLabel);
    checkDateIsMiddle(activityDate, accuracy);
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Then(io.cucumber.java.en.Then)

Example 98 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class MetricsSteps method checkLastProcessed.

/**
 * Check that last processed is valid and it is between start and end time of request
 */
@Then("^check that last processed date is valid$")
public void checkLastProcessed() throws ParseException {
    refresh();
    String dateLabel = metricsTab.getLastProcessed();
    if (metricsTab.getNumberOfTotalMessages() == 0) {
        assertThat(dateLabel).matches("^No Data Available$");
        return;
    }
    assertThat(dateLabel).matches("^\\d{1,2}/\\d{1,2}/\\d{4}, \\d{1,2}:\\d{2}:\\d{2} (AM|PM)$");
    Date dateWhenProcessed = new SimpleDateFormat("MM/dd/yyyy, hh:mm:ss a").parse(dateLabel);
    Calendar processedCalendar = Calendar.getInstance();
    processedCalendar.setTime(dateWhenProcessed);
    /*clear milliseconds because UI last processed label contains only minutes and seconds*/
    Calendar beforeRequest = calendarUtils.getLastBeforeRequest();
    beforeRequest.clear(Calendar.MILLISECOND);
    Calendar afterRequest = calendarUtils.getLastAfterRequest();
    afterRequest.clear(Calendar.MILLISECOND);
    // 5sec accuracy
    beforeRequest.add(Calendar.SECOND, -5);
    afterRequest.add(Calendar.SECOND, +5);
    SimpleDateFormat outFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    if (!processedCalendar.equals(beforeRequest)) {
        // if not same then it tests whether it was after
        assertThat(processedCalendar.after(beforeRequest)).as("Check that processed date and time \"%s\" is after %s", outFormat.format(processedCalendar.getTime()), outFormat.format(beforeRequest.getTime())).isTrue();
    }
    if (!processedCalendar.equals(afterRequest)) {
        // if not same then it tests whether it was before
        assertThat(processedCalendar.before(afterRequest)).as("Check that processed date and time \"%s\" is before %s", outFormat.format(processedCalendar.getTime()), outFormat.format(afterRequest.getTime())).isTrue();
    }
}
Also used : Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Then(io.cucumber.java.en.Then)

Example 99 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class CommonValidationSteps method verifyWarningOnIntegration.

@Then("check that integration {word} contains warning {string}")
public void verifyWarningOnIntegration(String integrationName, String warning) {
    IntegrationOverview overview = integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get());
    Assertions.assertThat(integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get()).getBoard().getWarnings().getAsInt()).isGreaterThan(0);
    Assertions.assertThat(overview.getBoard().getMessages().stream().filter(leveledMessage -> leveledMessage.getDetail().get().contains(warning)).findFirst()).isNotEmpty();
}
Also used : Then(io.cucumber.java.en.Then) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Autowired(org.springframework.beans.factory.annotation.Autowired) IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) IntegrationsEndpoint(io.syndesis.qe.endpoint.IntegrationsEndpoint) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Assertions(org.assertj.core.api.Assertions) Build(io.fabric8.openshift.api.model.Build) Integration(io.syndesis.common.model.integration.Integration) NoSuchElementException(java.util.NoSuchElementException) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) IntegrationOverviewEndpoint(io.syndesis.qe.endpoint.IntegrationOverviewEndpoint) InfraFail(io.syndesis.qe.test.InfraFail) When(io.cucumber.java.en.When) Pod(io.fabric8.kubernetes.api.model.Pod) OpenShiftUtils(io.syndesis.qe.utils.OpenShiftUtils) Collectors(java.util.stream.Collectors) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) TestUtils(io.syndesis.qe.utils.TestUtils) IntegrationDeploymentState(io.syndesis.common.model.integration.IntegrationDeploymentState) OpenShiftWaitUtils(io.syndesis.qe.wait.OpenShiftWaitUtils) IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Example 100 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class FhirValidationSteps method validateThatLastBasicsLanguageHasBeenChangedInFHIR.

@Then("validate that last inserted basics language has been changed to {string} in FHIR")
public void validateThatLastBasicsLanguageHasBeenChangedInFHIR(String lang) {
    MyBasicSpecification newBs = new MyBasicSpecification(lang);
    newBs.setId(fhirUtils.getLastBasicId());
    assertThat(fhirUtils.isBasicInFhir(newBs)).isTrue();
}
Also used : MyBasicSpecification(io.syndesis.qe.util.fhir.MyBasicSpecification) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)124 SelenideElement (com.codeborne.selenide.SelenideElement)20 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)16 List (java.util.List)13 HashMap (java.util.HashMap)10 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)9 Map (java.util.Map)9 ThingType (com.vaticle.typedb.core.concept.type.ThingType)8 DataTable (io.cucumber.datatable.DataTable)8 When (io.cucumber.java.en.When)8 Pod (io.fabric8.kubernetes.api.model.Pod)8 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 ArrayList (java.util.ArrayList)8 Date (java.util.Date)8 TimeoutException (java.util.concurrent.TimeoutException)8 TestUtils (io.syndesis.qe.utils.TestUtils)7 HTTPResponse (io.syndesis.qe.utils.http.HTTPResponse)7 OpenShiftWaitUtils (io.syndesis.qe.wait.OpenShiftWaitUtils)7 Slf4j (lombok.extern.slf4j.Slf4j)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7