diff --git a/ontrack-web-core/components/common/Breadcrumbs.js b/ontrack-web-core/components/common/Breadcrumbs.js index f63768e808..f71d4ce22d 100644 --- a/ontrack-web-core/components/common/Breadcrumbs.js +++ b/ontrack-web-core/components/common/Breadcrumbs.js @@ -65,5 +65,5 @@ export function promotionLevelBreadcrumbs(promotionLevel) { } export function validationStampBreadcrumbs(validationStamp) { - return downToBranchBreadcrumbs(validationStamp) + return validationStamp ? downToBranchBreadcrumbs(validationStamp) : [] } \ No newline at end of file diff --git a/ontrack-web-core/components/common/Titles.js b/ontrack-web-core/components/common/Titles.js index be93d02726..6dc21bd4af 100644 --- a/ontrack-web-core/components/common/Titles.js +++ b/ontrack-web-core/components/common/Titles.js @@ -59,7 +59,7 @@ export function validationStampTitleName(validationStamp, what) { } export function validationStampTitle(validationStamp) { - return title(validationStampTitleName(validationStamp)) + return validationStamp ? title(validationStampTitleName(validationStamp)) : '' } export function title(text) { diff --git a/ontrack-web-core/components/extension/environments/SlotPipelineDeploymentStatus.js b/ontrack-web-core/components/extension/environments/SlotPipelineDeploymentStatus.js index 556658ab06..638aea2a77 100644 --- a/ontrack-web-core/components/extension/environments/SlotPipelineDeploymentStatus.js +++ b/ontrack-web-core/components/extension/environments/SlotPipelineDeploymentStatus.js @@ -15,11 +15,11 @@ import {useReloadState} from "@components/common/StateUtils"; import PageSection from "@components/common/PageSection"; import SlotPipelineWorkflowsTable from "@components/extension/environments/SlotPipelineWorkflowsTable"; -export default function SlotPipelineDeploymentStatus({pipeline}) { +export default function SlotPipelineDeploymentStatus({pipeline, onChange}) { const client = useGraphQLClient() - const [reloadState, reload] = useReloadState() + const [reloadState, reload] = useReloadState({callback: onChange}) const [loading, setLoading] = useState(true) const [items, setItems] = useState([]) @@ -70,7 +70,7 @@ export default function SlotPipelineDeploymentStatus({pipeline}) { info={true} linkInfo={false} actions={true} - // TODO Refreshes the page on change + onChange={reload} />, span: 4, }) diff --git a/ontrack-web-core/components/extension/environments/SlotPipelineView.js b/ontrack-web-core/components/extension/environments/SlotPipelineView.js index e258405d66..837812720d 100644 --- a/ontrack-web-core/components/extension/environments/SlotPipelineView.js +++ b/ontrack-web-core/components/extension/environments/SlotPipelineView.js @@ -13,11 +13,13 @@ import { import {slotBreadcrumbs, slotTitle, slotUri} from "@components/extension/environments/EnvironmentsLinksUtils"; import {CloseCommand} from "@components/common/Commands"; import SlotPipelineDeploymentStatus from "@components/extension/environments/SlotPipelineDeploymentStatus"; +import {useReloadState} from "@components/common/StateUtils"; export default function SlotPipelineView({id}) { const client = useGraphQLClient() + const [reloadState, reload] = useReloadState() const [loading, setLoading] = useState(true) const [title, setTitle] = useState('') const [pipelinePageTitle, setPipelinePageTitle] = useState('') @@ -64,7 +66,7 @@ export default function SlotPipelineView({id}) { setLoading(false) }) } - }, [client, id]) + }, [client, id, reloadState]) return ( <> @@ -81,6 +83,7 @@ export default function SlotPipelineView({id}) { pipeline && } diff --git a/ontrack-web-core/components/validationStamps/ValidationStampView.js b/ontrack-web-core/components/validationStamps/ValidationStampView.js index 3ea69415f0..b538abe28b 100644 --- a/ontrack-web-core/components/validationStamps/ValidationStampView.js +++ b/ontrack-web-core/components/validationStamps/ValidationStampView.js @@ -36,7 +36,7 @@ export default function ValidationStampView({id}) { const client = useGraphQLClient() const [loading, setLoading] = useState(true) - const [validationStamp, setValidationStamp] = useState({branch: {project: {}}}) + const [validationStamp, setValidationStamp] = useState() const [commands, setCommands] = useState([]) const chartLeadTime = "chart-lead-time" @@ -191,7 +191,7 @@ export default function ValidationStampView({id}) { commands={commands} description={ - {validationStamp.description} + {validationStamp?.description} {/* Validation stamp data config */} { validationStamp && validationStamp.dataType && diff --git a/ontrack-web-core/components/validationStamps/ValidationStampViewTitle.js b/ontrack-web-core/components/validationStamps/ValidationStampViewTitle.js index 57ce7e1aab..41629493f4 100644 --- a/ontrack-web-core/components/validationStamps/ValidationStampViewTitle.js +++ b/ontrack-web-core/components/validationStamps/ValidationStampViewTitle.js @@ -6,14 +6,18 @@ export default function ValidationStampViewTitle({validationStamp, link = false} return ( <> { - link && - } - { - !link && - - - {validationStamp.name} - + validationStamp && <> + { + link && + } + { + !link && + + + {validationStamp.name} + + } + } ) diff --git a/ontrack-web-tests/tests/core/promotionLevels/PromotionsPage.js b/ontrack-web-tests/tests/core/promotionLevels/PromotionsPage.js index 8ccbff0365..76e49d8bbf 100644 --- a/ontrack-web-tests/tests/core/promotionLevels/PromotionsPage.js +++ b/ontrack-web-tests/tests/core/promotionLevels/PromotionsPage.js @@ -29,7 +29,7 @@ export class PromotionsPage { } async checkPromotionLevel({name}) { - await expect(this.page.getByRole('link', {name: name, exact: true})).toBeVisible() + await expect(this.page.getByRole('link', {name: name})).toBeVisible() } } diff --git a/ontrack-web-tests/tests/core/validationRuns/ValidationRunHistoryDialog.js b/ontrack-web-tests/tests/core/validationRuns/ValidationRunHistoryDialog.js index b5b635679b..59cebfcb44 100644 --- a/ontrack-web-tests/tests/core/validationRuns/ValidationRunHistoryDialog.js +++ b/ontrack-web-tests/tests/core/validationRuns/ValidationRunHistoryDialog.js @@ -7,7 +7,7 @@ export class ValidationRunHistoryDialog { } async waitFor() { - await expect(this.page.getByText(`Runs for ${this.run.validationStamp.name} in build ${this.run.build.name}`)).toBeVisible() + await expect(this.page.getByText(`${this.run.validationStamp.name} in build ${this.run.build.name}`)).toBeVisible() } async selectStatus(status) { diff --git a/ontrack-web-tests/tests/extensions/environments/Environments.js b/ontrack-web-tests/tests/extensions/environments/Environments.js index cc7694a247..9d9e42b5af 100644 --- a/ontrack-web-tests/tests/extensions/environments/Environments.js +++ b/ontrack-web-tests/tests/extensions/environments/Environments.js @@ -45,7 +45,7 @@ export class EnvironmentsPage { } async checkSlotIsVisible(environment, projectName, qualifier) { - const row = this.page.getByTestId(`environment-row-${environment.id}`) + const row = this.page.getByTestId(`environment-${environment.id}`) await expect(row.getByText(projectName, {exact: true})).toBeVisible() } diff --git a/ontrack-web-tests/tests/extensions/environments/manualApprovalFixtures.js b/ontrack-web-tests/tests/extensions/environments/manualApprovalFixtures.js index 4515c6e7ae..90ca63b03f 100644 --- a/ontrack-web-tests/tests/extensions/environments/manualApprovalFixtures.js +++ b/ontrack-web-tests/tests/extensions/environments/manualApprovalFixtures.js @@ -1,10 +1,10 @@ import {ontrack} from "@ontrack/ontrack"; import {login} from "../../core/login"; -import {EnvironmentsPage} from "./Environments"; import {expect} from "@playwright/test"; import {createSlot} from "./slotFixtures"; +import {PipelinePage} from "./PipelinePage"; -export const manualApprovalInEnvironmentsPage = async (page) => { +export const manualApprovalInPipelinePage = async (page) => { const {project, slot} = await createSlot(ontrack()) await ontrack().environments.addManualApproval({slot}) @@ -15,10 +15,10 @@ export const manualApprovalInEnvironmentsPage = async (page) => { await login(page) - const environmentsPage = new EnvironmentsPage(page) - await environmentsPage.goTo() + const pipelinePage = new PipelinePage(page, pipeline) + await pipelinePage.goTo() - const {pipelineActions} = await environmentsPage.checkPipelineCard(pipeline) + const pipelineActions = await pipelinePage.checkPipelineActions() await pipelineActions.expectManualInputButton() await pipelineActions.expectStatusProgress({value: 0}) diff --git a/ontrack-web-tests/tests/extensions/environments/manualInputs.spec.js b/ontrack-web-tests/tests/extensions/environments/manualInputs.spec.js index 1e6672efb0..794aefab0d 100644 --- a/ontrack-web-tests/tests/extensions/environments/manualInputs.spec.js +++ b/ontrack-web-tests/tests/extensions/environments/manualInputs.spec.js @@ -2,13 +2,8 @@ import {test} from "@playwright/test"; import {ontrack} from "@ontrack/ontrack"; import {login} from "../../core/login"; import {PipelinePage} from "./PipelinePage"; -import {manualApprovalInEnvironmentsPage} from "./manualApprovalFixtures"; import {createSlot} from "./slotFixtures"; -test('manual approval on the environments page', async ({page}) => { - await manualApprovalInEnvironmentsPage(page) -}) - test('manual approval on the pipeline page', async ({page}) => { const {project, slot} = await createSlot(ontrack()) await ontrack().environments.addManualApproval({slot}) diff --git a/ontrack-web-tests/tests/extensions/environments/pipelines.spec.js b/ontrack-web-tests/tests/extensions/environments/pipelines.spec.js index c04e449be9..e76906767f 100644 --- a/ontrack-web-tests/tests/extensions/environments/pipelines.spec.js +++ b/ontrack-web-tests/tests/extensions/environments/pipelines.spec.js @@ -1,12 +1,12 @@ import {test} from "@playwright/test"; -import {manualApprovalInEnvironmentsPage} from "./manualApprovalFixtures"; +import {manualApprovalInPipelinePage} from "./manualApprovalFixtures"; test('pipeline status refreshed when inputs completed', async ({page}) => { - await manualApprovalInEnvironmentsPage(page) + await manualApprovalInPipelinePage(page) }) test('pipeline marked as deploying', async ({page}) => { - const {pipelineActions} = await manualApprovalInEnvironmentsPage(page) + const {pipelineActions} = await manualApprovalInPipelinePage(page) // Pipeline is now ready to be set in "deploying" mode await pipelineActions.checkDeployingAction() await pipelineActions.deploying()