What to build
An automated end-to-end test that proves the full data preparation pipeline works on a fresh R environment with no pre-existing project data, for two different countries. This test is the definitive quality gate for the entire pipeline redesign (#149).
What it tests
Two country scenarios run in sequence (or in parallel if CI supports it):
- Rwanda — the default template country; uses
get_country_shapes("RWA") + the bundled Rwanda synthetic metadata Excel
- Ethiopia — a second country with different admin structure; uses
get_country_shapes("ETH") + auto-generated metadata skeleton
For each country, the test:
- Scaffolds a new project into
withr::local_tempdir() via create_new_pti(path, app_name = "<Country> PTI", open = FALSE)
- Verifies all placeholder tokens (
{{APP_NAME}}, {{COUNTRY NAME}}) are replaced
- Calls
get_country_shapes(iso3) and verifies the returned list passes validate_geometries()
- Runs the full
00-master.R pipeline headlessly — via quarto::quarto_render() calls matching the current master script
- Asserts all expected
app-data/ outputs exist and are valid:
app-data/shapes.rds — loadable with readRDS(); passes validate_geometries()
app-data/metadata.xlsx — loadable with fct_template_reader(); has at least one variable
app-data/metadata-hex.xlsx — exists (Step 4 runs by default)
app-data/pti-metadata.html — exists and is non-empty
docs/index.html — exists (Quarto website rendered)
- Verifies
shiny::testApp() or equivalent headless launch completes without error
Test location
tests/testthat/test-e2e-pipeline.R
Tagged with a custom skip condition so it does not run on every devtools::test() call — only in CI or when explicitly opted in:
skip_if_not(
identical(Sys.getenv("PTI_RUN_E2E"), "true"),
"Skipping E2E pipeline test (set PTI_RUN_E2E=true to run)"
)
CI configuration
A separate GitHub Actions workflow e2e-pipeline.yml that:
- Runs on push to
main and on a weekly schedule
- Sets
PTI_RUN_E2E=true
- Has internet access (fetches live WB parquets and hex data)
- Uses a clean R environment (no cached project data)
Ethiopia metadata note
Ethiopia requires a metadata workbook. For the E2E test, generate a minimal skeleton automatically using the auto-generation path (if #7 lands) or generate a synthetic one from the shapes using a test helper. The test does not need real indicator data — synthetic random values per polygon are sufficient to exercise the pipeline.
Acceptance criteria
Blocked by
#148 (Inf-4 — get_country_shapes() must exist)
Issues A through J of #149 (full pipeline must be in place)
What to build
An automated end-to-end test that proves the full data preparation pipeline works on a fresh R environment with no pre-existing project data, for two different countries. This test is the definitive quality gate for the entire pipeline redesign (#149).
What it tests
Two country scenarios run in sequence (or in parallel if CI supports it):
get_country_shapes("RWA")+ the bundled Rwanda synthetic metadata Excelget_country_shapes("ETH")+ auto-generated metadata skeletonFor each country, the test:
withr::local_tempdir()viacreate_new_pti(path, app_name = "<Country> PTI", open = FALSE){{APP_NAME}},{{COUNTRY NAME}}) are replacedget_country_shapes(iso3)and verifies the returned list passesvalidate_geometries()00-master.Rpipeline headlessly — viaquarto::quarto_render()calls matching the current master scriptapp-data/outputs exist and are valid:app-data/shapes.rds— loadable withreadRDS(); passesvalidate_geometries()app-data/metadata.xlsx— loadable withfct_template_reader(); has at least one variableapp-data/metadata-hex.xlsx— exists (Step 4 runs by default)app-data/pti-metadata.html— exists and is non-emptydocs/index.html— exists (Quarto website rendered)shiny::testApp()or equivalent headless launch completes without errorTest location
tests/testthat/test-e2e-pipeline.RTagged with a custom skip condition so it does not run on every
devtools::test()call — only in CI or when explicitly opted in:CI configuration
A separate GitHub Actions workflow
e2e-pipeline.ymlthat:mainand on a weekly schedulePTI_RUN_E2E=trueEthiopia metadata note
Ethiopia requires a metadata workbook. For the E2E test, generate a minimal skeleton automatically using the auto-generation path (if #7 lands) or generate a synthetic one from the shapes using a test helper. The test does not need real indicator data — synthetic random values per polygon are sufficient to exercise the pipeline.
Acceptance criteria
devtools::test(); runs withPTI_RUN_E2E=true.github/workflows/e2e-pipeline.ymlBlocked by
#148 (Inf-4 —
get_country_shapes()must exist)Issues A through J of #149 (full pipeline must be in place)