Skip to content

test: Add system tests for exercise administration #3008

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

arkirchner
Copy link
Contributor

The exercise administration form is a critical pass. The test will secure the functionality with the upcoming changes.

Relates to #2922

@arkirchner arkirchner self-assigned this Jul 8, 2025
@arkirchner arkirchner added the ruby Pull requests that update Ruby code label Jul 8, 2025
@arkirchner arkirchner force-pushed the ak/system_test_exercise_form branch 2 times, most recently from e2d0d2a to 1deabb1 Compare July 8, 2025 14:08
end
end

def chosen_select(name, value)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I want to keep the helper methods directly in the test. If further system tests need them, I would consider extracting them.

Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.20%. Comparing base (5acecc4) to head (3503961).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3008      +/-   ##
==========================================
+ Coverage   70.05%   70.20%   +0.15%     
==========================================
  Files         215      215              
  Lines        6846     6901      +55     
==========================================
+ Hits         4796     4845      +49     
- Misses       2050     2056       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arkirchner arkirchner marked this pull request as ready for review July 8, 2025 14:20
The exercise administration form is a critical pass. The test
will secure the functionality with the upcoming changes.

Relates to #2922
@arkirchner arkirchner force-pushed the ak/system_test_exercise_form branch from 1deabb1 to 5b124c0 Compare July 9, 2025 11:24
@arkirchner arkirchner requested a review from kkoehn July 15, 2025 07:50
Copy link
Contributor

@kkoehn kkoehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look good to me in general, I added a few nit-picky comments and suggestions

Comment on lines +50 to +52
within('.markdown-editor__wrapper') do
find('.ProseMirror').set(description)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these very specific class selectors might cause brittleness in the future if a refactoring is upcoming

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at this again. I hoped to find something like role="textbox" and/or aria-label="Description". But I cannot find anything that would be considered expected. I have no practical solution here.

I don't want to make any any UI change in this PR. Eventually I want to make the form accessible to screen readers. That would resolve the issues with testing.

For now I want to use this brittle implementation until we can make this page accessible. 🤔


click_button I18n.t('shared.create', model: Exercise.model_name.human)

expect(page).to have_text 'Exercise has successfully been created.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also use a translation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I overlooked this. Fixed!

Comment on lines 101 to 102
let!(:exercise) { create(:fibonacci) }
let(:teacher) { exercise.user }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let!(:exercise) { create(:fibonacci) }
let(:teacher) { exercise.user }
let!(:exercise) { create(:fibonacci, user: teacher) }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move the teacher declaration to the outer scope (and assign the user in the exercise directly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Thank you! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants