• 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

73.68
/src/js/components/helptips/onboardingcompletetip.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, useRef } from 'react';
15
import { connect } from 'react-redux';
16

17
import { CheckCircle as CheckCircleIcon } from '@mui/icons-material';
18
import { Button } from '@mui/material';
19

20
import { bindActionCreators } from 'redux';
21

22
import { getDeviceById, getDevicesByStatus } from '../../actions/deviceActions';
23
import { setOnboardingComplete } from '../../actions/onboardingActions';
24
import * as DeviceConstants from '../../constants/deviceConstants';
25
import { onboardingSteps } from '../../constants/onboardingConstants';
26
import { getDemoDeviceAddress, getDocsVersion } from '../../selectors';
27
import Loader from '../common/loader';
28
import { MenderTooltipClickable } from '../common/mendertooltip';
29
import { CompletionButton } from './deploymentcompletetip';
30

31
export const OnboardingCompleteTip = ({ anchor, docsVersion, getDeviceById, getDevicesByStatus, setOnboardingComplete, url }) => {
190✔
32
  const timer = useRef();
1✔
33
  useEffect(() => {
1✔
34
    getDevicesByStatus(DeviceConstants.DEVICE_STATES.accepted)
1✔
35
      .then(tasks => {
36
        return Promise.all(tasks[tasks.length - 1].deviceAccu.ids.map(getDeviceById));
×
37
      })
38
      .finally(() => {
39
        timer.current = setTimeout(() => setOnboardingComplete(true), 120000);
×
40
      });
41
    return () => {
1✔
42
      setOnboardingComplete(true);
1✔
43
      clearTimeout(timer.current);
1✔
44
    };
45
  }, []);
46

47
  return (
1✔
48
    <MenderTooltipClickable
49
      className="tooltip onboard-icon onboard-tip"
50
      id={onboardingSteps.ONBOARDING_FINISHED}
51
      onboarding
52
      startOpen
53
      style={anchor}
54
      PopperProps={{ style: { marginLeft: -30, marginTop: -20 } }}
55
      title={
56
        <div className="content">
57
          <p>Great work! You updated your device with the new Release!</p>
58
          <div className="margin-bottom-small margin-top-small">
59
            Your device is now running the updated version of the software. At
60
            <div className="flexbox centered" style={{ margin: '5px 0' }}>
61
              {!url ? (
1!
62
                <Loader show={true} />
63
              ) : (
64
                <CompletionButton
65
                  className="button"
66
                  variant="text"
67
                  href={`${url}/index.html?source=${encodeURIComponent(window.location)}`}
68
                  target="_blank"
69
                >{`Go to ${url}`}</CompletionButton>
70
              )}
71
            </div>
72
            you should now see &quot;Hello world&quot; in place of the webpage you saw previously. If you continue to see the webpage you saw previously you
73
            might have to refresh the page.
74
          </div>
75
          <p>You&apos;ve now got a good foundation in how to use Mender. Look for more help hints in the UI as you go along.</p>
76
          What next?
77
          <div>
78
            Proceed to one of the following tutorials (listed in recommended order):
79
            <ol>
80
              <li key="deploy-a-system-update">
81
                <a href={`https://docs.mender.io/${docsVersion}get-started/deploy-an-operating-system-update`} target="_blank" rel="noopener noreferrer">
82
                  Deploy an operating system update
83
                </a>
84
              </li>
85
              <li key="deploy-a-container-update">
86
                <a href={`https://docs.mender.io/${docsVersion}get-started/deploy-a-container-update`} target="_blank" rel="noopener noreferrer">
87
                  Deploy a container update
88
                </a>
89
              </li>
90
            </ol>
91
          </div>
92
          <div className="flexbox">
93
            <div style={{ flexGrow: 1 }} />
94
            <Button variant="contained" color="secondary" onClick={() => setOnboardingComplete(true)}>
×
95
              Close
96
            </Button>
97
          </div>
98
        </div>
99
      }
100
    >
101
      <CheckCircleIcon />
102
    </MenderTooltipClickable>
103
  );
104
};
105

106
const mapDispatchToProps = dispatch => {
190✔
107
  return bindActionCreators({ getDeviceById, getDevicesByStatus, setOnboardingComplete }, dispatch);
1✔
108
};
109

110
const mapStateToProps = (state, ownProps) => {
190✔
111
  return {
1✔
112
    docsVersion: getDocsVersion(state),
113
    url: getDemoDeviceAddress(state) || ownProps.targetUrl
1!
114
  };
115
};
116

117
export default connect(mapStateToProps, mapDispatchToProps)(OnboardingCompleteTip);
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