diff --git a/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.spec.ts b/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.spec.ts new file mode 100644 index 00000000000..215e2e5c623 --- /dev/null +++ b/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.spec.ts @@ -0,0 +1,46 @@ +import { fireEvent, screen, within } from '@testing-library/vue'; +import { expect, it, vi } from 'vitest'; + +import Liquibase from './index.vue'; + +import { applications } from '@/mocks/applications/data'; +import Application from '@/services/application'; +import { render } from '@/test-utils'; + +it('opens only the selected execution when two databases ran the same changelog', async () => { + const instance = new Application(applications[0]).instances[0]; + const changeSet = { + id: '001', + author: 'db', + changeLog: 'orders.xml', + checksum: '9:abc', + execType: 'EXECUTED', + contexts: [], + labels: [], + }; + vi.spyOn(instance, 'fetchLiquibase').mockResolvedValue({ + data: { + contexts: { + application: { + liquibaseBeans: { + east: { + changeSets: [{ ...changeSet, deploymentId: 'east-deploy' }], + }, + west: { + changeSets: [{ ...changeSet, deploymentId: 'west-deploy' }], + }, + }, + }, + }, + }, + } as never); + render(Liquibase, { props: { instance } }); + const [east, west] = await screen.findAllByText('001'); + await fireEvent.click(east); + expect(screen.getByText('east-deploy')).toBeVisible(); + expect(screen.queryByText('west-deploy')).toBeNull(); + await fireEvent.click(west); + expect(screen.getByText('west-deploy')).toBeVisible(); + await fireEvent.click(east); + expect(within(west.closest('table')!).getByText('west-deploy')).toBeVisible(); +}); diff --git a/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.vue b/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.vue index 2c87ebc6372..4d49536dc59 100644 --- a/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.vue +++ b/spring-boot-admin-server-ui/src/main/frontend/views/instances/liquibase/index.vue @@ -40,14 +40,20 @@