Projekt

Obecné

Profil

Stáhnout (2.26 KB) Statistiky
| Větev: | Tag: | Revize:
1
import {by, element, protractor} from 'protractor';
2

    
3
export class DashboardPo {
4

    
5
  async clickToAccordionTab(): Promise<unknown> {
6
    return element(by.id('p-accordiontab-0')).click();
7
  }
8

    
9
  async clickButtonByText(text: string): Promise<unknown> {
10
    return element(by.buttonText(text)).click();
11
  }
12

    
13
  async xpathIsVisible(xPath: string): Promise<boolean> {
14
    return element(by.xpath(xPath)).isDisplayed();
15
  }
16

    
17
  async buttonByTextIsVisible(buttonText: string): Promise<boolean> {
18
    return element(by.buttonText(buttonText)).isDisplayed();
19
  }
20

    
21
  async clickManipulationUnitButton(id: string): Promise<unknown> {
22
    return element(by.id('manipulation_'+id)).click();
23
  }
24

    
25
  async clickByXpath(xPath: string): Promise<unknown> {
26
    return element(by.xpath(xPath)).click();
27
  }
28

    
29
  async setUnitDescription(xPath: string, text: string): Promise<unknown> {
30
    element(by.xpath(xPath)).clear()
31
    return element(by.xpath(xPath)).sendKeys(text);
32
  }
33

    
34
  async fillPosition(): Promise<unknown> {
35
    element(by.id('lat')).click()
36
    element(by.id('lat')).sendKeys(protractor.Key.UP, '10');
37
    element(by.id('lat')).sendKeys(protractor.Key.UP);
38
    element(by.id('lat')).sendKeys(protractor.Key.UP);
39
    element(by.id('lon')).click()
40
    element(by.id('lon')).sendKeys(protractor.Key.UP);
41
    element(by.id('lon')).sendKeys(protractor.Key.UP);
42
    element(by.id('lon')).sendKeys(protractor.Key.UP);
43
    element(by.id('alt')).sendKeys('10');
44
    element(by.id('speed')).sendKeys('10');
45
    return element(by.id('dop')).sendKeys('10');
46
  }
47

    
48
  async numberOfxPaths(xPath: string): Promise<unknown> {
49
    return element.all(by.xpath(xPath)).count();
50
  }
51

    
52
  async fillSensorForm(text: string): Promise<unknown> {
53
    element(by.id('sensorId')).clear();
54
    element(by.id('sensorId')).sendKeys(text);
55
    element(by.id('sensorName')).clear()
56
    element(by.id('sensorName')).sendKeys(text)
57
    element(by.cssContainingText('option', 'test')).click();
58
    return element(by.cssContainingText('option', 'Strikes (  )')).click();
59
  }
60

    
61
  async fillEditSensorForm(text: string): Promise<unknown> {
62
    element(by.id('sensorName')).clear()
63
    return element(by.id('sensorName')).sendKeys(text)
64
  }
65

    
66
  async clickToAccordionTabByXpath(xPath: string): Promise<unknown> {
67
    return element(by.xpath(xPath)).click();
68
  }
69
}
(2-2/2)