Seek to Beginning of Track if Playback has Finished (#448)

This commit is contained in:
Violet Caulfield
2025-07-20 07:25:22 -05:00
committed by GitHub
parent 5d9b5aecb5
commit 0de2a9a97e
6 changed files with 23 additions and 17 deletions

View File

@@ -67,7 +67,6 @@ jobs:
env:
JELLYFIN_TEST_ADDRESS: ${{ secrets.JELLYFIN_TEST_URL }}
JELLYFIN_TEST_USERNAME: ${{ secrets.JELLYFIN_TEST_USERNAME }}
JELLYFIN_TEST_PASSWORD: ${{ secrets.JELLYFIN_TEST_PASSWORD }}
steps:
- name: 🛒 Checkout
@@ -122,7 +121,7 @@ jobs:
disable-animations: false
avd-name: e2e_emulator
script: |
node scripts/maestro-android.js ${{ env.JELLYFIN_TEST_ADDRESS }} ${{ env.JELLYFIN_TEST_USERNAME }} ${{ env.JELLYFIN_TEST_PASSWORD }}
node scripts/maestro-android.js ${{ env.JELLYFIN_TEST_ADDRESS }} ${{ env.JELLYFIN_TEST_USERNAME }}
- name: Store tests result
uses: actions/upload-artifact@v4.3.4
if: always()

View File

@@ -13,20 +13,16 @@ appId: com.jellify
- hideKeyboard
- tapOn:
id: "connect_button"
- assertVisible: "Sign in to Cosmonautical"
- assertVisible: "Sign in to Cassiopeia"
- tapOn:
id: "username_input"
- inputText: "${username}"
- hideKeyboard
- tapOn:
id: "password_input"
- inputText: "${password}"
- hideKeyboard
- tapOn:
id: "sign_in_button"
- assertVisible: "Select Music Library"
- tapOn:
text: "Music"
text: "Royalty Free Music"
- tapOn:
id: "let_s_go_button"
# Close the app to ensure app is logged in

View File

@@ -9,7 +9,8 @@ appId: com.jellify
- tapOn:
id: "search-input"
- inputText: "bbno$"
- inputText: "Otis McDonald"
- hideKeyboard
- assertVisible:
id: "artist-search-result-0"

View File

@@ -72,7 +72,7 @@ appId: com.jellify
- tapOn:
text: "Sign Out"
- assertVisible:
text: "Sign out of Cosmonautical?"
text: "Sign out of Cassiopeia?"
- tapOn:
text: "Cancel"

View File

@@ -3,10 +3,10 @@ const { execSync, exec, spawn } = require('child_process')
const path = require('path')
// Read arguments from CLI
const [, , serverAddress, username, password] = process.argv
const [, , serverAddress, username] = process.argv
if (!serverAddress || !username || !password) {
console.error('Usage: node runMaestro.js <server_address> <username> <password>')
if (!serverAddress || !username) {
console.error('Usage: node runMaestro.js <server_address> <username>')
process.exit(1)
}
@@ -53,8 +53,7 @@ async function stopRecording(pid) {
const command = `${MAESTRO_PATH} test ${FLOW_PATH} \
--env server_address=${serverAddress} \
--env username=${username} \
--env password=${password}`
--env username=${username}`
const output = execSync(command, { stdio: 'inherit', env: process.env })
console.log('✅ Maestro test completed')

View File

@@ -368,9 +368,20 @@ const PlayerContextInitializer = () => {
const useTogglePlayback = useMutation({
mutationFn: async () => {
trigger('impactMedium')
if ((await TrackPlayer.getPlaybackState()).state === State.Playing)
const { state } = await TrackPlayer.getPlaybackState()
if (state === State.Playing) {
return TrackPlayer.pause()
else return TrackPlayer.play()
}
const { duration, position } = await TrackPlayer.getProgress()
// if the track has ended, seek to start and play
if (duration <= position) {
await TrackPlayer.seekTo(0)
}
return TrackPlayer.play()
},
})