Projekt

Obecné

Profil

Stáhnout (3.12 KB) Statistiky
| Větev: | Tag: | Revize:
1
*** Settings ***
2
Documentation	A test suite with tests of vertex actions.
3
...
4
...				This test has a workflow that is created using keywords in
5
...				the imported resource file.
6
...
7
Suite Setup		Open Browser To Demo Diagram
8
Suite Teardown	Close Browser
9
Resource		common.robot
10

    
11
*** Variables ***
12
${zoomInButton}	//button[@id='zoomIn']
13

    
14
${vertex1}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='1']
15
${vertex2}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='2']
16
${vertex3}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='3']
17
${vertex4}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='4']
18
${vertex5}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='5']
19
${vertex6}	//*[name()='svg'][contains(@class, 'vertex')][@data-id='6']
20

    
21
${vertexInterface}	/*[name()='g'][@class='interface']
22

    
23
${vertexPopover}	//div[contains(@class, 'vertex-popover')]
24

    
25
*** Test Cases ***
26
Highlight Vertex
27
	Click Element	${vertex3}
28
	# check that other vertices are either highlighted or dimmed
29
	Element Should Have Class	${vertex1}	node--highlighted-provided
30
	Element Should Have Class	${vertex2}	node--dimmed
31
	Element Should Have Class	${vertex3}	node--highlighted
32
	Element Should Have Class	${vertex5}	node--dimmed
33
	Element Should Have Class	${vertex6}	node--highlighted-required
34
	# unhighlight
35
	Click Element	${vertex3}
36
	# check that other vertices are back to normal
37
	Element Should Not Have Class	${vertex1}	node--highlighted-provided
38
	Element Should Not Have Class	${vertex2}	node--dimmed
39
	Element Should Not Have Class	${vertex3}	node--highlighted
40
	Element Should Not Have Class	${vertex5}	node--dimmed
41
	Element Should Not Have Class	${vertex6}	node--highlighted-required
42

    
43
Mouse Down Vertex
44
	Mouse Down	${vertex3}
45
	Element Should Have Class	${vertex3}	node--dragged
46
	Mouse Up	${vertex3}
47
	Element Should Not Have Class	${vertex3}	node--dragged
48

    
49
Drag Vertex
50
	# zoom in to 100% to get correct coordinates
51
	Click Element	${zoomInButton}
52
	Click Element	${zoomInButton}
53
	# get old vertex coordinates
54
	${oldX}=	Get Element Attribute	${vertex3}	x
55
	${oldX}=	Convert To Number	${oldX}	2
56
	${oldY}=	Get Element Attribute	${vertex3}	y
57
	${oldY}=	Convert To Number	${oldY}	2
58
	# move vertex by 10 pixels in both directions
59
	Drag And Drop By Offset		${vertex3}	10	10
60
	# get new vertex coordinates
61
	${newX}=	Get Element Attribute	${vertex3}	x
62
	${newX}=	Convert To Number	${newX}	2
63
	${newY}=	Get Element Attribute	${vertex3}	y
64
	${newY}=	Convert To Number	${newY}	2
65
	# check that offset matches
66
	Should Be Equal As Numbers	${oldX + 10}	${newX}
67
	Should Be Equal As Numbers	${oldY + 10}	${newY}
68

    
69
Display Vertex Popover
70
	Click Element	${vertex3}${vertexInterface}
71
	Element Should Be Visible	${vertexPopover}
72
	Element Should Not Have Class  ${vertexPopover}  hidden
73

    
74
Hide Vertex Popover By Moving Mouse Out
75
	Click Element	${vertex3}${vertexInterface}
76
	Mouse Out	${vertexPopover}
77
	Element Should Not Be Visible	${vertexPopover}
78
	Element Should Have Class  ${vertexPopover}  hidden
79

    
80
Hide Vertex Popover By Clicking Elsewhere
81
	Click Element	${vertex3}${vertexInterface}
82
	Click Element	//body
83
	Element Should Not Be Visible	${vertexPopover}
84
	Element Should Have Class  ${vertexPopover}  hidden
85

    
86
*** Keywords ***
(13-13/14)