• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / gui / 897326496

pending completion
897326496

Pull #3752

gitlab-ci

mzedel
chore(e2e): made use of shared timeout & login checking values to remove code duplication

Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3752: chore(e2e-tests): slightly simplified log in test + separated log out test

4395 of 6392 branches covered (68.76%)

8060 of 9780 relevant lines covered (82.41%)

126.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.64
/src/js/components/helptips/deploymentcompletetip.js
1
// Copyright 2019 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React, { useEffect } from 'react';
15
import { connect } from 'react-redux';
16
import { useNavigate } from 'react-router-dom';
17

18
import { CheckCircle as CheckCircleIcon } from '@mui/icons-material';
19
import { Button } from '@mui/material';
20
import { withStyles } from 'tss-react/mui';
21

22
import { bindActionCreators } from 'redux';
23

24
import { getDevicesByStatus } from '../../actions/deviceActions';
25
import { advanceOnboarding, setOnboardingComplete, setShowCreateArtifactDialog } from '../../actions/onboardingActions';
26
import * as DeviceConstants from '../../constants/deviceConstants';
27
import { onboardingSteps } from '../../constants/onboardingConstants';
28
import { getDemoDeviceAddress } from '../../selectors';
29
import Tracking from '../../tracking';
30
import Loader from '../common/loader';
31
import { MenderTooltipClickable } from '../common/mendertooltip';
32

33
export const CompletionButton = withStyles(Button, ({ palette }) => ({
190✔
34
  root: {
35
    backgroundColor: palette.background.default,
36
    '&:hover': {
37
      backgroundColor: palette.background.default
38
    }
39
  }
40
}));
41

42
export const DeploymentCompleteTip = ({ advanceOnboarding, anchor, getDevicesByStatus, setShowCreateArtifactDialog, setOnboardingComplete, url }) => {
190✔
43
  const navigate = useNavigate();
1✔
44
  useEffect(() => {
1✔
45
    getDevicesByStatus(DeviceConstants.DEVICE_STATES.accepted);
1✔
46
    Tracking.event({ category: 'onboarding', action: onboardingSteps.DEPLOYMENTS_PAST_COMPLETED });
1✔
47
  }, []);
48

49
  const onClick = () => {
1✔
50
    const parametrizedAddress = `${url}/index.html?source=${encodeURIComponent(window.location)}`;
×
51
    window.open(parametrizedAddress, '_blank');
×
52
    advanceOnboarding(onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE);
×
53
    setOnboardingComplete(false);
×
54
    setShowCreateArtifactDialog(true);
×
55
    navigate('/releases');
×
56
  };
57

58
  return (
1✔
59
    <MenderTooltipClickable
60
      className="tooltip onboard-icon onboard-tip"
61
      id={onboardingSteps.DEPLOYMENTS_PAST_COMPLETED}
62
      onboarding
63
      startOpen
64
      style={anchor}
65
      PopperProps={{ style: { marginLeft: -30, marginTop: -20 } }}
66
      title={
67
        <div className="content">
68
          <p>Fantastic! You completed your first deployment!</p>
69
          <p>Your deployment is finished and your device is now running the updated software!</p>
70
          <div className="flexbox centered">
71
            {!url ? <Loader show={true} /> : <CompletionButton variant="text" onClick={onClick}>{`Go to ${url}`}</CompletionButton>}
1!
72
          </div>
73
          <p>and you should see the demo web application actually being run on the device.</p>
74
          <p>NOTE: if you have local network restrictions, you may need to check them if you have difficulty loading the page.</p>
75
          <a onClick={onClick}>Visit the web app running your device</a>
76
        </div>
77
      }
78
    >
79
      <CheckCircleIcon />
80
    </MenderTooltipClickable>
81
  );
82
};
83

84
const mapDispatchToProps = dispatch => {
190✔
85
  return bindActionCreators({ advanceOnboarding, getDevicesByStatus, setOnboardingComplete, setShowCreateArtifactDialog }, dispatch);
1✔
86
};
87

88
const mapStateToProps = (state, ownProps) => {
190✔
89
  return {
1✔
90
    url: getDemoDeviceAddress(state) || ownProps.targetUrl
1!
91
  };
92
};
93

94
export default connect(mapStateToProps, mapDispatchToProps)(DeploymentCompleteTip);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc