Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: python den levels page #1702

Merged
merged 73 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3b7c860
begin work on levels page
evemartin Jul 24, 2024
f833c7e
continue work on levels page
evemartin Jul 25, 2024
b9fd549
make UI changes, revert URL changes
evemartin Jul 26, 2024
4c5f568
more work on levels page
evemartin Jul 29, 2024
5a231db
more work on levels page
evemartin Aug 12, 2024
18b9fa1
add variable to track page path
evemartin Aug 12, 2024
075fa04
make levels page buttons conditional
evemartin Aug 12, 2024
de431c6
Merge branch 'master' into python-den-levels-page
evemartin Aug 12, 2024
18402a8
fix migrations
evemartin Aug 12, 2024
461afbf
debug with small changes
evemartin Aug 12, 2024
91a905d
update url ending
evemartin Aug 13, 2024
a5cbafd
reset unneeded changes
evemartin Aug 13, 2024
2df233f
debug test
evemartin Aug 13, 2024
c07f51b
test the test
evemartin Aug 13, 2024
c4cd95f
fix typo
evemartin Aug 13, 2024
74dbfff
test out something new
evemartin Aug 13, 2024
1d3be9b
undo previous changes
evemartin Aug 13, 2024
db86a9d
test change to test settings
evemartin Aug 14, 2024
bbb7242
add level urls
evemartin Aug 14, 2024
c8c5fdc
make small updates
evemartin Aug 14, 2024
8ecc1dc
merge master for real
evemartin Aug 15, 2024
2035ead
fix conflicting migrations
evemartin Aug 15, 2024
e54d9af
continue work on levels page and python den general setup
evemartin Aug 15, 2024
9044510
continue work on levels page
evemartin Aug 16, 2024
e8223fa
fix types
evemartin Aug 16, 2024
d8a3251
clean up tests, add episode urls to python den
evemartin Aug 16, 2024
61ac248
make some more episode url changes
evemartin Aug 16, 2024
1cc61f5
Merge master
faucomte97 Aug 20, 2024
6278f38
Optimise migrations
faucomte97 Aug 22, 2024
5d3d9cb
Fix URLs and everything related to that
faucomte97 Aug 23, 2024
598e9e9
Install portal branch
faucomte97 Aug 23, 2024
9da6723
Final fixes for URLs and tests
faucomte97 Aug 23, 2024
5ab3b79
Add redirection popup
faucomte97 Aug 23, 2024
7911dad
Final resource amendments
faucomte97 Aug 23, 2024
6e428f7
Install latest portal
faucomte97 Aug 23, 2024
49de87e
Final optimisations
faucomte97 Aug 23, 2024
bfc72d9
Increase link fields lengths
faucomte97 Aug 23, 2024
03b86fa
Black
faucomte97 Aug 27, 2024
de0a435
change redirect behavior for level-less episodes
evemartin Aug 27, 2024
98225ca
run black, write test, fix test
evemartin Aug 27, 2024
7f51600
fix test
evemartin Aug 27, 2024
70b5444
fix test syntax
evemartin Aug 27, 2024
8610d3a
fix test syntax
evemartin Aug 27, 2024
2fc630b
fix test syntax
evemartin Aug 27, 2024
3c58bd3
fix test syntax
evemartin Aug 27, 2024
bde7d0e
fix test syntax
evemartin Aug 27, 2024
0490f7d
fix test syntax
evemartin Aug 27, 2024
f6678d0
remove function call
evemartin Aug 27, 2024
5582d35
fix test
evemartin Aug 27, 2024
dd9a5c9
fix test
evemartin Aug 27, 2024
2109ad8
attempt fix syntax
evemartin Aug 27, 2024
e1ca2a7
check for visibility instead
evemartin Aug 27, 2024
bd59090
try to fix test
evemartin Aug 28, 2024
8e350a5
add test to test
evemartin Aug 28, 2024
a07bb3f
test the test
evemartin Aug 28, 2024
6c192f1
test the test
evemartin Aug 28, 2024
fca2cac
test the test
evemartin Aug 28, 2024
8ab8276
go straight to path
evemartin Aug 28, 2024
006cb46
fix path
evemartin Aug 28, 2024
0e58c1c
import reverse
evemartin Aug 28, 2024
d47f89b
define and use new function
evemartin Aug 28, 2024
a55d1c8
update check slightly
evemartin Aug 28, 2024
9717866
try checking different attribute
evemartin Aug 28, 2024
c25b25c
fix playthrough test
evemartin Aug 28, 2024
d781dc0
add specific redirecting check
evemartin Aug 28, 2024
ed8123d
run black
evemartin Aug 28, 2024
ceadcb0
fix some resource links
evemartin Aug 28, 2024
99efa2c
update levels used in locked levels test
evemartin Aug 28, 2024
0681827
fix next level button
evemartin Aug 28, 2024
0e1fe86
address PR feedback
evemartin Aug 28, 2024
df00a0f
rename level
evemartin Aug 28, 2024
ad09f77
change strange descriptions, fix misplaced episode
evemartin Aug 28, 2024
038f65f
fix playthrough test
evemartin Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example_project/rapid_router_test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
STATICFILES_DIRS = [os.path.join(BASE_DIR, "game/static")]

SECRET_KEY = "bad_test_secret"
ROOT_URLCONF = "example_project.urls"
ROOT_URLCONF = "urls"

WSGI_APPLICATION = "wsgi.application"

Expand Down
2 changes: 2 additions & 0 deletions example_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from portal import urls as portal_urls

from game import urls as game_urls
from game import python_den_urls

admin.autodiscover()

urlpatterns = [
url(r"^", include(portal_urls)),
path("administration/", admin.site.urls),
url(r"^rapidrouter/", include(game_urls)),
url(r"^pythonden/", include(python_den_urls)),
]
78 changes: 35 additions & 43 deletions game/end_to_end_tests/base_game_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ def _go_to_path(self, path):
else:
break

def _complete_level(self, level_number, **kwargs):
page = self.go_to_level(level_number)
self.complete_and_check_level(level_number, page, **kwargs)
def _complete_level(self, level_number, from_python_den=False, **kwargs):
page = self.go_to_level(level_number, from_python_den)
(self.complete_and_check_level(level_number, page, from_python_den, **kwargs))

def complete_and_check_level(
self,
level_number,
page,
from_python_den=False,
next_episode=None,
redirects=False,
check_algorithm_score=True,
check_route_score=True,
final_level=False,
Expand All @@ -60,18 +62,21 @@ def complete_and_check_level(
if check_algorithm_score:
page.assert_algorithm_score(10)
if check_route_score:
if level_number < 13:
if level_number < 13 and not from_python_den:
page.assert_route_score(20)
else:
page.assert_route_score(10)
if final_level:
return page
if next_episode is None:
page.next_level()
page.assert_level_number(level_number + 1)
if redirects:
page.next_level_redirected(from_python_den)
else:
page.next_level(from_python_den)
page.assert_level_number(level_number + 1, from_python_den)
else:
page.next_episode()
page.assert_episode_number(next_episode)
page.assert_episode_number(next_episode, from_python_den)
return page

def go_to_reverse(self, url_reverse):
Expand All @@ -84,14 +89,26 @@ def go_to_homepage(self):
self._go_to_path(path)
return HomePage(self.selenium)

def go_to_level(self, level_name):
path = reverse(
"play_default_level", kwargs={"levelName": str(level_name)}
def go_to_level(self, level_name, from_python_den=False):
viewname = (
"play_python_default_level" if from_python_den else "play_default_level"
)

path = reverse(viewname, kwargs={"level_name": str(level_name)})
self._go_to_path(path)

return GamePage(self.selenium)

def go_to_level_without_dismissing_dialog(self, level_name, from_python_den=False):
viewname = (
"play_python_default_level" if from_python_den else "play_default_level"
)

path = reverse(viewname, kwargs={"level_name": str(level_name)})
self._go_to_path(path)

return BasePage(self.selenium)

def go_to_custom_level(self, level):
path = reverse("play_custom_level", kwargs={"levelId": str(level.id)})
self._go_to_path(path)
Expand All @@ -104,7 +121,10 @@ def go_to_level_editor(self):
return EditorPage(self.selenium)

def go_to_episode(self, episodeId):
path = reverse("start_episode", kwargs={"episodeId": str(episodeId)})
if int(episodeId) > 9:
path = reverse("start_python_episode", kwargs={"episodeId": str(episodeId)})
else:
path = reverse("start_episode", kwargs={"episodeId": str(episodeId)})
self._go_to_path(path)

return GamePage(self.selenium)
Expand All @@ -119,41 +139,17 @@ def try_again_if_not_full_score_test(self, level, workspace_file):

workspace_id = self.use_workspace(workspace_file, user_profile)

return (
self.go_to_level(level)
.load_solution(workspace_id)
.run_retry_program()
)
return self.go_to_level(level).load_solution(workspace_id).run_retry_program()

def run_crashing_test(self, level, workspace_file):
user_profile = self.login_once()

workspace_id = self.use_workspace(workspace_file, user_profile)

return (
self.go_to_level(level)
.load_solution(workspace_id)
.run_crashing_program()
self.go_to_level(level).load_solution(workspace_id).run_crashing_program()
)

def run_python_commands_test(self, level):
return self.go_to_level(level).check_python_commands()

def run_clear_console_test(self, level):
return self.go_to_level(level).write_to_then_clear_console()

def run_console_parse_error_test(self, level):
return self.go_to_level(level).run_parse_error_program()

def run_console_attribute_error_test(self, level):
return self.go_to_level(level).run_attribute_error_program()

def run_console_print_test(self, level):
return self.go_to_level(level).run_print_program()

def run_invalid_import_test(self, level):
return self.go_to_level(level).run_invalid_import_program()

def run_animal_sound_horn_test(self, level):
return self.go_to_custom_level(level).run_animal_sound_horn_program()

Expand Down Expand Up @@ -228,9 +224,7 @@ def login_once(self):
login_page = self.go_to_homepage().go_to_teacher_login_page()
login_page.login(email, password)
email = email
BaseGameTest.user_profile = UserProfile.objects.get(
user__email=email
)
BaseGameTest.user_profile = UserProfile.objects.get(user__email=email)

BaseGameTest.already_logged_on = True

Expand All @@ -247,9 +241,7 @@ def tearDownClass(cls):
BaseGameTest.already_logged_on = False

def solution_file_path(self, filename):
return os.path.join(
BaseGameTest.BLOCKLY_SOLUTIONS_DIR, filename + ".xml"
)
return os.path.join(BaseGameTest.BLOCKLY_SOLUTIONS_DIR, filename + ".xml")

def read_solution(self, filename):
path = self.solution_file_path(filename)
Expand Down
Loading
Loading