Search in sources :

Example 1 with PublicationArchive

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

the class TestDataSteps method discardEditedDocument.

/**
 * <p>
 * Closes the current publication discarding current changes.
 * </p><p>
 * Only applicable to scenarios that leave the document in editable state; implemented as an {@linkplain After}
 * hook rather than a step because this is really a test cleanup/tear-down activity that doesn't warrant expressing
 * explicitly as a scenario step.
 * </p><p>
 * To ensure that this method gets called at the end of your scenario, tag the scenario with
 * {@code @DiscardAfter}.
 * </p>
 */
@After(value = "@DiscardAfter", order = 500)
public void discardEditedDocument() throws Throwable {
    Publication currentPublication = testDataRepo.getCurrentPublication();
    if (currentPublication != null) {
        final String currentPublicationName = currentPublication.getName();
        log.debug("Discarding and closing current publication: {}.", currentPublicationName);
        contentPage.discardUnsavedChanges(currentPublicationName);
    }
    Dataset dataset = testDataRepo.getDataset();
    if (dataset != null) {
        String datasetName = dataset.getName();
        log.debug("Discarding and closing current dataset: {}.", datasetName);
        contentPage.discardUnsavedChanges(datasetName);
    }
    PublicationSeries series = testDataRepo.getPublicationSeries();
    if (series != null) {
        final String currentSeriesName = series.getName();
        log.debug("Discarding and closing current series: {}.", currentSeriesName);
        contentPage.discardUnsavedChanges(currentSeriesName);
    }
    PublicationArchive archive = testDataRepo.getPublicationArchive();
    if (archive != null) {
        final String currentArchiveName = archive.getName();
        log.debug("Discarding and closing current archive: {}.", currentArchiveName);
        contentPage.discardUnsavedChanges(currentArchiveName);
    }
}
Also used : PublicationSeries(uk.nhs.digital.ps.test.acceptance.models.PublicationSeries) PublicationArchive(uk.nhs.digital.ps.test.acceptance.models.PublicationArchive) Dataset(uk.nhs.digital.ps.test.acceptance.models.Dataset) Publication(uk.nhs.digital.ps.test.acceptance.models.Publication) After(cucumber.api.java.After)

Example 2 with PublicationArchive

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

the class CmsSteps method createArchiveInEditableState.

private void createArchiveInEditableState() throws Throwable {
    loginSteps.loginAsCiEditor();
    contentPage.openContentTab();
    final PublicationArchive publicationArchive = TestDataFactory.createArchive().build();
    testDataRepo.setPublicationArchive(publicationArchive);
    contentPage.newArchive(publicationArchive);
}
Also used : PublicationArchive(uk.nhs.digital.ps.test.acceptance.models.PublicationArchive)

Aggregations

PublicationArchive (uk.nhs.digital.ps.test.acceptance.models.PublicationArchive)2 After (cucumber.api.java.After)1 Dataset (uk.nhs.digital.ps.test.acceptance.models.Dataset)1 Publication (uk.nhs.digital.ps.test.acceptance.models.Publication)1 PublicationSeries (uk.nhs.digital.ps.test.acceptance.models.PublicationSeries)1