mirror of
https://github.com/Jellify-Music/App.git
synced 2025-12-30 23:39:51 -06:00
Seek to Beginning of Track if Playback has Finished (#448)
This commit is contained in:
3
.github/workflows/maestro-test.yml
vendored
3
.github/workflows/maestro-test.yml
vendored
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,8 @@ appId: com.jellify
|
||||
|
||||
- tapOn:
|
||||
id: "search-input"
|
||||
- inputText: "bbno$"
|
||||
- inputText: "Otis McDonald"
|
||||
- hideKeyboard
|
||||
|
||||
- assertVisible:
|
||||
id: "artist-search-result-0"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user