public void checkExcerptDownloaded()

in src/main/java/platform/qa/steps/cabinet/ExcerptStepDefinitions.java [68:83]


    public void checkExcerptDownloaded() {
        List<File> beforeLoadFiles = convertToFileList(testContext.getScenarioContext().getContext(DOWNLOAD_FILES));
        File downloadDir = new File(WebDriverProvider.chromeDownloadPath);
        await()
                .atMost(Duration.ofSeconds(WAIT_FILE_LOAD))
                .pollInterval(Duration.ofSeconds(POOL_INTERVAL))
                .untilAsserted(() -> assertThat(FileUtils.listFiles(downloadDir, null, true))
                        .as("Файл витягу не з'явився в папці " + downloadDir.getAbsolutePath())
                        .hasSizeGreaterThan(beforeLoadFiles.size()));
        File downloadedExcerptFile = FileUtils.listFiles(downloadDir, null, true).stream()
                .filter(file -> !beforeLoadFiles.contains(file))
                .max(Comparator.comparing(CustomFileUtils::getFileModifiedTime))
                .orElseThrow();
        log.info("Excerpt file to compare: " + downloadedExcerptFile.getAbsolutePath());
        testContext.getScenarioContext().setContext(LAST_DOWNLOAD_FILE, downloadedExcerptFile);
    }