Skip to content

Commit

Permalink
test(player): re organize tests #7
Browse files Browse the repository at this point in the history
  • Loading branch information
rudywaltz committed Mar 3, 2019
1 parent fb63399 commit ecff6d6
Showing 1 changed file with 52 additions and 43 deletions.
95 changes: 52 additions & 43 deletions cypress/integration/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,64 @@ describe('player', () => {
});
})

it('should be render', () => {
cy.get('#player');
});
context('with song', () => {
beforeEach(() => {
cy.setStorage('song', {
title: 'Jézus és a jelzőrakéta',
url: '/jezusesajelzoraketa.mp3'
})
})

it('render song url', () => {
cy
.get('#player .player__title')
.contains('/jezusesajelzoraketa.mp3')
});
it('should be render', () => {
cy.get('#player');
});

it('render song duration', () => {
cy
.get('#player .player__duration')
.contains('00:05:46')
});
it('render song url', () => {
cy
.get('#player .player__title')
.contains('/jezusesajelzoraketa.mp3')
});

it('play sound', () => {
cy.get('#player .player__play')
.click();
cy.get('#player .player__play').contains('Pause')
});
it('render song duration', () => {
cy
.get('#player .player__duration')
.contains('00:05:46')
});

it('stop sound', () => {
cy.get('#player .player__play')
.click()
.click()
cy.get('#player .player__play').contains('Play')
});
it('play sound', () => {
cy.get('#player .player__play')
.click();
cy.get('#player .player__play').contains('Pause')
});

it('has progressbar', () => {
cy.get('#player .progress .progress__bar')
});
it('stop sound', () => {
cy.get('#player .player__play')
.click()
.click()
cy.get('#player .player__play').contains('Play')
});

it('render current time', () => { // TODO: more accurate test
cy.get('#player .player__play')
.click()
cy.get('#player .player__current')
.contains('00:00:01')
cy.get('#player .player__current')
.contains('00:00:02')
cy.get('.progress__bar')
.should( $div => {
expect($div[0].style.width).to.be.greaterThan('0.30%');
})
});
it('has progressbar', () => {
cy.get('#player .progress .progress__bar')
});

it.skip('render current time2', () => { // TODO
cy.get('audio').should($element => {
$element[0].currentTime = 100;
})
it('render current time', () => { // TODO: more accurate test
cy.get('#player .player__play')
.click()
cy.get('#player .player__current')
.contains('00:00:01')
cy.get('#player .player__current')
.contains('00:00:02')
cy.get('.progress__bar')
.should( $div => {
expect($div[0].style.width).to.be.greaterThan('0.30%');
})
});

it.skip('render current time2', () => { // TODO
cy.get('audio').should($element => {
$element[0].currentTime = 100;
})
});
});
});

0 comments on commit ecff6d6

Please sign in to comment.