Skip to content

AO3-7214 AO3-7215 Bookmark Javascript Improvement#5499

Open
ReverM wants to merge 27 commits intootwcode:masterfrom
ReverM:AO3-7215
Open

AO3-7214 AO3-7215 Bookmark Javascript Improvement#5499
ReverM wants to merge 27 commits intootwcode:masterfrom
ReverM:AO3-7215

Conversation

@ReverM
Copy link
Contributor

@ReverM ReverM commented Dec 10, 2025

Issue

https://otwarchive.atlassian.net/browse/AO3-7214
https://otwarchive.atlassian.net/browse/AO3-7215

Purpose

This adresses both tickets 7214 and 7215 by making all buttons that could edit a bookmark disappear when the form is open, by allowing a closed form to be reopened (7215) and by fixing the opening and closing of multiple forms at the same time.
7214 was fixed by removing the variables and jquerying the appropriate component each time the form is closed or reopened.
7215 was fixed by changing the href of the opening buttons as part of the closing event, as well as changing the id to a class so every element is affected at the same time.

Credit

Danaël / Rever ( they / he )

Jira account goes by Danaël Villeneuve

ReverM and others added 8 commits December 4, 2025 10:37
Changed id to class so that every button that can do one feature behaves the same and changed the organisation of the jquery
Since the new tests have been moved to their new feature file to test javascript feature these are not needed
@ReverM
Copy link
Contributor Author

ReverM commented Dec 10, 2025

Appologies if having multiple ticket in one PR is bad etiquette. I decided to put both in the same PR, as they were extremely closely related, and would likely be waiting on each other if done separately.

@slavalamp
Copy link
Contributor

slavalamp commented Dec 10, 2025

yeah, putting two tickets in one pr is fine when it's exact the same fix for both

though the pr name should begin like this: "AO3-7214 AO3-7215"

@ReverM ReverM changed the title AO3 7214 + 7215 Bookmark Javascript Improvement AO3-7214 AO3-7215 Bookmark Javascript Improvement Dec 10, 2025
@ReverM
Copy link
Contributor Author

ReverM commented Dec 10, 2025

though the pr name should begin like this: "AO3-7214 AO3-7215"

Changed the PR name accordingly

Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! In addition to the question I left on the JavaScript file, I think you also need to changeid to class for the buttons in the bookmarkable_blurb, which is used for pages where we show multiple bookmarks under a single item, e.g., a tag's bookmark listing.

@ReverM
Copy link
Contributor Author

ReverM commented Jan 8, 2026

I pushed changes to the gemfile.lock by accident. Disregard the Gem Updates tag

@ReverM ReverM requested a review from sarken January 8, 2026 21:08
@ReverM
Copy link
Contributor Author

ReverM commented Jan 14, 2026

Gonna put this to draft while I add the rest of the test coverage.

@ReverM
Copy link
Contributor Author

ReverM commented Jan 15, 2026

Some of the steps in the test are very inconsistent. I'm unsure what could be the cause. Is cucumber not the best friend with javascript? They overall seem very flaky. What could be explaining this?

@ReverM ReverM marked this pull request as ready for review January 15, 2026 21:12
@ReverM
Copy link
Contributor Author

ReverM commented Jan 15, 2026

I shall put this as ready for review as I do not understand why the step fails in the test.

Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

Our JavaScript tests do tend to be flaky, unfortunately. If these continue to be a problem, we can update our list of known test failures to mention features/bookmarks when they're merged.

Comment on lines 2 to 5
Feature: Edit bookmarks with javascript enabled
In order to have a good user experience
As a humble user
I want to be able to edit bookmarks with javascript enabled
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would probably be a good idea to change this section to talk about both creating and editing now that we have some tests for both.

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'm unsure where exactly to put this, but for some reason, clicking on the bookmark link with javascript enabled doesnt work on github. It's one that's flaky on my end, but it's consistently not working on github. Is there an alternate way to setup pre-existing bookmarks with cucumber without passing by steps?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I had the exact opposite problem: I was having consistent local failures, but it was working more often than not on GitHub Actions. The second scenario still doesn't pass locally for me even with the changes here, but we can live with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What step exactly fails?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I should see "Bookmark" within "#main .navigation" in features/bookmarks/bookmark_javascript.feature:13

Copy link
Contributor Author

@ReverM ReverM Jan 23, 2026

Choose a reason for hiding this comment

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

I was looking at the documentation of Capybara, and it seemed to say to use js: true to switch to the Capybara.javascript_driver. This is not something we seem to be doing, so could this explain the flakiness of the javascript tests? https://github.com/teamcapybara/capybara#using-capybara-with-rspec

We currently have the hook before "@javascript" do which changes the host and set the javascript variable to true (so that the website renders with javascript), but no driver change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately, no. That section is about RSpec, but these are Cucumber tests, which are discussed in the previous section. Using the @javascript tag in our tests automatically switches to the JavaScript driver, which is defined in our config:

Capybara.javascript_driver = :selenium_chrome_headless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you address the comment at the very top of this thread (the one about updating the description)? Then this will be ready to merge! 🎉

Given how consistently the I bookmark the work X step seemed to be, I decided to add a new step definition. I could combine it with the previous one if that is simpler (as they are quite similar)
Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

Just a few little things left, most of which are from Reviewdog! Thank you so much for working on this; I'm sorry it turned out to be so much more complicated than it looked.

Comment on lines 2 to 5
Feature: Edit bookmarks with javascript enabled
In order to have a good user experience
As a humble user
I want to be able to edit bookmarks with javascript enabled
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had the exact opposite problem: I was having consistent local failures, but it was working more often than not on GitHub Actions. The second scenario still doesn't pass locally for me even with the changes here, but we can live with that.

Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants