Skip to content

Commit

Permalink
feat: add multiple house delivery (#1611)
Browse files Browse the repository at this point in the history
* add "add house" button

* add additional houses

* add ability to delete houses

* fix typos

* write test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* debug test

* fix typo

* debug test

* test a change to the test

* fix bug with deleting houses

* fix typo

* debug test

* make start not deletable

* address PR comments

* debug test

* rewrite test

* test new test

* debug test

* debug test

* debug test again

* fix typo

* Merge branch 'master' into add-multiple-house-delivery

Co-Authored-By: Florian Aucomte <f.aucomte@hotmail.co.uk>
  • Loading branch information
evemartin and faucomte97 authored May 16, 2024
1 parent b27c137 commit 8ff1ad7
Show file tree
Hide file tree
Showing 10 changed files with 301 additions and 309 deletions.
27 changes: 27 additions & 0 deletions game/end_to_end_tests/test_level_editor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By

from game.end_to_end_tests.base_game_test import BaseGameTest
from game.views.level_editor import available_blocks

Expand All @@ -17,3 +20,27 @@ def test_code_tab_blocks_load(self):
for block_type in block_types:
assert page.element_exists_by_id(f"{block_type}_checkbox")
assert page.element_exists_by_id(f"{block_type}_image")

def test_multiple_houses(self):
add_road_button = self.selenium.find_element(By.ID, "add_road")
add_road_button.click()

road_start = self.selenium.find_element(By.CSS_SELECTOR, "rect[x='130'][y='530']")
road_end = self.selenium.find_element(By.CSS_SELECTOR, "rect[x='330'][y='530']")
ActionChains(self.selenium).drag_and_drop(road_start, road_end).perform()

add_house_button = self.selenium.find_element(By.ID, "add_house")
add_house_button.click()
ActionChains(self.selenium).move_to_element(road_start).click().perform()
ActionChains(self.selenium).move_to_element(road_end).click().perform()

added_houses = self.selenium.find_elements(By.CSS_SELECTOR, "rect[fill='#0000ff']")
assert len(added_houses) == 2

delete_house_button = self.selenium.find_element(By.ID, "delete_house")
delete_house_button.click()
ActionChains(self.selenium).move_to_element(road_end).click().perform()
ActionChains(self.selenium).move_to_element(road_start).perform()

houses_after_delete = self.selenium.find_elements(By.CSS_SELECTOR, "rect[fill='#0000ff']")
assert len(houses_after_delete) == 1
26 changes: 26 additions & 0 deletions game/static/game/image/icons/add_house.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions game/static/game/image/icons/delete_house.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions game/static/game/image/icons/destination.svg

This file was deleted.

Loading

0 comments on commit 8ff1ad7

Please sign in to comment.