From 6e1e296dafd3882e0b06e33eea54233ddfa01025 Mon Sep 17 00:00:00 2001 From: TL Date: Fri, 12 Jul 2024 16:48:18 +0200 Subject: [PATCH] delay in tests --- src/SpotifyConnect/SPOCTestApiNext.class.st | 7 ++- src/SpotifyConnect/SPOCTestApiPause.class.st | 3 +- src/SpotifyConnect/SPOCTestApiPlay.class.st | 33 ++++++++++ .../SPOCTestApiPrevious.class.st | 2 +- .../SPOCTestApiSwitchDevice.class.st | 3 +- src/SpotifyConnect/SPOCTestPlay.class.st | 60 ------------------- 6 files changed, 42 insertions(+), 66 deletions(-) delete mode 100644 src/SpotifyConnect/SPOCTestPlay.class.st diff --git a/src/SpotifyConnect/SPOCTestApiNext.class.st b/src/SpotifyConnect/SPOCTestApiNext.class.st index 547dac9..beda9d6 100644 --- a/src/SpotifyConnect/SPOCTestApiNext.class.st +++ b/src/SpotifyConnect/SPOCTestApiNext.class.st @@ -10,7 +10,7 @@ Class { { #category : #running, - #'squeak_changestamp' : 'TL 7/12/2024 16:18' + #'squeak_changestamp' : 'TL 7/12/2024 16:45' } SPOCTestApiNext >> setUp [ @@ -33,14 +33,15 @@ SPOCTestApiNext >> testApiNextExecute [ { #category : #testing, - #'squeak_changestamp' : 'TL 6/24/2024 02:08' + #'squeak_changestamp' : 'TL 7/12/2024 16:35' } SPOCTestApiNext >> testSkipToNextOn [ | oldPlaybackState newPlaybackState | oldPlaybackState := self getPlaybackState. self apiEndpoint skipToNextOn: oldPlaybackState device id. + (Delay forSeconds: 0.6) wait. newPlaybackState := self getPlaybackState. - "self assert: newPlaybackState track id ~= oldPlaybackState track id." + self assert: newPlaybackState track id ~= oldPlaybackState track id. self assert: newPlaybackState isPlaying ] diff --git a/src/SpotifyConnect/SPOCTestApiPause.class.st b/src/SpotifyConnect/SPOCTestApiPause.class.st index 624b53a..a8007fb 100644 --- a/src/SpotifyConnect/SPOCTestApiPause.class.st +++ b/src/SpotifyConnect/SPOCTestApiPause.class.st @@ -37,10 +37,11 @@ SPOCTestApiPause >> testApiPauseExecute [ { #category : #testing, - #'squeak_changestamp' : 'TL 6/24/2024 01:53' + #'squeak_changestamp' : 'TL 7/12/2024 16:39' } SPOCTestApiPause >> testPauseOn [ self apiEndpoint pauseOn: self getPlaybackState device id. + (Delay forSeconds: 0.6) wait. self assert: self getPlaybackState isPlaying not ] diff --git a/src/SpotifyConnect/SPOCTestApiPlay.class.st b/src/SpotifyConnect/SPOCTestApiPlay.class.st index 4186728..d99ffb5 100644 --- a/src/SpotifyConnect/SPOCTestApiPlay.class.st +++ b/src/SpotifyConnect/SPOCTestApiPlay.class.st @@ -80,3 +80,36 @@ SPOCTestApiPlay >> testApiPlayTrackwithPlaylistExecute [ res := self apiEndpoint execute: dict. self assert: res response code = 204 ] + +{ + #category : #testing, + #'squeak_changestamp' : 'TL 7/12/2024 16:40' +} +SPOCTestApiPlay >> testPlayTrackOn [ + + | playbackState | + self apiEndpoint playTrack: '4PTG3Z6ehGkBFwjybzWkR8' on: self getPlaybackState device id. + (Delay forSeconds: 0.6) wait. + playbackState := self getPlaybackState. + self assert: playbackState track id = '4PTG3Z6ehGkBFwjybzWkR8'. + self assert: playbackState isPlaying + +] + +{ + #category : #testing, + #'squeak_changestamp' : 'TL 7/12/2024 16:41' +} +SPOCTestApiPlay >> testPlayTrackWithAlbumOn [ + + | playbackState | + self apiEndpoint playTrack: '4PTG3Z6ehGkBFwjybzWkR8' + withAlbum: '6eUW0wxWtzkFdaEFsTJto6' + on: self getPlaybackState device id. + (Delay forSeconds: 0.6) wait. + playbackState := self getPlaybackState. + self assert: playbackState track id = '4PTG3Z6ehGkBFwjybzWkR8'. + self assert: playbackState track album id = '6eUW0wxWtzkFdaEFsTJto6'. + self assert: playbackState isPlaying + +] diff --git a/src/SpotifyConnect/SPOCTestApiPrevious.class.st b/src/SpotifyConnect/SPOCTestApiPrevious.class.st index 5eace7f..cc7ac0d 100644 --- a/src/SpotifyConnect/SPOCTestApiPrevious.class.st +++ b/src/SpotifyConnect/SPOCTestApiPrevious.class.st @@ -10,7 +10,7 @@ Class { { #category : #running, - #'squeak_changestamp' : 'TL 6/24/2024 03:21' + #'squeak_changestamp' : 'TL 7/12/2024 16:45' } SPOCTestApiPrevious >> setUp [ diff --git a/src/SpotifyConnect/SPOCTestApiSwitchDevice.class.st b/src/SpotifyConnect/SPOCTestApiSwitchDevice.class.st index ceba3e3..8225b3c 100644 --- a/src/SpotifyConnect/SPOCTestApiSwitchDevice.class.st +++ b/src/SpotifyConnect/SPOCTestApiSwitchDevice.class.st @@ -33,12 +33,13 @@ SPOCTestApiSwitchDevice >> testApiSwitchDeviceExecute [ { #category : #testing, - #'squeak_changestamp' : 'TL 6/24/2024 02:05' + #'squeak_changestamp' : 'TL 7/12/2024 16:39' } SPOCTestApiSwitchDevice >> testSwitchDeviceTo [ | newDeviceID | newDeviceID := self getPlaybackState device id. self apiEndpoint switchDeviceTo: newDeviceID. + (Delay forSeconds: 0.6) wait. self assert: self getPlaybackState device id = newDeviceID ] diff --git a/src/SpotifyConnect/SPOCTestPlay.class.st b/src/SpotifyConnect/SPOCTestPlay.class.st deleted file mode 100644 index f463499..0000000 --- a/src/SpotifyConnect/SPOCTestPlay.class.st +++ /dev/null @@ -1,60 +0,0 @@ -" -Test Play API request. -" -Class { - #name : #SPOCTestPlay, - #superclass : #SPOCTestCaseWithAuth, - #category : #'SpotifyConnect-Auth-Tests', - #'squeak_changestamp' : 'OW 7/9/2024 10:44' -} - -{ - #category : #running, - #'squeak_changestamp' : 'TL 6/24/2024 03:21' -} -SPOCTestPlay >> setUp [ - - self apiEndpoint: (SPOCApiPlay new authorizer: self auth) -] - -{ - #category : #testing, - #'squeak_changestamp' : 'TL 6/24/2024 02:30' -} -SPOCTestPlay >> testPlayOn [ - - self apiEndpoint playOn: self getPlaybackState device id. - self assert: self getPlaybackState isPlaying -] - -{ - #category : #testing, - #'squeak_changestamp' : 'TL 7/12/2024 16:28' -} -SPOCTestPlay >> testPlayTrackOn [ - - | playbackState | - self apiEndpoint playTrack: '4PTG3Z6ehGkBFwjybzWkR8' on: self getPlaybackState device id. - (Delay forSeconds: 0.6) wait. - playbackState := self getPlaybackState. - self assert: playbackState track id = '4PTG3Z6ehGkBFwjybzWkR8'. - self assert: playbackState isPlaying - -] - -{ - #category : #testing, - #'squeak_changestamp' : 'TL 7/11/2024 19:19' -} -SPOCTestPlay >> testPlayTrackWithContextOn [ - - | playbackState | - self apiEndpoint playTrack: '4PTG3Z6ehGkBFwjybzWkR8' - withAlbum: '6eUW0wxWtzkFdaEFsTJto6' - on: self getPlaybackState device id. - playbackState := self getPlaybackState. - self assert: playbackState track id = '4PTG3Z6ehGkBFwjybzWkR8'. - self assert: playbackState track album id = '6eUW0wxWtzkFdaEFsTJto6'. - self assert: playbackState isPlaying - -]