diff --git a/.github/workflows/component-tests.yml b/.github/workflows/component-tests.yml deleted file mode 100644 index fcc2c2138..000000000 --- a/.github/workflows/component-tests.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Run Component Tests - -on: - workflow_dispatch: - inputs: - ref: - description: 'Branch/Tag/SHA to test' - required: true - pull_request: - paths: - - 'client/**' - - '.github/workflows/component-tests.yml' - push: - paths: - - 'client/**' - - '.github/workflows/component-tests.yml' - -jobs: - run-component-tests: - name: Run Component Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout (push/pull request) - uses: actions/checkout@v4 - if: github.event_name != 'workflow_dispatch' - - - name: Checkout (workflow_dispatch) - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - if: github.event_name == 'workflow_dispatch' - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install dependencies - run: | - cd client - npm ci - - - name: Run tests - run: | - cd client - npm test diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 35c959fad..e9ad8c8de 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -223,7 +223,8 @@ export default { return this.mediaMetadata.explicit || false }, placeholderUrl() { - return this.store.getters['globals/getPlaceholderCoverSrc'] + const config = this.$config || this.$nuxt.$config + return `${config.routerBasePath}/book_placeholder.jpg` }, bookCoverSrc() { return this.store.getters['globals/getLibraryItemCoverSrc'](this._libraryItem, this.placeholderUrl) diff --git a/client/components/covers/BookCover.vue b/client/components/covers/BookCover.vue index e55d38c17..0a9248d22 100644 --- a/client/components/covers/BookCover.vue +++ b/client/components/covers/BookCover.vue @@ -96,8 +96,8 @@ export default { return this.author }, placeholderUrl() { - const store = this.$store || this.$nuxt.$store - return store.getters['globals/getPlaceholderCoverSrc'] + const config = this.$config || this.$nuxt.$config + return `${config.routerBasePath}/book_placeholder.jpg` }, fullCoverUrl() { if (!this.libraryItem) return null diff --git a/client/components/covers/PreviewCover.vue b/client/components/covers/PreviewCover.vue index 0ce7e55ed..0b73b009c 100644 --- a/client/components/covers/PreviewCover.vue +++ b/client/components/covers/PreviewCover.vue @@ -18,7 +18,7 @@ -

{{ resolution }}

+

{{ resolution }}

@@ -65,12 +65,11 @@ export default { return 0.8 * this.sizeMultiplier }, resolution() { - if (!this.naturalWidth || !this.naturalHeight) return null return `${this.naturalWidth}×${this.naturalHeight}px` }, placeholderUrl() { - const store = this.$store || this.$nuxt.$store - return store.getters['globals/getPlaceholderCoverSrc'] + const config = this.$config || this.$nuxt.$config + return `${config.routerBasePath}/book_placeholder.jpg` } }, methods: { diff --git a/client/components/modals/item/tabs/Cover.vue b/client/components/modals/item/tabs/Cover.vue index 17979f708..fd258760a 100644 --- a/client/components/modals/item/tabs/Cover.vue +++ b/client/components/modals/item/tabs/Cover.vue @@ -2,7 +2,7 @@
- +
@@ -157,12 +157,6 @@ export default { coverPath() { return this.media.coverPath }, - coverUrl() { - if (!this.coverPath) { - return this.$store.getters['globals/getPlaceholderCoverSrc'] - } - return this.$store.getters['globals/getLibraryItemCoverSrcById'](this.libraryItemId, this.libraryItemUpdatedAt, true) - }, mediaMetadata() { return this.media.metadata || {} }, diff --git a/client/components/modals/player/QueueItemRow.vue b/client/components/modals/player/QueueItemRow.vue index 9ac01a167..2eb1bc3b6 100644 --- a/client/components/modals/player/QueueItemRow.vue +++ b/client/components/modals/player/QueueItemRow.vue @@ -55,7 +55,7 @@ export default { return this.item.coverPath }, coverUrl() { - if (!this.coverPath) return this.$store.getters['globals/getPlaceholderCoverSrc'] + if (!this.coverPath) return `${this.$config.routerBasePath}/book_placeholder.jpg` return this.$store.getters['globals/getLibraryItemCoverSrcById'](this.libraryItemId) }, bookCoverAspectRatio() { diff --git a/client/cypress/tests/components/cards/AuthorCard.cy.js b/client/cypress/tests/components/cards/AuthorCard.cy.js index 4c4a1cb88..21c638e18 100644 --- a/client/cypress/tests/components/cards/AuthorCard.cy.js +++ b/client/cypress/tests/components/cards/AuthorCard.cy.js @@ -19,9 +19,7 @@ describe('AuthorCard', () => { const mocks = { $strings: { LabelBooks: 'Books', - ButtonQuickMatch: 'Quick Match', - ToastAuthorUpdateSuccess: 'Author updated', - ToastAuthorUpdateSuccessNoImageFound: 'Author updated (no image found)' + ButtonQuickMatch: 'Quick Match' }, $store: { getters: { @@ -169,7 +167,7 @@ describe('AuthorCard', () => { cy.get('&match').click() cy.get('&spinner').should('be.hidden') - cy.get('@success').should('have.been.calledOnceWithExactly', 'Author updated (no image found)') + cy.get('@success').should('have.been.calledOnceWithExactly', 'Author John Doe was updated (no image found)') cy.get('@error').should('not.have.been.called') cy.get('@info').should('not.have.been.called') }) @@ -191,7 +189,7 @@ describe('AuthorCard', () => { cy.get('&match').click() cy.get('&spinner').should('be.hidden') - cy.get('@success').should('have.been.calledOnceWithExactly', 'Author updated') + cy.get('@success').should('have.been.calledOnceWithExactly', 'Author John Doe was updated') cy.get('@error').should('not.have.been.called') cy.get('@info').should('not.have.been.called') }) diff --git a/client/cypress/tests/components/cards/LazyBookCard.cy.js b/client/cypress/tests/components/cards/LazyBookCard.cy.js index dbe33f81d..c39c03023 100644 --- a/client/cypress/tests/components/cards/LazyBookCard.cy.js +++ b/client/cypress/tests/components/cards/LazyBookCard.cy.js @@ -172,7 +172,6 @@ describe('LazyBookCard', () => { }) it('shows titleImageNotReady and sets opacity 0 on coverImage when image not ready', () => { - mountOptions.mocks.$store.getters['globals/getLibraryItemCoverSrc'] = () => 'https://my.server.com/notfound.jpg' cy.mount(LazyBookCard, mountOptions) cy.get('&titleImageNotReady').should('be.visible') @@ -258,7 +257,7 @@ describe('LazyBookCard', () => { cy.get('#book-card-0').trigger('mouseover') cy.get('&titleImageNotReady').should('be.hidden') - cy.get('&seriesNameOverlay').should('be.visible').and('have.text', 'The Lord of the Rings') + cy.get('&seriesNameOverlay').should('be.visible').and('have.text', 'Middle Earth Chronicles') }) it('shows the seriesSequenceList when collapsed series has a sequence list', () => { diff --git a/client/cypress/tests/components/cards/LazySeriesCard.cy.js b/client/cypress/tests/components/cards/LazySeriesCard.cy.js index 346259d27..c637c604e 100644 --- a/client/cypress/tests/components/cards/LazySeriesCard.cy.js +++ b/client/cypress/tests/components/cards/LazySeriesCard.cy.js @@ -30,14 +30,6 @@ describe('LazySeriesCard', () => { } const mocks = { - $getString: (id, args) => { - switch (id) { - case 'LabelAddedDate': - return `Added ${args[0]}` - default: - return null - } - }, $store: { getters: { 'user/getUserCanUpdate': true, diff --git a/client/pages/share/_slug.vue b/client/pages/share/_slug.vue index bcc779d96..e7d00f005 100644 --- a/client/pages/share/_slug.vue +++ b/client/pages/share/_slug.vue @@ -64,7 +64,7 @@ export default { return this.mediaItemShare.playbackSession }, coverUrl() { - if (!this.playbackSession.coverPath) return this.$store.getters['globals/getPlaceholderCoverSrc'] + if (!this.playbackSession.coverPath) return `${this.$config.routerBasePath}/book_placeholder.jpg` return `${this.$config.routerBasePath}/public/share/${this.mediaItemShare.slug}/cover` }, downloadUrl() { diff --git a/client/store/globals.js b/client/store/globals.js index 7b416196a..65878fb44 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -87,7 +87,7 @@ export const getters = { getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = null, raw = false) => { - if (!placeholder) placeholder = getters.getPlaceholderCoverSrc + if (!placeholder) placeholder = `${rootState.routerBasePath}/book_placeholder.jpg` if (!libraryItem) return placeholder const media = libraryItem.media if (!media?.coverPath || media.coverPath === placeholder) return placeholder @@ -95,6 +95,7 @@ export const getters = { // Absolute URL covers (should no longer be used) if (media.coverPath.startsWith('http:') || media.coverPath.startsWith('https:')) return media.coverPath + const userToken = rootGetters['user/getToken'] const lastUpdate = libraryItem.updatedAt || Date.now() const libraryItemId = libraryItem.libraryItemId || libraryItem.id // Workaround for /users/:id page showing media progress covers return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?ts=${lastUpdate}${raw ? '&raw=1' : ''}` @@ -102,13 +103,11 @@ export const getters = { getLibraryItemCoverSrcById: (state, getters, rootState, rootGetters) => (libraryItemId, timestamp = null, raw = false) => { - if (!libraryItemId) return getters.getPlaceholderCoverSrc - + const placeholder = `${rootState.routerBasePath}/book_placeholder.jpg` + if (!libraryItemId) return placeholder + const userToken = rootGetters['user/getToken'] return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?${raw ? '&raw=1' : ''}${timestamp ? `&ts=${timestamp}` : ''}` }, - getPlaceholderCoverSrc: (state, getters, rootState, rootGetters) => { - return `${rootState.routerBasePath}/book_placeholder.jpg` - }, getIsBatchSelectingMediaItems: (state) => { return state.selectedMediaItems.length }