Skip to content

Commit

Permalink
Merge pull request #420 from robbrad/419-fix-selenium-behave-tests
Browse files Browse the repository at this point in the history
fix: 419-fix-selenium-behave-tests
  • Loading branch information
OliverCullimore authored Nov 5, 2023
2 parents 9ef3bac + 0771d96 commit 709506b
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 106 deletions.
200 changes: 100 additions & 100 deletions uk_bin_collection/tests/features/validate_council_outputs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,107 @@ Feature: Test each council output matches expected results

Scenario Outline: Validate Council Output
Given the council: <council>
When we scrape the data from <council>
When we scrape the data from <council> using <selenium_mode> and the <selenium_url> is set
Then the result is valid json
And the output should validate against the schema

Examples: Testing : <council>
| council |
| AylesburyValeCouncil |
| BasingstokeCouncil |
| BathAndNorthEastSomersetCouncil |
| BCPCouncil |
| BexleyCouncil |
| BlackburnCouncil |
| BoltonCouncil |
| BristolCityCouncil |
| BromleyBoroughCouncil |
| BroxtoweBoroughCouncil |
| BuckinghamshireCouncil |
| BuryCouncil |
| CalderdaleCouncil |
| CannockChaseDistrictCouncil |
| CardiffCouncil |
| CastlepointDistrictCouncil |
| CharnwoodBoroughCouncil |
| ChelmsfordCityCouncil |
| CheshireEastCouncil |
| ConwyCountyBorough |
| CrawleyBoroughCouncil |
| CroydonCouncil |
| DerbyshireDalesDistrictCouncil |
| DoncasterCouncil |
| DurhamCouncil |
| EastCambridgeshireCouncil |
| EastDevonDC |
| EastleighBoroughCouncil |
| EastLindseyDistrictCouncil |
| EastRidingCouncil |
| EastSuffolkCouncil |
| ErewashBoroughCouncil |
| FenlandDistrictCouncil |
| GatesheadCouncil |
| GlasgowCityCouncil |
| GuildfordCouncil |
| HarrogateBoroughCouncil |
| HighPeakCouncil |
| HuntingdonDistrictCouncil |
| KingstonUponThamesCouncil |
| LancasterCityCouncil |
| LeedsCityCouncil |
| LisburnCastlereaghCityCouncil |
| LondonBoroughHounslow |
| MaldonDistrictCouncil |
| MalvernHillsDC |
| ManchesterCityCouncil |
| MertonCouncil |
| MidSussexDistrictCouncil |
| MiltonKeynesCityCouncil |
| NeathPortTalbotCouncil |
| NewarkAndSherwoodDC |
| NewcastleCityCouncil |
| NorthEastLincs |
| NorthKestevenDistrictCouncil |
| NorthLanarkshireCouncil |
| NorthLincolnshireCouncil |
| NorthNorfolkDistrictCouncil |
| NorthNorthamptonshireCouncil |
| NorthSomersetCouncil |
| NorthTynesideCouncil |
| NorthumberlandCouncil |
| PrestonCityCouncil |
| ReigateAndBansteadBoroughCouncil |
| RhonddaCynonTaffCouncil |
| RochdaleCouncil |
| RushcliffeBoroughCouncil |
| RushmoorCouncil |
| SalfordCityCouncil |
| SheffieldCityCouncil |
| SomersetCouncil |
| SouthAyrshireCouncil |
| SouthCambridgeshireCouncil |
| SouthLanarkshireCouncil |
| SouthNorfolkCouncil |
| SouthOxfordshireCouncil |
| SouthTynesideCouncil |
| StaffordshireMoorlandsDistrictCouncil |
| StHelensBC |
| StockportBoroughCouncil |
| StratfordUponAvonCouncil |
| SwaleBoroughCouncil |
| TamesideMBCouncil |
| TonbridgeAndMallingBC |
| TorbayCouncil |
| TorridgeDistrictCouncil |
| ValeofGlamorganCouncil |
| WakefieldCityCouncil |
| WarwickDistrictCouncil |
| WaverleyBoroughCouncil |
| WealdenDistrictCouncil |
| WelhatCouncil |
| WestLothianCouncil |
| WiganBoroughCouncil |
| WiltshireCouncil |
| WindsorAndMaidenheadCouncil |
| WokingBoroughCouncil |
| YorkCouncil |
| council | selenium_url | selenium_mode |
| AylesburyValeCouncil | None | None |
| BasingstokeCouncil | None | None |
| BathAndNorthEastSomersetCouncil | None | None |
| BCPCouncil | None | None |
| BexleyCouncil | None | None |
| BlackburnCouncil | None | None |
| BoltonCouncil | None | None |
| BristolCityCouncil | None | None |
| BromleyBoroughCouncil | None | None |
| BroxtoweBoroughCouncil | http://selenium:4444 | local |
| BuckinghamshireCouncil | http://selenium:4444 | local |
| BuryCouncil | None | None |
| CalderdaleCouncil | None | None |
| CannockChaseDistrictCouncil | None | None |
| CardiffCouncil | None | None |
| CastlepointDistrictCouncil | None | None |
| CharnwoodBoroughCouncil | None | None |
| ChelmsfordCityCouncil | None | None |
| CheshireEastCouncil | None | None |
| ConwyCountyBorough | None | None |
| CrawleyBoroughCouncil | None | None |
| CroydonCouncil | None | None |
| DerbyshireDalesDistrictCouncil | http://selenium:4444 | local |
| DoncasterCouncil | None | None |
| DurhamCouncil | None | None |
| EastCambridgeshireCouncil | None | None |
| EastDevonDC | None | None |
| EastleighBoroughCouncil | None | None |
| EastLindseyDistrictCouncil | http://selenium:4444 | local |
| EastRidingCouncil | None | None |
| EastSuffolkCouncil | http://selenium:4444 | local |
| ErewashBoroughCouncil | None | None |
| FenlandDistrictCouncil | None | None |
| GatesheadCouncil | http://selenium:4444 | local |
| GlasgowCityCouncil | None | None |
| GuildfordCouncil | None | None |
| HarrogateBoroughCouncil | None | None |
| HighPeakCouncil | http://selenium:4444 | local |
| HuntingdonDistrictCouncil | None | None |
| KingstonUponThamesCouncil | None | None |
| LancasterCityCouncil | None | None |
| LeedsCityCouncil | None | None |
| LisburnCastlereaghCityCouncil | None | None |
| LondonBoroughHounslow | None | None |
| MaldonDistrictCouncil | None | None |
| MalvernHillsDC | None | None |
| ManchesterCityCouncil | None | None |
| MertonCouncil | None | None |
| MidSussexDistrictCouncil | None | None |
| MiltonKeynesCityCouncil | None | None |
| NeathPortTalbotCouncil | http://selenium:4444 | local |
| NewarkAndSherwoodDC | None | None |
| NewcastleCityCouncil | None | None |
| NorthEastLincs | None | None |
| NorthKestevenDistrictCouncil | None | None |
| NorthLanarkshireCouncil | None | None |
| NorthLincolnshireCouncil | None | None |
| NorthNorfolkDistrictCouncil | http://selenium:4444 | local |
| NorthNorthamptonshireCouncil | None | None |
| NorthSomersetCouncil | None | None |
| NorthTynesideCouncil | None | None |
| NorthumberlandCouncil | http://selenium:4444 | local |
| PrestonCityCouncil | http://selenium:4444 | local |
| ReigateAndBansteadBoroughCouncil | http://selenium:4444 | local |
| RhonddaCynonTaffCouncil | None | None |
| RochdaleCouncil | None | None |
| RushcliffeBoroughCouncil | http://selenium:4444 | local |
| RushmoorCouncil | None | None |
| SalfordCityCouncil | None | None |
| SheffieldCityCouncil | None | None |
| SomersetCouncil | None | None |
| SouthAyrshireCouncil | None | None |
| SouthCambridgeshireCouncil | None | None |
| SouthLanarkshireCouncil | None | None |
| SouthNorfolkCouncil | None | None |
| SouthOxfordshireCouncil | None | None |
| SouthTynesideCouncil | None | None |
| StaffordshireMoorlandsDistrictCouncil | http://selenium:4444 | local |
| StHelensBC | None | None |
| StockportBoroughCouncil | None | None |
| StratfordUponAvonCouncil | None | None |
| SwaleBoroughCouncil | None | None |
| TamesideMBCouncil | None | None |
| TonbridgeAndMallingBC | None | None |
| TorbayCouncil | None | None |
| TorridgeDistrictCouncil | None | None |
| ValeofGlamorganCouncil | None | None |
| WakefieldCityCouncil | http://selenium:4444 | local |
| WarwickDistrictCouncil | None | None |
| WaverleyBoroughCouncil | None | None |
| WealdenDistrictCouncil | None | None |
| WelhatCouncil | None | None |
| WestLothianCouncil | http://selenium:4444 | local |
| WiganBoroughCouncil | None | None |
| WiltshireCouncil | None | None |
| WindsorAndMaidenheadCouncil | None | None |
| WokingBoroughCouncil | None | None |
| YorkCouncil | None | None |
20 changes: 14 additions & 6 deletions uk_bin_collection/tests/step_defs/test_validate_council.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def get_council_step(context, council_name):
logging.info(f"Validate Output: {err}")
raise (err)


@when(parsers.parse("we scrape the data from {council}"))
def scrape_step(context, council):
# When we scrape the data from <council> using <selenium_mode> and the <selenium_url> is set.
@when(parsers.parse("we scrape the data from {council} using {selenium_mode} and the {selenium_url} is set"))
def scrape_step(context, council, selenium_mode, selenium_url):
context.council = council
context.selenium_mode = selenium_mode
context.selenium_url = selenium_url

args = [council, context.metadata["url"]]

if "uprn" in context.metadata:
Expand All @@ -51,9 +54,14 @@ def scrape_step(context, council):
usrn = context.metadata["usrn"]
args.append(f"-us={usrn}")
# TODO we should somehow run this test with and without this argument passed
if "web_driver" in context.metadata:
web_driver = context.metadata["web_driver"]
args.append(f"-w={web_driver}")
# TODO I do think this would make the testing of the councils a lot longer and cause a double hit from us

# At the moment the feature file is set to local execution of the selenium so no url will be set
# And it the behave test will execute locally
if selenium_mode != 'None' and selenium_url != 'None':
if selenium_mode != 'local':
web_driver = context.metadata["web_driver"]
args.append(f"-w={web_driver}")
if "skip_get_url" in context.metadata:
args.append(f"-s")

Expand Down

0 comments on commit 709506b

Please sign in to comment.