Search in sources :

Example 1 with Publication

use of uk.nhs.digital.ps.test.acceptance.models.Publication in project hippo by NHS-digital-website.

the class PublicationSteps method thenItIsVisibleToConsumers.

@Then(("^it is visible to consumers"))
public void thenItIsVisibleToConsumers() throws Throwable {
    final Publication publication = testDataRepo.getCurrentPublication();
    publicationPage.open(publication);
    assertThat("Publication title is as expected", sitePage.getDocumentTitle(), is(publication.getTitle()));
    assertThat("Publication summary is as expected", publicationPage.getSummaryText(), is(publication.getSummary()));
    assertThat("Geographic coverage is as expected", publicationPage.getGeographicCoverage(), is(publication.getGeographicCoverage().getDisplayValue()));
    assertThat("Publication information type is as expected", publicationPage.getInformationType(), is(publication.getInformationType().getDisplayName()));
    assertThat("Granularity is as expected", publicationPage.getGranularity(), is(publication.getGranularity().getDisplayValue()));
    iCanSeeTheSectionedPublicationBody();
    assertAttachmentsUpload(publication.getAttachments());
}
Also used : Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) Then(cucumber.api.java.en.Then)

Example 2 with Publication

use of uk.nhs.digital.ps.test.acceptance.models.Publication in project hippo by NHS-digital-website.

the class PublicationSteps method iCanSeeTheSectionedPublicationBody.

@Then("^I can see the sectioned publication body$")
public void iCanSeeTheSectionedPublicationBody() throws Throwable {
    Publication publication = testDataRepo.getCurrentPublication();
    List<Matcher<? super SectionWidget>> matchers = publication.getBodySections().stream().map(BodySection::getMatcher).collect(Collectors.toList());
    assertThat("Body sections are as expected", publicationPage.getBodySections(), contains(matchers));
}
Also used : Matcher(org.hamcrest.Matcher) Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) SectionWidget(uk.nhs.digital.ps.test.acceptance.pages.widgets.SectionWidget) Then(cucumber.api.java.en.Then)

Example 3 with Publication

use of uk.nhs.digital.ps.test.acceptance.models.Publication in project hippo by NHS-digital-website.

the class CmsSteps method givenIHaveAPublishedPublicationWithNominalDateFallingBeforeWeeksFromNow.

@Given("^I have a published publication with nominal date falling before (-?\\d+) (days|weeks|years) from now$")
public void givenIHaveAPublishedPublicationWithNominalDateFallingBeforeWeeksFromNow(final int valueFromNow, final String unit) throws Throwable {
    ChronoUnit chronoUnit = ChronoUnit.valueOf(unit.toUpperCase());
    final Publication publicationWithNominalDateBeforeCutOff = TestDataFactory.createBareMinimumPublication().withNominalDate(LocalDateTime.now().plus(valueFromNow, chronoUnit).toInstant(ZoneOffset.UTC)).build();
    testDataRepo.setPublication(publicationWithNominalDateBeforeCutOff);
    createPublishedPublication(publicationWithNominalDateBeforeCutOff);
}
Also used : Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) ChronoUnit(java.time.temporal.ChronoUnit) Given(cucumber.api.java.en.Given)

Example 4 with Publication

use of uk.nhs.digital.ps.test.acceptance.models.Publication in project hippo by NHS-digital-website.

the class CmsSteps method givenIHaveAReleasedPublicationFlaggedAsUpcoming.

// Scenario: Details are hidden from the end users in a published upcoming publication ==============================
@Given("^I have a published publication flagged as upcoming$")
public void givenIHaveAReleasedPublicationFlaggedAsUpcoming() throws Throwable {
    final Publication publication = ExpectedTestDataProvider.getPublishedUpcomingPublications().build().get(0);
    testDataRepo.setPublication(publication);
    createPublicationInEditableState(publication);
    whenIPopulateAndSaveThePublication();
    whenIPublishThePublication();
}
Also used : Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) Given(cucumber.api.java.en.Given)

Example 5 with Publication

use of uk.nhs.digital.ps.test.acceptance.models.Publication in project hippo by NHS-digital-website.

the class CmsSteps method whenICreateANewPublicationWithTaxonomy.

@When("^I create a publication with taxonomy$")
public void whenICreateANewPublicationWithTaxonomy() throws Throwable {
    final Publication publication = TestDataFactory.createBareMinimumPublication().withTaxonomy(Taxonomy.createNew("Conditions", "Accidents and injuries", "Falls")).build();
    testDataRepo.setPublication(publication);
    assertThat("New publication created.", contentPage.newPublication(publication), is(true));
}
Also used : Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) When(cucumber.api.java.en.When)

Aggregations

Publication (uk.nhs.digital.ps.test.acceptance.models.Publication)11 Given (cucumber.api.java.en.Given)5 Then (cucumber.api.java.en.Then)3 When (cucumber.api.java.en.When)2 After (cucumber.api.java.After)1 LocalDateTime (java.time.LocalDateTime)1 ChronoUnit (java.time.temporal.ChronoUnit)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Matcher (org.hamcrest.Matcher)1 Dataset (uk.nhs.digital.ps.test.acceptance.models.Dataset)1 PublicationArchive (uk.nhs.digital.ps.test.acceptance.models.PublicationArchive)1 PublicationSeries (uk.nhs.digital.ps.test.acceptance.models.PublicationSeries)1 SectionWidget (uk.nhs.digital.ps.test.acceptance.pages.widgets.SectionWidget)1