Skip to content

Commit

Permalink
verify start/stop immediate updates on browse game details
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes committed Dec 11, 2024
1 parent c530cb9 commit 661482b
Show file tree
Hide file tree
Showing 41 changed files with 338 additions and 214 deletions.
11 changes: 6 additions & 5 deletions apps/playnite-web/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"all": true,
"include": ["src/**", "app.ts", "server.ts"],
"exclude": [
"cypress",
"**/testUtils",
"**/__tests__",
"**/__component_tests__",
"../../.yarn/**"
"cypress/**",
"**/testUtils/**",
"**/__tests__/**",
"**/__component_tests__/**",
"../../.yarn/**",
"**/public/**"
]
}
3 changes: 2 additions & 1 deletion apps/playnite-web/cypress-image-diff.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const config = {
FAILURE_THRESHOLD: process.env.TEST === 'e2e' ? 0.12 : 0.09,
FAIL_ON_MISSING_BASELINE: process.env.CI === 'true',
FAIL_ON_MISSING_BASELINE:
process.env.CI === 'true' && process.env.UPDATE !== 'true',
ROOT_DIR: 'visual-regression-tests',
REPORT_DIR: process.env.TEST ? `${process.env.TEST}-report` : 'report',
JSON_REPORT: {
Expand Down
25 changes: 25 additions & 0 deletions apps/playnite-web/cypress.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import mqtt from 'async-mqtt'
import { defineConfig } from 'cypress'
import imageDiff from 'cypress-image-diff-js/plugin'
import fs from 'fs'
import { MongoClient } from 'mongodb'

const config = {
chromeWebSecurity: false,
Expand All @@ -16,6 +17,7 @@ const config = {
'**/cypress/**',
'**/__tests__/**',
'**/__component_tests__/**',
'**/public/assets/**',
],
url: 'http://localhost:3000/__coverage__',
},
Expand Down Expand Up @@ -83,6 +85,29 @@ const config = {
},
})

const url = `mongodb://${process.env.DB_HOST ?? 'localhost'}:${process.env.DB_PORT ?? '27017'}`
const username = process.env.DB_USERNAME ?? 'local'
const password = process.env.DB_PASSWORD ?? 'dev'
const client = new MongoClient(url, {
auth: {
username,
password,
},
enableUtf8Validation: false,
})
on('task', {
async updateDatabase({ collection, filter, update }) {
try {
await client.connect()
const db = client.db('games')
const dbCollection = db.collection(collection)
return dbCollection.updateMany(filter, update)
} catch {
await client.close()
}
},
})

codeCoverage(on, config)

return imageDiff(on, config)
Expand Down
15 changes: 12 additions & 3 deletions apps/playnite-web/cypress/e2e/filtering/browse.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ describe('Filtering.', () => {
name: `filter-panel-open_${breakpointName}`,
cypressScreenshotOptions: {
onBeforeScreenshot($el) {
Cypress.$('[data-test="GameFigure').css('color', 'transparent')
Cypress.$('[data-test="GameFigure"]').css(
'color',
'transparent',
)
},
},
})
Expand Down Expand Up @@ -322,7 +325,10 @@ describe('Filtering.', () => {
name: `platform-filter_lookup_${breakpointName}`,
cypressScreenshotOptions: {
onBeforeScreenshot($el) {
Cypress.$('[data-test="GameFigure').css('color', 'transparent')
Cypress.$('[data-test="GameFigure"]').css(
'color',
'transparent',
)
},
},
})
Expand Down Expand Up @@ -364,7 +370,10 @@ describe('Filtering.', () => {
name: `filter-by-platform-selection_${breakpointName}`,
cypressScreenshotOptions: {
onBeforeScreenshot($el) {
Cypress.$('[data-test="GameFigure').css('color', 'transparent')
Cypress.$('[data-test="GameFigure"]').css(
'color',
'transparent',
)
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion apps/playnite-web/cypress/e2e/game-details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Game details.', () => {
name: `game-details-${locationName}-${breakpointName}`,
cypressScreenshotOptions: {
onBeforeScreenshot($el) {
Cypress.$('[data-test="GameFigure').css(
Cypress.$('[data-test="GameFigure"]').css(
'color',
'transparent',
)
Expand Down
Loading

0 comments on commit 661482b

Please sign in to comment.