Projekt

Obecné

Profil

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

    
13
*** Variables ***
14
${defaultZoom}	${80}
15
${minZoom}	${10}
16
${maxZoom}	${500}
17

    
18
${graphWrapper}		//*[name()='g'][@id='graph']
19

    
20
${zoomInButton}		//button[@id='zoomIn']
21
${zoomOutButton}	//button[@id='zoomOut']
22
${zoomValue}		//span[@id='zoomValue']
23

    
24
*** Test Cases ***
25
Zoom In
26
	Click Element		${zoomInButton}
27
	Zoom Should Be Equal	${defaultZoom + 10}
28

    
29
Zoom In Constraint
30
	# zoom in to maximum (there are 12 steps between default and maximum zoom level)
31
	Repeat Keyword	12	Click Element	${zoomInButton}
32
	Zoom Should Be Equal	${maxZoom}
33
	Element Should Have Class	${zoomInButton}	disabled
34

    
35
Zoom Out
36
	Click Element		${zoomOutButton}
37
	Zoom Should Be Equal	${defaultZoom - 10}
38

    
39
Zoom Out Constraint
40
	# zoom out to minimum (there are 5 steps between default and minimum zoom level)
41
	Repeat Keyword	5	Click Element	${zoomOutButton}
42
	Zoom Should Be Equal	${minZoom}
43
	Element Should Have Class	${zoomOutButton}	disabled
44

    
45
*** Keywords ***
46
Zoom Should Be Equal
47
	[Arguments]	${expectedScale}
48
	# check zoom scale text
49
	${scalePercentage}=	Get Text	${zoomValue}
50
	${expectedPercentage}=	Catenate	SEPARATOR=	${expectedScale}	%
51
	Should Be Equal As Strings	${scalePercentage}	${expectedPercentage}
52
	# check zoom scale attribute
53
	${expectedScaleAsString}=	Convert To String	${expectedScale / 100}
54
	${expectedScaleAsString}=	Replace String	${expectedScaleAsString}	.0	${EMPTY}
55
	${scaleAttribute}=	Get Element Attribute	${graphWrapper}	transform
56
	${expectedAttribute}=	Catenate	SEPARATOR=	scale(	${expectedScaleAsString}	)
57
	Should Be Equal As Strings	${scaleAttribute}	${expectedAttribute}
(14-14/14)