Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-3517 Fix e2e tests failing from notifications (#5773)

christof-wittreicha89be1c53812
diff --git a/web/js/app.js b/web/js/app.js
index 35bfb939b..c05d1463f 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -68,10 +68,10 @@ class App extends React.Component {
componentDidUpdate(prevProps) {
// Check if the numberUnseen prop has changed
const {
- kioskModeEnabled, notifications, numberOutagesUnseen, e2eModeEnabled,
+ kioskModeEnabled, notifications, numberOutagesUnseen, e2eModeEnabled, hideNotificationsPopup,
} = this.props;
if (numberOutagesUnseen !== prevProps.numberOutagesUnseen) {
- if (numberOutagesUnseen > 0 && !kioskModeEnabled && !e2eModeEnabled) {
+ if (numberOutagesUnseen > 0 && !kioskModeEnabled && !e2eModeEnabled && !hideNotificationsPopup) {
this.openNotification(notifications, numberOutagesUnseen);
}
}
@@ -154,6 +154,7 @@ class App extends React.Component {
locationKey,
modalId,
parameters,
+ hideNotificationsPopup,
} = this.props;
const appClass = `wv-content ${isEmbedModeActive ? 'embed-mode' : ''}`;
return (
@@ -164,7 +165,7 @@ class App extends React.Component {
<MapInteractions />
<AlertDropdown isTourActive={isTourActive} />
<div>
- {isTourActive && numberOutagesUnseen === 0 && (!isMobile || isEmbedModeActive) ? <Tour /> : null}
+ {isTourActive && (numberOutagesUnseen === 0 || hideNotificationsPopup) && (!isMobile || isEmbedModeActive) ? <Tour /> : null}
</div>
<Sidebar />
<div id="layer-modal" className="layer-modal" />
@@ -193,6 +194,8 @@ function mapStateToProps(state) {
} = notifications;
const kioskModeEnabled = (state.ui.eic !== null && state.ui.eic !== '') || state.ui.isKioskModeActive;
const e2eModeEnabled = state.ui.isE2eModeActive;
+ const githubActionsRunning = process.env.GITHUB_ACTIONS === 'true';
+ const locallyHosted = /localhost/.test(window.location.href);
return {
state,
kioskModeEnabled,
@@ -211,6 +214,7 @@ function mapStateToProps(state) {
parameters: state.parameters,
locationKey: state.location.key,
modalId: state.modal.id,
+ hideNotificationsPopup: githubActionsRunning || locallyHosted,
};
}
const mapDispatchToProps = (dispatch) => ({
@@ -265,6 +269,7 @@ App.propTypes = {
numberOutagesUnseen: PropTypes.number,
parameters: PropTypes.object,
setScreenInfoAction: PropTypes.func,
+ hideNotificationsPopup: PropTypes.bool,
};
App.defaultProps = {
diff --git a/webpack.config.js b/webpack.config.js
index 438bfc46e..59d49f750 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -15,6 +15,9 @@ const pluginSystem = [
new CssUrlRelativePlugin(),
new MiniCssExtractPlugin({
filename: 'wv.css'
+ }),
+ new webpack.DefinePlugin({
+ 'process.env.GITHUB_ACTIONS': JSON.stringify(process.env.GITHUB_ACTIONS || 'false')
})
]