Fix tests

This commit is contained in:
Kylart 2020-04-14 23:37:57 +02:00
parent 8999465d53
commit 70fb6dcbc7
4 changed files with 11 additions and 9 deletions

View File

@ -16,7 +16,7 @@
v-container(grid-list-md)
v-layout(row, wrap, justify-center)
v-flex(xs6)
v-text-field(
v-text-field#info-search-input(
ref='input',
v-model='term',
label='Search',
@ -141,7 +141,7 @@ export default {
})
},
search: debounce(function () {
if (this.term.length < 3) return
if (this.term && this.term.length < 3) return
this.loading = true

View File

@ -6,6 +6,8 @@ const BEST_ANIME = {
id: 20047
}
const SEARCH_INPUT = 'input#info-search-input'
module.exports = function () {
describe('Search modal', function () {
before(function (done) {
@ -95,13 +97,13 @@ module.exports = function () {
return this.app.client
.$('.toolbar > div > *:nth-child(5)').click()
.pause(500)
.$('input').hasFocus().should.eventually.be.true
.$(SEARCH_INPUT).hasFocus().should.eventually.be.true
.saveScreenshot('test/screenshots/search_modal.png')
})
it('should make a research', function () {
return this.app.client
.$('input').addValue(BEST_ANIME.name)
.$(SEARCH_INPUT).addValue(BEST_ANIME.name)
.pause(500)
.waitUntilTextExists('.v-dialog .container > div:last-child > div:nth-child(1)', BEST_ANIME.name, 7500)
.saveScreenshot('test/screenshots/search_modal_results.png')
@ -109,7 +111,7 @@ module.exports = function () {
it('should open the result into the modal and set it fullscreen', function () {
return this.app.client
.$('.v-dialog .container > div:last-child > div:nth-child(1)').click()
.$('.v-dialog .container > div:last-child > div:nth-child(1) > .entry').click()
.waitUntil(async () => this.app.client.$('.info-container').isExisting(), 10000)
.pause(1000)
.saveScreenshot('test/screenshots/search_modal_info.png')
@ -120,7 +122,7 @@ module.exports = function () {
.waitUntilTextExists('.info-container', this.sakuraTrick.title.native)
.getText('.score').should.eventually.equal(`${this.sakuraTrick.averageScore} / 100`)
.getText('.users').should.eventually.equal(this.sakuraTrick.stats.scoreDistribution.reduce((acc, { amount }) => (acc + amount), 0) + ' votes')
.$('.v-image > div:nth-child(2)').getAttribute('style')
.$('.info-container .v-image > div:nth-child(2)').getAttribute('style')
.should.eventually.include(this.sakuraTrick.coverImage.extraLarge || this.sakuraTrick.coverImage.large)
.$$('.characters-container > *').should.eventually.have.length(this.sakuraTrick.characters.edges.length + 1)
.$$('.staff-container > *').should.eventually.have.length(this.sakuraTrick.staff.edges.length)
@ -145,7 +147,7 @@ module.exports = function () {
it('should exit on escape key press', function () {
return this.app.client
.$('input').hasFocus().should.eventually.be.true
.$(SEARCH_INPUT).hasFocus().should.eventually.be.true
.keys([ 'Escape' ]).pause(750)
.$('.v-dialog').isVisible().should.eventually.be.false
})

View File

@ -1,6 +1,6 @@
module.exports = function () {
describe('General window behaviour', function () {
it('should be visible', async function () {
it('should be visible', function () {
return this.app.client
.getWindowCount()
.should.eventually.have.at.least(1)

View File

@ -18,6 +18,6 @@ describe('KawAnime main test routine', function () {
require('./hooks')()
require('./container')
require('./app')
require('./container')
})