Skip to content

Commit 68913cb

Browse files
committed
Add key to list of scrobbles from other user
Fixes #262
1 parent 752b912 commit 68913cb

File tree

8 files changed

+5522
-3
lines changed

8 files changed

+5522
-3
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
describe('Scrobble user (results)', () => {
2+
beforeEach(() => {
3+
cy.clearCookies();
4+
cy.clearLocalStorage();
5+
6+
cy.intercept('GET', '/api/v2/user.php', { fixture: 'api/v2/user/authenticated.json' }).as('userData');
7+
cy.intercept('GET', '/api/v2/settings.php', { fixture: 'api/v2/settings/authenticated.json' }).as('settings');
8+
cy.intercept('POST', '/api/v2/scrobble.php', { fixture: 'api/v2/scrobble/success.json' }).as('scrobbleData');
9+
});
10+
11+
describe('Private user', () => {
12+
beforeEach(() => {
13+
cy.intercept('GET', 'https://ws.audioscrobbler.com/2.0/*method=user.getRecentTracks*', {
14+
fixture: 'lastfm/user/getRecentTracks.private.json',
15+
}).as('privateUserTracks');
16+
17+
cy.visit('/scrobble/user/privateryan');
18+
cy.wait('@userData');
19+
cy.wait('@settings');
20+
});
21+
22+
it.skip('shows empty when profile is private', () => {
23+
// Currently redirects to search, since lastfm replies with an error
24+
});
25+
});
26+
27+
describe('Normal user', () => {
28+
beforeEach(() => {
29+
cy.intercept('GET', 'https://ws.audioscrobbler.com/2.0/*method=user.getRecentTracks*page=1', {
30+
fixture: 'lastfm/user/getRecentTracks.elamperti.page1.json',
31+
}).as('page1');
32+
cy.intercept('GET', 'https://ws.audioscrobbler.com/2.0/*method=user.getRecentTracks*page=2', {
33+
fixture: 'lastfm/user/getRecentTracks.elamperti.page2.json',
34+
}).as('page2');
35+
cy.intercept('GET', 'https://ws.audioscrobbler.com/2.0/*method=user.getRecentTracks*page=3', {
36+
fixture: 'lastfm/user/getRecentTracks.elamperti.page3.json',
37+
}).as('page3');
38+
39+
cy.visit('/scrobble/user/elamperti');
40+
cy.wait('@userData');
41+
cy.wait('@settings');
42+
cy.wait('@page1');
43+
});
44+
45+
it('shows past scrobbles for a user', () => {
46+
cy.get('[data-cy="FriendScrobbles-ScrobbleList"]').should('exist');
47+
cy.get('[data-cy="ScrobbleItem"]').should('have.length', 50);
48+
});
49+
50+
it('navigates to second page', () => {
51+
cy.get('[data-cy="Paginator"]').should('exist');
52+
cy.get('[data-cy="Paginator"] .page-item button').contains('2').click();
53+
cy.wait('@page2');
54+
cy.get('[data-cy="ScrobbleItem"]').should('have.length', 50);
55+
});
56+
57+
it('resets scrobble button in list after changing pages', () => {
58+
cy.get('[data-cy="ScrobbleItem"]').first().find('.quick-scrobble-button').contains('Scrobble');
59+
cy.get('[data-cy="ScrobbleItem"]').first().find('.quick-scrobble-button').click();
60+
cy.wait('@scrobbleData');
61+
cy.get('[data-cy="ScrobbleItem"]').first().find('.quick-scrobble-button svg').should('exist');
62+
63+
cy.get('[data-cy="Paginator"] .page-item button').contains('2').click();
64+
cy.wait('@page2');
65+
cy.get('[data-cy="ScrobbleItem"]').first().find('.quick-scrobble-button').contains('Scrobble');
66+
});
67+
});
68+
});

0 commit comments

Comments
 (0)