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

Deck options test #17550

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

Conversation

Arthur-Milchior
Copy link
Member

This PR contains #17315 plus one commit for tests.
I've no idea why those tests used to pass when I created the PR for the first time, but now they fail. I'd appreciate some help if anyone has any idea how to tap on the "Deck options" entry of the context menu opened by long pressing a deck

I also remove `OnPageFinishedCallback` because I don't really see the
point in this list in Kotlin. I keep the interface as it's used in AbstractFlashcardViewer.
The names were far from clear
`bridgeCommand` is the general process by which Anki's webview send
command to the webview's owner. In Anki, it's interpreted by
Python. In AnkiDroid it must be interpreted by Kotlin.

Currently, the only `bridgeCommand` we listen to are in
CongratsPage. And I'm really thankful `@BrayanDSO` for creating this
first usage!

When anki 24.10 beta 2 is used in ankidroid, the DeckOptions will also
send `bridgeCommand`. And, I expect that when we'll use more webview,
more `bridgeCommand` will arrive.

So, I decided to generalize Brayan's code and ensure that there is a
simple map that any PageFragment can override that would allow to
declare its `bridgeCommand` without needing to add copy
`CongratsPage`'s code.

I tested this manually, and the CongratsPage's button still works.
This use a recent change introduced upstream.

Unit test can't run the webview. So it has to be replaced by
instrumented tests.

Test fails on CI while working locally, so I have to assume it's not
CI.
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

how to tap on the "Deck options" entry of the context menu opened by long pressing a deck

Those views are in a dialog so you need to scope the Espresso search to the dialog's window. Example from the HelpDialogTest class:

onView(withText(R.string.help_title_community)).inRoot(isDialog()).perform(click())

@@ -43,6 +43,8 @@ androidxSqlite = "2.4.0"
androidxSwipeRefreshLayout = "1.1.0"
# https://developer.android.com/jetpack/androidx/releases/test
androidxTest = "1.6.1"
# https://developer.android.com/training/testing/espresso/web
androidxTestEspressoWeb = "3.6.1"
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed we already have the espresso version number(all espresso artifacts use the same version).

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author Blocked by dependency Currently blocked by some other dependent / related change labels Dec 5, 2024
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked by dependency Currently blocked by some other dependent / related change Has Conflicts Needs Author Reply Waiting for a reply from the original author Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants