Welcome to mirror list, hosted at ThFree Co, Russian Federation.

macros.xml « modules « testcases « webtest « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c342b19cc85c7f51a427dd754838f6c1866033d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<macrodef name="generateResetToken" description="generate reset token">
	<attribute name="output" default="piwik_reset_token" />
	<sequential>
		<exec executable="${php.executable}" dir="${basedir}" outputproperty="@{output}">
			<arg value="-r" />
			<arg value="@date_default_timezone_set('UTC'); &#36;ini = parse_ini_file('${basedir}/../../config/config.ini.php', true); &#36;passwd = md5('piwik_password'); echo md5(strftime('%Y%m%d%H', time()+24*60*60) . 'piwik_login' . 'nobody@piwik.org' . substr(&#36;passwd, 0, 16) . &#36;ini['superuser']['salt'] . substr(&#36;passwd, -16));" />
		</exec>
	</sequential>
</macrodef>

<macrodef name="retryClickLink" description="clickLink with retry and timeout">
	<attribute name="maxcount" default="1" />
	<attribute name="seconds" default="1" />
	<attribute name="description" default="" />
	<attribute name="label" default="" />
	<attribute name="href" default="" />
	<sequential>
		<retry description="@{description}" maxcount="@{maxcount}">
			<sleep description="pause" seconds="@{seconds}" />
			<clickLink description="click link" label="@{label}" href="@{href}" />
		</retry>
	</sequential>
</macrodef>

<macrodef name="piwikGetVersion" description="get Piwik version">
	<attribute name="propertyName" default="latestVersion" />
	<sequential>
		<get src="http://api.piwik.org/1.0/getLatestVersion/" dest="latestVersion.txt" />
		<loadfile srcFile="latestVersion.txt" property="@{propertyName}">
			<filterchain>
				<striplinebreaks />
			</filterchain>
		</loadfile>
	</sequential>
</macrodef>

<macrodef name="piwikPreInstall" description="pre-install Piwik">
	<attribute name="version" default="1.0" />
	<sequential>
		<!-- download Piwik and unzip -->

		<property environment="env" />

		<get src="http://builds.piwik.org/piwik-@{version}.zip" dest="piwik-@{version}.zip" />

		<unzip src="piwik-@{version}.zip" dest="${env.WORKSPACE}" />

		<delete includeemptydirs="true">
			<fileset dir="${basedir}/../.." includes="config/**" />
			<fileset dir="${basedir}/../.." includes="core/**" />
			<fileset dir="${basedir}/../.." includes="js/**" />
			<fileset dir="${basedir}/../.." includes="lang/**" />
			<fileset dir="${basedir}/../.." includes="libs/**" />
			<fileset dir="${basedir}/../.." includes="misc/**" />
			<fileset dir="${basedir}/../.." includes="plugins/**" />
			<fileset dir="${basedir}/../.." includes="themes/**" />
			<fileset dir="${basedir}/../.." includes="tmp/**" />
			<fileset dir="${basedir}/../..">
				<include name="*" />
				<exclude name="tests" />
			</fileset>
		</delete>

		<move todir="${env.WORKSPACE}/build/">
			<fileset dir="${env.WORKSPACE}/piwik/" />
		</move>

		<replace file="${env.WORKSPACE}/build/config/global.ini.php">
			<replacefilter 
				token="latest_version_url = http://piwik.org/latest.zip" 
						value="latest_version_url = http://${env.HTTP_HOST}/jenkins.private/jobs/Piwik/workspace/latest.zip" />
			<replacefilter 
				token="api_service_url = http://api.piwik.org" 
				value="api_service_url = http://${env.HTTP_HOST}/jenkins.private/jobs/Piwik/workspace" />
		</replace>
		<length file="${env.WORKSPACE}/build/config/global.ini.php" property="configLEN" />
		<checksum file="${env.WORKSPACE}/build/config/global.ini.php" property="configMD5" />
		<replaceregexp
			file="${env.WORKSPACE}/build/config/manifest.inc.php"
			match='"(config/global.ini.php)".*'
			replace='"\1" => array("${configLEN}", "${configMD5}"),'
			byline="true" />
	</sequential>
</macrodef>

<macrodef name="piwikAutoUpdate" description="auto-update Piwik">
	<sequential>
		<!-- logging in -->

		<invoke description="get index" url="/" />
		<verifyTitle description="check the title is parsed correctly" text="Piwik &rsaquo; Sign in" />
		<verifyText description="check page text" text="Piwik" />
		<verifyText description="check page text" text="Lost your password?" />

		&checkForErrors;
		&verifyLinksAndImages;
					
		<setInputField description="set Piwik login" htmlId="form_login" value="piwik_login" />
		<setInputField description="set Piwik password" htmlId="form_password" value="piwik_password" />

		<clickButton description="click 'Sign in' button" label="Sign in" />

		<!-- logged in -->

		<verifyTitle description="check the title is parsed correctly" text="Piwik &rsaquo; Web Analytics Reports" />
		<verifyText description="check page text" text="Piwik" />
		<verifyText description="check page text" text="Dashboard" />
		<verifyText description="check page text" text="Hello" />

		<!-- update notice -->

		<verifyText description="check page text" text="New Update:" />
		<mouseOver description="expand header message" htmlId="header_message" />
		<verifyText description="check page text" text="Please update now!" />

		<enableJavaScript enable="false" />
		<clickLink description="click 'Please update now'" href="action=newVersionAvailable" />

		<!-- one click update -->

		<verifyTitle description="check the title is parsed correctly" text="Piwik &rsaquo; Update" />
		<verifyText description="check page text" text="Piwik" />
		<verifyText description="check page text" text="Update Automatically" />
		<verifyText description="check page text" text="Download" />

		<clickButton description="click 'Update Automatically' Button" label="Update Automatically" />
		<!-- invoke description="one click update" url="/index.php?module=CoreUpdater&amp;action=oneClickUpdate" /-->

		<!-- download, unzip -->

		<not description="check for errors">
			<verifyXPath description="looking for error image" xpath="//img[@src='themes/default/images/error_medium.png']" />
		</not>

		<not description="check if zip archive passed">
			<verifyText description="check page text" text="Incompatible archive" />
		</not>

		<verifyText description="check page text" text="Piwik updated successfully!" />
		<clickButton description="click 'Continue to Piwik' button" label="Continue to Piwik" />

		<!-- db update? -->

		<ifStep description="check if db update required">
			<condition>
				<verifyText description="check page text" text="Database Upgrade Required" />
			</condition>
			<then>
				<clickButton description="click 'Upgrade Piwik' button" label="Upgrade Piwik" />

				<!-- db update done -->

				<not description="check for errors">
					<verifyXPath description="looking for error image" xpath="//img[@src='themes/default/images/error_medium.png']" />
				</not>

				<verifyText description="check page text" text="Piwik has been successfully updated!" />
				<clickButton description="click 'Continue to Piwik' button" label="Continue to Piwik" />
			</then>
		</ifStep>

		<!-- logged out? -->
		<ifStep description="check if re-login required">
			<condition>
				<verifyTitle description="check the title is parsed correctly" text="Piwik &rsaquo; Sign in" />
			</condition>
			<then>
				<setInputField description="set Piwik login" htmlId="form_login" value="piwik_login" />
				<setInputField description="set Piwik password" htmlId="form_password" value="piwik_password" />

				<!-- sign in -->

				<clickButton description="click 'Sign in' button" label="Sign in" />
			</then>
		</ifStep>

		<!-- logged in -->

		<verifyTitle description="check the title is parsed correctly" text="Piwik &rsaquo; Web Analytics Reports" />
		<verifyText description="check page text" text="Piwik" />
		<verifyText description="check page text" text="Dashboard" />
		<verifyText description="check page text" text="Hello" />

		<not description="up to date">
			<verifyText description="check page text" text="New Update:" />
		</not>
	</sequential>
</macrodef>