diff --git a/jam-ui/cypress/e2e/friends/friends-page.cy.js b/jam-ui/cypress/e2e/friends/friends-page.cy.js index c322f70d7..e9b6bcc9f 100644 --- a/jam-ui/cypress/e2e/friends/friends-page.cy.js +++ b/jam-ui/cypress/e2e/friends/friends-page.cy.js @@ -2,16 +2,14 @@ const showSidePanelContent = () => { cy.get('[data-testid=profileSidePanel] h4').should('have.text', 'Test User1'); - cy.get('[data-testid=profileSidePanel] .modal-body p').first().within(() => { + cy.get('[data-testid=profileSidePanel] .modal-body').first().within(() => { cy.contains('Location: Denver, CO, US') .and('contain', 'Skill Level: Professional') .and('contain', 'Joined JamKazam: 08-26-2021') .and('contain', 'Last Active:') .and('contain', 'Latency To Me:'); cy.get('.latency-badge').contains('UNKNOWN'); - }); - cy.get('[data-testid=profileSidePanel] .modal-body').first().within(() => { cy.get('[data-testid=biography]').contains('Biography of Test User1'); //instruments @@ -25,17 +23,14 @@ const showSidePanelContent = () => { cy.get('[data-testid=bands]').contains('The Band'); //performance_samples - //cy.get('[data-testid=performance_samples]').contains('The Band') + cy.get('[data-testid=performance_samples]').contains('Test Recording1')//.should('have.attr', 'href').and('eq', 'https://www.jamkazam.com/test-recording1'); //online presence - cy.get('[data-testid=online_presences]').contains('Soundcloud').should('have.attr', 'href').and('eq', 'https://www.soundcloud.com/testuser'); - cy.get('[data-testid=online_presences]').contains('Reverbnation').should('have.attr', 'href').and('eq', 'https://www.reverbnation.com/testuser'); - cy.get('[data-testid=online_presences]').contains('Bandcamp').should('have.attr', 'href').and('eq', 'https://testuser.bandcamp.com'); - cy.get('[data-testid=online_presences]').contains('Fandalism').should('have.attr', 'href').and('eq', 'https://www.fandalism.com/testuser'); cy.get('[data-testid=online_presences]').contains('Youtube').should('have.attr', 'href').and('eq', 'https://www.youtube.com/testuser'); cy.get('[data-testid=online_presences]').contains('Facebook').should('have.attr', 'href').and('eq', 'https://www.facebook.com/testuser'); cy.get('[data-testid=online_presences]').contains('Twitter').should('have.attr', 'href').and('eq', 'https://www.twitter.com/testuser'); }); + }; const closeSidePanel = () => { @@ -103,7 +98,7 @@ describe('Friends page with data', () => { cy.intercept('POST', /\S+\/filter\?offset=0/, { fixture: 'people_page1' }).as('getPeople_page1'); cy.intercept('POST', /\S+\/filter\?offset=10/, { fixture: 'people_page2' }).as('getPeople_page2'); cy.intercept('POST', /\S+\/filter\?offset=20/, { fixture: 'people_page3' }).as('getPeople_page3'); - cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'person' }); + cy.intercept('GET', /\S+\/profile/, { fixture: 'person' }); }); describe('listing users', () => { @@ -127,7 +122,7 @@ describe('Friends page with data', () => { cy.get('[data-testid=paginate-next-page]').should('not.exist'); }); - it.only('show profiles', () => { + it('show profiles', () => { cy.contains('Find New Friends').should('exist'); cy.contains('Update Search').should('exist'); cy.contains('Reset Filters').should('exist'); @@ -183,7 +178,7 @@ describe('Friends page with data', () => { .first() .find('[data-testid=instrumentList]') .within(() => { - cy.get('div').should('have.length', 4); //show only 4 instruments plus more link + cy.get('[data-testid=instrument]').should('have.length', 4); //show only 4 instruments plus more link cy.contains('Acoustic Guitar: Expert'); cy.contains('Keyboard: Expert'); cy.contains('Ukulele: Expert'); @@ -306,7 +301,7 @@ describe('Friends page with data', () => { }); it('remove friend', () => { - cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'friend' }); + cy.intercept('GET', /\S+\/profile/, { fixture: 'friend' }); cy.intercept('DELETE', /\S+\/friends\S+/, { statusCode: 204, body: { ok: true } }); cy.visit('/friends'); @@ -384,7 +379,7 @@ describe('Friends page with data', () => { }); cy.get('button') - .contains('Cancel') + .contains('Close') .should('not.be.disabled') .click(); }); @@ -436,7 +431,7 @@ describe('Friends page with data', () => { .click(); cy.get('[data-testid=textMessageModal]').within(() => { cy.get('button') - .contains('Cancel') + .contains('Close') .should('not.be.disabled') .click(); }); diff --git a/jam-ui/cypress/fixtures/person.json b/jam-ui/cypress/fixtures/person.json index b35334316..dc980a6b8 100644 --- a/jam-ui/cypress/fixtures/person.json +++ b/jam-ui/cypress/fixtures/person.json @@ -50,7 +50,6 @@ { "id": "005a7c78-db8b-4f72-a51f-d64d579c22b3", "service_type": "facebook", "username": "testuser" }, { "id": "005a7c78-db8b-4f72-a51f-d64d579c22b4", "service_type": "twitter", "username": "testuser" } ], - "performance_samples": [], "genres": [ { "genre_id": "classical", "player_type": "JamRuby::User", "genre_type": "profile" }, { "genre_id": "blues", "player_type": "JamRuby::User", "genre_type": "free_sessions" } @@ -74,6 +73,16 @@ { "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1, "instrument_id": "acoustic guitar" }, { "description": "Keyboard", "proficiency_level": 3, "priority": 8, "instrument_id": "keyboard" } ], + "performance_samples": [ + { + "id": "1", + "service_type": "youtube", + "claimed_recording": { + "id": "1", + "name": "Test Recording1" + } + } + ], "is_friend": false, "is_following": false, "is_liking": false, diff --git a/jam-ui/src/components/profile/JKConnectButton.js b/jam-ui/src/components/profile/JKConnectButton.js index d8eabf3a8..7fd6c4663 100644 --- a/jam-ui/src/components/profile/JKConnectButton.js +++ b/jam-ui/src/components/profile/JKConnectButton.js @@ -12,8 +12,10 @@ const JKConnectButton = props => { const [showConfirmModal, setShowConfirmModal] = useState(false); useEffect(() => { - setIsFriend(user.is_friend); - setPendingFriendRequest(user.pending_friend_request); + if(user){ + setIsFriend(user.is_friend); + setPendingFriendRequest(user.pending_friend_request); + } }, [user]); const queryString = useBrowserQuery(); diff --git a/jam-ui/src/components/profile/JKProfileInstrumentsList.js b/jam-ui/src/components/profile/JKProfileInstrumentsList.js index 65909b039..8632a9d2a 100644 --- a/jam-ui/src/components/profile/JKProfileInstrumentsList.js +++ b/jam-ui/src/components/profile/JKProfileInstrumentsList.js @@ -24,7 +24,7 @@ const JKPersonInstrumentsList = ({ instruments, showIcons, showAll, toggleMoreDe