Skip to content

Commit

Permalink
[CONTENT] Split keywords into adventures (hedyorg#4184)
Browse files Browse the repository at this point in the history
Splits new keywords into separate adventures allowing for a better flow in the learning trajectory, f.e. in level 2 is, ask and sleep get their own tabs:

<img width="1469" alt="image" src="https://github.com/hedyorg/hedy/assets/1003685/779dc616-ef73-459e-92f5-5d62cd9bece7">
  • Loading branch information
MarleenGilsing authored May 25, 2023
1 parent 42c9378 commit 7bb7195
Show file tree
Hide file tree
Showing 6 changed files with 1,006 additions and 496 deletions.
1,426 changes: 949 additions & 477 deletions content/adventures/en.yaml

Large diffs are not rendered by default.

60 changes: 45 additions & 15 deletions hedy_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
ADVENTURE_ORDER_PER_LEVEL = {
1: [
'default',
'print_command',
'ask_command',
'parrot',
'rock',
'haunted',
Expand All @@ -62,27 +64,34 @@
],
2: [
'default',
'is_command',
'rock',
'ask_command',
'rock_2',
'haunted',
'sleep_command',
'parrot',
'story',
'haunted',
'restaurant',
'turtle'
],
3: [
'default',
'dishes',
'rock',
'random_command',
'dice',
'rock',
'fortune',
'turtle',
'story',
'restaurant',
'add_remove_command',
'parrot',
'dishes',
'story',
'haunted',
'restaurant'
'turtle'
],
4: [
'default',
'quotation_marks',
'rock',
'dice',
'dishes',
Expand All @@ -95,20 +104,23 @@
],
5: [
'default',
'if_command',
'language',
'dice',
'dishes',
'story',
'rock',
'pressit',
'parrot',
'turtle',
'haunted',
'in_command',
'restaurant',
'fortune'
'fortune',
'pressit',
'turtle'
],
6: [
'default',
'maths',
'songs',
'dice',
'dishes',
Expand All @@ -119,46 +131,55 @@
],
7: [
'default',
'repeat_command',
'story',
'songs',
'dishes',
'pressit',
'dice',
'repeat_command_2',
'fortune',
'restaurant'
'restaurant',
'pressit'
],
8: [
'default',
'story',
'repeat_command',
'fortune',
'repeat_command_2',
'songs',
'if_command',
'story',
'haunted',
'restaurant',
'turtle'
],
9: [
'default',
'repeat_command',
'rock',
'story',
'pressit',
'calculator',
'restaurant',
'haunted',
'pressit',
'turtle'
],
10: [
'default',
'for_command',
'dishes',
'fortune',
'rock',
'dice',
'fortune',
'harry_potter',
'songs',
'story',
'rock',
'calculator',
'restaurant',
],
11: [
'default',
'for_command',
'years',
'calculator',
'songs',
Expand All @@ -167,6 +188,8 @@
],
12: [
'default',
'maths',
'quotation_marks',
'story',
'fortune',
'songs',
Expand All @@ -177,6 +200,7 @@
],
13: [
'default',
'and_or_command',
'secret',
'story',
'rock',
Expand All @@ -186,6 +210,7 @@
],
14: [
'default',
'is_command',
'haunted',
'calculator',
'piggybank',
Expand All @@ -194,6 +219,7 @@
],
15: [
'default',
'while_command',
'restaurant',
'story',
'dice',
Expand All @@ -203,17 +229,21 @@
],
16: [
'default',
'random_command',
'haunted',
'songs',
'language'
],
17: [
'default',
'print_command',
'elif_command',
'tic',
'blackjack'
],
18: [
'default',
'print_command',
'story',
'songs'
]
Expand Down
1 change: 1 addition & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = defineConfig({
recover_page: '/recover',
hedy_page: '/hedy',
hedy_level2_page: '/hedy/2',
adventure_page: '/hedy/1#print_command',
admin_page: '/admin',
admin_users_page: '/admin/users',
teachers_page: '/for-teachers',
Expand Down
6 changes: 3 additions & 3 deletions tests/cypress/e2e/hedy_page/syntax_highlighting.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { loginForUser } from "../tools/login/login";
import { goToHedyPage } from "../tools/navigation/nav";
import { goToHedyPage, goToAdventurePage } from "../tools/navigation/nav";

describe('The Hedy level 1 page', () => {
describe('The Hedy level 1 print adventure page', () => {
beforeEach(() => {
goToHedyPage();
goToAdventurePage();
});

it('has the word print highlighted in examples', () => {
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/e2e/tools/navigation/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export function goToHedyPage()
return goToPage(Cypress.env('hedy_page'));
}

export function goToAdventurePage()
{
return goToPage(Cypress.env('adventure_page'));
}

export function goToProfilePage()
{
return goToPage(Cypress.env('profile_page'));
Expand Down
4 changes: 3 additions & 1 deletion tests/test_snippets/test_adventures.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ class TestsAdventurePrograms(HedyTester):

@parameterized.expand(Hedy_snippets, skip_on_empty=True)
def test_adventures(self, name, snippet):
keywords = ['Introduction']

if snippet is not None and len(snippet.code) > 0:
if snippet is not None and len(snippet.code) > 0 and snippet.adventure_name not in keywords:
try:
self.single_level_tester(
code=snippet.code,
Expand All @@ -149,6 +150,7 @@ def test_adventures(self, name, snippet):
error_message = error_message.replace('<span class="command-highlighted">', '`')
error_message = error_message.replace('</span>', '`')
print(f'\n----\n{snippet.code}\n----')
print(f'from adventure {snippet.adventure_name}')
print(f'in language {snippet.language} from level {snippet.level} gives error:')
print(f'{error_message} at line {location}')
raise E

0 comments on commit 7bb7195

Please sign in to comment.