2021-08-11 08:12:32 +00:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
const showSidePanelContent = () => {
|
|
|
|
|
cy.get('[data-testid=profileSidePanel] h4').should('have.text', 'Test User1');
|
|
|
|
|
cy.get('[data-testid=profileSidePanel] .modal-body p').within(() => {
|
2022-01-11 10:49:39 +00:00
|
|
|
cy.contains('Location: Denver, CO, US')
|
2021-11-24 04:21:28 +00:00
|
|
|
.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').within(() => {
|
|
|
|
|
cy.get('[data-testid=biography]').contains('Biography of Test User1');
|
|
|
|
|
|
|
|
|
|
//instruments
|
|
|
|
|
cy.get('[data-testid=instruments]').contains('Acoustic Guitar: Expert');
|
|
|
|
|
cy.get('[data-testid=instruments]').contains('Keyboard: Expert');
|
|
|
|
|
|
|
|
|
|
//genres
|
|
|
|
|
cy.get('[data-testid=genres]').contains('classical, blues');
|
|
|
|
|
|
|
|
|
|
//bands
|
|
|
|
|
cy.get('[data-testid=bands]').contains('The Band');
|
|
|
|
|
|
|
|
|
|
//performance_samples
|
|
|
|
|
//cy.get('[data-testid=performance_samples]').contains('The Band')
|
|
|
|
|
|
|
|
|
|
//online presence
|
2022-01-11 10:49:39 +00:00
|
|
|
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');
|
2021-11-24 04:21:28 +00:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const closeSidePanel = () => {
|
|
|
|
|
cy.get('[data-testid=profileSidePanel] .modal-header button.close').click();
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-08 15:25:00 +00:00
|
|
|
describe('Friends page without data', () => {
|
2021-09-27 13:53:40 +00:00
|
|
|
beforeEach(() => {
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.stubAuthenticate();
|
|
|
|
|
cy.intercept('POST', /\S+\/filter/, {
|
|
|
|
|
musicians: []
|
2022-01-13 12:54:01 +00:00
|
|
|
}).as("getPeople_empty");
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-09-27 13:53:40 +00:00
|
|
|
|
2022-01-13 12:54:01 +00:00
|
|
|
it('from_location is unchecked', () => {
|
2021-09-27 13:53:40 +00:00
|
|
|
cy.visit('/friends');
|
2022-01-13 12:54:01 +00:00
|
|
|
|
|
|
|
|
//default api call with from_location parameter turned off
|
|
|
|
|
cy.wait('@getPeople_empty')
|
|
|
|
|
.then(interception => {
|
|
|
|
|
assert.isNotNull(interception.response.body, '1st API call');
|
|
|
|
|
})
|
|
|
|
|
.its('request.body')
|
|
|
|
|
.should('deep.contain', {
|
|
|
|
|
from_location: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//now it automatically turns on from_location parameter and fetches again
|
|
|
|
|
cy.wait('@getPeople_empty')
|
|
|
|
|
.then(interception => {
|
2022-10-26 17:14:20 +00:00
|
|
|
assert.isNotNull(interception.response.body, '2nd API call - (prefetched)');
|
2022-01-13 12:54:01 +00:00
|
|
|
})
|
|
|
|
|
.its('request.body')
|
|
|
|
|
.should('deep.contain', {
|
|
|
|
|
from_location: true
|
|
|
|
|
});
|
|
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.contains('No Records!');
|
2022-01-13 12:54:01 +00:00
|
|
|
|
|
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=from_location]').check();
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
cy.get('[data-testid=btnSubmitSearch]').click();
|
|
|
|
|
|
|
|
|
|
//default api call with from_location parameter turned on
|
|
|
|
|
cy.wait('@getPeople_empty')
|
|
|
|
|
.then(interception => {
|
2022-10-26 17:14:20 +00:00
|
|
|
assert.isNotNull(interception.response.body, '3th API call');
|
2022-01-13 12:54:01 +00:00
|
|
|
})
|
|
|
|
|
.its('request.body')
|
|
|
|
|
.should('deep.contain', {
|
|
|
|
|
from_location: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cy.contains('No Records!');
|
|
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2022-01-13 12:54:01 +00:00
|
|
|
|
|
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-09-27 13:53:40 +00:00
|
|
|
|
2022-10-26 17:14:20 +00:00
|
|
|
describe('Friends page with data', () => {
|
2021-08-26 17:23:24 +00:00
|
|
|
beforeEach(() => {
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.stubAuthenticate({ id: '2' }); //currentUser id is 2 - people.yaml fixture
|
2022-10-26 17:14:20 +00:00
|
|
|
cy.intercept('POST', /\S+\/filter\?offset=0/, { fixture: 'people_page1' }).as('getPeople_page1');
|
2022-10-27 05:59:20 +00:00
|
|
|
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');
|
2021-11-24 04:21:28 +00:00
|
|
|
cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'person' });
|
2021-08-26 17:23:24 +00:00
|
|
|
});
|
2021-10-19 13:49:44 +00:00
|
|
|
|
2022-10-25 13:15:48 +00:00
|
|
|
describe('listing users', () => {
|
2021-08-11 08:12:32 +00:00
|
|
|
beforeEach(() => {
|
2021-08-26 17:23:24 +00:00
|
|
|
cy.visit('/friends');
|
|
|
|
|
});
|
2021-08-11 08:12:32 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
describe('in desktop', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.viewport('macbook-13');
|
|
|
|
|
});
|
2021-08-11 08:12:32 +00:00
|
|
|
|
2022-10-27 05:59:20 +00:00
|
|
|
it.only('paginate', () => {
|
2022-03-18 13:57:48 +00:00
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr').should('have.length', 10);
|
2022-10-25 13:15:48 +00:00
|
|
|
cy.wait('@getPeople_page2')
|
2022-03-18 13:57:48 +00:00
|
|
|
cy.get('[data-testid=paginate-next-page]').click();
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr').should('have.length', 20);
|
2022-10-27 05:59:20 +00:00
|
|
|
//cy.get('[data-testid=paginate-next-page]').should('not.exist');
|
|
|
|
|
cy.get('[data-testid=paginate-next-page]').click();
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr').should('have.length', 30);
|
2022-03-18 13:57:48 +00:00
|
|
|
cy.get('[data-testid=paginate-next-page]').should('not.exist');
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('show profiles', () => {
|
|
|
|
|
cy.contains('Find New Friends').should('exist');
|
|
|
|
|
cy.contains('Update Search').should('exist');
|
|
|
|
|
cy.contains('Reset Filters').should('exist');
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-12-18 14:41:28 +00:00
|
|
|
.should('have.length', 10)
|
2021-11-24 04:21:28 +00:00
|
|
|
.first()
|
|
|
|
|
.contains('Test User1');
|
|
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
|
2022-01-13 12:54:01 +00:00
|
|
|
it('click profile name', () => {
|
2021-11-24 04:21:28 +00:00
|
|
|
//open side panel by clicking name
|
|
|
|
|
cy.get('[data-testid=peopleListTable]').within(() => {
|
|
|
|
|
cy.contains('Test User1').click();
|
|
|
|
|
});
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('click more button', () => {
|
|
|
|
|
//open side panel by clicking more button
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=btnMore]')
|
|
|
|
|
.click();
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('click more link', () => {
|
|
|
|
|
//open side panel by clicking more link
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=linkMore]')
|
|
|
|
|
.click();
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('click description more link', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
|
|
|
|
.first()
|
|
|
|
|
.find('td[data-testid=biography-col]')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.contains('More').click();
|
|
|
|
|
});
|
2021-12-18 14:41:28 +00:00
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
2021-11-24 04:21:28 +00:00
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('click instruments more link', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
|
|
|
|
.first()
|
2021-11-24 04:33:47 +00:00
|
|
|
.find('[data-testid=instrumentList]')
|
2021-11-24 04:21:28 +00:00
|
|
|
.within(() => {
|
|
|
|
|
cy.get('div').should('have.length', 4); //show only 4 instruments plus more link
|
|
|
|
|
cy.contains('Acoustic Guitar: Expert');
|
|
|
|
|
cy.contains('Keyboard: Expert');
|
|
|
|
|
cy.contains('Ukulele: Expert');
|
|
|
|
|
cy.contains('Voice: Expert');
|
|
|
|
|
cy.contains('More').click();
|
|
|
|
|
});
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('click genres more link', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
|
|
|
|
.first()
|
|
|
|
|
.find('td[data-testid=genres-col]')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.contains('More').click();
|
|
|
|
|
});
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
|
|
|
|
});
|
2021-12-18 14:41:28 +00:00
|
|
|
|
2022-03-18 13:57:48 +00:00
|
|
|
|
2021-12-18 14:41:28 +00:00
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
describe('in mobile', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.viewport('iphone-6');
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-08-31 18:25:15 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('show profile', () => {
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide').should('have.length', 10);
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.eq(0)
|
|
|
|
|
.contains('Test User1');
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.eq(0)
|
|
|
|
|
.should('be.visible');
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.eq(2)
|
|
|
|
|
.should('not.be.visible');
|
|
|
|
|
});
|
2021-10-19 13:49:44 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('show all profile description', () => {
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=mobBiography]')
|
|
|
|
|
.should('not.contain', 'More');
|
|
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('show all instruments', () => {
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=instrumentList] div')
|
|
|
|
|
.its('length')
|
|
|
|
|
.should('be.gte', 1);
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=instrumentList]')
|
|
|
|
|
.should('not.contain', 'More');
|
|
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('show all genres', () => {
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=genreList] div')
|
|
|
|
|
.its('length')
|
|
|
|
|
.should('be.gte', 1);
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=genreList]')
|
|
|
|
|
.should('not.contain', 'More');
|
|
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
|
2022-03-18 13:57:48 +00:00
|
|
|
//it.skip('click connect button', () => {});
|
2021-11-24 04:21:28 +00:00
|
|
|
|
2022-03-18 13:57:48 +00:00
|
|
|
//it.skip('click message button', () => {});
|
2021-11-24 04:21:28 +00:00
|
|
|
|
2021-12-18 14:41:28 +00:00
|
|
|
it('paginate', () => {
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-button-prev').should('have.class', 'swiper-button-disabled');
|
|
|
|
|
for (let i = 0; i < 19; i++) {
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-button-next').click();
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
}
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-button-next').should('have.class', 'swiper-button-disabled');
|
|
|
|
|
});
|
2022-03-18 13:57:48 +00:00
|
|
|
|
|
|
|
|
it('click more button', () => {
|
|
|
|
|
cy.get('[data-testid=peopleSwiper] .swiper-slide')
|
|
|
|
|
.first()
|
|
|
|
|
.find('[data-testid=btnMore]')
|
|
|
|
|
.click();
|
|
|
|
|
showSidePanelContent();
|
|
|
|
|
closeSidePanel();
|
|
|
|
|
});
|
2021-12-18 14:41:28 +00:00
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
});
|
|
|
|
|
|
2021-11-24 04:33:47 +00:00
|
|
|
describe('making friendship', () => {
|
2021-08-26 17:23:24 +00:00
|
|
|
it('add friend', () => {
|
|
|
|
|
cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'person' });
|
|
|
|
|
cy.intercept('POST', /\S+\/friend_requests/, { statusCode: 201, body: { ok: true } });
|
2021-10-19 13:49:44 +00:00
|
|
|
|
2021-08-26 17:23:24 +00:00
|
|
|
cy.visit('/friends');
|
2021-10-22 08:41:00 +00:00
|
|
|
cy.contains('Test User2').click();
|
2021-08-26 17:23:24 +00:00
|
|
|
|
|
|
|
|
cy.get('[data-testid=profileSidePanel]')
|
|
|
|
|
.find('[data-testid=connect]')
|
|
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.click();
|
2021-11-24 04:21:28 +00:00
|
|
|
// cy.get('[data-testid=confirmFriendRequestModal]').within(() => {
|
|
|
|
|
// cy.contains('Send a friend request to Test User2');
|
|
|
|
|
// cy.contains('Yes').click();
|
|
|
|
|
// });
|
|
|
|
|
|
2021-08-26 17:23:24 +00:00
|
|
|
cy.get('[data-testid=profileSidePanel]')
|
|
|
|
|
.find('[data-testid=connect]')
|
|
|
|
|
.should('be.disabled');
|
2021-11-24 04:21:28 +00:00
|
|
|
cy.contains('Success! Your friend request has been sent to Test User2.');
|
2021-08-26 17:23:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('remove friend', () => {
|
|
|
|
|
cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'friend' });
|
|
|
|
|
cy.intercept('DELETE', /\S+\/friends\S+/, { statusCode: 204, body: { ok: true } });
|
|
|
|
|
|
|
|
|
|
cy.visit('/friends');
|
|
|
|
|
cy.contains('Test User1').click();
|
|
|
|
|
|
|
|
|
|
cy.get('[data-testid=profileSidePanel]')
|
|
|
|
|
.find('[data-testid=disconnect]')
|
|
|
|
|
.should('exist')
|
|
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
cy.get('[data-testid=profileSidePanel]')
|
|
|
|
|
.find('[data-testid=disconnect]')
|
|
|
|
|
.should('not.exist');
|
|
|
|
|
|
|
|
|
|
cy.get('[data-testid=profileSidePanel]')
|
|
|
|
|
.find('[data-testid=connect]')
|
|
|
|
|
.should('be.exist')
|
2021-10-19 13:49:44 +00:00
|
|
|
.should('not.be.disabled');
|
2021-08-26 17:23:24 +00:00
|
|
|
});
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-08-26 17:23:24 +00:00
|
|
|
|
2021-09-23 14:04:43 +00:00
|
|
|
describe('chat window', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.visit('/friends');
|
|
|
|
|
});
|
2021-10-19 13:49:44 +00:00
|
|
|
|
2021-09-23 14:04:43 +00:00
|
|
|
it('is not disabled for friends', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(0)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.trigger('mouseover');
|
|
|
|
|
cy.contains('Send a message').should('exist');
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it('is disabled for non friends', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(1)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.should('be.disabled');
|
2021-09-23 14:04:43 +00:00
|
|
|
//cy.contains('You can message this user once you are friends').should('exist')
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it('lists text messages', () => {
|
|
|
|
|
//initially show the most recent messages on openning chat window modal
|
2021-10-19 13:49:44 +00:00
|
|
|
let numberOfMessages = 10;
|
|
|
|
|
cy.fixture('text_messages_page1').then(json => {
|
2021-09-23 14:04:43 +00:00
|
|
|
cy.intercept('GET', /\S+\/text_messages\S+/, json).as('getTextMessages');
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(0)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.click();
|
|
|
|
|
cy.wait('@getTextMessages');
|
|
|
|
|
cy.get('[data-testid=textMessageModal]')
|
|
|
|
|
.should('be.visible')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.get('.text-message-row').should('have.length', numberOfMessages);
|
|
|
|
|
|
|
|
|
|
//display previous messages by scrolling up
|
|
|
|
|
const messageFixtures = ['text_messages_page2', 'text_messages_page3'];
|
|
|
|
|
messageFixtures.forEach(fixture => {
|
|
|
|
|
cy.fixture(fixture).then(json => {
|
|
|
|
|
cy.intercept('GET', /\S+\/text_messages\S+/, json);
|
|
|
|
|
cy.get('.modal-body .ScrollbarsCustom')
|
|
|
|
|
.trigger('mouseover')
|
|
|
|
|
.scrollTo('bottom');
|
|
|
|
|
cy.get('.modal-body .ScrollbarsCustom')
|
|
|
|
|
.trigger('mouseover')
|
|
|
|
|
.scrollTo('top');
|
|
|
|
|
numberOfMessages = numberOfMessages + 10;
|
|
|
|
|
cy.get('.text-message-row').should('have.length', numberOfMessages);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cy.get('button')
|
2022-02-08 15:25:00 +00:00
|
|
|
.contains('Cancel')
|
2021-10-19 13:49:44 +00:00
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.click();
|
|
|
|
|
});
|
|
|
|
|
cy.get('[data-testid=textMessageModal]').should('not.be.visible');
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it('sends message by clicking send button', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(0)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.click();
|
2021-09-23 14:04:43 +00:00
|
|
|
cy.get('[data-testid=textMessageModal]').within(() => {
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('button')
|
|
|
|
|
.contains('Send')
|
|
|
|
|
.should('be.disabled');
|
|
|
|
|
cy.get('textarea').type('Hello');
|
|
|
|
|
cy.get('button')
|
|
|
|
|
.contains('Send')
|
|
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.click();
|
|
|
|
|
cy.get('textarea').should('have.value', '');
|
|
|
|
|
cy.get('button')
|
|
|
|
|
.contains('Send')
|
|
|
|
|
.should('be.disabled');
|
|
|
|
|
});
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it('sends message by pressing enter key', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(0)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.click();
|
2021-09-23 14:04:43 +00:00
|
|
|
cy.get('[data-testid=textMessageModal]').within(() => {
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('button')
|
|
|
|
|
.contains('Send')
|
|
|
|
|
.should('be.disabled');
|
|
|
|
|
cy.get('textarea').type('Hello{enter}');
|
|
|
|
|
cy.get('textarea').should('have.value', '');
|
|
|
|
|
cy.get('button')
|
|
|
|
|
.contains('Send')
|
|
|
|
|
.should('be.disabled');
|
|
|
|
|
});
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it('goes away by clicking close button', () => {
|
|
|
|
|
cy.get('[data-testid=peopleListTable] > tbody tr')
|
2021-10-19 13:49:44 +00:00
|
|
|
.eq(0)
|
|
|
|
|
.find('[data-testid=message]')
|
|
|
|
|
.click();
|
2021-09-23 14:04:43 +00:00
|
|
|
cy.get('[data-testid=textMessageModal]').within(() => {
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('button')
|
2022-02-08 15:25:00 +00:00
|
|
|
.contains('Cancel')
|
2021-10-19 13:49:44 +00:00
|
|
|
.should('not.be.disabled')
|
|
|
|
|
.click();
|
|
|
|
|
});
|
|
|
|
|
cy.get('[data-testid=textMessageModal]').should('not.be.visible');
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
|
|
|
|
it.skip('shows received message by other user', () => {
|
2021-10-15 12:06:58 +00:00
|
|
|
//TODO: this should be test in e2e test
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
|
|
|
|
});
|
2021-09-23 14:04:43 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
describe('filter', () => {
|
|
|
|
|
const fillFilterForm = () => {
|
|
|
|
|
//cy.get('[data-testid=btnUpdateSearch]').click();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=latency_good]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=latency_fair]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=latency_high]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=proficiency_beginner]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=proficiency_intermediate]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=proficiency_expert]').uncheck();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=proficiency_expert]').uncheck();
|
2022-01-13 12:54:01 +00:00
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=from_location]').uncheck();
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('#selInstruments')
|
|
|
|
|
.type('Drums{enter}')
|
|
|
|
|
.click();
|
|
|
|
|
cy.get('#selGenres')
|
|
|
|
|
.type('Pop{enter}')
|
|
|
|
|
.click();
|
2022-02-17 14:47:20 +00:00
|
|
|
cy.get('#selLastActive').type('Within last 1 Day{enter}');
|
|
|
|
|
cy.get('#selJoinedWithin').type('Within last 7 Day{enter}');
|
2021-11-24 04:21:28 +00:00
|
|
|
};
|
|
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.visit('/friends');
|
|
|
|
|
});
|
2021-10-15 12:06:58 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
it('open and close filter modal', () => {
|
|
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch]').should('be.visible');
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch]')
|
|
|
|
|
.contains('Cancel')
|
|
|
|
|
.click();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch]').should('not.be.visible');
|
|
|
|
|
});
|
2021-08-11 08:12:32 +00:00
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
it('render filter form', () => {
|
|
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
|
|
|
|
cy.get('[data-testid=modalUpdateSearch]').within(() => {
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.get('input[name=latency_good]')
|
|
|
|
|
.should('be.checked')
|
|
|
|
|
.next()
|
|
|
|
|
.contains('Good (less than 40ms)');
|
|
|
|
|
cy.get('input[name=latency_fair]')
|
|
|
|
|
.should('be.checked')
|
|
|
|
|
.next()
|
|
|
|
|
.contains('Fair (40-60ms)');
|
|
|
|
|
cy.get('input[name=latency_high]')
|
|
|
|
|
.should('not.be.checked')
|
|
|
|
|
.next()
|
|
|
|
|
.contains('Poor (more than 60ms)');
|
2022-01-13 12:54:01 +00:00
|
|
|
cy.get('input[name=from_location]')
|
|
|
|
|
.should('not.be.checked')
|
2021-12-18 14:41:28 +00:00
|
|
|
});
|
|
|
|
|
});
|
2021-11-24 04:21:28 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
it('reset filters', () => {
|
|
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
2021-11-24 04:21:28 +00:00
|
|
|
fillFilterForm();
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=modalUpdateSearch]')
|
2021-11-24 04:21:28 +00:00
|
|
|
.contains('Cancel')
|
|
|
|
|
.click();
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
2021-11-24 04:21:28 +00:00
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=latency_good]').should('not.be.checked');
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=modalUpdateSearch]')
|
2021-11-24 04:21:28 +00:00
|
|
|
.contains('Cancel')
|
|
|
|
|
.click();
|
|
|
|
|
cy.get('[data-testid=btnResetSearch]').click(); //click reset button
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
2021-11-24 04:21:28 +00:00
|
|
|
cy.get('[data-testid=modalUpdateSearch] input[name=latency_good]').should('be.checked');
|
|
|
|
|
});
|
2021-08-31 18:25:15 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
it('submit filter form with params', () => {
|
|
|
|
|
//wait for stubbed request sent to fetch data for initial page load
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.wait('@getPeople_page1').then(interception => {
|
2021-10-19 13:49:44 +00:00
|
|
|
assert.isNotNull(interception.response.body, '1st API call has data');
|
|
|
|
|
});
|
2021-12-18 14:41:28 +00:00
|
|
|
//the subsequent request sent to perfetch data and store in redux prefetched buffer
|
|
|
|
|
cy.wait('@getPeople_page2').then(interception => {
|
|
|
|
|
assert.isNotNull(interception.response.body, '1st API call has data - (prefethed)');
|
|
|
|
|
});
|
2021-10-19 13:49:44 +00:00
|
|
|
|
|
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.wait(1000);
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=btnSubmitSearch]').click();
|
2021-12-18 14:41:28 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
//wait for stubbed request sent by submitting search form without filling any form field
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.wait('@getPeople_page1')
|
2021-10-19 13:49:44 +00:00
|
|
|
.then(interception => {
|
2021-12-18 14:41:28 +00:00
|
|
|
assert.isNotNull(interception.response.body, '3rd API call has data');
|
2021-10-19 13:49:44 +00:00
|
|
|
})
|
|
|
|
|
.its('request.body')
|
2021-12-18 14:41:28 +00:00
|
|
|
.should('deep.contain', {
|
2021-10-19 13:49:44 +00:00
|
|
|
latency_good: true,
|
|
|
|
|
latency_fair: true,
|
2021-11-24 04:21:28 +00:00
|
|
|
latency_high: false,
|
2021-10-19 13:49:44 +00:00
|
|
|
proficiency_beginner: true,
|
|
|
|
|
proficiency_intermediate: true,
|
|
|
|
|
proficiency_expert: true,
|
|
|
|
|
instruments: [],
|
2022-01-13 12:54:01 +00:00
|
|
|
genres: [],
|
|
|
|
|
from_location: false
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
|
|
|
|
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.wait('@getPeople_page2').then(interception => {
|
|
|
|
|
assert.isNotNull(interception.response.body, '4th API call has data - (prefethed)');
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-24 04:21:28 +00:00
|
|
|
cy.get('[data-testid=btnUpdateSearch]').click();
|
2021-12-18 14:41:28 +00:00
|
|
|
fillFilterForm(); // change filter options
|
2021-10-19 13:49:44 +00:00
|
|
|
cy.get('[data-testid=btnSubmitSearch]').click();
|
2021-12-18 14:41:28 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
//wait for stubbed request sent by submitting search form again. but this time fill form fields
|
2021-12-18 14:41:28 +00:00
|
|
|
cy.wait('@getPeople_page1')
|
2021-10-19 13:49:44 +00:00
|
|
|
.then(interception => {
|
2021-12-18 14:41:28 +00:00
|
|
|
assert.isNotNull(interception.response.body, '5th API call has data');
|
2021-10-19 13:49:44 +00:00
|
|
|
})
|
|
|
|
|
.its('request.body')
|
2021-12-18 14:41:28 +00:00
|
|
|
.should('deep.contain', {
|
|
|
|
|
latency_good: false,
|
|
|
|
|
latency_fair: false,
|
|
|
|
|
latency_high: false,
|
|
|
|
|
proficiency_beginner: false,
|
|
|
|
|
proficiency_intermediate: false,
|
|
|
|
|
proficiency_expert: false,
|
|
|
|
|
instruments: [{ value: 'drums', label: 'Drums' }],
|
2022-01-13 12:54:01 +00:00
|
|
|
genres: ['pop'],
|
|
|
|
|
from_location: false
|
2021-12-18 14:41:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cy.wait('@getPeople_page2').then(interception => {
|
|
|
|
|
assert.isNotNull(interception.response.body, '6th API call has data - (prefethed)');
|
|
|
|
|
});
|
2022-01-13 12:54:01 +00:00
|
|
|
|
2021-10-19 13:49:44 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|