From 3dfbc3a323b0cdf77a082b3522f230736f717165 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Fri, 4 Jun 2021 16:57:22 +0200 Subject: [PATCH] SONAR-14893 Adding Bitbucket pipline tutorial --- .../tutorials/TutorialSelectionRenderer.tsx | 27 + .../TutorialSelectionRenderer-test.tsx | 18 + .../bitbucket-pipelines/AnalysisCommand.tsx | 201 ++++++++ .../BitbucketPipelinesTutorial.tsx | 77 +++ .../bitbucket-pipelines/PreambuleYaml.tsx | 79 +++ .../RepositoryVariables.tsx | 119 +++++ .../__tests__/AnalysisCommand-test.tsx | 45 ++ .../BitbucketPipelinesTutorial-test.tsx | 51 ++ .../__tests__/PreambuleYaml-test.tsx | 37 ++ .../__tests__/RepositoryVariables-test.tsx | 45 ++ .../AnalysisCommand-test.tsx.snap | 469 ++++++++++++++++++ .../BitbucketPipelinesTutorial-test.tsx.snap | 41 ++ .../__snapshots__/PreambuleYaml-test.tsx.snap | 101 ++++ .../RepositoryVariables-test.tsx.snap | 161 ++++++ .../commands => components}/CreateYmlFile.tsx | 9 +- .../YamlFileStep.tsx | 13 +- .../__tests__/CreateYmlFile-test.tsx | 6 +- .../__tests__/YamlFileStep-test.tsx | 3 +- .../__snapshots__/CreateYmlFile-test.tsx.snap | 4 +- .../__snapshots__/YamlFileStep-test.tsx.snap | 26 + .../github-action/GitHubActionTutorial.tsx | 9 +- .../__snapshots__/YamlFileStep-test.tsx.snap | 50 -- .../github-action/commands/DotNet.tsx | 9 +- .../github-action/commands/Gradle.tsx | 11 +- .../github-action/commands/JavaMaven.tsx | 11 +- .../github-action/commands/Others.tsx | 7 +- .../__snapshots__/DotNet-test.tsx.snap | 2 + .../__snapshots__/Gradle-test.tsx.snap | 10 +- .../__snapshots__/JavaMaven-test.tsx.snap | 10 +- .../__snapshots__/Others-test.tsx.snap | 2 + .../src/main/js/components/tutorials/types.ts | 1 + .../resources/org/sonar/l10n/core.properties | 21 +- 32 files changed, 1586 insertions(+), 89 deletions(-) create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/PreambuleYaml-test.tsx.snap create mode 100644 server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/RepositoryVariables-test.tsx.snap rename server/sonar-web/src/main/js/components/tutorials/{github-action/commands => components}/CreateYmlFile.tsx (86%) rename server/sonar-web/src/main/js/components/tutorials/{github-action => components}/YamlFileStep.tsx (87%) rename server/sonar-web/src/main/js/components/tutorials/{github-action/commands => components}/__tests__/CreateYmlFile-test.tsx (85%) rename server/sonar-web/src/main/js/components/tutorials/{github-action => components}/__tests__/YamlFileStep-test.tsx (87%) rename server/sonar-web/src/main/js/components/tutorials/{github-action/commands => components}/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap (85%) create mode 100644 server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/YamlFileStep-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/YamlFileStep-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx index e2d2afbf34d..b724e53b3b6 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx @@ -22,6 +22,7 @@ import { translate } from 'sonar-ui-common/helpers/l10n'; import { getBaseUrl } from 'sonar-ui-common/helpers/urls'; import { AlmKeys, AlmSettingsInstance, ProjectAlmBindingResponse } from '../../types/alm-settings'; import AzurePipelinesTutorial from './azure-pipelines/AzurePipelinesTutorial'; +import BitbucketPipelinesTutorial from './bitbucket-pipelines/BitbucketPipelinesTutorial'; import GitHubActionTutorial from './github-action/GitHubActionTutorial'; import GitLabCITutorial from './gitlabci/GitLabCITutorial'; import JenkinsTutorial from './jenkins/JenkinsTutorial'; @@ -120,6 +121,22 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender )} + {projectBinding?.alm === AlmKeys.BitbucketCloud && ( + + )} + {jenkinsAvailable && ( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx new file mode 100644 index 00000000000..fe163ec5ba7 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx @@ -0,0 +1,45 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { mockAppState, mockComponent } from '../../../../helpers/testMocks'; +import { BuildTools } from '../../types'; +import { AnalysisCommand, AnalysisCommandProps } from '../AnalysisCommand'; + +it.each([[BuildTools.DotNet], [BuildTools.Gradle], [BuildTools.Maven], [BuildTools.Other]])( + 'should render correctly for %s', + buildTool => { + expect(shallowRender({ buildTool })).toMatchSnapshot(); + expect( + shallowRender({ appState: mockAppState({ branchesEnabled: true }), buildTool }) + ).toMatchSnapshot('with branch enabled'); + } +); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx new file mode 100644 index 00000000000..655744180b6 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { + mockAlmSettingsInstance, + mockProjectBitbucketCloudBindingResponse +} from '../../../../helpers/mocks/alm-settings'; +import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import Step from '../../components/Step'; +import BitbucketPipelinesTutorial, { + BitbucketPipelinesTutorialProps +} from '../BitbucketPipelinesTutorial'; + +it('should render correctly', () => { + const wrapper = shallowRender(); + expect(wrapper).toMatchSnapshot('For variable steps'); + const stepYaml = wrapper.find(Step).at(1); + stepYaml.simulate('open'); + expect(wrapper).toMatchSnapshot('For yaml steps'); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx new file mode 100644 index 00000000000..c8c5a5248c2 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx @@ -0,0 +1,37 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { mockComponent } from '../../../../helpers/testMocks'; +import { BuildTools } from '../../types'; +import { PreambuleYaml, PreambuleYamlProps } from '../PreambuleYaml'; + +it.each([[BuildTools.DotNet], [BuildTools.Gradle], [BuildTools.Maven], [BuildTools.Other]])( + 'should render correctly for %s', + buildTool => { + expect(shallowRender({ buildTool })).toMatchSnapshot(); + } +); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx new file mode 100644 index 00000000000..14413ebaf8c --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx @@ -0,0 +1,45 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { shallow } from 'enzyme'; +import * as React from 'react'; +import { + mockAlmSettingsInstance, + mockProjectBitbucketCloudBindingResponse +} from '../../../../helpers/mocks/alm-settings'; +import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import RepositoryVariables, { RepositoryVariablesProps } from '../RepositoryVariables'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap new file mode 100644 index 00000000000..51a6080106e --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap @@ -0,0 +1,469 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly for dotnet 1`] = ` + + + + +`; + +exports[`should render correctly for dotnet: with branch enabled 1`] = ` + + + + +`; + +exports[`should render correctly for gradle 1`] = ` + + + + +`; + +exports[`should render correctly for gradle: with branch enabled 1`] = ` + + + + +`; + +exports[`should render correctly for maven 1`] = ` + + + + +`; + +exports[`should render correctly for maven: with branch enabled 1`] = ` + + + + +`; + +exports[`should render correctly for other 1`] = ` + + + + +`; + +exports[`should render correctly for other: with branch enabled 1`] = ` + + + + +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap new file mode 100644 index 00000000000..0e33b556ff6 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap @@ -0,0 +1,41 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly: For variable steps 1`] = ` + + + + +`; + +exports[`should render correctly: For yaml steps 1`] = ` + + + + +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/PreambuleYaml-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/PreambuleYaml-test.tsx.snap new file mode 100644 index 00000000000..79f07d67d61 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/PreambuleYaml-test.tsx.snap @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly for dotnet 1`] = `""`; + +exports[`should render correctly for gradle 1`] = ` +
  • + + + build.gradle + + + , + "sq": + org.sonarqube + , + } + } + /> + +
  • +`; + +exports[`should render correctly for maven 1`] = ` +
  • + + + pom.xml + + + , + } + } + /> + +
  • +`; + +exports[`should render correctly for other 1`] = ` + +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/RepositoryVariables-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/RepositoryVariables-test.tsx.snap new file mode 100644 index 00000000000..2bd194884dd --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/RepositoryVariables-test.tsx.snap @@ -0,0 +1,161 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
    +

    + + onboarding.tutorial.with.bitbucket_pipelines.variables.intro.link + , + } + } + /> +

    +
      +
    1. + + + SONAR_TOKEN + + +
    2. + +
    3. + +
    4. +
    5. + +
    6. +
    +
    +
      +
    1. + + + SONAR_HOST_URL + + +
    2. +
    3. + , + "field": + onboarding.tutorial.env_variables.field + , + "value": + test + , + } + } + /> +
    4. +
    5. + +
    6. +
    + +
    +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CreateYmlFile.tsx b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx similarity index 86% rename from server/sonar-web/src/main/js/components/tutorials/github-action/commands/CreateYmlFile.tsx rename to server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx index e7c47ed263d..395aadbc729 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CreateYmlFile.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx @@ -21,14 +21,15 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; import { translate } from 'sonar-ui-common/helpers/l10n'; -import CodeSnippet from '../../../common/CodeSnippet'; +import CodeSnippet from '../../common/CodeSnippet'; export interface CreateYmlFileProps { + yamlFileName: string; yamlTemplate: string; } export default function CreateYmlFile(props: CreateYmlFileProps) { - const { yamlTemplate } = props; + const { yamlTemplate, yamlFileName } = props; return (
  • - .github/workflows/build.yml - + {yamlFileName} + ) }} diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/YamlFileStep.tsx b/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx similarity index 87% rename from server/sonar-web/src/main/js/components/tutorials/github-action/YamlFileStep.tsx rename to server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx index e76055a96e3..007c9a8a975 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/YamlFileStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx @@ -19,17 +19,22 @@ */ import * as React from 'react'; import { translate } from 'sonar-ui-common/helpers/l10n'; -import AllSet from '../components/AllSet'; import RenderOptions from '../components/RenderOptions'; import { BuildTools } from '../types'; -import AnalysisCommand from './AnalysisCommand'; +import AllSet from './AllSet'; export interface YamlFileStepProps { + children?: (buildTool?: BuildTools) => React.ReactElement<{}>; +} + +export interface AnalysisCommandProps { + appState: T.AppState; + buildTool?: BuildTools; component: T.Component; } export default function YamlFileStep(props: YamlFileStepProps) { - const { component } = props; + const { children } = props; const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet, BuildTools.Other]; const [buildToolSelected, setBuildToolSelected] = React.useState(); @@ -47,7 +52,7 @@ export default function YamlFileStep(props: YamlFileStepProps) { optionLabelKey="onboarding.build" />
  • - + {children && children(buildToolSelected)} {buildToolSelected !== undefined && ( <> diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CreateYmlFile-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/CreateYmlFile-test.tsx similarity index 85% rename from server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CreateYmlFile-test.tsx rename to server/sonar-web/src/main/js/components/tutorials/components/__tests__/CreateYmlFile-test.tsx index 9dfe3cbcb55..136fee4fade 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CreateYmlFile-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/CreateYmlFile-test.tsx @@ -19,13 +19,15 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { GradleProps } from '../../github-action/commands/Gradle'; import CreateYmlFile, { CreateYmlFileProps } from '../CreateYmlFile'; -import { GradleProps } from '../Gradle'; it('should render correctly', () => { expect(shallowRender()).toMatchSnapshot(); }); function shallowRender(props: Partial = {}) { - return shallow(); + return shallow( + + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/YamlFileStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/YamlFileStep-test.tsx similarity index 87% rename from server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/YamlFileStep-test.tsx rename to server/sonar-web/src/main/js/components/tutorials/components/__tests__/YamlFileStep-test.tsx index 1d1f3c07d1b..9b70ee7c486 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/YamlFileStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/YamlFileStep-test.tsx @@ -19,7 +19,6 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; import YamlFileStep, { YamlFileStepProps } from '../YamlFileStep'; it('should render correctly', () => { @@ -27,5 +26,5 @@ it('should render correctly', () => { }); function shallowRender(props: Partial = {}) { - return shallow(); + return shallow(); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap similarity index 85% rename from server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap rename to server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap index 61e32f72b14..098d9b25cc7 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CreateYmlFile-test.tsx.snap @@ -13,10 +13,10 @@ exports[`should render correctly 1`] = ` - .github/workflows/build.yml + test.yml , } diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/YamlFileStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/YamlFileStep-test.tsx.snap new file mode 100644 index 00000000000..4682c79068d --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/YamlFileStep-test.tsx.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` + +
      +
    1. + onboarding.build + +
    2. +
    +
    +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx index 61eded63854..6779481065a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx @@ -21,8 +21,9 @@ import * as React from 'react'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { AlmSettingsInstance, ProjectAlmBindingResponse } from '../../../types/alm-settings'; import Step from '../components/Step'; +import YamlFileStep from '../components/YamlFileStep'; +import AnalysisCommand from './AnalysisCommand'; import SecretStep from './SecretStep'; -import YamlFileStep from './YamlFileStep'; export enum Steps { CREATE_SECRET = 1, @@ -63,7 +64,11 @@ export default function GitHubActionTutorial(props: GitHubActionTutorialProps) { setStep(Steps.YAML)} open={step === Steps.YAML} - renderForm={() => } + renderForm={() => ( + + {buildTool => } + + )} stepNumber={Steps.YAML} stepTitle={translate('onboarding.tutorial.with.github_action.yaml.title')} /> diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/YamlFileStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/YamlFileStep-test.tsx.snap deleted file mode 100644 index 8f3bfa8a26a..00000000000 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/YamlFileStep-test.tsx.snap +++ /dev/null @@ -1,50 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -
      -
    1. - onboarding.build - -
    2. - -
    -
    -`; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/DotNet.tsx index f8a5d5edb14..c99e812057f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/DotNet.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/DotNet.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import CreateYmlFile from './CreateYmlFile'; +import CreateYmlFile from '../../components/CreateYmlFile'; export interface DotNetProps { branchesEnabled?: boolean; @@ -73,5 +73,10 @@ jobs: export default function DotNet(props: DotNetProps) { const { component, branchesEnabled } = props; - return ; + return ( + + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx index 6f3d323f13f..42cffc2d98c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx @@ -22,8 +22,8 @@ import { FormattedMessage } from 'react-intl'; import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; import { translate } from 'sonar-ui-common/helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; +import CreateYmlFile from '../../components/CreateYmlFile'; import { buildGradleSnippet } from '../../utils'; -import CreateYmlFile from './CreateYmlFile'; export interface GradleProps { branchesEnabled?: boolean; @@ -73,8 +73,8 @@ export default function Gradle(props: GradleProps) { <>
  • @@ -87,7 +87,10 @@ export default function Gradle(props: GradleProps) { />
  • - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/JavaMaven.tsx index cbafc007bf5..54d21e2232c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/JavaMaven.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/JavaMaven.tsx @@ -22,8 +22,8 @@ import { FormattedMessage } from 'react-intl'; import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; import { translate } from 'sonar-ui-common/helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; +import CreateYmlFile from '../../components/CreateYmlFile'; import { mavenPomSnippet } from '../../utils'; -import CreateYmlFile from './CreateYmlFile'; export interface JavaMavenProps { branchesEnabled?: boolean; @@ -73,8 +73,8 @@ export default function JavaMaven(props: JavaMavenProps) { <>
  • @@ -86,7 +86,10 @@ export default function JavaMaven(props: JavaMavenProps) { />
  • - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Others.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Others.tsx index 11320042f68..ea4f93e419f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Others.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Others.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import CreateYmlFile from '../../components/CreateYmlFile'; import DefaultProjectKey from '../../components/DefaultProjectKey'; -import CreateYmlFile from './CreateYmlFile'; export interface OthersProps { branchesEnabled?: boolean; @@ -75,7 +75,10 @@ export default function Others(props: OthersProps) { return ( <> - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/DotNet-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/DotNet-test.tsx.snap index ae1bd7ae9cd..afb06fa5683 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/DotNet-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/DotNet-test.tsx.snap @@ -2,6 +2,7 @@ exports[`should render correctly 1`] = ` @@ -41,6 +41,7 @@ sonarqube { /> @@ -123,6 +124,7 @@ sonarqube { /> @@ -30,6 +30,7 @@ exports[`should render correctly 1`] = ` /> @@ -101,6 +102,7 @@ exports[`should render correctly: without branch enabled 1`] = ` />