2019-07-03 15:54:29 +00:00
|
|
|
module.exports = function () {
|
2019-07-03 15:39:38 +00:00
|
|
|
describe('Downloader modal', function () {
|
2019-07-07 21:29:28 +00:00
|
|
|
it('should open on click', function () {
|
2019-07-03 15:39:38 +00:00
|
|
|
return this.app.client
|
2019-08-19 14:16:21 +00:00
|
|
|
.$('.toolbar > div > *:nth-child(8)').click()
|
2019-07-08 15:06:02 +00:00
|
|
|
.pause(500).saveScreenshot('test/screenshots/downloader_modal.png')
|
2019-07-03 15:39:38 +00:00
|
|
|
.getText('.button-container .button').should.eventually.equal('DOWNLOAD')
|
|
|
|
.isExisting('.input-container').should.eventually.be.true
|
|
|
|
.isExisting('.quality-container').should.eventually.be.true
|
|
|
|
.isExisting('.left').should.eventually.be.true
|
|
|
|
.isExisting('.right').should.eventually.be.true
|
|
|
|
})
|
|
|
|
|
2019-07-03 20:29:44 +00:00
|
|
|
it('should fill in the form and show the magnet modal', function () {
|
2019-07-03 15:39:38 +00:00
|
|
|
return this.app.client
|
|
|
|
.$('.input-container:nth-child(1) input').addValue('Sakura Trick')
|
|
|
|
.keys([ 'Tab' ])
|
|
|
|
.$('.input-container:nth-child(2) input').hasFocus().should.eventually.be.true
|
|
|
|
.$('.input-container:nth-child(2) input').addValue('4')
|
|
|
|
.keys([ 'Tab' ])
|
|
|
|
.$('.input-container:nth-child(3) input').hasFocus().should.eventually.be.true
|
|
|
|
.$('.input-container:nth-child(3) input').addValue('8')
|
|
|
|
.keys([ 'Tab', 'ArrowRight', 'ArrowLeft', 'ArrowLeft', 'ArrowRight', 'ArrowRight' ]) // Should select 1080p quality
|
|
|
|
.$('.quality-container div[role="radiogroup"] div:nth-child(4) input').hasFocus().should.eventually.be.true
|
2019-07-08 15:06:02 +00:00
|
|
|
.saveScreenshot('test/screenshots/downloader_modal_filled.png')
|
2019-07-03 15:39:38 +00:00
|
|
|
.keys([ 'Tab', 'Enter' ])
|
2019-07-03 21:03:16 +00:00
|
|
|
.waitUntil(() => this.app.client.$('#magnet-modal').isVisible(), 10000)
|
2019-07-03 21:37:35 +00:00
|
|
|
.pause(500)
|
2019-07-03 20:34:10 +00:00
|
|
|
.isVisible('.quality-container').should.eventually.be.false
|
|
|
|
.isVisible('.left').should.eventually.be.false
|
|
|
|
.isVisible('.right').should.eventually.be.false
|
2019-07-03 15:39:38 +00:00
|
|
|
.pause(500)
|
|
|
|
})
|
|
|
|
|
2019-07-03 20:29:44 +00:00
|
|
|
it('should open the magnet modal with the correct magnets', function () {
|
|
|
|
return this.app.client
|
2019-07-08 15:06:02 +00:00
|
|
|
.saveScreenshot('test/screenshots/downloader_results.png')
|
2019-07-03 20:29:44 +00:00
|
|
|
.getText('#magnet-modal').should.eventually.include('Results for Sakura Trick')
|
2019-08-19 14:16:21 +00:00
|
|
|
.$('#magnet-modal div:nth-child(3) > div > div > button').click()
|
|
|
|
.waitUntil(async () => (await this.app.client.$('#magnet-modal div:nth-child(3) > div > div').getAttribute('aria-expanded')) === 'true')
|
2019-07-04 15:44:19 +00:00
|
|
|
.pause(500)
|
2019-07-08 15:06:02 +00:00
|
|
|
.saveScreenshot('test/screenshots/downloader_results_expanded.png')
|
2019-08-19 14:16:21 +00:00
|
|
|
.getText('#magnet-modal > div:nth-child(3) > div > div > div > div > div:nth-child(5)').should.eventually.include('Sakura Trick - Ep. 4')
|
|
|
|
.getText('#magnet-modal > div:nth-child(3) > div > div > div > div > div:nth-child(1)').should.eventually.include('Sakura Trick - Ep. 8')
|
|
|
|
.getText('#magnet-modal > div:nth-child(3) > div > div > div > div > div:nth-child(2)').should.eventually.include('Sakura Trick - Ep. 7')
|
2019-07-03 20:29:44 +00:00
|
|
|
})
|
|
|
|
|
2019-08-19 14:16:21 +00:00
|
|
|
it('should close the magnet modal when hitting the escape key', async function () {
|
2019-07-03 20:29:44 +00:00
|
|
|
return this.app.client
|
2019-08-19 14:16:21 +00:00
|
|
|
.$('#magnet-modal > div:nth-child(4) > button').click()
|
2019-07-03 20:29:44 +00:00
|
|
|
.pause(500)
|
|
|
|
.isVisible('#magnet-modal').should.eventually.be.false
|
|
|
|
})
|
2019-07-02 12:21:50 +00:00
|
|
|
})
|
2019-07-03 15:54:29 +00:00
|
|
|
}
|