diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index b01faefab..9a4ef1620 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -35,7 +35,7 @@ jobs: - name: Upload coverage reports to Codecov if: success() - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 + uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -63,7 +63,7 @@ jobs: - name: Upload Cypress screenshots if: failure() - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 with: name: Inventory management system Screenshots path: cypress/screenshots @@ -74,7 +74,7 @@ jobs: steps: - name: Clone api repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb with: repository: ral-facilities/inventory-management-system-api ref: develop @@ -146,7 +146,7 @@ jobs: - name: Upload Cypress screenshots if: failure() - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 with: name: Inventory management system (with api) Screenshots path: cypress/screenshots @@ -170,12 +170,12 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1 with: images: ${{ secrets.HARBOR_URL }}/ims - name: Build and push Docker image to Harbor - uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 with: context: . file: ./Dockerfile.prod diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 07146f1a1..706618615 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -24,7 +24,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1 with: images: ${{ secrets.HARBOR_URL }}/ims tags: | @@ -34,7 +34,7 @@ jobs: latest=false - name: Build and push Docker image to Harbor - uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 with: context: . file: ./Dockerfile.prod diff --git a/Dockerfile b/Dockerfile index 4b51d1855..f7a55204c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Specify a base image -FROM node:20.17.0-alpine3.20@sha256:2d07db07a2df6830718ae2a47db6fedce6745f5bcd174c398f2acdda90a11c03 +FROM node:22.12.0-alpine3.20@sha256:96cc8323e25c8cc6ddcb8b965e135cfd57846e8003ec0d7bcec16c5fd5f6d39f # Set the working directory WORKDIR /inventory-management-system-run diff --git a/Dockerfile.prod b/Dockerfile.prod index fb5722ef9..563d42696 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -1,7 +1,7 @@ # Dockerfile to build and serve inventory management system # Build stage -FROM node:20.17.0-alpine3.20@sha256:2d07db07a2df6830718ae2a47db6fedce6745f5bcd174c398f2acdda90a11c03 as builder +FROM node:22.12.0-alpine3.20@sha256:96cc8323e25c8cc6ddcb8b965e135cfd57846e8003ec0d7bcec16c5fd5f6d39f as builder WORKDIR /inventory-management-system-build diff --git a/cypress/e2e/with_api/catalogueItems/catelogueItems.cy.ts b/cypress/e2e/with_api/catalogueItems/catalogueItems.cy.ts similarity index 100% rename from cypress/e2e/with_api/catalogueItems/catelogueItems.cy.ts rename to cypress/e2e/with_api/catalogueItems/catalogueItems.cy.ts diff --git a/cypress/e2e/with_mock_data/items.cy.ts b/cypress/e2e/with_mock_data/items.cy.ts index 0e46a41fd..f6f01cb37 100644 --- a/cypress/e2e/with_mock_data/items.cy.ts +++ b/cypress/e2e/with_mock_data/items.cy.ts @@ -893,9 +893,51 @@ describe('Items', () => { cy.findByTestId('galleryLightBox').should('not.exist'); }); + + it('deletes an image', () => { + cy.findByText('5YUQDDjKpz2z').click(); + cy.findByText( + 'High-resolution cameras for beam characterization. 1' + ).should('exist'); + + cy.findByText('Gallery').click(); + + cy.findAllByAltText('test').first().click(); + cy.findByTestId('galleryLightBox').within(() => { + cy.findByText('File name: stfc-logo-blue-text.png').should('exist'); + cy.findByText('Title: stfc-logo-blue-text').should('exist'); + cy.findByText('test').should('exist'); + + cy.findByAltText('test').should('exist'); + + cy.findByAltText('test') + .should('have.attr', 'src') + .and( + 'include', + 'http://localhost:3000/images/stfc-logo-blue-text.png?text=1' + ); + + cy.findByLabelText('Image Actions').click(); + }); + + cy.findAllByText('Delete').last().click(); + + cy.startSnoopingBrowserMockedRequest(); + + cy.findByRole('button', { name: 'Continue' }).click(); + + cy.findBrowserMockedRequests({ + method: 'DELETE', + url: '/images/:id', + }).should((patchRequests) => { + expect(patchRequests.length).equal(1); + const request = patchRequests[0]; + expect(request.url.toString()).to.contain('1'); + }); + }); }); - it('delete an item', () => { + it('deletes an item', () => { cy.findAllByLabelText('Row Actions').first().click(); cy.findByText('Delete').click(); @@ -915,7 +957,7 @@ describe('Items', () => { }); }); - it('duplicate an item', () => { + it('duplicates an item', () => { cy.findAllByLabelText('Row Actions').first().click(); cy.findByText('Duplicate').click(); diff --git a/package.json b/package.json index b66a45e08..af4a5b69f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@reduxjs/toolkit": "^2.2.5", "@tanstack/react-query": "^5.40.0", "@tanstack/react-query-devtools": "^5.40.0", - "@types/node": "^20.14.0", + "@types/node": "^22.0.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@types/uuid": "^10.0.0", @@ -37,7 +37,7 @@ "loglevel": "^1.9.1", "lz-string": "^1.5.0", "material-react-table": "^2.13.0", - "msw": "2.4.11", + "msw": "2.6.9", "react": "^18.3.1", "react-dom": "^18.3.1", "react-hook-form": "^7.52.0", @@ -45,7 +45,7 @@ "react-router-dom": "^6.23.1", "single-spa-react": "6.0.2", "typescript": "^5.4.5", - "uuid": "^10.0.0", + "uuid": "^11.0.0", "vite": "^5.2.12", "vite-plugin-css-injected-by-js": "^3.5.2", "zod": "^3.23.8" @@ -78,39 +78,39 @@ ], "packageManager": "yarn@4.5.0", "devDependencies": { - "@babel/eslint-parser": "7.25.8", - "@eslint/compat": "1.2.0", - "@eslint/js": "9.12.0", - "@tanstack/eslint-plugin-query": "5.59.7", + "@babel/eslint-parser": "7.25.9", + "@eslint/compat": "1.2.4", + "@eslint/js": "9.17.0", + "@tanstack/eslint-plugin-query": "5.62.1", "@testing-library/cypress": "10.0.2", "@testing-library/dom": "10.4.0", - "@testing-library/jest-dom": "6.5.0", - "@testing-library/react": "16.0.1", + "@testing-library/jest-dom": "6.6.3", + "@testing-library/react": "16.1.0", "@testing-library/user-event": "14.5.2", - "@types/eslint-plugin-jsx-a11y": "6.9.0", + "@types/eslint-plugin-jsx-a11y": "6.10.0", "@types/eslint__js": "8.42.3", "@types/react-router-dom": "5.3.3", - "@vitest/coverage-v8": "2.1.3", + "@vitest/coverage-v8": "2.1.8", "cross-env": "7.0.3", - "cypress": "13.15.0", - "eslint": "9.12.0", + "cypress": "13.16.1", + "eslint": "9.17.0", "eslint-config-prettier": "9.1.0", - "eslint-plugin-cypress": "4.0.0", - "eslint-plugin-jsx-a11y": "6.10.0", + "eslint-plugin-cypress": "4.1.0", + "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-no-only-tests": "3.3.0", "eslint-plugin-prettier": "5.2.1", - "eslint-plugin-react": "7.37.1", - "eslint-plugin-react-hooks": "5.0.0", - "eslint-plugin-testing-library": "6.4.0", - "express": "4.21.1", - "globals": "15.11.0", + "eslint-plugin-react": "7.37.2", + "eslint-plugin-react-hooks": "5.1.0", + "eslint-plugin-testing-library": "7.1.1", + "express": "4.21.2", + "globals": "15.13.0", "jsdom": "25.0.1", - "prettier": "3.3.3", - "serve": "14.2.3", + "prettier": "3.4.2", + "serve": "14.2.4", "serve-static": "1.16.2", - "start-server-and-test": "2.0.8", - "typescript-eslint": "8.10.0", - "vitest": "2.1.3" + "start-server-and-test": "2.0.9", + "typescript-eslint": "8.18.0", + "vitest": "2.1.8" }, "msw": { "workerDirectory": "public" diff --git a/src/admin/units/__snapshots__/units.component.test.tsx.snap b/src/admin/units/__snapshots__/units.component.test.tsx.snap index a57675b94..22d2c0ecd 100644 --- a/src/admin/units/__snapshots__/units.component.test.tsx.snap +++ b/src/admin/units/__snapshots__/units.component.test.tsx.snap @@ -1584,7 +1584,7 @@ exports[`Units > renders table correctly 1`] = ` Rows per page