Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 0 additions & 8 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ jobs:
- name: Run Playwright E2E tests
run: BASE_URL=http://localhost:5000 pytest e2e/ -v

- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7

- name: Stop services
if: always()
run: docker compose down
6 changes: 3 additions & 3 deletions e2e/test_exercise_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Helpers
# ---------------------------------------------------------------------------

def _load_prebuilt_exercise(page, base_url, exercise_file="robotrain.json"):
def _load_prebuilt_exercise(page, base_url, exercise_file="equivalent.json"):
"""Navigate to the predefined exercise page for a prebuilt JSON file."""
page.goto(f"{base_url}/exercise/predefined?sourceuri=preload:{exercise_file}")
page.wait_for_selector("#questions")
Expand Down Expand Up @@ -44,7 +44,7 @@ def _answer_and_advance(page):
"""Select the first radio option, check the answer, then click Next."""
visible = page.locator(".question:visible")
# Remember the current question number so we can detect advance
text = visible.locator("small.text-muted").inner_text()
text = visible.locator(".question-counter").inner_text()
m = re.search(r"Question (\d+) of (\d+)", text)
current_q = int(m.group(1))
total_q = int(m.group(2))
Expand All @@ -66,7 +66,7 @@ def _answer_and_advance(page):
f"""(() => {{
const vis = document.querySelector('.question:not([style*="display: none"])');
if (!vis) return false;
const t = vis.querySelector('small.text-muted')?.textContent || '';
const t = vis.querySelector('.question-counter')?.textContent || '';
const m = t.match(/Question (\\d+) of/);
return m && parseInt(m[1]) > {current_q};
}})()""",
Expand Down
31 changes: 0 additions & 31 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,37 +1081,6 @@ def generate_new_name():



@app.route('/entryexitticket/<ticket>')
@login_required
def entryexitticket(ticket):
userId = getUserName()
if not userId:
return "USER ID IS NOT SET, PLEASE RELOAD THE PAGE."

uidlen = len(userId)
choices = ["preload:robotrain-odd.json", "preload:robotrain-even.json"]

entry_index = uidlen % 2
exit_index = (uidlen + 1) % 2

if ticket == "entry":
return robotrain(choices[entry_index], exercise_name = "robotrain-entry")
elif ticket == "exit":
return robotrain(choices[exit_index], exercise_name = "robotrain-exit")
else:
return "Invalid ticket type."

def robotrain(sourceuri, exercise_name):
try:
data = exerciseprocessor.load_questions_from_sourceuri(sourceuri, app.static_folder)
data = exerciseprocessor.randomize_questions(data)
data = exerciseprocessor.change_traces_to_render_data(data, literals = ["e", "h"])
except Exception as e:
print(e)
return "Error loading exercise"
return render_template('/prebuiltexercises/robotrain.html', uid = getUserName(), questions=data, exercise_name=exercise_name)


###### Stepper routes ######

@app.route('/stepper', methods=['GET', 'POST'])
Expand Down
1 change: 1 addition & 0 deletions src/static/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
background-color: rgba(0, 0, 0, 0.05); /* Change this color as needed */
}


.trace-option-label {
cursor: pointer;
}
Expand Down
Loading
Loading