@@ -22,12 +22,14 @@ package it.ui; | |||
import com.sonar.orchestrator.Orchestrator; | |||
import com.sonar.orchestrator.build.SonarScanner; | |||
import it.Category4Suite; | |||
import it.user.ForceAuthenticationTest; | |||
import java.util.Map; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.ws.client.GetRequest; | |||
import org.sonarqube.ws.client.WsResponse; | |||
import org.sonarqube.ws.client.setting.SetRequest; | |||
import pageobjects.Navigation; | |||
import util.ItUtils; | |||
@@ -38,6 +40,7 @@ import static com.codeborne.selenide.Selenide.$; | |||
import static com.codeborne.selenide.WebDriverRunner.url; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static util.ItUtils.projectDir; | |||
import static util.ItUtils.setServerProperty; | |||
public class UiTest { | |||
@@ -71,6 +74,16 @@ public class UiTest { | |||
nav.getFooter().shouldNot(hasText((String) statusMap.get("version"))); | |||
} | |||
@Test | |||
public void footer_doesnt_contains_about_when_not_logged_in() { | |||
setServerProperty(ORCHESTRATOR, "sonar.forceAuthentication", "true"); | |||
nav.openLogin(); | |||
nav.getFooter() | |||
.shouldNot(hasText("About")) | |||
.shouldNot(hasText("Web API")); | |||
setServerProperty(ORCHESTRATOR, "sonar.forceAuthentication", null); | |||
} | |||
@Test | |||
public void many_page_transitions() { | |||
analyzeSampleProject(); |
@@ -20,7 +20,7 @@ | |||
// @flow | |||
import React from 'react'; | |||
import GlobalNav from './nav/global/GlobalNav'; | |||
import GlobalFooter from './GlobalFooter'; | |||
import GlobalFooterContainer from './GlobalFooterContainer'; | |||
import GlobalMessagesContainer from './GlobalMessagesContainer'; | |||
export default function GlobalContainer(props: Object) { | |||
@@ -35,7 +35,7 @@ export default function GlobalContainer(props: Object) { | |||
{props.children} | |||
</div> | |||
</div> | |||
<GlobalFooter /> | |||
<GlobalFooterContainer /> | |||
</div> | |||
); | |||
} |
@@ -20,18 +20,27 @@ | |||
// @flow | |||
import React from 'react'; | |||
import { Link } from 'react-router'; | |||
import { connect } from 'react-redux'; | |||
import { getAppState } from '../../store/rootReducer'; | |||
import GlobalFooterForSonarQubeDotCom from './GlobalFooterForSonarQubeDotCom'; | |||
import GlobalFooterBranding from './GlobalFooterBranding'; | |||
import { translate, translateWithParameters } from '../../helpers/l10n'; | |||
type Props = { | |||
hideLoggedInInfo?: boolean, | |||
productionDatabase: boolean, | |||
sonarqubeDotCom: boolean, | |||
sonarqubeVersion?: string | |||
}; | |||
function GlobalFooter({ hideLoggedInInfo, sonarqubeVersion, productionDatabase }: Props) { | |||
export default function GlobalFooter({ | |||
hideLoggedInInfo, | |||
productionDatabase, | |||
sonarqubeDotCom, | |||
sonarqubeVersion | |||
}: Props) { | |||
if (sonarqubeDotCom) { | |||
return <GlobalFooterForSonarQubeDotCom hideLoggedInInfo={hideLoggedInInfo} />; | |||
} | |||
return ( | |||
<div id="footer" className="page-footer page-container"> | |||
{productionDatabase === false && | |||
@@ -74,10 +83,3 @@ function GlobalFooter({ hideLoggedInInfo, sonarqubeVersion, productionDatabase } | |||
</div> | |||
); | |||
} | |||
const mapStateToProps = state => ({ | |||
sonarqubeVersion: getAppState(state).version, | |||
productionDatabase: getAppState(state).productionDatabase | |||
}); | |||
export default connect(mapStateToProps)(GlobalFooter); |
@@ -0,0 +1,31 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 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. | |||
*/ | |||
// @flow | |||
import { connect } from 'react-redux'; | |||
import { getAppState, getSettingValue } from '../../store/rootReducer'; | |||
import GlobalFooter from './GlobalFooter'; | |||
const mapStateToProps = state => ({ | |||
sonarqubeVersion: getAppState(state).version, | |||
productionDatabase: getAppState(state).productionDatabase, | |||
sonarqubeDotCom: getSettingValue(state, 'sonar.lf.sonarqube.com.enabled') | |||
}); | |||
export default connect(mapStateToProps)(GlobalFooter); |
@@ -0,0 +1,50 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 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. | |||
*/ | |||
// @flow | |||
import React from 'react'; | |||
import { Link } from 'react-router'; | |||
import { translate } from '../../helpers/l10n'; | |||
export default function GlobalFooterForSonarQubeDotCom() { | |||
return ( | |||
<div id="footer" className="page-footer page-container"> | |||
<div> | |||
© 2008-2017, SonarQube.com by | |||
{' '} | |||
<a href="http://www.sonarsource.com" title="SonarSource SA">SonarSource SA</a> | |||
. All rights reserved. | |||
</div> | |||
<div> | |||
<a href="https://about.sonarqube.com/news/">{translate('footer.news')}</a> | |||
{' - '} | |||
<a href="https://about.sonarqube.com/Terms_of_service.pdf">{translate('footer.terms')}</a> | |||
{' - '} | |||
<a href="https://twitter.com/sonarqube">{translate('footer.twitter')}</a> | |||
{' - '} | |||
<a href="https://about.sonarqube.com/get-started/">{translate('footer.get_started')}</a> | |||
{' - '} | |||
<a href="https://about.sonarqube.com/contact/">{translate('footer.help')}</a> | |||
{' - '} | |||
{<Link to="/about">{translate('footer.about')}</Link>} | |||
</div> | |||
</div> | |||
); | |||
} |
@@ -19,7 +19,7 @@ | |||
*/ | |||
// @flow | |||
import React from 'react'; | |||
import GlobalFooter from './GlobalFooter'; | |||
import GlobalFooterContainer from './GlobalFooterContainer'; | |||
type Props = { | |||
children?: React.Element<*> | Array<React.Element<*>>, | |||
@@ -57,7 +57,7 @@ export default class SimpleContainer extends React.PureComponent { | |||
</div> | |||
</div> | |||
</div> | |||
<GlobalFooter hideLoggedInInfo={this.props.hideLoggedInInfo} /> | |||
<GlobalFooterContainer hideLoggedInInfo={this.props.hideLoggedInInfo} /> | |||
</div> | |||
); | |||
} |
@@ -0,0 +1,65 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 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 React from 'react'; | |||
import GlobalFooter from '../GlobalFooter'; | |||
it('should render the only logged in information', () => { | |||
expect( | |||
shallow(<GlobalFooter productionDatabase={true} sonarqubeDotCom={false} />) | |||
).toMatchSnapshot(); | |||
}); | |||
it('should not render the only logged in information', () => { | |||
expect( | |||
shallow( | |||
<GlobalFooter | |||
hideLoggedInInfo={true} | |||
productionDatabase={true} | |||
sonarqubeDotCom={false} | |||
sonarqubeVersion="6.4-SNAPSHOT" | |||
/> | |||
) | |||
).toMatchSnapshot(); | |||
}); | |||
it('should show the db warning message', () => { | |||
expect( | |||
shallow(<GlobalFooter productionDatabase={false} sonarqubeDotCom={false} />).find('.alert') | |||
).toMatchSnapshot(); | |||
}); | |||
it('should display the sq version', () => { | |||
expect( | |||
shallow( | |||
<GlobalFooter | |||
productionDatabase={true} | |||
sonarqubeDotCom={false} | |||
sonarqubeVersion="6.4-SNAPSHOT" | |||
/> | |||
) | |||
).toMatchSnapshot(); | |||
}); | |||
it('should render SonarqubeDotCom footer', () => { | |||
expect( | |||
shallow(<GlobalFooter productionDatabase={true} sonarqubeDotCom={true} />) | |||
).toMatchSnapshot(); | |||
}); |
@@ -0,0 +1,26 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 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 React from 'react'; | |||
import GlobalFooterForSonarQubeDotCom from '../GlobalFooterForSonarQubeDotCom'; | |||
it('should render correctly', () => { | |||
expect(shallow(<GlobalFooterForSonarQubeDotCom />)).toMatchSnapshot(); | |||
}); |
@@ -0,0 +1,173 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should display the sq version 1`] = ` | |||
<div | |||
className="page-footer page-container" | |||
id="footer" | |||
> | |||
<GlobalFooterBranding /> | |||
<div> | |||
footer.version_x.6.4-SNAPSHOT | |||
- | |||
<a | |||
href="http://www.gnu.org/licenses/lgpl-3.0.txt" | |||
> | |||
footer.licence | |||
</a> | |||
- | |||
<a | |||
href="http://www.sonarqube.org" | |||
> | |||
footer.community | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/home.html" | |||
> | |||
footer.documentation | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/community.html" | |||
> | |||
footer.support | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/plugin-library.html" | |||
> | |||
footer.plugins | |||
</a> | |||
- | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to="/web_api" | |||
> | |||
footer.web_api | |||
</Link> | |||
- | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to="/about" | |||
> | |||
footer.about | |||
</Link> | |||
</div> | |||
</div> | |||
`; | |||
exports[`should not render the only logged in information 1`] = ` | |||
<div | |||
className="page-footer page-container" | |||
id="footer" | |||
> | |||
<GlobalFooterBranding /> | |||
<div> | |||
<a | |||
href="http://www.gnu.org/licenses/lgpl-3.0.txt" | |||
> | |||
footer.licence | |||
</a> | |||
- | |||
<a | |||
href="http://www.sonarqube.org" | |||
> | |||
footer.community | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/home.html" | |||
> | |||
footer.documentation | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/community.html" | |||
> | |||
footer.support | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/plugin-library.html" | |||
> | |||
footer.plugins | |||
</a> | |||
</div> | |||
</div> | |||
`; | |||
exports[`should render SonarqubeDotCom footer 1`] = `<GlobalFooterForSonarQubeDotCom />`; | |||
exports[`should render the only logged in information 1`] = ` | |||
<div | |||
className="page-footer page-container" | |||
id="footer" | |||
> | |||
<GlobalFooterBranding /> | |||
<div> | |||
<a | |||
href="http://www.gnu.org/licenses/lgpl-3.0.txt" | |||
> | |||
footer.licence | |||
</a> | |||
- | |||
<a | |||
href="http://www.sonarqube.org" | |||
> | |||
footer.community | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/home.html" | |||
> | |||
footer.documentation | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/community.html" | |||
> | |||
footer.support | |||
</a> | |||
- | |||
<a | |||
href="https://redirect.sonarsource.com/doc/plugin-library.html" | |||
> | |||
footer.plugins | |||
</a> | |||
- | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to="/web_api" | |||
> | |||
footer.web_api | |||
</Link> | |||
- | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to="/about" | |||
> | |||
footer.about | |||
</Link> | |||
</div> | |||
</div> | |||
`; | |||
exports[`should show the db warning message 1`] = ` | |||
<div | |||
className="alert alert-danger" | |||
> | |||
<p | |||
className="big" | |||
id="evaluation_warning" | |||
> | |||
footer.production_database_warning | |||
</p> | |||
<p> | |||
footer.production_database_explanation | |||
</p> | |||
</div> | |||
`; |
@@ -0,0 +1,59 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly 1`] = ` | |||
<div | |||
className="page-footer page-container" | |||
id="footer" | |||
> | |||
<div> | |||
© 2008-2017, SonarQube.com by | |||
<a | |||
href="http://www.sonarsource.com" | |||
title="SonarSource SA" | |||
> | |||
SonarSource SA | |||
</a> | |||
. All rights reserved. | |||
</div> | |||
<div> | |||
<a | |||
href="https://about.sonarqube.com/news/" | |||
> | |||
footer.news | |||
</a> | |||
- | |||
<a | |||
href="https://about.sonarqube.com/Terms_of_service.pdf" | |||
> | |||
footer.terms | |||
</a> | |||
- | |||
<a | |||
href="https://twitter.com/sonarqube" | |||
> | |||
footer.twitter | |||
</a> | |||
- | |||
<a | |||
href="https://about.sonarqube.com/get-started/" | |||
> | |||
footer.get_started | |||
</a> | |||
- | |||
<a | |||
href="https://about.sonarqube.com/contact/" | |||
> | |||
footer.help | |||
</a> | |||
- | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to="/about" | |||
> | |||
footer.about | |||
</Link> | |||
</div> | |||
</div> | |||
`; |
@@ -2884,10 +2884,15 @@ organization.change_visibility_form.submit=Change Default Visibility | |||
footer.about=About | |||
footer.community=Community | |||
footer.documentation=Documentation | |||
footer.get_started=Get Started | |||
footer.help=Help | |||
footer.licence=LGPL v3 | |||
footer.news=News | |||
footer.plugins=Plugins | |||
footer.production_database_explanation=The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, and there is no support for migrating your data out of it into a different database engine. | |||
footer.production_database_warning=Embedded database should be used for evaluation purpose only | |||
footer.support=Get Support | |||
footer.terms=Terms | |||
footer.twitter=Twitter | |||
footer.version_x=Version {0} | |||
footer.web_api=Web API |