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

glorious-codes / glorious-demo / 971b12eb-089e-42e4-89d6-04e2d7329d1c

pending completion
971b12eb-089e-42e4-89d6-04e2d7329d1c

Pull #107

circleci

GitHub
build(deps): bump minimist from 1.2.5 to 1.2.6
Pull Request #107: build(deps): bump minimist from 1.2.5 to 1.2.6

62 of 62 branches covered (100.0%)

Branch coverage included in aggregate %.

273 of 273 relevant lines covered (100.0%)

10.96 hits per line

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

100.0
/src/scripts/components/player/player.js
1
import { Desktop } from '../desktop/desktop';
2

3
export class Player {
4
  constructor(container, steps){
5
    this.container = container;
12✔
6
    this.steps = steps;
12✔
7
    this.desktop = new Desktop(container);
12✔
8
    this.setCurrentStepNumber(0);
12✔
9
  }
10
  play(){
11
    const { desktop, steps } = this;
9✔
12
    return new Promise(resolve => playSteps(this, desktop, steps, resolve));
9✔
13
  }
14
  getCurrentStepNumber(){
15
    return this.currentStepNumber;
17✔
16
  }
17
  setCurrentStepNumber(stepNumber){
18
    this.currentStepNumber = stepNumber;
20✔
19
  }
20
}
21

22
function playSteps(player, desktop, steps, onComplete){
23
  let currentStepNumber = player.getCurrentStepNumber();
17✔
24
  if(currentStepNumber < steps.length){
17✔
25
    const step = steps[currentStepNumber];
11✔
26
    playStep(desktop, step, () => {
11✔
27
      player.setCurrentStepNumber(currentStepNumber + 1);
8✔
28
      playSteps(player, desktop, steps, onComplete);
8✔
29
    }, step.onCompleteDelay);
30
  } else {
31
    onComplete();
6✔
32
  }
33
}
34

35
function playStep(desktop, step, onComplete, onCompleteDelay = 0){
10✔
36
  getApplication(desktop, step.app, step.options, application => {
11✔
37
    if(step.action)
9✔
38
      application[step.action](step.params, () => {
7✔
39
        setTimeout(onComplete, onCompleteDelay);
6✔
40
      });
41
    else
42
      setTimeout(onComplete, onCompleteDelay);
2✔
43
  });
44
}
45

46
function getApplication(desktop, app, options, onGetApplication){
47
  const application = desktop.openApplication(app, options);
11✔
48
  const onMaximizeApplication = () => onGetApplication(application);
11✔
49
  if(application.isMaximized) {
11✔
50
    onGetApplication(application);
8✔
51
  } else if(application.inanimate) {
3✔
52
    desktop.minimizeAllApplications();
1✔
53
    desktop.maximizeApplication(application, onMaximizeApplication)
1✔
54
  } else {
55
    desktop.minimizeAllApplications(() => {
2✔
56
      desktop.maximizeApplication(application, onMaximizeApplication);
1✔
57
    });
58
  }
59
}
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