Compare commits
566 Commits
DEVOPS-341
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b9fa8b705 | ||
|
|
d9b2fbf15f | ||
|
|
b6cd48c736 | ||
|
|
e8628f5fa4 | ||
|
|
0be7dafa6f | ||
|
|
3506f31750 | ||
|
|
570b6ee1e3 | ||
|
|
0761d0b042 | ||
|
|
316890b0b1 | ||
|
|
f294a02896 | ||
|
|
0131200b1b | ||
|
|
1dadde6bc4 | ||
|
|
7390a8d8b1 | ||
|
|
a04b6bdf22 | ||
|
|
b6e6d5c76c | ||
|
|
06bcff4914 | ||
|
|
e9a8d40a45 | ||
|
|
80f486e056 | ||
|
|
980122145c | ||
|
|
09ad3fa7a6 | ||
|
|
afa3ccbf27 | ||
|
|
bd0a7ec477 | ||
|
|
830e60a9d5 | ||
|
|
564104ccf6 | ||
|
|
1a9b2690e1 | ||
|
|
8ae7e5d946 | ||
|
|
e1c6479b82 | ||
|
|
8bfd8ddd7f | ||
|
|
71b0129aad | ||
|
|
316e2ae5b6 | ||
|
|
1232768f58 | ||
|
|
f138815bb1 | ||
|
|
bbb5b5b85b | ||
|
|
e7b607d299 | ||
|
|
4ed4024d0a | ||
|
|
cdd33b66df | ||
|
|
c8d4ebdd22 | ||
|
|
2a64fcb588 | ||
|
|
f696768e8e | ||
|
|
112dc99390 | ||
|
|
0fe4e9f275 | ||
|
|
e19f26aa58 | ||
|
|
5c522b4c45 | ||
|
|
f3a9fd4bae | ||
|
|
060f14dae2 | ||
|
|
bc6ff59b2d | ||
|
|
005eb96efd | ||
|
|
01927a93e7 | ||
|
|
fd2285dda3 | ||
|
|
d68bc49536 | ||
|
|
9e76b341e7 | ||
|
|
dfb357e610 | ||
|
|
b4ccaa797f | ||
|
|
abc4eecf5b | ||
|
|
3beb2362fc | ||
|
|
d29ba2fa33 | ||
|
|
f5f650cd8c | ||
|
|
187cba3900 | ||
|
|
effb90727f | ||
|
|
1a001edd26 | ||
|
|
a558b32643 | ||
|
|
4532e58015 | ||
|
|
adcd14c5d3 | ||
|
|
b689271b17 | ||
|
|
5a3c8fa499 | ||
|
|
8500868013 | ||
|
|
b0a1fbcc33 | ||
|
|
89e5bd0354 | ||
|
|
5339ca15a9 | ||
|
|
e8e6fdcb36 | ||
|
|
536a34d271 | ||
|
|
2a8f96f34a | ||
|
|
e0e0a33f96 | ||
|
|
ea415822bb | ||
|
|
f099bfeb41 | ||
|
|
5fbe07c083 | ||
|
|
b834eef85d | ||
|
|
e1ad8acd64 | ||
|
|
ada9c561c5 | ||
|
|
8931614770 | ||
|
|
f1377f9b54 | ||
|
|
4af2fca18e | ||
|
|
bfe7619c29 | ||
|
|
a5cbfac627 | ||
|
|
3154909a30 | ||
|
|
1da66bc6b1 | ||
|
|
8af00c24d0 | ||
|
|
b4ba1525cc | ||
|
|
661b8afd41 | ||
|
|
bc2e98f9bb | ||
|
|
7afaf3b6c8 | ||
|
|
fea336cd84 | ||
|
|
e43a7ca7c3 | ||
|
|
ded5a8a62e | ||
|
|
685c0a8179 | ||
|
|
63db8efd51 | ||
|
|
efacf269bf | ||
|
|
4bb7da5b72 | ||
|
|
87f24c0b07 | ||
|
|
498e97e728 | ||
|
|
b7bab50039 | ||
|
|
387fe02ee4 | ||
|
|
264488cbd8 | ||
|
|
daaedc606d | ||
|
|
bf029085b0 | ||
|
|
ab03bc73d8 | ||
|
|
b3163e0506 | ||
|
|
d8de4eceeb | ||
|
|
52027982b3 | ||
|
|
6baf223d4b | ||
|
|
1c84f33cf9 | ||
|
|
2604c8879d | ||
|
|
68aa2ec472 | ||
|
|
1efa44b4c7 | ||
|
|
083801aeed | ||
|
|
e70e1da078 | ||
|
|
8506dd936e | ||
|
|
83d901889f | ||
|
|
c222ffc878 | ||
|
|
a8d7bfb602 | ||
|
|
1d99e9aa8e | ||
|
|
c3fafd585b | ||
|
|
ef86bfbda6 | ||
|
|
ca81f51682 | ||
|
|
c4ce1182e4 | ||
|
|
b619a17738 | ||
|
|
accfe0ace7 | ||
|
|
84882aedb0 | ||
|
|
c43efe2e8b | ||
|
|
06c2dad6fa | ||
|
|
d0f646ea95 | ||
|
|
9d24e770ae | ||
|
|
f82a47658b | ||
|
|
1667e9f9fd | ||
|
|
e7872ad833 | ||
|
|
03e7c33868 | ||
|
|
022f19351c | ||
|
|
5f0a329f2f | ||
|
|
47cdb653e8 | ||
|
|
31242ad06b | ||
|
|
6c72cd7e77 | ||
|
|
dc4f29dd35 | ||
|
|
b7015bffe6 | ||
|
|
a7420d44a5 | ||
|
|
be66c6961e | ||
|
|
2f65dab03f | ||
|
|
9f3defe82d | ||
|
|
ea01349cb6 | ||
|
|
ad07b823c7 | ||
|
|
10b68996de | ||
|
|
bf840eb313 | ||
|
|
4c0978c2f4 | ||
|
|
a6c312acd2 | ||
|
|
20ae49845d | ||
|
|
ccacddbe99 | ||
|
|
7652c35654 | ||
|
|
0c6212a7f7 | ||
|
|
768276e2e7 | ||
|
|
725b135f9f | ||
|
|
d873fb9da8 | ||
|
|
fe65638909 | ||
|
|
1e178f1591 | ||
|
|
01c5a90eef | ||
|
|
2c68d2e2fa | ||
|
|
b8dfd66a47 | ||
|
|
29869ed457 | ||
|
|
895782ace7 | ||
|
|
64dc068278 | ||
|
|
bae12c4e14 | ||
|
|
68577c581c | ||
|
|
6dde673391 | ||
|
|
0481693f7c | ||
|
|
4aad0fea7a | ||
|
|
774961c154 | ||
|
|
edeb799fd8 | ||
|
|
b5dab630db | ||
|
|
69cca097ee | ||
|
|
755ee60d48 | ||
|
|
38d4f6e80f | ||
|
|
b1cf79956c | ||
|
|
026732ad77 | ||
|
|
5d17aa48af | ||
|
|
9929a852cc | ||
|
|
f9af9dd9d0 | ||
|
|
fbbfc2d8f3 | ||
|
|
805979ef35 | ||
|
|
cdf6dc248a | ||
|
|
634e572d62 | ||
|
|
91a13c3234 | ||
|
|
8aee0c68cd | ||
|
|
da2354abe1 | ||
|
|
530cc5ebf4 | ||
|
|
e994b4d24c | ||
|
|
a33fd83e35 | ||
|
|
98f261db1b | ||
|
|
076fd9f0a3 | ||
|
|
473b9988ec | ||
|
|
3740418181 | ||
|
|
aebcd3f1f9 | ||
|
|
96fbf87fa0 | ||
|
|
d53894ebee | ||
|
|
0b70f8965d | ||
|
|
7810e83b53 | ||
|
|
44285b606f | ||
|
|
79b1dd29da | ||
|
|
3d449e99e9 | ||
|
|
d7b06b65d6 | ||
|
|
ae61c67a50 | ||
|
|
7f9e0c0b5b | ||
|
|
59ed4fab92 | ||
|
|
8e31bc7242 | ||
|
|
b3814fdd13 | ||
|
|
300ac25976 | ||
|
|
d97e9a031c | ||
|
|
c7c99db53d | ||
|
|
c435e81f3f | ||
|
|
04328fab5d | ||
|
|
24e0656cc5 | ||
|
|
1018e263aa | ||
|
|
58fc4c0ebc | ||
|
|
3a90604fb0 | ||
|
|
395317615e | ||
|
|
7fe7282f00 | ||
|
|
0ad3552ca6 | ||
|
|
da4c0bcdce | ||
|
|
849dd9aa93 | ||
|
|
c1a2c97983 | ||
|
|
3218857d42 | ||
|
|
cb32d16980 | ||
|
|
7f68edd187 | ||
|
|
28d1eed5d2 | ||
|
|
e781f1524d | ||
|
|
e663e0102d | ||
|
|
bd540a9899 | ||
|
|
8d48021a75 | ||
|
|
232530be68 | ||
|
|
e4fbe3bac8 | ||
|
|
73838caa2e | ||
|
|
2df253f73d | ||
|
|
7db593793c | ||
|
|
595a98821c | ||
|
|
f2eebe8d6d | ||
|
|
d7c64d6512 | ||
|
|
cacf7a2525 | ||
|
|
d8a7c0dd94 | ||
|
|
58b2f34151 | ||
|
|
b6f859d6be | ||
|
|
5fbe91de84 | ||
|
|
fff8215819 | ||
|
|
9ac132a022 | ||
|
|
e7e2e349c2 | ||
|
|
a4bc905ca9 | ||
|
|
8859cc73f8 | ||
|
|
9a9d9d1efd | ||
|
|
d62a0ececb | ||
|
|
f4a3a39fab | ||
|
|
79607a9588 | ||
|
|
d5c25c4ca4 | ||
|
|
2ad98e3af1 | ||
|
|
10c21323ac | ||
|
|
41cd21a6de | ||
|
|
b025c0d4c8 | ||
|
|
23cb9181fc | ||
|
|
24d9ce7e89 | ||
|
|
3224dcbbbc | ||
|
|
3570aa08fd | ||
|
|
32322ec9ef | ||
|
|
cd84a8dabb | ||
|
|
c67ee6240f | ||
|
|
ee14aa5949 | ||
|
|
d41a8a4bde | ||
|
|
b24c572e5f | ||
|
|
174b8cca73 | ||
|
|
8ff003cab5 | ||
|
|
59b8735ea8 | ||
|
|
e859aec0b3 | ||
|
|
9e39e1ff75 | ||
|
|
14d460c6c5 | ||
|
|
62d0b5a11c | ||
|
|
3f9fe2b94c | ||
|
|
268bff404b | ||
|
|
3c3d7a4b5b | ||
|
|
170a329225 | ||
|
|
88a06934c8 | ||
|
|
bfb89b0de9 | ||
|
|
3396aa7a36 | ||
|
|
0385943a62 | ||
|
|
6633982a00 | ||
|
|
288850262d | ||
|
|
323ff8799e | ||
|
|
4322438fe3 | ||
|
|
c671453663 | ||
|
|
75f11dd275 | ||
|
|
fabf2317d0 | ||
|
|
564ffa1a70 | ||
|
|
208475bc73 | ||
|
|
851311e143 | ||
|
|
4ec5d92ba2 | ||
|
|
8753769d18 | ||
|
|
1279b593b0 | ||
|
|
bc66089870 | ||
|
|
45d0ed0082 | ||
|
|
5e8adbc0f6 | ||
|
|
09f285565b | ||
|
|
917ebbbd1f | ||
|
|
e2e0d89d33 | ||
|
|
c8342f3199 | ||
|
|
6f9ff764d9 | ||
|
|
7cc67bdb25 | ||
|
|
eaa2010f20 | ||
|
|
fcada75608 | ||
|
|
bf09fc5020 | ||
|
|
f27362830d | ||
|
|
fcff1d6bc2 | ||
|
|
21fa370937 | ||
|
|
dfab81fc77 | ||
|
|
56c8b16b13 | ||
|
|
a7f1c57053 | ||
|
|
9e14345e1c | ||
|
|
bb5eaaca25 | ||
|
|
5cf6059b0b | ||
|
|
97f7b19e0c | ||
|
|
60285db66f | ||
|
|
f36c778a84 | ||
|
|
e2e146113f | ||
|
|
df6962d399 | ||
|
|
5075443ab9 | ||
|
|
a5957fc4c4 | ||
|
|
3211c56c01 | ||
|
|
56f7274173 | ||
|
|
a3ea962fc2 | ||
|
|
899e924bbc | ||
|
|
8d7766c137 | ||
|
|
f77a2a2d25 | ||
|
|
4ade37cc01 | ||
|
|
3af236d67c | ||
|
|
fbe48525fc | ||
|
|
db25e19cc9 | ||
|
|
1d0fdcc363 | ||
|
|
fff581f23c | ||
|
|
cc8f30854c | ||
|
|
c1ce317f6b | ||
|
|
a49ec8f345 | ||
|
|
173de6cc4c | ||
|
|
8a546289ce | ||
|
|
91904a82f0 | ||
|
|
6ac55ab596 | ||
|
|
ce501c44df | ||
|
|
c429028f61 | ||
|
|
6e64e1cac4 | ||
|
|
1d06b4a445 | ||
|
|
2447abe76e | ||
|
|
431bc036a6 | ||
|
|
e98be9a320 | ||
|
|
fdcb79383b | ||
|
|
a02aa68484 | ||
|
|
ed608c17b4 | ||
|
|
5258d8def9 | ||
|
|
2ad994e1ff | ||
|
|
05e16023a2 | ||
|
|
48be76a8dd | ||
|
|
cfd845da98 | ||
|
|
440d0a5c2b | ||
|
|
1489d6cc32 | ||
|
|
02052ae703 | ||
|
|
bf5fd0e008 | ||
|
|
ac8e08aab1 | ||
|
|
274f3e0509 | ||
|
|
6024be4024 | ||
|
|
37c909a3f1 | ||
|
|
8d77700942 | ||
|
|
4f73df387a | ||
|
|
9dbcf19ce8 | ||
|
|
15ca561a97 | ||
|
|
a4c255a9d8 | ||
|
|
59172ddbfa | ||
|
|
8888cf41c6 | ||
|
|
6524ce4f5a | ||
|
|
52601866de | ||
|
|
577e10eeca | ||
|
|
a5ad6a47ac | ||
|
|
138820241e | ||
|
|
d6352ee0c5 | ||
|
|
43ccef7fbb | ||
|
|
2fd1f3df9c | ||
|
|
8dac3ea2e0 | ||
|
|
404063d975 | ||
|
|
266212a727 | ||
|
|
bf8290fd90 | ||
|
|
fa6dda5835 | ||
|
|
a4f08eff29 | ||
|
|
c11ddef89b | ||
|
|
4288d9a1f1 | ||
|
|
69e36990d6 | ||
|
|
652f5c9dee | ||
|
|
8edef8e020 | ||
|
|
98220cd201 | ||
|
|
eb54609b63 | ||
|
|
cef9e53a4f | ||
|
|
2cf00bcaa7 | ||
|
|
9b3a0179f7 | ||
|
|
e84eb591e4 | ||
|
|
64205b546b | ||
|
|
cf0d9ea0e7 | ||
|
|
f97a44e56e | ||
|
|
becf84f918 | ||
|
|
94f11f21be | ||
|
|
f874b2a8bc | ||
|
|
e1aaf1d8e0 | ||
|
|
ca5c448c06 | ||
|
|
4345d67e26 | ||
|
|
aa000c447d | ||
|
|
9a406adada | ||
|
|
ce0c166915 | ||
|
|
649acd5114 | ||
|
|
0cab09a680 | ||
|
|
69906204be | ||
|
|
51c361c249 | ||
|
|
7ef7d5bb72 | ||
|
|
799adaec2a | ||
|
|
6d369d01ee | ||
|
|
b280483e4c | ||
|
|
0fb433805f | ||
|
|
e05a044ed2 | ||
|
|
a1dd496481 | ||
|
|
791da2aa21 | ||
|
|
8a7190c12b | ||
|
|
41f62f989d | ||
|
|
d4561caf9d | ||
|
|
024de88302 | ||
|
|
63659156a3 | ||
|
|
0065d8cd1a | ||
|
|
cde78d899b | ||
|
|
7b4722a838 | ||
|
|
ad108b75df | ||
|
|
b4a2ca7f66 | ||
|
|
5ef5eee610 | ||
|
|
97b2c44103 | ||
|
|
80e3289056 | ||
|
|
eecc45d199 | ||
|
|
5e707c53ba | ||
|
|
ee71c5b6ca | ||
|
|
fb6e5dabf4 | ||
|
|
6b413c72a0 | ||
|
|
9a252c4323 | ||
|
|
81d4115ab5 | ||
|
|
9f133a02c2 | ||
|
|
a566270451 | ||
|
|
8d5a79cf50 | ||
|
|
839543740d | ||
|
|
9ee53024ff | ||
|
|
b84f08985c | ||
|
|
9d60a5f757 | ||
|
|
2d911e896e | ||
|
|
b1040d5d0d | ||
|
|
40867c9183 | ||
|
|
b74b2a446a | ||
|
|
6c0de2f94a | ||
|
|
4182d9bb49 | ||
|
|
209af2f0e3 | ||
|
|
4be4c8175d | ||
|
|
0f9e38470f | ||
|
|
2955afeddd | ||
|
|
81e3277450 | ||
|
|
6a3c524770 | ||
|
|
e77526588e | ||
|
|
92f3d61bd5 | ||
|
|
0d65aaef59 | ||
|
|
664ff5a6ea | ||
|
|
5ac6b454c7 | ||
|
|
2753fa5e53 | ||
|
|
82a75a1766 | ||
|
|
61f29df4c1 | ||
|
|
0f1b8905d8 | ||
|
|
7c6763b1ae | ||
|
|
38e855b183 | ||
|
|
fcb3611bf7 | ||
|
|
a9d0f0ff90 | ||
|
|
e1cf4da7b3 | ||
|
|
546a2b0f85 | ||
|
|
2499709adf | ||
|
|
76a463d326 | ||
|
|
7bdda46fcf | ||
|
|
274518e520 | ||
|
|
869f5ff017 | ||
|
|
3207b84c1c | ||
|
|
e5a306bf75 | ||
|
|
3556e92abd | ||
|
|
7cfbaa39dd | ||
|
|
de4f039f5a | ||
|
|
bf305c1b89 | ||
|
|
1979918616 | ||
|
|
e52fe96c54 | ||
|
|
0fcd591574 | ||
|
|
e87a1ea486 | ||
|
|
4c7f54a3e0 | ||
|
|
63f1de6fed | ||
|
|
e810346603 | ||
|
|
aff2bd7643 | ||
|
|
d1bf9a3b93 | ||
|
|
14982d849c | ||
|
|
984c401608 | ||
|
|
cffd1f55af | ||
|
|
8b2f27186e | ||
|
|
f1368dcad3 | ||
|
|
00f6c7a561 | ||
|
|
9b4e314c54 | ||
|
|
2dce88cacb | ||
|
|
76b1f45f5b | ||
|
|
a69a7cc611 | ||
|
|
4147964e52 | ||
|
|
e86c794988 | ||
|
|
07d8d39d49 | ||
|
|
033f70e7f5 | ||
|
|
ff54a83f4a | ||
|
|
09e16538f0 | ||
|
|
693f772806 | ||
|
|
fc406d370b | ||
|
|
009be1b04d | ||
|
|
1bae5d6b77 | ||
|
|
023914c09f | ||
|
|
baf7ee66a3 | ||
|
|
5becad20a3 | ||
|
|
4e4a24e7a0 | ||
|
|
2d9d764e20 | ||
|
|
753c9cde06 | ||
|
|
ef7be9d63a | ||
|
|
14a662ca6e | ||
|
|
fc849a9209 | ||
|
|
041cf22047 | ||
|
|
65f6a73b40 | ||
|
|
cfc29a8c89 | ||
|
|
0e2253def4 | ||
|
|
432a953cdc | ||
|
|
7102c727f9 | ||
|
|
9b4c10dd06 | ||
|
|
9ec45c0e82 | ||
|
|
b00a59f8b7 | ||
|
|
147431f141 | ||
|
|
8e62a4b82e | ||
|
|
01b1d1a751 | ||
|
|
eec4d1eee2 | ||
|
|
3fa92fea98 | ||
|
|
b4f48487b7 | ||
|
|
bebc8d3c6e | ||
|
|
9e86f36c25 | ||
|
|
b652a8e11b | ||
|
|
3f55b4f7e7 | ||
|
|
6e3ac05763 | ||
|
|
c01d6afad1 | ||
|
|
c2e68dd231 | ||
|
|
8e5b8ade1a | ||
|
|
9ee28d2d7f | ||
|
|
8714f9cb88 | ||
|
|
1a7dd37027 | ||
|
|
3136bcc0a2 | ||
|
|
d10cab0d86 | ||
|
|
82f0735a83 | ||
|
|
dd06659896 | ||
|
|
225dd027cb | ||
|
|
0afbbde2f1 | ||
|
|
e1173f790c | ||
|
|
48c78638e9 | ||
|
|
3e759fa008 | ||
|
|
a4b85b0a91 | ||
|
|
60bb859a5c |
7
org.talend.mdm.swtbot.test/.classpath
Normal file
7
org.talend.mdm.swtbot.test/.classpath
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
28
org.talend.mdm.swtbot.test/.project
Normal file
28
org.talend.mdm.swtbot.test/.project
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.mdm.swtbot.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
#Thu Mar 29 13:24:41 CST 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
26
org.talend.mdm.swtbot.test/META-INF/MANIFEST.MF
Normal file
26
org.talend.mdm.swtbot.test/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,26 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: mdm Test
|
||||
Bundle-SymbolicName: org.talend.mdm.swtbot.test
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.talend.swtbot.mdm.test.Activator
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.swtbot.eclipse.core,
|
||||
org.eclipse.swtbot.eclipse.finder,
|
||||
org.eclipse.swtbot.junit4_x,
|
||||
org.hamcrest,
|
||||
org.junit4,
|
||||
org.apache.log4j,
|
||||
org.talend.mdm.commmon,
|
||||
org.talend.mdm.workbench,
|
||||
org.eclipse.ui.forms,
|
||||
org.talend.mdm.workbench.enterprise,
|
||||
org.talend.mdm.repository
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: org.eclipse.core.resources,
|
||||
org.eclipse.gef.commands,
|
||||
org.eclipse.ui.internal.views.properties.tabbed.view,
|
||||
org.eclipse.wst.xsd.ui.internal.editor
|
||||
|
||||
4
org.talend.mdm.swtbot.test/build.properties
Normal file
4
org.talend.mdm.swtbot.test/build.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
source.. = src/main/java
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
3
org.talend.mdm.swtbot.test/readme.txt
Normal file
3
org.talend.mdm.swtbot.test/readme.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
1. MDM Server view was deprecated , so it's no need to add junit test case for serverview.
|
||||
2. SWTBotForMDMRepositoryView is designed to be inherited by all the subclass in serverview.
|
||||
of course, you can add interfaces or super class to match your requirements.
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.talend.swtbot.mdm.test;
|
||||
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.talend.swtbot.mdm.test"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.repositoryview;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.mdm.repository.ui.navigator.MDMRepositoryView;
|
||||
|
||||
|
||||
/**
|
||||
* SWTBot test super class for MDM Repository View
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class SWTBotForMDMRepositoryView {
|
||||
protected static SWTWorkbenchBot bot = new SWTWorkbenchBot();
|
||||
|
||||
protected static SWTBotTreeItem repositoryItem;
|
||||
|
||||
private static SWTBotTree repositoryTree;
|
||||
|
||||
private static Tree swtTree;
|
||||
|
||||
private static final long ONE_MINUTE_IN_MILLISEC = 60000;
|
||||
|
||||
private static boolean isLoggined = false;
|
||||
|
||||
private static SWTBotView view;
|
||||
|
||||
private static void initRepositoryView() {
|
||||
view = bot
|
||||
.viewById(MDMRepositoryView.VIEW_ID);
|
||||
view.show();
|
||||
view.setFocus();
|
||||
// bot.perspectiveById("org.talend.mdm.perstective").activate();
|
||||
view.getWidget().getDisplay().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
// SWTBotTree
|
||||
// tree=bot.treeWithLabel("http://localhost:8080/talend/TalendPort[HEAD] admin");
|
||||
Composite comp = (Composite) view.getWidget();
|
||||
comp = (Composite) comp.getChildren()[0];
|
||||
|
||||
swtTree = (Tree) comp.getChildren()[0];
|
||||
}
|
||||
});
|
||||
repositoryTree = new SWTBotTree(swtTree);
|
||||
repositoryItem=repositoryItem.getNode(0);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
System.out.println("beforeClass");
|
||||
if (!isLoggined) {
|
||||
// SWTBotView welcomeView = bot.viewByTitle("Welcome");
|
||||
// if (welcomeView != null)
|
||||
// welcomeView.close();
|
||||
bot.perspectiveByLabel("MDM").activate();
|
||||
view.show();
|
||||
|
||||
initRepositoryView();
|
||||
//importDemo();
|
||||
bot.waitUntil(Conditions.widgetIsEnabled(repositoryTree),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
isLoggined = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void importDemo() {
|
||||
repositoryItem.contextMenu("Import Items").click();
|
||||
SWTBotShell shell=bot.shell("Import Repository items");
|
||||
shell.activate();
|
||||
bot.radio("Select archive file:").click();
|
||||
bot.button("Import from Talend Exchange").click();
|
||||
SWTBotShell importDstarShell = bot
|
||||
.shell("Import from Talend Exchange options");
|
||||
importDstarShell.activate();
|
||||
bot.table().select(1);
|
||||
bot.button("OK").click();
|
||||
bot.waitUntil(Conditions.shellIsActive("Import Repository items"));
|
||||
|
||||
bot.waitUntil(Conditions.shellCloses(importDstarShell));
|
||||
sleep(10);
|
||||
bot.button("Finish").click();
|
||||
bot.waitUntil(Conditions.shellCloses(shell));
|
||||
sleep();
|
||||
bot.shell("Confirm Overwrite").activate();
|
||||
bot.button("Yes To All").click();
|
||||
bot.waitUntil(
|
||||
Conditions.shellCloses(bot.shell("Progress Information")),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void AfterClass() {
|
||||
System.out.println("AfterClass");
|
||||
// logout();
|
||||
bot.sleep(2000);
|
||||
}
|
||||
|
||||
|
||||
protected static void sleep() {
|
||||
bot.sleep(1000);
|
||||
}
|
||||
|
||||
protected static void sleep(int count) {
|
||||
bot.sleep(1000 * count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview;
|
||||
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* SWTBot test super class for MDM Repository View
|
||||
*/
|
||||
public class SWTBotForMDMServiewView {
|
||||
|
||||
protected static SWTWorkbenchBot bot = new SWTWorkbenchBot();
|
||||
|
||||
protected static SWTBotTreeItem serverItem;
|
||||
|
||||
private static SWTBotTree serverTree;
|
||||
|
||||
private static Tree swtTree;
|
||||
|
||||
private static boolean isLoggined = false;
|
||||
|
||||
private static final long ONE_MINUTE_IN_MILLISEC = 60000;
|
||||
|
||||
public static void login() {
|
||||
|
||||
bot.viewByTitle("MDM Server").toolbarButton("Add MDM Server Location")
|
||||
.click();
|
||||
SWTBotShell shell = bot.shell("Talend MDM Studio Login");
|
||||
bot.waitUntil(Conditions.shellIsActive("Talend MDM Studio Login"),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
shell.activate();
|
||||
sleep();
|
||||
bot.comboBoxWithLabel("Description(*)").setText("administrator");
|
||||
sleep();
|
||||
bot.textWithLabel("Username").setText("admin");
|
||||
sleep();
|
||||
bot.textWithLabel("Password").setText("talend");
|
||||
sleep();
|
||||
if (bot.comboBoxWithLabel("Version").itemCount() > 0)
|
||||
bot.comboBoxWithLabel("Version").setSelection(0);
|
||||
sleep();
|
||||
bot.checkBox("Save this MDM Server Location").select();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
bot.waitUntil(
|
||||
Conditions.shellCloses(bot.shell("Progress Information")),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
}
|
||||
|
||||
private static void initServerView() {
|
||||
final SWTBotView view = bot
|
||||
.viewById("org.talend.mdm.workbench.views.ServerView");
|
||||
view.show();
|
||||
view.setFocus();
|
||||
// bot.perspectiveById("org.talend.mdm.perstective").activate();
|
||||
view.getWidget().getDisplay().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
// SWTBotTree
|
||||
// tree=bot.treeWithLabel("http://localhost:8080/talend/TalendPort[HEAD] admin");
|
||||
Composite comp = (Composite) view.getWidget();
|
||||
comp = (Composite) comp.getChildren()[0];
|
||||
|
||||
swtTree = (Tree) comp.getChildren()[0];
|
||||
}
|
||||
});
|
||||
serverTree = new SWTBotTree(swtTree);
|
||||
serverItem = serverTree
|
||||
.expandNode("http://localhost:8080/talend/TalendPort [HEAD] admin");
|
||||
serverItem.expand();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
System.out.println("beforeClass");
|
||||
if (!isLoggined) {
|
||||
// SWTBotView welcomeView = bot.viewByTitle("Welcome");
|
||||
// if (welcomeView != null)
|
||||
// welcomeView.close();
|
||||
bot.menu("Window").menu("Open Perspective").menu("Other...")
|
||||
.click();
|
||||
final SWTBotShell shellShowView = bot.shell("Open Perspective");
|
||||
bot.waitUntil(Conditions.shellIsActive("Open Perspective"));
|
||||
shellShowView.widget.getDisplay().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
shellShowView.widget.setSize(new Point(300, 600));
|
||||
}
|
||||
});
|
||||
shellShowView.activate();
|
||||
bot.table().select("MDM");
|
||||
bot.button("OK").click();
|
||||
bot.perspectiveByLabel("MDM").activate();
|
||||
bot.viewByTitle("MDM Server").show();
|
||||
|
||||
login();
|
||||
initServerView();
|
||||
importDemo();
|
||||
bot.waitUntil(Conditions.widgetIsEnabled(serverTree),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
isLoggined = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void importDemo() {
|
||||
serverItem.contextMenu("Import").click();
|
||||
bot.shell("Import Objects").activate();
|
||||
bot.radio("Select archive file:").click();
|
||||
bot.button("Import from Talend Exchange").click();
|
||||
SWTBotShell importDstarShell = bot
|
||||
.shell("Import from Talend Exchange options");
|
||||
importDstarShell.activate();
|
||||
bot.table().select(1);
|
||||
bot.button("OK").click();
|
||||
bot.waitUntil(Conditions.shellIsActive("Import Objects"));
|
||||
SWTBotShell shell = bot.shell("Import Objects");
|
||||
bot.waitUntil(Conditions.shellCloses(importDstarShell));
|
||||
sleep(10);
|
||||
bot.button("Finish").click();
|
||||
bot.waitUntil(Conditions.shellCloses(shell));
|
||||
sleep();
|
||||
bot.shell("Confirm Overwrite").activate();
|
||||
bot.button("Yes To All").click();
|
||||
bot.waitUntil(
|
||||
Conditions.shellCloses(bot.shell("Progress Information")),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void AfterClass() {
|
||||
System.out.println("AfterClass");
|
||||
// logout();
|
||||
bot.sleep(2000);
|
||||
}
|
||||
|
||||
public static void logout() {
|
||||
serverItem.contextMenu("Logout").click();
|
||||
}
|
||||
|
||||
protected static void sleep() {
|
||||
bot.sleep(1000);
|
||||
}
|
||||
|
||||
protected static void sleep(int count) {
|
||||
bot.sleep(1000 * count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.common;
|
||||
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class ImportObjectsTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private static final long ONE_MINUTE_IN_MILLISEC = 60000;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void importObjectsTest() {
|
||||
serverItem.contextMenu("Import").click();
|
||||
bot.shell("Import Objects").activate();
|
||||
bot.radio("Select archive file:").click();
|
||||
bot.button("Import from Talend Exchange").click();
|
||||
bot.shell("Import from Talend Exchange options").activate();
|
||||
bot.table().select(1);
|
||||
bot.button("OK").click();
|
||||
bot.waitUntil(Conditions.shellIsActive("Import Objects"));
|
||||
SWTBotShell shell = bot.shell("Import Objects");
|
||||
sleep(10);
|
||||
bot.button("Finish").click();
|
||||
bot.waitUntil(Conditions.shellCloses(shell));
|
||||
sleep();
|
||||
bot.shell("Confirm Overwrite").activate();
|
||||
bot.button("Yes To All").click();
|
||||
bot.waitUntil(
|
||||
Conditions.shellCloses(bot.shell("Progress Information")),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.common.copy;
|
||||
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class ImportObjectsTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private static final long ONE_MINUTE_IN_MILLISEC = 60000;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void importObjectsTest() {
|
||||
serverItem.contextMenu("Import").click();
|
||||
bot.shell("Import Objects").activate();
|
||||
bot.radio("Select archive file:").click();
|
||||
bot.button("Import from Talend Exchange").click();
|
||||
bot.shell("Import from Talend Exchange options").activate();
|
||||
bot.table().select(1);
|
||||
bot.button("OK").click();
|
||||
bot.waitUntil(Conditions.shellIsActive("Import Objects"));
|
||||
SWTBotShell shell = bot.shell("Import Objects");
|
||||
sleep(10);
|
||||
bot.button("Finish").click();
|
||||
bot.waitUntil(Conditions.shellCloses(shell));
|
||||
sleep();
|
||||
bot.shell("Confirm Overwrite").activate();
|
||||
bot.button("Yes To All").click();
|
||||
bot.waitUntil(
|
||||
Conditions.shellCloses(bot.shell("Progress Information")),
|
||||
ONE_MINUTE_IN_MILLISEC * 10);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datacontainer;
|
||||
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataClusterBrowserMainPage;
|
||||
import com.amalto.workbench.editors.XObjectBrowser;
|
||||
|
||||
/**
|
||||
* DataContainerContentOperationTest is SWTBot test class to test the operation
|
||||
* on the records.
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataContainerContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem dataContainerItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataContainerItem = serverItem.getNode("Data Container");
|
||||
dataContainerItem.expand();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void recordEditTest() {
|
||||
SWTBotTreeItem node = dataContainerItem.expandNode("System").getNode(
|
||||
"PROVISIONING");
|
||||
node.doubleClick();
|
||||
bot.buttonWithTooltip("Search").click();
|
||||
sleep(2);
|
||||
XObjectBrowser ep = (XObjectBrowser) bot.activeEditor().getReference()
|
||||
.getPart(true);
|
||||
Assert.assertNotNull(ep);
|
||||
DataClusterBrowserMainPage mainpage = (DataClusterBrowserMainPage) ep
|
||||
.getPage(0);
|
||||
Assert.assertNotNull(mainpage);
|
||||
Table table = mainpage.getResultsViewer().getTable();
|
||||
SWTBotTable conceptBotTable = new SWTBotTable(table);
|
||||
Assert.assertNotNull(conceptBotTable);
|
||||
conceptBotTable.select(1, 1);
|
||||
bot.table().contextMenu("Commit").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("XML Editor/Viewer");
|
||||
newDataContainerShell.activate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.Activator;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
import org.talend.swtbot.mdm.test.serverview.util.Util;
|
||||
|
||||
/**
|
||||
* DataModelContentOperationTest is a SWTBot test class to test the operation
|
||||
* associated with the import,export.
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
* see bug 0017197.
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private String DSTAR_DATAMODEL = "DStar.xsd";
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataModelShell = bot.shell("New Data Model");
|
||||
newDataModelShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
bot.activeEditor().save();
|
||||
bot.activeEditor().close();
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void importXSDTest() throws IOException, URISyntaxException {
|
||||
// File sourceFile = null;
|
||||
// try {
|
||||
// sourceFile = new
|
||||
// File(FileLocator.toFileURL(Platform.getBundle(Activator.PLUGIN_ID).getEntry("testDocuments"))
|
||||
// .getPath().substring(1)
|
||||
// + "testImport.xsd");
|
||||
// } catch (IOException e1) {
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
// File targetFile = new
|
||||
// File(Platform.getInstanceLocation().getURL().getPath().substring(1) +
|
||||
// "testImport.xsd");
|
||||
//
|
||||
// try {
|
||||
// if (sourceFile != null)
|
||||
// Util.copyFile(sourceFile, targetFile);
|
||||
// } catch (Exception e1) {
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
bot.buttonWithTooltip("Import...").click();
|
||||
// // TODO: now SWTBot doesn't support native SWT dialogs,so this needs
|
||||
// more investigation.
|
||||
// /*
|
||||
// * SWTBotShell importDataModelShell =
|
||||
// bot.shell("Select the XML definition for XML Schema");
|
||||
// * importDataModelShell.activate();
|
||||
// bot.comboBox(1).setText("testxsd");
|
||||
// * System.out.println(bot.comboBox(1).getText() + "test");
|
||||
// bot.button("Open(O)").click();
|
||||
// */
|
||||
Util.getFileFromCurrentPluginSampleFolder(DSTAR_DATAMODEL)
|
||||
.getAbsolutePath();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void importXSDSchemaFromLocalTest() {
|
||||
File sourceFile = null;
|
||||
try {
|
||||
sourceFile = new File(FileLocator
|
||||
.toFileURL(
|
||||
Platform.getBundle(Activator.PLUGIN_ID).getEntry(
|
||||
"testDocuments")).getPath().substring(1)
|
||||
+ "testImport.xsd");
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
File targetFile = new File(Platform.getInstanceLocation().getURL()
|
||||
.getPath().substring(1)
|
||||
+ "testImport.xsd");
|
||||
|
||||
try {
|
||||
if (sourceFile != null)
|
||||
Util.copyFile(sourceFile, targetFile);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
bot.buttonWithTooltip("import/include specific Schema Namespace ...")
|
||||
.click();
|
||||
SWTBotShell importXSDSchemaShell = bot
|
||||
.shell("Import xsd schema modules");
|
||||
importXSDSchemaShell.activate();
|
||||
bot.button("Add xsd from local").click();
|
||||
/*
|
||||
* bot.comboBox(0).setText("testxsd");
|
||||
* System.out.println(bot.comboBox(1).getText() + "test");
|
||||
* bot.button("Open(O)").click();
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelSchemaElementOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem entityNode;
|
||||
|
||||
private SWTBotTreeItem elementNode;
|
||||
|
||||
private SWTBotTreeItem groupItem;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(2);
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree conceptTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(conceptTree);
|
||||
newEntity();
|
||||
newElement();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
public void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
entityNode = conceptBotTree.getTreeItem("ComplexTypeEntity");
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...", 0).click();
|
||||
}
|
||||
|
||||
public void newElement() {
|
||||
groupItem = entityNode.getNode("ComplexTypeEntityType");
|
||||
groupItem.contextMenu("Add Element").click();
|
||||
|
||||
SWTBotShell newElementShell = bot.shell("Add a new Business Element");
|
||||
newElementShell.activate();
|
||||
bot.textWithLabel("Business Element Name").setText("Ele");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
elementNode = groupItem.expand().getNode("Ele [0...1]");
|
||||
elementNode.select();
|
||||
}
|
||||
|
||||
// new feature in 4.2,see bug 0017128
|
||||
@Test
|
||||
public void autoPlaceCursorTest() {
|
||||
elementNode.select();
|
||||
bot.cTabItem(1).activate();
|
||||
sleep();
|
||||
bot.cTabItem(2).activate();
|
||||
entityNode = conceptBotTree.getTreeItem("ComplexTypeEntity");
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...", 0).click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void editElementTest() {
|
||||
elementNode.contextMenu("Edit Element").click();
|
||||
SWTBotShell newEleShell = bot.shell("Edit Business Element");
|
||||
newEleShell.activate();
|
||||
bot.textWithLabel("Business Element Name").setText("ConceptTest");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
Assert.assertNotNull(groupItem.getNode("ConceptTest [0...1]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addElementTest() {
|
||||
// SWTBotTreeItem groupItem = conceptNode.getNode("ReportingType");
|
||||
elementNode.contextMenu("Add Element (after)").click();
|
||||
SWTBotShell newEntityShell = bot.shell("Add a new Business Element");
|
||||
newEntityShell.activate();
|
||||
bot.textWithLabel("Business Element Name").setText("testElement");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
Assert.assertNotNull(groupItem.getNode("testElement [0...1]"));
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void copyElementTest() {
|
||||
// TODO:I can not paste a element after I copy the element.
|
||||
elementNode.contextMenu("Copy Element").click();
|
||||
sleep();
|
||||
elementNode.contextMenu("Paste Element").click();
|
||||
sleep();
|
||||
SWTBotShell saveShell = bot.shell("Paste Element");
|
||||
saveShell.activate();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToComplexTypeTest() {
|
||||
elementNode.contextMenu("Change to a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Sequence").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
// TODO:need assertion
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToSimpleTypeTest() {
|
||||
elementNode.contextMenu("Change to a Simple Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Make Simple Type");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Custom").click();
|
||||
sleep();
|
||||
bot.ccomboBoxWithLabel("Type").setSelection(0);
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setLabelsTest() {
|
||||
elementNode.contextMenu("Set the Labels").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Labels");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("en");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("fr");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("English Label: en"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionsTest() {
|
||||
elementNode.contextMenu("Set the Descriptions").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Descriptions of This Element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("enlish description");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("french description");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("English Description: enlish description"));
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setWriteAccessTest() {
|
||||
elementNode.contextMenu("Set the Roles with Write Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Have Write Access");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection("System_Web");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection("System_Admin");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select("System_Web");
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("Writable By : System_Admin"));
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNoAccessTest() {
|
||||
elementNode.contextMenu("Set the Roles with No Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Cannot Access This Field");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection("System_Web");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection("System_Admin");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select("System_Admin");
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("No Access to : System_Web"));
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void setWorkflowAccessTest() {
|
||||
// TODO:check this action
|
||||
elementNode.contextMenu("Set the Workflow Access").click();
|
||||
SWTBotShell shell = bot.shell("Set the Workflow Access");
|
||||
shell.activate();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key").click();
|
||||
SWTBotShell shell = bot.shell("Set the Foreign Key");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Select xpath").click();
|
||||
// test the filter of the composite by meanwhile.
|
||||
bot.textWithLabel("Filter:").setText("R");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("U");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("");
|
||||
sleep();
|
||||
bot.tree().select("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
shell = bot.shell("Set the Foreign Key");
|
||||
shell.activate();
|
||||
bot.button("OK").click();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("Foreign Key: ComplexTypeEntity"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyFilterTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key Filter").click();
|
||||
SWTBotShell shell = bot.shell("Set Foreign Key Filter");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.table().click(0, 2);
|
||||
// bot.buttonWithTooltip("Select Xpath").click();
|
||||
//
|
||||
// bot.tree().expandNode("BrowseItem").expandNode("anonymous type")
|
||||
// .select("Owner");
|
||||
// sleep();
|
||||
// bot.button("Add").click();
|
||||
// sleep();
|
||||
//
|
||||
// // bot.textInGroup("Custom filters").setText("filter");
|
||||
// sleep();
|
||||
bot.button("OK").click();
|
||||
// Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
// .expand().getNode("Foreign Key Filter: Reporting"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyInfoTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key Infos").click();
|
||||
SWTBotShell shell = bot.shell("Set the Foreign Key Infos");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Select xpath").click();
|
||||
SWTBotShell shell1 = bot.shell("Select Xpath ...");
|
||||
shell1.activate();
|
||||
bot.tree().select(0);
|
||||
bot.button("Add").click();
|
||||
bot.waitUntil(Conditions.shellCloses(shell1));
|
||||
shell.activate();
|
||||
bot.button("Ok").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setFacetTest() {
|
||||
elementNode.contextMenu("Set the facet message").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot
|
||||
.shell("Set multilingual facet error messages for the content of this element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("test error facet in English");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("test error facet in French");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(elementNode.expand().getNode("Annotations")
|
||||
.expand().getNode("Facet_Msg_EN: test error facet in English"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDisplayFormatTest() {
|
||||
elementNode.contextMenu("Set the display format").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot
|
||||
.shell("Set the display format for the content of this element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("test error format in English");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("test error format in French");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void copyXpathTest() {
|
||||
// TODO:it dose nothing now,need to check
|
||||
elementNode.contextMenu("Copy Xpath").click();
|
||||
sleep();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newEntityTest() {
|
||||
elementNode.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity1");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelSchemaEntityOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem conceptNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
if (dataModelItem.getNodes().contains("TestDataModel"))
|
||||
dataModelItem.getNode("TestDataModel").doubleClick();
|
||||
else
|
||||
newDatamodel();
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree conceptTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(conceptTree);
|
||||
newEntity();
|
||||
}
|
||||
|
||||
private void newDatamodel() {
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
private void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
conceptNode = conceptBotTree.getTreeItem("ComplexTypeEntity");
|
||||
conceptNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...", 0).click();
|
||||
}
|
||||
|
||||
private void newElement() {
|
||||
conceptBotTree.getTreeItem("ComplexTypeEntity")
|
||||
.getNode("ComplexTypeEntityType").contextMenu("Add Element")
|
||||
.click();
|
||||
|
||||
SWTBotShell newElementShell = bot.shell("Add a new Business Element");
|
||||
newElementShell.activate();
|
||||
bot.textWithLabel("Business Element Name").setText("Ele");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
conceptNode = conceptBotTree.getTreeItem("ComplexTypeEntity");
|
||||
conceptNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newEntityTest() {
|
||||
conceptNode.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("newEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteEntityTest() {
|
||||
conceptNode.select();
|
||||
conceptNode.contextMenu("Delete Entity").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void editEntityTest() {
|
||||
conceptNode.contextMenu("Edit Entity").click();
|
||||
SWTBotShell editEntityShell = bot.shell("Edit Entity");
|
||||
editEntityShell.activate();
|
||||
bot.textWithLabel("Enter a new Name for the Entity").setText(
|
||||
"EditEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
Assert.assertEquals("EditEntity", conceptNode.getText());
|
||||
// new feature in 4.2,see bug 0017070:
|
||||
// Assert.assertNotNull(conceptNode.getNode("EditEntity"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateDefaultViewTest() {
|
||||
bot.activeEditor().save();
|
||||
conceptNode.contextMenu("Generate default Browse Items Views").click();
|
||||
sleep();
|
||||
SWTBotShell generateViewShell = bot
|
||||
.shell("Generate default Browse Items Views");
|
||||
generateViewShell.activate();
|
||||
bot.button("Finish").click();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void copyEntityTest() {
|
||||
conceptNode.contextMenu("Copy Entity").click();
|
||||
sleep();
|
||||
conceptNode.select();
|
||||
conceptNode.contextMenu("Paste Entity").click();
|
||||
sleep();
|
||||
SWTBotShell saveShell = bot.shell("Copy Entity");
|
||||
saveShell.activate();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToSimpleTypeTest() {
|
||||
conceptNode.contextMenu("Change to a Simple Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Make Simple Type");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Custom").click();
|
||||
sleep();
|
||||
bot.ccomboBoxWithLabel("Type").setSelection(1);
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToComplexTypeTest() {
|
||||
conceptNode.contextMenu("Change to a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Sequence").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addKeyTest() {
|
||||
conceptNode.contextMenu("Add Key").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Add a new Key");
|
||||
changeTypeShell.activate();
|
||||
bot.ccomboBox(1).setSelection(1);
|
||||
bot.text().setText("Test");
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setLabelsTest() {
|
||||
conceptNode.contextMenu("Set the Labels").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Labels");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("en");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("fr");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionsTest() {
|
||||
conceptNode.contextMenu("Set the Descriptions").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Descriptions of This Element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("enlish descriptions");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("french descriptions");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setLookupFieldsTest() {
|
||||
newElement();
|
||||
conceptNode.contextMenu("Set Lookup Fields").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set Lookup Fields");
|
||||
shell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection(1);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setWriteAccessTest() {
|
||||
conceptNode.contextMenu("Set the Roles with Write Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Have Write Access");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection(1);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNoAccessTest() {
|
||||
conceptNode.contextMenu("Set the Roles with No Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Cannot Access This Field");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection(1);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void setWorkflowAccessTest() {
|
||||
conceptNode.contextMenu("Set the Workflow Access").click();
|
||||
SWTBotShell shell = bot.shell("Set the Workflow Access");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Add Multiple").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void genarateWorkflowTest() {
|
||||
conceptNode.contextMenu("Genarate Workflow").click();
|
||||
SWTBotShell shell = bot.shell("Genarate Workflow");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void addValidationRuleTest() {
|
||||
conceptNode.contextMenu("Set the Validation Rule").click();
|
||||
SWTBotShell shell = bot.shell("Add a Validation Rule");
|
||||
shell.activate();
|
||||
bot.text().setText("vadation rule");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void deleteValidationRuleTest() {
|
||||
conceptNode.contextMenu("Delete All Validation Rules").click();
|
||||
SWTBotShell shell = bot.shell("Confirm");
|
||||
shell.activate();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelSchemaGroupOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem groupNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
if (dataModelItem.getNodes().contains("TestDataModel"))
|
||||
dataModelItem.getNode("TestDataModel").doubleClick();
|
||||
else
|
||||
newDatamodel();
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree conceptTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(conceptTree);
|
||||
newEntity();
|
||||
}
|
||||
|
||||
private void newDatamodel() {
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
private void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
groupNode = conceptBotTree.getTreeItem("ComplexTypeEntity").expand()
|
||||
.getNode("ComplexTypeEntityType");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
// new feature in 4.2,See bug 0012073
|
||||
@Test
|
||||
public void addElementTest() {
|
||||
groupNode.contextMenu("Add Element").click();
|
||||
SWTBotShell newEntityShell = bot.shell("Add a new Business Element");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Business Element Name").setText("testElement");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeSubElementGroupTest() {
|
||||
groupNode.contextMenu("Change Sub-Element Group").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Choice").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newEntityTest() {
|
||||
groupNode.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexEntity");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelSchemaKeyOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem keyNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
if (dataModelItem.getNodes().contains("TestDataModel"))
|
||||
dataModelItem.getNode("TestDataModel").doubleClick();
|
||||
else
|
||||
newDatamodel();
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree conceptTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(conceptTree);
|
||||
newEntity();
|
||||
}
|
||||
|
||||
private void newDatamodel() {
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
private void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
keyNode = conceptBotTree.getTreeItem("ComplexTypeEntity").expand()
|
||||
.getNode("ComplexTypeEntity");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newEntityTest() {
|
||||
keyNode.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexEntity");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
Assert.assertNotNull(conceptBotTree.getTreeItem("ComplexEntity"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addKeyTest() {
|
||||
keyNode.contextMenu("Add Key").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Add a new Key");
|
||||
changeTypeShell.activate();
|
||||
bot.ccomboBox(1).setSelection(1);
|
||||
bot.text().setText("Test");
|
||||
bot.button("OK").click();
|
||||
Assert.assertNotNull(conceptBotTree.getTreeItem("ComplexTypeEntity")
|
||||
.expand().getNode("Test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteKeyTest() {
|
||||
addKeyTest();
|
||||
conceptBotTree.getTreeItem("ComplexTypeEntity").expand()
|
||||
.getNode("Test").contextMenu("Delete Key").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addFieldTest() {
|
||||
keyNode.contextMenu("New Field").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Select one field");
|
||||
changeTypeShell.activate();
|
||||
bot.ccomboBox().setText("Field");
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void editKeyTest() {
|
||||
addKeyTest();
|
||||
conceptBotTree.getTreeItem("ComplexTypeEntity").expand()
|
||||
.getNode("Test").contextMenu("Edit Key").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Edit Key");
|
||||
changeTypeShell.activate();
|
||||
bot.text().setText("TestEditKey");
|
||||
bot.button("OK").click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelSchemaOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem entityNode;
|
||||
|
||||
private SWTBotTreeItem elementNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
if (dataModelItem.getNodes().contains("TestDataModel"))
|
||||
dataModelItem.getNode("TestDataModel").doubleClick();
|
||||
else
|
||||
newDatamodel();
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree conceptTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(conceptTree);
|
||||
newEntity();
|
||||
newElement();
|
||||
}
|
||||
|
||||
private void newDatamodel() {
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
private void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
entityNode = conceptBotTree.getTreeItem("ComplexTypeEntity");
|
||||
entityNode.select();
|
||||
}
|
||||
|
||||
private void newElement() {
|
||||
entityNode.expand().getNode("ComplexTypeEntityType")
|
||||
.contextMenu("Add Element").click();
|
||||
|
||||
SWTBotShell newElementShell = bot.shell("Add a new Business Element");
|
||||
newElementShell.activate();
|
||||
bot.textWithLabel("Business Element Name").setText("Ele");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
elementNode = entityNode.expand().getNode("ComplexTypeEntityType")
|
||||
.expand().getNode("Ele [0...1]");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void filterTest() {
|
||||
bot.toolbarRadioButtonWithTooltip("Filter...").click();
|
||||
SWTBotShell filterShell = bot.shell("Data Model Filter");
|
||||
filterShell.activate();
|
||||
bot.ccomboBox().setSelection(1);
|
||||
sleep();
|
||||
bot.radio(3).click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
bot.toolbarButtonWithTooltip("Filter...").click();
|
||||
filterShell = bot.shell("Data Model Filter");
|
||||
filterShell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
sleep();
|
||||
bot.radio(0).click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void expandTest() {
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collapseTest() {
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Collapse...").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void expandModelGroupTest() {
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand ModelGroup...").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elementUpTest() {
|
||||
elementNode.select();
|
||||
bot.toolbarButtonWithTooltip("UP...").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elementDownTest() {
|
||||
entityNode.expand().getNode("ComplexTypeEntityType").expand()
|
||||
.getNode("subelement").select();
|
||||
bot.toolbarButtonWithTooltip("DOWN...").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void labelOperationTest() {
|
||||
entityNode.select();
|
||||
bot.toolbarButtonWithTooltip("Expand...").click();
|
||||
sleep();
|
||||
bot.comboBoxWithLabel("Language:").setSelection(1);
|
||||
bot.buttonWithTooltip("Add...").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Remove...").click();
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,436 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelTypesElementOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private SWTBotTree typesBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem typeNode;
|
||||
|
||||
private SWTBotTreeItem elementNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(4);
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree elemetnsTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(elemetnsTree);
|
||||
Tree typesTree = mainpage.getTypesViewer().getTree();
|
||||
typesBotTree = new SWTBotTree(typesTree);
|
||||
newEntity();
|
||||
bot.activeEditor().save();
|
||||
|
||||
}
|
||||
|
||||
public void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
elementNode = typesBotTree.getTreeItem("ComplexTypeEntityType")
|
||||
.expand().getNode("subelement");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CreateComplexType() {
|
||||
elementNode.contextMenu("Create a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.ccomboBox(0).setText("ComplexType");
|
||||
bot.radio("Sequence").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("ComplexType"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CreateSimpleType() {
|
||||
elementNode.contextMenu("Create a Simple Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("New Simple Type");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Custom").click();
|
||||
sleep();
|
||||
bot.ccomboBoxWithLabel("Type").setSelection(0);
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("PICTURE : string"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void editElementTest() {
|
||||
elementNode.contextMenu("Edit Element").click();
|
||||
SWTBotShell newEntityShell = bot.shell("Edit Business Element");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Business Element Name").setText("element");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addElementTest() {
|
||||
// SWTBotTreeItem groupItem = conceptNode.getNode("ReportingType");
|
||||
elementNode.contextMenu("Add Element (after)").click();
|
||||
SWTBotShell newEntityShell = bot.shell("Add a new Business Element");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Business Element Name").setText("element");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("ComplexTypeEntityType")
|
||||
.expand().getNode("element [0...1]"));
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void copyElementTest() {
|
||||
elementNode.contextMenu("Copy Element").click();
|
||||
sleep();
|
||||
elementNode.contextMenu("Paste Element").click();
|
||||
sleep();
|
||||
SWTBotShell saveShell = bot.shell("Copy Element");
|
||||
saveShell.activate();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToComplexTypeTest() {
|
||||
elementNode.contextMenu("Change to a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Sequence").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeToSimpleTypeTest() {
|
||||
elementNode.contextMenu("Change to a Simple Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Make Simple Type");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Custom").click();
|
||||
sleep();
|
||||
bot.ccomboBoxWithLabel("Type").setSelection(0);
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setLabelsTest() {
|
||||
elementNode.contextMenu("Set the Labels").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Labels");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("en");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("fr");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionsTest() {
|
||||
elementNode.contextMenu("Set the Descriptions").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot.shell("Set the Descriptions of This Element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("enlish descriptions");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("french descriptions");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setWriteAccessTest() {
|
||||
elementNode.contextMenu("Set the Roles with Write Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Have Write Access");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection(1);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNoAccessTest() {
|
||||
elementNode.contextMenu("Set the Roles with No Access").click();
|
||||
SWTBotShell newViewShell = bot
|
||||
.shell("Set The Roles That Cannot Access This Field");
|
||||
newViewShell.activate();
|
||||
bot.ccomboBox().setSelection(0);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.ccomboBox().setSelection(1);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
|
||||
bot.table().select(0);
|
||||
bot.buttonWithTooltip("Move down the selected item").click();
|
||||
sleep(2);
|
||||
bot.buttonWithTooltip("Move up the selected item").click();
|
||||
sleep(2);
|
||||
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Delete the selected item").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void setWorkflowAccessTest() {
|
||||
elementNode.contextMenu("Set the Workflow Access").click();
|
||||
SWTBotShell shell = bot.shell("Set the Workflow Access");
|
||||
shell.activate();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key").click();
|
||||
SWTBotShell shell = bot.shell("Set the Foreign Key");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Select xpath").click();
|
||||
// test the filter of the composite by meanwhile.see bug 0016511
|
||||
bot.textWithLabel("Filter:").setText("R");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("U");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("");
|
||||
sleep();
|
||||
bot.tree().select(0);
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
shell = bot.shell("Set the Foreign Key");
|
||||
shell.activate();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyFilterTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key Filter").click();
|
||||
SWTBotShell shell = bot.shell("Set Foreign Key Filter");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
// TODO:check
|
||||
// bot.buttonWithTooltip("Select Xpath").click();
|
||||
//
|
||||
// bot.tree().expandNode("BrowseItem").select("Owner");
|
||||
// sleep();
|
||||
// bot.button("Add").click();
|
||||
// sleep();
|
||||
|
||||
bot.text().setText("filter");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setForeignKeyInfoTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
}
|
||||
});
|
||||
elementNode.contextMenu("Set the Foreign Key Infos").click();
|
||||
SWTBotShell shell = bot.shell("Set the Foreign Key Infos");
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Select xpath").click();
|
||||
// test the filter of the composite meanwhile.
|
||||
bot.textWithLabel("Filter:").setText("R");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("U");
|
||||
sleep();
|
||||
bot.textWithLabel("Filter:").setText("");
|
||||
sleep();
|
||||
bot.tree().select(0);
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
shell.activate();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setFacetTest() {
|
||||
elementNode.contextMenu("Set the facet message").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot
|
||||
.shell("Set multilingual facet error messages for the content of this element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("test error facet in English");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("test error facet in French");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDisplayFormatTest() {
|
||||
elementNode.contextMenu("Set the display format").click();
|
||||
sleep();
|
||||
SWTBotShell shell = bot
|
||||
.shell("Set the display format for the content of this element");
|
||||
shell.activate();
|
||||
bot.comboBox().setSelection(0);
|
||||
bot.text().setText("test error format in English");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.comboBox().setSelection(1);
|
||||
bot.text().setText("test error format in French");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.table().select(1);
|
||||
bot.buttonWithTooltip("Del").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void copyXpathTest() {
|
||||
// TODO:it dose nothing now,need to check
|
||||
elementNode.contextMenu("Copy Xpath").click();
|
||||
sleep();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.datamodel;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
import com.amalto.workbench.editors.DataModelMainPage;
|
||||
import com.amalto.workbench.editors.xsdeditor.XSDEditor;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class DataModelTypesTypeOperationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTree conceptBotTree;
|
||||
|
||||
private SWTBotTree typesBotTree;
|
||||
|
||||
private DataModelMainPage mainpage;
|
||||
|
||||
private SWTBotTreeItem dataModelItem;
|
||||
|
||||
private SWTBotTreeItem typeNode;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
dataModelItem = serverItem.getNode("Data Model [HEAD]");
|
||||
dataModelItem.expand();
|
||||
|
||||
dataModelItem.contextMenu("New").click();
|
||||
SWTBotShell newDataContainerShell = bot.shell("New Data Model");
|
||||
newDataContainerShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a name for the New Instance");
|
||||
text.setText("TestDataModel");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(dataModelItem.getNode("TestDataModel"));
|
||||
sleep(4);
|
||||
|
||||
final SWTBotEditor editor = bot.editorByTitle("TestDataModel");
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
XSDEditor ep = (XSDEditor) editor.getReference().getPart(true);
|
||||
mainpage = (DataModelMainPage) ep.getSelectedPage();
|
||||
}
|
||||
});
|
||||
Tree elemetnsTree = mainpage.getElementsViewer().getTree();
|
||||
conceptBotTree = new SWTBotTree(elemetnsTree);
|
||||
Tree typesTree = mainpage.getTypesViewer().getTree();
|
||||
typesBotTree = new SWTBotTree(typesTree);
|
||||
newEntity();
|
||||
bot.activeEditor().save();
|
||||
|
||||
}
|
||||
|
||||
public void newEntity() {
|
||||
conceptBotTree.contextMenu("New Entity").click();
|
||||
SWTBotShell newEntityShell = bot.shell("New Entity");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Name:").setText("ComplexTypeEntity");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
typeNode = typesBotTree.getTreeItem("ComplexTypeEntityType");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
mainpage.doSave(new NullProgressMonitor());
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
});
|
||||
dataModelItem.getNode("TestDataModel").contextMenu("Delete").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createComplexTypeTest() {
|
||||
typeNode.contextMenu("Create a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("Complex Type Properties");
|
||||
changeTypeShell.activate();
|
||||
bot.ccomboBox(0).setText("ComplexType");
|
||||
bot.radio("Sequence").click();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("ComplexType"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addSimpleTypeTest() {
|
||||
typeNode.contextMenu("Create a Simple Type").click();
|
||||
sleep();
|
||||
SWTBotShell changeTypeShell = bot.shell("New Simple Type");
|
||||
changeTypeShell.activate();
|
||||
bot.radio("Custom").click();
|
||||
sleep();
|
||||
bot.ccomboBoxWithLabel("Type").setSelection(0);
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("PICTURE : string"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addElementTest() {
|
||||
typeNode.contextMenu("Add Element").click();
|
||||
SWTBotShell newEntityShell = bot.shell("Add a new Business Element");
|
||||
newEntityShell.activate();
|
||||
// create a entity with a complex type
|
||||
bot.textWithLabel("Business Element Name").setText("testElement");
|
||||
sleep();
|
||||
bot.button("OK").click(); // create a entity with a simple type
|
||||
sleep(2);
|
||||
Assert.assertNotNull(typeNode.expand().getNode("testElement [0...1]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void editComplexTypeTest() {
|
||||
typeNode.contextMenu("Edit a Complex Type").click();
|
||||
sleep();
|
||||
SWTBotShell editTypeShell = bot.shell("Edit Complex Type");
|
||||
editTypeShell.activate();
|
||||
bot.text().setText("TextEditComplexType");
|
||||
bot.button("OK").click();
|
||||
Assert.assertNotNull(typesBotTree.getTreeItem("TextEditComplexType"));
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void deleteComplexTypeTest() {
|
||||
createComplexTypeTest();
|
||||
typesBotTree.getTreeItem("ComplexType")
|
||||
.contextMenu("Delete type definition").click();
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.talend.swtbot.mdm.test.serverview.eventmanagement;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class EventManagerTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem eventManagerNode;
|
||||
|
||||
private SWTBotTreeItem eventManagementItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
eventManagementItem = serverItem.getNode("Event Management");
|
||||
eventManagementItem.expand();
|
||||
|
||||
eventManagerNode = eventManagementItem.getNode("Event Manager");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void browseTest() {
|
||||
eventManagerNode.contextMenu("Browse").click();
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void statusTest() {
|
||||
bot.buttonWithTooltip("Start").click();
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Suspend").click();
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Stop").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchTest() {
|
||||
bot.comboBoxWithLabel("Status").setSelection(1);
|
||||
bot.buttonWithTooltip("Search").click();
|
||||
sleep();
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
package org.talend.swtbot.mdm.test.serverview.job;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* @author rhou
|
||||
*
|
||||
*/
|
||||
public class JobRunTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem jobParentItem;
|
||||
|
||||
private SWTBotTreeItem jobItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
jobParentItem = serverItem.getNode("Job Repository");
|
||||
jobParentItem.expand();
|
||||
if(jobParentItem.getNodes().contains("Source Jobs"))
|
||||
jobItem=jobParentItem.getNode("Source Jobs").getNode(0);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
//new feature in 4.2,see bug 0018022,0018002
|
||||
@Test
|
||||
public void jobRunTest(){
|
||||
if(jobItem!=null)
|
||||
jobItem.contextMenu("Run").click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.menu;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class MenuContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem menuParentItem;
|
||||
|
||||
private SWTBotTreeItem menuItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
menuParentItem = serverItem.getNode("Menu [HEAD]");
|
||||
menuParentItem.expand();
|
||||
init();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
menuParentItem.getNode("TestMenu").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
menuParentItem.contextMenu("New").click();
|
||||
SWTBotShell shell = bot.shell("New Menu");
|
||||
shell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a Name for the New Instance");
|
||||
text.setText("TestMenu");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
bot.activeEditor().save();
|
||||
sleep();
|
||||
menuItem = menuParentItem.getNode("TestMenu");
|
||||
Assert.assertNotNull(menuItem);
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
String des = "This is a description for TestMenu";
|
||||
bot.textWithLabel("Description").setText(des);
|
||||
Assert.assertEquals(des, bot.textWithLabel("Description").getText());
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void editMenuEntryTest() {
|
||||
bot.tree().contextMenu("Edit").click();
|
||||
bot.shell("Edit the Menu Entry TestMenu").activate();
|
||||
bot.textWithLabel("Context").setText("TestMenu");
|
||||
bot.textWithLabel("Application").setText("TestMenu");
|
||||
bot.textWithLabel("Icon Path").setText("");// TODO:add the url of the
|
||||
// icon.
|
||||
bot.buttonWithTooltip("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void addBeforeEntryTest() {
|
||||
bot.tree().contextMenu("Add a menu entry before this entry").click();
|
||||
bot.shell("Edit the Menu Entry TestMenu").activate();
|
||||
bot.textWithLabel("ID").setText("BeforeEntry");
|
||||
bot.textWithLabel("Context").setText("BeforeEntry");
|
||||
bot.textWithLabel("Application").setText("BeforeEntry");
|
||||
bot.textInGroup("Menu Entry Labels").setText("BeforeEntry");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.buttonWithTooltip("OK").click();
|
||||
Assert.assertNotNull(bot.tree().getTreeItem(
|
||||
"BeforeEntry - [en: BeforeEntry]"));
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void addAfterEntryTest() {
|
||||
bot.tree().contextMenu("Add a menu entry after this entry").click();
|
||||
bot.shell("Edit the Menu Entry TestMenu").activate();
|
||||
bot.textWithLabel("ID").setText("AfterEntry");
|
||||
bot.textWithLabel("Context").setText("AfterEntry");
|
||||
bot.textWithLabel("Application").setText("AfterEntry");
|
||||
bot.textInGroup("Menu Entry Labels").setText("AfterEntry");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.buttonWithTooltip("OK").click();
|
||||
Assert.assertNotNull(bot.tree().getTreeItem(
|
||||
"AfterEntry - [en: AfterEntry]"));
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void addSubEntryTest() {
|
||||
bot.tree().contextMenu("Add a menu entry after this entry").click();
|
||||
bot.shell("Edit the Menu Entry TestMenu").activate();
|
||||
bot.textWithLabel("ID").setText("SubEntry");
|
||||
bot.textWithLabel("Context").setText("SubEntry");
|
||||
bot.textWithLabel("Application").setText("SubEntry");
|
||||
bot.textInGroup("Menu Entry Labels").setText("SubEntry");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.buttonWithTooltip("OK").click();
|
||||
Assert.assertNotNull(bot.tree()
|
||||
.getTreeItem("TestMenu - [en: TestMenu]")
|
||||
.getNode("SubEntry - [en: SubEntry]"));
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void deleteEntryTest() {
|
||||
bot.tree().contextMenu("Delete Entry").click();
|
||||
Assert.assertNull(bot.tree().getTreeItem("TestMenu - [en: TestMenu]"));
|
||||
sleep();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.resources.customtype;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.util.Util;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class CustomTypeUploadTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem customTypeParentNode;
|
||||
|
||||
private static String SAMPLE_RELATIVE_FILEPATH = "customType.xsd";
|
||||
|
||||
private String[] creation;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
SWTBotTreeItem resourcesItem = serverItem.getNode("Resources");
|
||||
resourcesItem.expand();
|
||||
|
||||
customTypeParentNode = resourcesItem.getNode("Custom Type");
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
customTypeParentNode.select(creation).contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void customTypeUploadTest() throws IOException, URISyntaxException {
|
||||
customTypeParentNode.contextMenu("Upload").click();
|
||||
bot.shell("Upload Custom Type").activate();
|
||||
bot.textWithLabel("Custom Type Name").setText("CustomType");
|
||||
bot.textWithLabel("File Path").setText(
|
||||
Util.getFileFromCurrentPluginSampleFolder(
|
||||
SAMPLE_RELATIVE_FILEPATH).getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.role;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class RoleContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem roleParentItem;
|
||||
|
||||
private SWTBotTreeItem roleItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
roleParentItem = serverItem.getNode("Role [HEAD]");
|
||||
roleParentItem.expand();
|
||||
roleItem = roleParentItem.getNode("Manager_MWest");
|
||||
roleItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
roleParentItem.contextMenu("New Role").click();
|
||||
SWTBotShell newroleShell = bot.shell("New Role");
|
||||
newroleShell.activate();
|
||||
SWTBotText text = bot.textWithLabel("Enter a name for the Role:");
|
||||
text.setText("TestRole");
|
||||
sleep();
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
bot.button(IDialogConstants.NEXT_LABEL).click();
|
||||
sleep();
|
||||
|
||||
bot.comboBoxWithLabel("Administrator").selection();
|
||||
bot.button(IDialogConstants.FINISH_LABEL).click();
|
||||
bot.activeEditor().save();
|
||||
bot.activeEditor().close();
|
||||
roleItem = roleParentItem.getNode("TestRole");
|
||||
Assert.assertNotNull(roleItem);
|
||||
roleItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
bot.buttonWithTooltip("Set the Descriptions").click();
|
||||
bot.shell("Set the Description of the Role").activate();
|
||||
bot.comboBox().setSelection("English");
|
||||
String des = "Administrator";
|
||||
bot.text().setText(des);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.button("OK").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setPermissionTest() {
|
||||
String type = "Object Type";
|
||||
String instance = "Read and Write Permissins On Specific Instances";
|
||||
|
||||
bot.comboBoxWithLabel(type).setSelection("Data Container");
|
||||
bot.comboBox(1).setSelection("CONF");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
|
||||
bot.comboBoxWithLabel(type).setSelection("Data Model");
|
||||
bot.comboBox(1).setSelection("SearchTemplate");
|
||||
bot.comboBox("Read Only").setSelection("Read & Write");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.serviceconfiguration;
|
||||
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class ServiceConfigurationTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem scItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
scItem = serverItem.getNode("Service Configuration");
|
||||
scItem.expand();
|
||||
scItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
bot.activeEditor().close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serviceConfigurationContentTest() {
|
||||
|
||||
bot.comboBox().setSelection("smtp");
|
||||
bot.button("Check").click();
|
||||
// Assert.assertEquals("Connection sucessfully!",
|
||||
// bot.text(1).getText());
|
||||
sleep();
|
||||
|
||||
bot.comboBox().setSelection("svn");
|
||||
bot.button("Check").click();
|
||||
// Assert.assertEquals("Connection sucessfully!",
|
||||
// bot.text(1).getText());
|
||||
sleep();
|
||||
|
||||
bot.comboBox().setSelection("workflow");
|
||||
bot.button("Check").click();
|
||||
// Assert.assertEquals("Connection sucessfully!",
|
||||
// bot.text(1).getText());
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.storedprocedure;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class StoredProcedureContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem spParentItem;
|
||||
|
||||
private SWTBotTreeItem spItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
spParentItem = serverItem.getNode("Stored Procedure [HEAD]");
|
||||
spParentItem.expand();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
spParentItem.contextMenu("New").click();
|
||||
SWTBotShell newspShell = bot.shell("New Stored Procedure");
|
||||
newspShell.activate();
|
||||
SWTBotText text = bot.textWithLabel("Enter a Name for the New Instance");
|
||||
text.setText("TestStoredProcedure");
|
||||
bot.button("OK").click();
|
||||
bot.activeEditor().save();
|
||||
sleep();
|
||||
spParentItem.expand();
|
||||
spItem = spParentItem.getNode("TestStoredProcedure");
|
||||
Assert.assertNotNull(spItem);
|
||||
spItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
init();
|
||||
String des = "This is a stored procedure";
|
||||
bot.textWithLabel("Description").setText(des);
|
||||
Assert.assertEquals(des, bot.textWithLabel("Description").getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setProcedureTest() {
|
||||
String pro = "";
|
||||
bot.styledText().setText(pro);
|
||||
Assert.assertEquals(pro, bot.styledText().getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executeProcedureTest() {
|
||||
String pro = "";
|
||||
bot.comboBox().setSelection("SearchTemplate");
|
||||
bot.button("Execute Procedure").click();
|
||||
spParentItem.expand();
|
||||
spParentItem.getNode("TestStoredProcedure").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.synchronization;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class SynchronizationPlanContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem spParentItem;
|
||||
|
||||
private SWTBotTreeItem spItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
spParentItem = serverItem.getNode("Synchronization Plan [HEAD]");
|
||||
spParentItem.expand();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
spParentItem.contextMenu("New").click();
|
||||
SWTBotShell newspShell = bot.shell("New Synchronization Plan");
|
||||
newspShell.activate();
|
||||
SWTBotText text = bot.textWithLabel("Enter a Name for the New Instance");
|
||||
text.setText("TestSynchronizationPlan");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
bot.activeEditor().save();
|
||||
sleep();
|
||||
spItem = spParentItem.getNode("TestSynchronizationPlan");
|
||||
Assert.assertNotNull(spItem);
|
||||
spItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
init();
|
||||
String des = "This is a stored procedure";
|
||||
bot.textWithLabel("Description").setText(des);
|
||||
Assert.assertEquals(des, bot.textWithLabel("Description").getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkServerTest() {
|
||||
bot.textWithLabel("Name").setText("Test");
|
||||
bot.textWithLabel("URL").setText("http://localhost:8080/talend/TalendPort");
|
||||
bot.textWithLabel("Username").setText("admin");
|
||||
bot.textWithLabel("Password").setText("talend");
|
||||
bot.button("Check").click();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addRecordsSPTest() {
|
||||
// TODO:need more detailed test codes with version after the version is created.
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkActionTest() {
|
||||
bot.activeEditor().save();
|
||||
bot.buttonWithTooltip("Start Full").click();
|
||||
// TODO:need assertion;
|
||||
spParentItem.getNode("TestSynchronizationPlan").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.transformer;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class TransformerContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem jobParentItem;
|
||||
|
||||
private SWTBotTreeItem jobCategoryItem;
|
||||
|
||||
private SWTBotTreeItem jobItem = null;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
jobParentItem = serverItem.getNode("Job Repository");
|
||||
jobParentItem.expand();
|
||||
|
||||
jobCategoryItem = jobParentItem.getNode("Deployed Jobs");
|
||||
if (jobCategoryItem.getItems().length > 0) {
|
||||
jobItem = jobCategoryItem.getNode(0);
|
||||
jobItem.doubleClick();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkTest() {
|
||||
if (jobItem != null)
|
||||
bot.button("Check").click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.talend.swtbot.mdm.test.serverview.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
|
||||
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
|
||||
import org.eclipse.swtbot.swt.finder.SWTBot;
|
||||
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
|
||||
import org.eclipse.swtbot.swt.finder.results.VoidResult;
|
||||
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
public class Util {
|
||||
|
||||
private static String SAMPLE_FOLDER_PATH = "/sample/";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Copy a file with the FileChannel that will accelerate the process.
|
||||
*
|
||||
* @param inputFile
|
||||
* @param outFile
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static long copyFile(File inputFile, File outFile) throws Exception {
|
||||
long time = new Date().getTime();
|
||||
int length = 2097152;
|
||||
FileInputStream in = new FileInputStream(inputFile);
|
||||
FileOutputStream out = new FileOutputStream(outFile);
|
||||
FileChannel inC = in.getChannel();
|
||||
FileChannel outC = out.getChannel();
|
||||
ByteBuffer b = null;
|
||||
while (true) {
|
||||
if (inC.position() == inC.size()) {
|
||||
inC.close();
|
||||
outC.close();
|
||||
return new Date().getTime() - time;
|
||||
}
|
||||
if ((inC.size() - inC.position()) < length) {
|
||||
length = (int) (inC.size() - inC.position());
|
||||
} else
|
||||
length = 2097152;
|
||||
b = ByteBuffer.allocateDirect(length);
|
||||
inC.read(b);
|
||||
b.flip();
|
||||
outC.write(b);
|
||||
outC.force(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a File instance pointing to the file or folder located below this
|
||||
* plugin sample folder
|
||||
*
|
||||
* @param subSamplePath
|
||||
* , path located below /sample/, so subpath should never start
|
||||
* with a /, example : test.xsl
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
public static File getFileFromCurrentPluginSampleFolder(String subSamplePath)
|
||||
throws IOException, URISyntaxException {
|
||||
URL url = Util.class.getResource(SAMPLE_FOLDER_PATH + subSamplePath);
|
||||
URI escapedURI = getFileUrl(url);
|
||||
return URIUtil.toFile(escapedURI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert any URL to a file URL
|
||||
*
|
||||
* @param url
|
||||
* ,maybe an eclipse URL
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
private static URI getFileUrl(URL url) throws IOException,
|
||||
URISyntaxException {
|
||||
URL unescapedURL = FileLocator.toFileURL(url);
|
||||
URI escapedURI = new URI(unescapedURL.getProtocol(),
|
||||
unescapedURL.getPath(), unescapedURL.getQuery());
|
||||
return escapedURI;
|
||||
}
|
||||
|
||||
/**
|
||||
* look for all the widget of type TalendTabbedPropertyList and select the
|
||||
* tab at index for all of them
|
||||
*
|
||||
* @param index
|
||||
* index of the tab to select in aTalendTabbedPropertyList
|
||||
* TalendTabbedPropertyList(values start from 0)
|
||||
*/
|
||||
public static void selecteTalendTabbedPropertyListAtIndex(SWTBot bot,
|
||||
final int index) {
|
||||
// look for all the widgets of type TabbedPropertyList
|
||||
final List<TabbedPropertyList> controls = bot.getFinder().findControls(
|
||||
new BaseMatcher<TabbedPropertyList>() {
|
||||
|
||||
// @Override
|
||||
public boolean matches(Object item) {
|
||||
if (item instanceof TabbedPropertyList) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
public void describeTo(Description description) {
|
||||
description
|
||||
.appendText("looking for widget of type TabbedPropertyList");
|
||||
}
|
||||
});
|
||||
|
||||
// select the desired tab in the UI thread
|
||||
UIThreadRunnable.syncExec(new VoidResult() {
|
||||
|
||||
// @Override
|
||||
public void run() {
|
||||
for (TabbedPropertyList ttpl : controls) {
|
||||
Method select;
|
||||
try {
|
||||
select = ttpl.getClass().getDeclaredMethod("select",
|
||||
int.class);
|
||||
select.setAccessible(true);
|
||||
select.invoke(ttpl, index);
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.version;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class VersionContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem versionParentItem;
|
||||
|
||||
private SWTBotTreeItem versionItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
versionParentItem = serverItem.getNode("Version");
|
||||
versionParentItem.expand();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
versionParentItem.contextMenu("New").click();
|
||||
SWTBotShell newspShell = bot.shell("New Version");
|
||||
newspShell.activate();
|
||||
SWTBotText text = bot
|
||||
.textWithLabel("Enter a Name for the New Instance");
|
||||
text.setText("TestVersion");
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
bot.activeEditor().save();
|
||||
sleep();
|
||||
versionItem = versionParentItem.expand().getNode("TestVersion");
|
||||
Assert.assertNotNull(versionItem);
|
||||
versionItem.doubleClick();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
init();
|
||||
String des = "This is a Version";
|
||||
bot.textWithLabel("Description").setText(des);
|
||||
Assert.assertEquals(des, bot.textWithLabel("Description").getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setEntityIDTest() {
|
||||
bot.text(1).setText("r1");
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
// String pro = "";
|
||||
// bot.styledText().setText(pro);
|
||||
// Assert.assertEquals(pro, bot.styledText().getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setSOIDTest() {
|
||||
// bot.ccomboBoxWithLabel("Data Model").setText("DataModel");
|
||||
bot.ccomboBox(0).setText("DataModel");
|
||||
versionParentItem.expand().getNode("TestVersion").contextMenu("Delete")
|
||||
.click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.view;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
public class IsEmptyOrNullOperatorTest extends SWTBotForMDMServiewView {
|
||||
private SWTBotTreeItem viewParentItem;
|
||||
|
||||
private SWTBotTreeItem viewItem;
|
||||
|
||||
private String[] array = new String[] { "Id", "Firstname", "Lastname",
|
||||
"CommissionCode", "StartDate", "TermDate" };
|
||||
|
||||
private String PREFIX = "Browse_items_";
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
viewParentItem = serverItem.getNode("View [HEAD]");
|
||||
viewParentItem.expand();
|
||||
|
||||
}
|
||||
|
||||
private void setElements() {
|
||||
setViewableElementsTest();
|
||||
bot.buttonWithTooltip("Add", 1).click();
|
||||
|
||||
}
|
||||
|
||||
private void setViewableElementsTest() {
|
||||
bot.buttonWithTooltip("Add Multiple", 0).click();
|
||||
|
||||
bot.shell("Select Multiple XPaths").activate();
|
||||
// bot.comboBox().setSelection("CONF");
|
||||
// sleep();
|
||||
SWTBotTreeItem parent = bot.tree().getTreeItem("Conf").expand()
|
||||
.getNode(0).expand();
|
||||
parent.select("id");
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
bot.activeEditor().save();
|
||||
bot.activeEditor().close();
|
||||
viewParentItem.getNode(PREFIX + "Conf").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
private void createView() {
|
||||
viewParentItem.contextMenu("New").click();
|
||||
SWTBotShell newViewShell = bot.shell("New View");
|
||||
newViewShell.activate();
|
||||
bot.buttonWithTooltip("Select one Entity").click();
|
||||
bot.shell("Select one Entity").activate();
|
||||
|
||||
bot.comboBoxWithLabel("Data Models:").setSelection("CONF");
|
||||
bot.tree().select("Conf");
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
createView();
|
||||
setElements();
|
||||
}
|
||||
|
||||
// new feature in 4.2,see bug 0018359.
|
||||
// @Test
|
||||
public void isEmptyOrNullOperatorTest() {
|
||||
init();
|
||||
bot.buttonWithTooltip("Add", 2).click();
|
||||
bot.table(2).click(0, 1);
|
||||
SWTBotCombo com = bot.comboBox();
|
||||
com.setFocus();
|
||||
com.setSelection("IsEmptyOrNull");
|
||||
Assert.assertEquals("IsEmptyOrNull", bot.ccomboBox().getText());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.view;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* ViewContentOperationTest is a SWTBot test class to imitate the process to
|
||||
* create a view like Browse_items_Agent.
|
||||
*
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*
|
||||
* see bug 0017197.
|
||||
*
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class ViewContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem viewParentItem;
|
||||
|
||||
private SWTBotTreeItem viewItem;
|
||||
|
||||
// private String[] array = new String[] { "Id", "Firstname", "Lastname",
|
||||
// "CommissionCode", "StartDate", "TermDate" };
|
||||
private String[] array = new String[] { "id", "Config" };
|
||||
private String PREFIX = "Browse_items_";
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
viewParentItem = serverItem.getNode("View [HEAD]");
|
||||
viewParentItem.expand();
|
||||
|
||||
}
|
||||
|
||||
private void createView() {
|
||||
// new feature in 4.2,see bug 0016511.
|
||||
// Create a new view to test the filter of the xpath.
|
||||
viewParentItem.contextMenu("New").click();
|
||||
// bot.sleep(1000);
|
||||
SWTBotShell newViewShell = bot.shell("New View");
|
||||
newViewShell.activate();
|
||||
// bot.buttonWithLabel("...").click();
|
||||
bot.buttonWithTooltip("Select one Entity").click();
|
||||
bot.shell("Select one Entity").activate();
|
||||
|
||||
bot.comboBoxWithLabel("Data Models:").setSelection("CONF");
|
||||
bot.tree().select("Conf");
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
// setDescription();
|
||||
// setElements();
|
||||
// bot.activeEditor().save();
|
||||
// bot.activeEditor().close();
|
||||
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
createView();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDescriptionTest() {
|
||||
bot.buttonWithTooltip("Set the Descriptions").click();
|
||||
bot.shell("Set the Descriptions").activate();
|
||||
bot.comboBox().setSelection("English");
|
||||
String des = "Conf";
|
||||
bot.text().setText(des);
|
||||
bot.buttonWithTooltip("Add").click();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setViewableElementsTest() {
|
||||
init();
|
||||
bot.buttonWithTooltip("Add Multiple", 0).click();
|
||||
bot.shell("Select Multiple XPaths").activate();
|
||||
// bot.comboBox().setSelection("CONF");
|
||||
// sleep();
|
||||
SWTBotTreeItem parent = bot.tree().getTreeItem("Conf").expand()
|
||||
.getNode(0).expand();
|
||||
parent.select(array);
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setSearchableElementsTest() {
|
||||
bot.buttonWithTooltip("Add Multiple", 1).click();
|
||||
bot.shell("Select Multiple XPaths").activate();
|
||||
// bot.comboBox().setSelection("Agent");
|
||||
// sleep();
|
||||
SWTBotTreeItem parent = bot.tree().getTreeItem("Conf").expand()
|
||||
.getNode(0).expand();
|
||||
parent.select(array);
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
|
||||
// bot.buttonWithTooltip("Add Multiple", 1).click();
|
||||
// bot.shell("Select Multiple XPaths").activate();
|
||||
// bot.comboBox().setSelection("Agent");
|
||||
// sleep();
|
||||
// bot.tree().select("Agent");
|
||||
// sleep();
|
||||
// bot.button("Add").click();
|
||||
// sleep();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setWhereConditionsTest() {
|
||||
bot.buttonWithTooltip("Add Multiple", 2).click();
|
||||
bot.shell("Select Multiple XPaths").activate();
|
||||
// bot.comboBox().setSelection("Agent");
|
||||
// sleep();
|
||||
SWTBotTreeItem parent = bot.tree().getTreeItem("Conf").expand()
|
||||
.getNode(0).expand();
|
||||
parent.select("Config");
|
||||
sleep();
|
||||
bot.button("Add").click();
|
||||
sleep();
|
||||
|
||||
bot.activeEditor().save();
|
||||
sleep(2);
|
||||
viewParentItem.getNode(PREFIX + "Conf").contextMenu("Delete").click();
|
||||
sleep();
|
||||
bot.button("OK").click();
|
||||
sleep();
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
// TODO:add the content
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.swtbot.mdm.test.serverview.workflow;
|
||||
|
||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.talend.swtbot.mdm.test.serverview.SWTBotForMDMServiewView;
|
||||
|
||||
/**
|
||||
* DOC rhou class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
public class WorkflowContentTest extends SWTBotForMDMServiewView {
|
||||
|
||||
private SWTBotTreeItem workflowParentItem;
|
||||
|
||||
@Before
|
||||
public void runBeforeEveryTest() {
|
||||
workflowParentItem = serverItem.getNode("Workflow");
|
||||
workflowParentItem.expand();
|
||||
SWTBotTreeItem workflowItem;
|
||||
if (workflowParentItem.getItems().length > 0) {
|
||||
workflowItem = workflowParentItem.getNode(0);
|
||||
workflowItem.doubleClick();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void runAfterEveryTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void workflowContentTest() {
|
||||
// TODO:need further test codes.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.repositorymanager.selenium.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,13 @@
|
||||
#Tue Sep 14 10:33:44 CEST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.4
|
||||
@@ -0,0 +1,9 @@
|
||||
#Tue Sep 14 10:33:44 CEST 2010
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
||||
@@ -0,0 +1,208 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-acceptance</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-tests</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>repositorymanager-tests</name>
|
||||
|
||||
<properties>
|
||||
<repositorymanager.webapp>RepoMngGxt.war</repositorymanager.webapp>
|
||||
<tomcat.file>file:/d:/apache-tomcat-6.0.20.zip</tomcat.file>
|
||||
<war.file>RepoMngGxt.war</war.file>
|
||||
<webapp.url>http://localhost:8080/RepoMngGxt</webapp.url>
|
||||
<webapp.timeout>240000</webapp.timeout>
|
||||
<tomcat.home>target/tomcat6x</tomcat.home>
|
||||
<container.id>tomcat6x</container.id>
|
||||
<container.type>standalone</container.type>
|
||||
<selenium.background>true</selenium.background>
|
||||
<repositorymanager.wait>false</repositorymanager.wait>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-assembly</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openqa.selenium</groupId>
|
||||
<artifactId>selenium-rc</artifactId>
|
||||
<version>1.0-20081010.060147</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
|
||||
<artifactId>selenium-java-client-driver</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>env-build</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env-build</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>selenium-maven-plugin</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xvfb</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>xvfb</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<testSourceDirectory>src/main/java</testSourceDirectory>
|
||||
<plugins>
|
||||
|
||||
<!-- JUnit Compilation -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Junit Tests -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Cargo -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<configuration>
|
||||
<container>
|
||||
<containerId>${container.id}</containerId>
|
||||
<zipUrlInstaller>
|
||||
<url>${tomcat.file}</url>
|
||||
</zipUrlInstaller>
|
||||
</container>
|
||||
|
||||
<!-- Configuration to use with the Container -->
|
||||
<configuration>
|
||||
<type>${container.type}</type>
|
||||
<home>${tomcat.home}</home>
|
||||
</configuration>
|
||||
|
||||
<!-- Deployment of war file in standalone Tomcat -->
|
||||
<deployer>
|
||||
<deployables>
|
||||
<deployable>
|
||||
<type>war</type>
|
||||
<location>${war.file}</location>
|
||||
<pingURL>${webapp.url}</pingURL>
|
||||
<pingTimeout>${webapp.timeout}</pingTimeout>
|
||||
</deployable>
|
||||
</deployables>
|
||||
</deployer>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-container</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>start</goal>
|
||||
<goal>deployer-deploy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<wait>${repositorymanager.wait}</wait>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-container</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Selenium management -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>selenium-maven-plugin</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-selenium</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>start-server</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<background>${selenium.background}</background>
|
||||
<logOutput>true</logOutput>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-selenium</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop-server</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
import com.thoughtworks.selenium.SeleneseTestCase;
|
||||
|
||||
public class BaseSeleniumConfig extends SeleneseTestCase {
|
||||
|
||||
private static String application_server = "localhost";
|
||||
private static String port = "8080";
|
||||
private static String browser = "*firefox";
|
||||
private static String url = "/RepoMngGxt/";
|
||||
|
||||
public void setUp() throws Exception {
|
||||
setUp("http://" + application_server + ":" + port, browser);
|
||||
}
|
||||
|
||||
public static String getUrl() {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
import com.thoughtworks.selenium.Selenium;
|
||||
|
||||
public class LoginAdmin extends BaseSeleniumConfig {
|
||||
|
||||
public LoginAdmin(Selenium selenium) {
|
||||
super.selenium = selenium;
|
||||
}
|
||||
|
||||
public void testLogin() throws Exception {
|
||||
selenium.open(getUrl());
|
||||
selenium.type("idLoginInput", "admin@company.com");
|
||||
selenium.type("idLoginPasswordInput", "admin");
|
||||
selenium.keyDown("idLoginInput", "\\13");
|
||||
selenium.keyUp("idLoginInput", "\\13");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
|
||||
import com.thoughtworks.selenium.Selenium;
|
||||
|
||||
public class Logout extends BaseSeleniumConfig {
|
||||
|
||||
public Logout(Selenium selenium) {
|
||||
super.selenium = selenium;
|
||||
}
|
||||
|
||||
public void testLogout() throws Exception {
|
||||
selenium.click("idLeftMenuTreeLogoutButton");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
import com.thoughtworks.selenium.Selenium;
|
||||
|
||||
public class TestAdminLogin extends BaseSeleniumConfig {
|
||||
Logout logout;
|
||||
LoginAdmin login_admin;
|
||||
|
||||
public TestAdminLogin() {
|
||||
|
||||
}
|
||||
|
||||
public TestAdminLogin(Selenium selenium) {
|
||||
super.selenium = selenium;
|
||||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
login_admin = new LoginAdmin(super.selenium);
|
||||
logout = new Logout(super.selenium);
|
||||
}
|
||||
|
||||
public void testLogin() throws Exception {
|
||||
login_admin.testLogin();
|
||||
selenium.waitForPageToLoad("60000");
|
||||
logout.testLogout();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
public class TestWrongLogin extends BaseSeleniumConfig {
|
||||
|
||||
public void testWrongLogin() throws Exception {
|
||||
selenium.open(getUrl());
|
||||
selenium.type("idLoginInput", "user@unknown-company.com");
|
||||
selenium.type("idLoginPasswordInput", "admin");
|
||||
selenium.keyDown("idLoginInput", "\\13");
|
||||
selenium.keyUp("idLoginInput", "\\13");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.talend.repositorymanager.selenium.test.login;
|
||||
|
||||
public class TestWrongPassword extends BaseSeleniumConfig {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testWrongPassword() throws Exception {
|
||||
selenium.open(getUrl());
|
||||
selenium.type("idLoginInput", "admin@company.com");
|
||||
selenium.type("idLoginPasswordInput", "wrong_password");
|
||||
selenium.keyDown("idLoginInput", "\\13");
|
||||
selenium.keyUp("idLoginInput", "\\13");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.repositorymanager-assembly.selenium.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,13 @@
|
||||
#Thu Nov 04 12:35:34 CET 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.4
|
||||
@@ -0,0 +1,9 @@
|
||||
#Thu Nov 04 12:35:31 CET 2010
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
||||
@@ -0,0 +1,64 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-acceptance</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-assembly</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>repositorymanager-assembly</name>
|
||||
|
||||
<!-- Variables used in the project -->
|
||||
<properties>
|
||||
<repositorymanager.webapp>RepoMngGxt.war</repositorymanager.webapp>
|
||||
<tomcat.file>file:/c:/apache-tomcat-6.0.28-windows-x86.zip</tomcat.file>
|
||||
<war.file>RepoMngGxt.war</war.file>
|
||||
<webapp.url>http://localhost:8080/RepoMngGxt</webapp.url>
|
||||
<webapp.timeout>240000</webapp.timeout>
|
||||
<tomcat.home>target/tomcat6x</tomcat.home>
|
||||
<container.id>tomcat6x</container.id>
|
||||
<container.type>standalone</container.type>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Tomcat container management -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<configuration>
|
||||
<container>
|
||||
<containerId>${container.id}</containerId>
|
||||
<zipUrlInstaller>
|
||||
<url>${tomcat.file}</url>
|
||||
</zipUrlInstaller>
|
||||
</container>
|
||||
|
||||
<!-- Configuration to use with the Container -->
|
||||
<configuration>
|
||||
<type>${container.type}</type>
|
||||
<home>${tomcat.home}</home>
|
||||
</configuration>
|
||||
|
||||
<!-- Deployment of war file in standalone Tomcat -->
|
||||
<deployer>
|
||||
<deployables>
|
||||
<deployable>
|
||||
<type>war</type>
|
||||
<location>${war.file}</location>
|
||||
<pingURL>${webapp.url}</pingURL>
|
||||
<pingTimeout>${webapp.timeout}</pingTimeout>
|
||||
</deployable>
|
||||
</deployables>
|
||||
</deployer>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
36
org.talend.repositorymanager.selenium.test/pom.xml
Normal file
36
org.talend.repositorymanager.selenium.test/pom.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.repositorymanager.tests</groupId>
|
||||
<artifactId>repositorymanager-acceptance</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>repositorymanager-acceptance</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<description>Repository Manager Acceptance parent POM</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://www.talendforge.org/svn/tis_shared/trunk/org.talend.repositorymanager.selenium.test</connection>
|
||||
<url>http://www.talendforge.org/svn/tis_shared/trunk/org.talend.repositorymanager.selenium.test</url>
|
||||
</scm>
|
||||
|
||||
<modules>
|
||||
<module>org.talend.repositorymanager-assembly.selenium.test</module>
|
||||
<module>org.talend.repository-manager-tests.selenium.test</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-plugin</artifactId>
|
||||
<configuration>
|
||||
<connectionType>connection</connectionType>
|
||||
<username>${scm.username}</username>
|
||||
<password>${scm.password}</password>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
10
org.talend.selenium.mdm.test/.classpath
Normal file
10
org.talend.selenium.mdm.test/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Selenium2"/>
|
||||
<classpathentry kind="lib" path="C:/Users/andy/Downloads/apache-log4j-1.2.16/log4j-1.2.16.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/selenium2.19"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
org.talend.selenium.mdm.test/.project
Normal file
17
org.talend.selenium.mdm.test/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.selenium.mdm.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
29
org.talend.selenium.mdm.test/src/main/java/launch_tests.xml
Normal file
29
org.talend.selenium.mdm.test/src/main/java/launch_tests.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
<parameter name="testlink.porject" value="TMDMQA"/>
|
||||
<parameter name="testlink.id" value="TMDMQA-0"/>
|
||||
|
||||
<parameter name ="url" value ="http://localhost:8180"/>
|
||||
<parameter name ="root" value ="/talendmdm/secure/"/>
|
||||
<parameter name="user.name" value="administrator" />
|
||||
<parameter name="user.password" value="administrator" />
|
||||
<parameter name="message" value="User 'administrator' is already logged in another session!" />
|
||||
<parameter name="container" value="Product" />
|
||||
<parameter name="modle" value="Product" />
|
||||
<parameter name="user.frank.name" value="frank" />
|
||||
<parameter name="user.frank.password" value="frank" />
|
||||
<parameter name="user.jennifer.name" value="jennifer" />
|
||||
<parameter name="user.jennifer.password" value="jennifer" />
|
||||
<suite-files>
|
||||
<suite-file path='org/talend/mdm/conf/welcome.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/license.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/login.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/user.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/productFamilyRecord.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/productRecord.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/storeRecord.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/agencyRecord.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/agentRecord.xml' />
|
||||
<suite-file path='org/talend/mdm/conf/dsc.xml' />
|
||||
</suite-files>
|
||||
</suite>
|
||||
@@ -0,0 +1,655 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Robot;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.openqa.selenium.Alert;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxProfile;
|
||||
import org.openqa.selenium.ie.InternetExplorerDriver;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.talend.mdm.TestCase.Result;
|
||||
import org.testng.Assert;
|
||||
import org.testng.IClass;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.ITestResult;
|
||||
import org.testng.Reporter;
|
||||
import org.testng.TestListenerAdapter;
|
||||
import org.testng.TestRunner;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
public class Base {
|
||||
public Logger logger = Logger.getLogger(this.getClass());
|
||||
public Locale currentLocale = new Locale("en", "US"); // set the locale that
|
||||
// you want to test
|
||||
public ResourceBundle rb = ResourceBundle.getBundle("org.talend.mdm.resources.messages",currentLocale);
|
||||
|
||||
public ResourceBundle other = ResourceBundle.getBundle("org.talend.mdm.resources.other",currentLocale);
|
||||
public ResourceBundle locator = ResourceBundle.getBundle("org.talend.mdm.resources.locator",currentLocale);
|
||||
|
||||
public enum Browser{
|
||||
firefox,iexplore
|
||||
}
|
||||
|
||||
public final static int WAIT_TIME_MIN =50;
|
||||
public final static int WAIT_TIME_MID = 300;
|
||||
public final static int WAIT_TIME_MAX = 5000;
|
||||
|
||||
public static List<TestCase> successTestCases = new ArrayList<TestCase>();
|
||||
public static List<TestCase> failedTestCases = new ArrayList<TestCase>();
|
||||
TestCaseRecorder testCaseRecorder = new TestCaseRecorder();
|
||||
TestCaseScreenRecorder testCaseScreenRecorder;
|
||||
|
||||
public WebDriver driver;
|
||||
public void setDriver(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public void sleepCertainTime(int sleepTime){
|
||||
try {
|
||||
Thread.sleep(sleepTime);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshBrowser(){
|
||||
driver.navigate().refresh();
|
||||
}
|
||||
|
||||
public void openURL(WebDriver dri,String url){
|
||||
dri.get(url);
|
||||
}
|
||||
|
||||
public WebDriver initNewDriver(){
|
||||
|
||||
return new FirefoxDriver();
|
||||
|
||||
}
|
||||
|
||||
public WebElement findElementDefineDriver(WebDriver dri,By by){
|
||||
return dri.findElement(by);
|
||||
}
|
||||
|
||||
public WebElement waitfor(final By by, int timeout) {
|
||||
WebElement element = null;
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, timeout);
|
||||
|
||||
try {
|
||||
element = wait.until((new Function<WebDriver, WebElement>() {
|
||||
public WebElement apply(WebDriver webDriver) {
|
||||
WebElement wElement = webDriver.findElement(by);
|
||||
if (wElement != null) {
|
||||
return wElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
System.out.println("Couldn't find the element - " + by);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public boolean isElementPresent(By by, int timeout) {
|
||||
if(this.waitfor(by, WAIT_TIME_MIN) == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public WebElement waitfor(final By by, int checkTimes, int timeout) {
|
||||
int i=0;
|
||||
WebElement element = null;
|
||||
do{
|
||||
i++;
|
||||
element = waitfor(by, timeout);
|
||||
try {
|
||||
Thread.sleep(timeout);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}while(element==null | i<=checkTimes);
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public boolean waitforElementDisplayed(final By by, int timeout) {
|
||||
WebDriverWait wait = new WebDriverWait(driver, timeout);
|
||||
wait.until((new Predicate<WebDriver>(){
|
||||
public boolean apply(WebDriver webDriver) {
|
||||
WebElement wElement = webDriver.findElement(by);
|
||||
return wElement.isDisplayed();
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public boolean waitforElementDisplayed(final WebElement wElement, int timeout) {
|
||||
WebDriverWait wait = new WebDriverWait(driver, timeout);
|
||||
wait.until((new Predicate<WebDriver>(){
|
||||
public boolean apply(WebDriver webDriver) {
|
||||
return wElement.isDisplayed();
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver.findElement(By.tagName("body")).getText().contains(what);
|
||||
* @param by
|
||||
* @param timeout
|
||||
*/
|
||||
public boolean waitforTextDisplayed(final String text, int timeout) {
|
||||
WebDriverWait wait = new WebDriverWait(driver, timeout);
|
||||
wait.until((new Predicate<WebDriver>(){
|
||||
public boolean apply(WebDriver webDriver) {
|
||||
return driver.findElement(By.tagName("body")).getText().contains(text);
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver.findElement(By.tagName("body")).getText().contains(what);
|
||||
* @param by
|
||||
* @param timeout
|
||||
*/
|
||||
public boolean waitforTextDisplayed(final String text, int checkTimes, int timeout) {
|
||||
int i=0;
|
||||
boolean flag = false;
|
||||
do{
|
||||
i++;
|
||||
flag = this.waitforTextDisplayed(text, timeout);
|
||||
}while(flag | i>checkTimes);
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* driver.findElement(By.tagName("body")).getText().contains(what);
|
||||
* @param by
|
||||
* @param timeout
|
||||
*/
|
||||
public boolean waitforTextDisappeared(final String text, int timeout) {
|
||||
WebDriverWait wait = new WebDriverWait(driver, timeout);
|
||||
wait.until((new Predicate<WebDriver>(){
|
||||
public boolean apply(WebDriver webDriver) {
|
||||
return !driver.findElement(By.tagName("body")).getText().contains(text);
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
|
||||
public void typeString(WebElement ele,String value){
|
||||
Assert.assertTrue(ele.isEnabled());
|
||||
// ele.click();
|
||||
ele.clear();
|
||||
ele.sendKeys(value);
|
||||
}
|
||||
|
||||
public void typeString(By by, String str, int timeout) {
|
||||
WebElement element = this.waitfor(by, timeout);
|
||||
element.sendKeys(str);
|
||||
}
|
||||
|
||||
public WebElement getElementById(String id) {
|
||||
return this.waitfor(By.id(id), WAIT_TIME_MIN);
|
||||
}
|
||||
public WebElement getElementByName(String name) {
|
||||
return this.waitfor(By.name(name), WAIT_TIME_MIN);
|
||||
}
|
||||
public WebElement getElementByXpath(String xpath) {
|
||||
return this.waitfor(By.xpath(xpath), WAIT_TIME_MIN);
|
||||
}
|
||||
|
||||
public WebElement getElementByLinkText(String linkText) {
|
||||
return this.waitfor(By.linkText(linkText), WAIT_TIME_MIN);
|
||||
}
|
||||
|
||||
public void typeTextById(String id, String text) {
|
||||
this.getElementById(id).sendKeys(text);
|
||||
// System.out.println("ID - " + this.getElementById(id).getText());
|
||||
}
|
||||
public void typeTextByName(String name, String text) {
|
||||
this.getElementByName(name).sendKeys(text);
|
||||
}
|
||||
public void typeTextByXpath(String xpath, String text) {
|
||||
this.getElementByXpath(xpath).sendKeys(text);
|
||||
}
|
||||
|
||||
public void modifyText(WebElement element,String text) {
|
||||
element.clear();
|
||||
element.sendKeys(text);
|
||||
}
|
||||
public void modifyTextById(String id, String text) {
|
||||
this.modifyText(this.getElementById(id), text);
|
||||
}
|
||||
public void modifyTextByName(String name, String text) {
|
||||
this.modifyText(this.getElementByName(name), text);
|
||||
}
|
||||
public void modifyTextByXpath(String xpath, String text) {
|
||||
this.modifyText(this.getElementByXpath(xpath), text);
|
||||
}
|
||||
|
||||
public String getText(){
|
||||
return driver.findElement(By.tagName("body")).getText();
|
||||
}
|
||||
|
||||
public String getValue(WebElement element){
|
||||
return element.getText();
|
||||
}
|
||||
|
||||
public boolean isTextPresent(String what) {
|
||||
try {
|
||||
return driver.findElement(By.tagName("body")).getText().contains(what);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void clickElementById(String id){
|
||||
this.getElementById(id).click();
|
||||
}
|
||||
public void clickElementByName(String name){
|
||||
this.getElementByName(name).click();
|
||||
}
|
||||
public void clickElementByXpath(String xpath){
|
||||
Assert.assertTrue(this.waitfor(By.xpath(xpath), WAIT_TIME_MIN)!=null);
|
||||
this.driver.findElement(By.xpath(xpath)).click();
|
||||
// this.getElementByXpath(xpath).click();
|
||||
|
||||
}
|
||||
|
||||
public void clickVisibleElementByXpath(String xpath){
|
||||
List<WebElement> a = this.getElementsByXpath(xpath);
|
||||
for(int i = 0; i < a.size(); i ++) {
|
||||
if (a.get(i).isDisplayed()){
|
||||
a.get(i).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clickElementByLinkText(String linkText){
|
||||
this.getElementByLinkText(linkText).click();
|
||||
}
|
||||
|
||||
public List<WebElement> getElementsByXpath(String xpath){
|
||||
return driver.findElements(By.xpath(xpath));
|
||||
}
|
||||
|
||||
public void dragAndDrop(WebElement source, WebElement target){
|
||||
(new Actions(driver)).dragAndDrop(source, target).perform();
|
||||
}
|
||||
|
||||
public void dragAndDropBy(WebElement source, int xOffset, int yOffset){
|
||||
new Actions(driver).dragAndDropBy(source, xOffset, yOffset).perform();
|
||||
}
|
||||
|
||||
public void dragAndDropByXOffset(WebElement source, int xOffset){
|
||||
new Actions(driver).dragAndDropBy(source, xOffset, 0).perform();
|
||||
}
|
||||
|
||||
public void dragAndDropByYOffset(WebElement source, int yOffset){
|
||||
new Actions(driver).dragAndDropBy(source, 0, yOffset).perform();
|
||||
}
|
||||
|
||||
public void rightClick(WebElement element){
|
||||
new Actions(driver).contextClick(element).perform();
|
||||
}
|
||||
|
||||
public void doubleClick(WebElement element){
|
||||
new Actions(driver).doubleClick(element).perform();
|
||||
}
|
||||
|
||||
public void release(WebElement element){
|
||||
new Actions(driver).release(element).perform();
|
||||
}
|
||||
|
||||
public void release(){
|
||||
new Actions(driver).release().perform();
|
||||
}
|
||||
|
||||
public void clickAndOnHold(WebElement element){
|
||||
new Actions(driver).clickAndHold(element).perform();
|
||||
}
|
||||
|
||||
public void keyDown(WebElement element, Keys keys){
|
||||
new Actions(driver).keyDown(element, keys).perform();
|
||||
}
|
||||
|
||||
public void keyDown(Keys keys){
|
||||
new Actions(driver).keyDown(keys).perform();
|
||||
}
|
||||
|
||||
public void keyUp(WebElement element, Keys keys){
|
||||
new Actions(driver).keyUp(element, keys).perform();
|
||||
}
|
||||
|
||||
public void keyUp(Keys keys){
|
||||
new Actions(driver).keyUp(keys).perform();
|
||||
|
||||
}
|
||||
|
||||
public void moveToElement(WebElement element){
|
||||
new Actions(driver).moveToElement(element).perform();
|
||||
}
|
||||
|
||||
public void moveToElement(WebElement element, int xOffset, int yOffset){
|
||||
new Actions(driver).moveToElement(element, xOffset, yOffset).perform();
|
||||
}
|
||||
|
||||
public void moveToElement(int xOffset, int yOffset){
|
||||
new Actions(driver).moveByOffset(xOffset, yOffset).perform();
|
||||
}
|
||||
|
||||
|
||||
public void acceptAlert(){
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Alert alert = driver.switchTo().alert();
|
||||
System.out.println(driver.switchTo().alert().getText());
|
||||
alert.accept();
|
||||
}
|
||||
public void acceptAlert(String allertMessage){
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Alert alert = driver.switchTo().alert();
|
||||
Assert.assertTrue((driver.switchTo().alert().getText().contains(allertMessage)),"allert wrong message!");
|
||||
alert.accept();
|
||||
}
|
||||
|
||||
public void dismissAlert(){
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Alert alert = driver.switchTo().alert();
|
||||
System.out.println(driver.switchTo().alert().getText());
|
||||
alert.dismiss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void windowMaximize(){
|
||||
driver.manage().window().maximize();
|
||||
|
||||
// Toolkit toolkit = Toolkit.getDefaultToolkit ();
|
||||
// java.awt.Dimension dim = toolkit.getScreenSize();
|
||||
// Dimension dimension = new Dimension(dim.width, dim.height);
|
||||
// driver.manage().window().setSize(dimension);
|
||||
}
|
||||
|
||||
public void captureScreenshot(String filename){
|
||||
try {
|
||||
Robot robot = new Robot();
|
||||
BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
|
||||
ImageIO.write(screenShot, "JPG", new File(filename));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AWTException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void onTestListener(ITestContext context, final String imgFilePath){
|
||||
TestRunner runner = (TestRunner) context;
|
||||
runner.addListener(new TestListenerAdapter(){
|
||||
@Override
|
||||
public void onTestFailure(ITestResult tr) {
|
||||
Reporter.setCurrentTestResult(tr);
|
||||
|
||||
String testCaseInfo = this.getTestCaseInfo(tr);
|
||||
|
||||
String methodName = tr.getMethod().getMethodName();
|
||||
int lineNumber = 0;
|
||||
for(StackTraceElement element: tr.getThrowable().getStackTrace()) {
|
||||
if(methodName.equals(element.getMethodName())) {
|
||||
lineNumber = element.getLineNumber();
|
||||
}
|
||||
}
|
||||
String name = testCaseInfo + "_" + lineNumber + ".png";
|
||||
try {
|
||||
captureScreenshot(imgFilePath + File.separator + name);
|
||||
System.out.println(imgFilePath + File.separator + name);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
this.setTestCaseResultInfo(failedTestCases, testCaseInfo, Result.f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTestSuccess(ITestResult tr) {
|
||||
super.onTestSuccess(tr);
|
||||
Reporter.setCurrentTestResult(tr);
|
||||
String testCaseInfo = this.getTestCaseInfo(tr);
|
||||
this.setTestCaseResultInfo(successTestCases, testCaseInfo, Result.p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestStart(ITestResult tr) {
|
||||
String testCaseInfo = this.getTestCaseInfo(tr);
|
||||
try {
|
||||
// Comment the video record
|
||||
// testCaseScreenRecorder = testCaseRecorder.getScreenRecorder(getAbsoluteFolderPath("org/talend/mdm/download") + "/" + testCaseInfo);
|
||||
logger.info(getAbsoluteFolderPath("org/talend/mdm/download") + "/" + testCaseInfo);
|
||||
|
||||
if(testCaseScreenRecorder == null) {
|
||||
logger.info("testCaseScreenRecorder = null");
|
||||
}
|
||||
|
||||
// testCaseScreenRecorder.start();
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
super.onTestStart(tr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(ITestContext testContext) {
|
||||
try {
|
||||
if(testCaseScreenRecorder != null) {
|
||||
testCaseScreenRecorder.stop();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
testCaseScreenRecorder = null;
|
||||
}
|
||||
super.onFinish(testContext);
|
||||
}
|
||||
|
||||
public String getTestCaseInfo(ITestResult tr) {
|
||||
IClass clazz = tr.getTestClass();
|
||||
|
||||
String className = clazz.getRealClass().getSimpleName();
|
||||
|
||||
String methodName = tr.getMethod().getMethodName();
|
||||
|
||||
String parameter = "";
|
||||
|
||||
try {
|
||||
for(Object param : tr.getParameters()) {
|
||||
String par = (String)param;
|
||||
parameter = parameter + ",'" + par.replaceAll("/", "_")+"'";
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if(parameter!=null && !"".equals(parameter.trim())){
|
||||
parameter = parameter.substring(1);
|
||||
}
|
||||
|
||||
return className + "." + methodName + "(" + parameter + ")";
|
||||
}
|
||||
|
||||
public void setTestCaseResultInfo(List<TestCase> testcases, String testCaseInfo, Result result) {
|
||||
TestCase testCase = new TestCase();
|
||||
|
||||
String testlinkProject = System.getProperty("testlink.porject");
|
||||
String testlinkId = System.getProperty("testlink.id");
|
||||
int id = Integer.parseInt(testlinkId.substring(testlinkProject.length()+1));
|
||||
testCase.setId(id);
|
||||
|
||||
testCase.setResult(result);
|
||||
testCase.setNote(testCaseInfo + " !");
|
||||
testCase.setComment(testCaseInfo);
|
||||
testcases.add(testCase);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* split parameter to an array
|
||||
* @param parameter
|
||||
* @return an array
|
||||
*/
|
||||
public String[] splitParameter(String parameter){
|
||||
String[] parameters = parameter.split(",");
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public String getString(ResourceBundle locator, String key, String[] params) {
|
||||
String value = locator.getString(key);
|
||||
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
Pattern pattern = Pattern.compile(".*{" + i + "}.*");
|
||||
Matcher matcher = pattern.matcher(value);
|
||||
if (matcher.matches()) {
|
||||
value = value.replace("{" + i + "}", params[i]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getString(ResourceBundle locator,String key, String param) {
|
||||
if ("".equals(param) || param == null) {
|
||||
return locator.getString(key);
|
||||
} else {
|
||||
return this.getString(locator, key, new String[] { param });
|
||||
}
|
||||
}
|
||||
|
||||
public String getAbsoluteFolderPath(String folder) {
|
||||
String path = Base.class.getClassLoader().getResource(folder).getPath();
|
||||
if(System.getProperty("os.name").startsWith("Windows")) {
|
||||
if(path.startsWith("/")){
|
||||
path = path.substring(1);
|
||||
}
|
||||
path = path.replace("/", "\\");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public void seletDropDownList(By by,String option){
|
||||
|
||||
Assert.assertTrue(this.isElementPresent(by, 3000));
|
||||
Assert.assertTrue(this.waitfor(by, 50)!=null);
|
||||
// this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskproperties.tasktype.arrow"));
|
||||
this.waitfor(by, WAIT_TIME_MIN).click();
|
||||
// this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskproperties.tasktype.arrow"));
|
||||
this.isElementPresent(By.xpath("//div[contains(@class,'x-combo-list-item') and contains(text(),'"+option+"')]"),WAIT_TIME_MAX);
|
||||
this.clickElementByXpath("//div[contains(@class,'x-combo-list-item') and contains(text(),'"+option+"')]");
|
||||
|
||||
}
|
||||
|
||||
public String getValueInput(By by){
|
||||
return this.waitfor(by, WAIT_TIME_MIN).getAttribute("value");
|
||||
}
|
||||
|
||||
public Dimension getWindowSize(){
|
||||
return driver.manage().window().getSize();
|
||||
}
|
||||
public int getWindowSizeHeight(){
|
||||
return driver.manage().window().getSize().height;
|
||||
}
|
||||
public int getWindowSizeWidth(){
|
||||
return driver.manage().window().getSize().width;
|
||||
}
|
||||
|
||||
public WebDriver setWebDriver(Browser browser){
|
||||
switch(browser) {
|
||||
case iexplore:
|
||||
driver = this.setIExplore();
|
||||
break;
|
||||
default:
|
||||
driver = this.setFirefox();
|
||||
}
|
||||
return driver;
|
||||
}
|
||||
|
||||
public WebDriver setIExplore(){
|
||||
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
|
||||
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
|
||||
return new InternetExplorerDriver(ieCapabilities);
|
||||
}
|
||||
|
||||
public WebDriver setFirefox() {
|
||||
logger.info("webdriver.firefox.bin.path = " + System.getProperty("webdriver.firefox.bin.path"));
|
||||
if(null == System.getProperty("webdriver.firefox.bin.path") || "".equals(System.getProperty("webdriver.firefox.bin.path").trim()) || System.getProperty("webdriver.firefox.bin.path").trim().contains("webdriver.firefox.bin.path")) {
|
||||
} else{
|
||||
System.setProperty("webdriver.firefox.bin", System.getProperty("webdriver.firefox.bin.path").trim());
|
||||
}
|
||||
|
||||
FirefoxProfile firefoxProfile = new FirefoxProfile();
|
||||
firefoxProfile.setPreference("browser.download.folderList",2);
|
||||
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
|
||||
firefoxProfile.setPreference("browser.download.dir", this.getAbsoluteFolderPath("org/talend/mdm/download"));
|
||||
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv, application/vnd.ms-excel, application/zip, application/pdf");
|
||||
|
||||
firefoxProfile.setPreference("dom.max_script_run_time", 0);
|
||||
firefoxProfile.setPreference("dom.max_chrome_script_run_time", 0);
|
||||
|
||||
// firefoxProfile.setPreference("native_events_enabled", false);
|
||||
firefoxProfile.setPreference("webdriver_enable_native_events", false);
|
||||
|
||||
// firefoxProfile.setEnableNativeEvents(true);
|
||||
logger.info("setEnableNativeEvents-" + firefoxProfile.areNativeEventsEnabled());
|
||||
// firefoxProfile.setEnableNativeEvents(false);
|
||||
// logger.info("setEnableNativeEvents-" + firefoxProfile.areNativeEventsEnabled());
|
||||
|
||||
return new FirefoxDriver(firefoxProfile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.AfterSuite;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
|
||||
|
||||
public class Login extends Base{
|
||||
protected WebDriver driver;
|
||||
|
||||
@BeforeClass
|
||||
@Parameters({"url", "root", "testlink.id", "testlink.porject"})
|
||||
public void initWebdriver(String url, String root, String testlinkId, String testlinkProject , ITestContext context){
|
||||
System.setProperty("testlink.id", testlinkId);
|
||||
System.setProperty("testlink.porject", testlinkProject);
|
||||
|
||||
URL file = Login.class.getClassLoader().getResource("org/talend/mdm/resources");
|
||||
PropertyConfigurator.configure( file.getPath() + "/log4j.properties" );
|
||||
|
||||
if(null == System.getProperty("webdriver.browser") || "".equals(System.getProperty("webdriver.browser").trim()) || System.getProperty("webdriver.browser").trim().contains("webdriver.browser")) {
|
||||
driver = this.setFirefox();
|
||||
} else{
|
||||
|
||||
try {
|
||||
driver = this.setWebDriver(Browser.valueOf(System.getProperty("webdriver.browser").trim()));
|
||||
} catch (Exception e) {
|
||||
logger.info("Doesn't not support the browser of - " + System.getProperty("webdriver.browser").trim() + ", will use firefox!");
|
||||
driver = this.setFirefox();
|
||||
}
|
||||
}
|
||||
|
||||
// Old code for firefox
|
||||
/**
|
||||
logger.info("webdriver.firefox.bin.path = " + System.getProperty("webdriver.firefox.bin.path").trim());
|
||||
if(null == System.getProperty("webdriver.firefox.bin.path") || "".equals(System.getProperty("webdriver.firefox.bin.path").trim()) || System.getProperty("webdriver.firefox.bin.path").trim().contains("webdriver.firefox.bin.path")) {
|
||||
} else{
|
||||
System.setProperty("webdriver.firefox.bin", System.getProperty("webdriver.firefox.bin.path").trim());
|
||||
}
|
||||
|
||||
FirefoxProfile firefoxProfile = new FirefoxProfile();
|
||||
firefoxProfile.setPreference("browser.download.folderList",2);
|
||||
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
|
||||
firefoxProfile.setPreference("browser.download.dir", this.getAbsoluteFolderPath("org/talend/mdm/download"));
|
||||
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv, application/vnd.ms-excel, application/zip, application/pdf");
|
||||
|
||||
firefoxProfile.setPreference("dom.max_script_run_time", 0);
|
||||
firefoxProfile.setPreference("dom.max_chrome_script_run_time", 0);
|
||||
|
||||
// firefoxProfile.setPreference("native_events_enabled", false);
|
||||
firefoxProfile.setPreference("webdriver_enable_native_events", false);
|
||||
|
||||
|
||||
// firefoxProfile.setEnableNativeEvents(true);
|
||||
//
|
||||
logger.info("setEnableNativeEvents-" + firefoxProfile.areNativeEventsEnabled());
|
||||
// firefoxProfile.setEnableNativeEvents(false);
|
||||
//
|
||||
// logger.info("setEnableNativeEvents-" + firefoxProfile.areNativeEventsEnabled());
|
||||
|
||||
driver = new FirefoxDriver(firefoxProfile);
|
||||
**/
|
||||
|
||||
//set driver time out with TimeUnit
|
||||
driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
|
||||
logger.info("Set Firefox Driver with Profile");
|
||||
|
||||
// driver = new FirefoxDriver();
|
||||
logger.info("URL - " +url + root);
|
||||
|
||||
|
||||
driver.get(url + root);
|
||||
super.setDriver(driver);
|
||||
windowMaximize();
|
||||
|
||||
onTestListener(context, Login.class.getClassLoader().getResource("org/talend/mdm/download").getPath());
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
@Parameters( { "user.name", "user.password", "message" })
|
||||
public void login(String userName, String userPassword, String message) {
|
||||
this.login(userName, userPassword);
|
||||
|
||||
// if (this.isTextPresent(message)) {
|
||||
// this.getElementById("idLoginForceLogoutButton").click();
|
||||
// this.getElementById("idLoginButton").click();
|
||||
// logger.info("Force login TAC");
|
||||
// }
|
||||
|
||||
if(this.isTextPresent(message)) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.login(userName, userPassword);
|
||||
} else {
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
}
|
||||
|
||||
public void login(String userName, String userPassword) {
|
||||
|
||||
WebElement userE = this.getElementByName(locator.getString("id.login.username"));
|
||||
userE.clear();
|
||||
userE.sendKeys(userName);
|
||||
WebElement passwordE = this.getElementByName(locator.getString("id.login.password"));
|
||||
passwordE.clear();
|
||||
passwordE.sendKeys(userPassword);
|
||||
this.getElementByName("login").click();
|
||||
logger.info("Login MDM");
|
||||
}
|
||||
|
||||
|
||||
@AfterMethod
|
||||
public void logout() {
|
||||
|
||||
logger.info("Click MDM logout button");
|
||||
this.getElementByXpath("//button[text()='Logout']").click();
|
||||
logger.info("Logout MDM");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void killBroswer() {
|
||||
driver.quit();
|
||||
logger.info("WebDriver Quit");
|
||||
}
|
||||
|
||||
@AfterSuite
|
||||
public void generateXmlReport(){
|
||||
Results result = new Results();
|
||||
|
||||
result.crateXmlFile(result.getResults(failedTestCases), this.getAbsoluteFolderPath("org/talend/mdm/download")+ "/Failed.xml");
|
||||
result.crateXmlFile(result.getResults(successTestCases), this.getAbsoluteFolderPath("org/talend/mdm/download")+ "/Succes.xml");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
|
||||
public class Results {
|
||||
|
||||
public Document getResults(List<TestCase> tcs){
|
||||
Document document = DocumentHelper.createDocument();
|
||||
Element results = document.addElement("results");
|
||||
|
||||
for(TestCase tc : tcs) {
|
||||
results.addComment(tc.getComment());
|
||||
Element testcase = results.addElement("testcase");
|
||||
testcase.addAttribute("id", tc.getId()+"");
|
||||
|
||||
Element result = testcase.addElement("result");
|
||||
result.setText(tc.getResult().toString());
|
||||
Element notes = testcase.addElement("notes");
|
||||
notes.setText(tc.getNote());
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
public void crateXmlFile(Document document, String fileName) {
|
||||
XMLWriter output;
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
try {
|
||||
output = new XMLWriter(new FileWriter(fileName), format);
|
||||
output.write(document);
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
public class TestCase {
|
||||
private int id;
|
||||
private Result result;
|
||||
private String note;
|
||||
private String comment;
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public enum Result {
|
||||
p,f,b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
import static org.monte.media.AudioFormatKeys.SampleRateKey;
|
||||
import static org.monte.media.AudioFormatKeys.SampleSizeInBitsKey;
|
||||
import static org.monte.media.FormatKeys.EncodingKey;
|
||||
import static org.monte.media.FormatKeys.FrameRateKey;
|
||||
import static org.monte.media.FormatKeys.KeyFrameIntervalKey;
|
||||
import static org.monte.media.FormatKeys.MediaTypeKey;
|
||||
import static org.monte.media.FormatKeys.MimeTypeKey;
|
||||
import static org.monte.media.VideoFormatKeys.CompressorNameKey;
|
||||
import static org.monte.media.VideoFormatKeys.DepthKey;
|
||||
import static org.monte.media.VideoFormatKeys.QualityKey;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.monte.media.Format;
|
||||
import org.monte.media.FormatKeys.MediaType;
|
||||
import org.monte.media.math.Rational;
|
||||
|
||||
public class TestCaseRecorder {
|
||||
|
||||
private TestCaseScreenRecorder screenRecorder;
|
||||
|
||||
public TestCaseScreenRecorder getScreenRecorder(String name) throws IOException, AWTException{
|
||||
GraphicsConfiguration gc = GraphicsEnvironment//
|
||||
.getLocalGraphicsEnvironment()//
|
||||
.getDefaultScreenDevice()//
|
||||
.getDefaultConfiguration();
|
||||
|
||||
TestCaseScreenRecorder screenRecorder = new TestCaseScreenRecorder(gc,
|
||||
// the file format:
|
||||
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, "video/avi"),
|
||||
//
|
||||
// the output format for screen capture:
|
||||
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "tscc",
|
||||
CompressorNameKey, "tscc",
|
||||
DepthKey, 8, FrameRateKey, Rational.valueOf(15.0),
|
||||
QualityKey, 1.0f,
|
||||
KeyFrameIntervalKey, (int) (15.0 * 60) // one keyframe per minute is enough
|
||||
),
|
||||
//
|
||||
// the output format for mouse capture:
|
||||
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black",
|
||||
FrameRateKey, Rational.valueOf(30.0)),
|
||||
//
|
||||
// the output format for audio capture:
|
||||
new Format(MediaTypeKey, MediaType.AUDIO,
|
||||
//EncodingKey, audioFormatName,
|
||||
SampleRateKey, Rational.valueOf(8000),
|
||||
SampleSizeInBitsKey, 16), name);
|
||||
|
||||
return screenRecorder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,890 @@
|
||||
package org.talend.mdm;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
import static org.monte.media.AudioFormatKeys.ByteOrderKey;
|
||||
import static org.monte.media.AudioFormatKeys.ChannelsKey;
|
||||
import static org.monte.media.AudioFormatKeys.ENCODING_QUICKTIME_TWOS_PCM;
|
||||
import static org.monte.media.AudioFormatKeys.SampleRateKey;
|
||||
import static org.monte.media.AudioFormatKeys.SampleSizeInBitsKey;
|
||||
import static org.monte.media.AudioFormatKeys.SignedKey;
|
||||
import static org.monte.media.AudioFormatKeys.fromAudioFormat;
|
||||
import static org.monte.media.BufferFlag.SAME_DATA;
|
||||
import static org.monte.media.FormatKeys.EncodingKey;
|
||||
import static org.monte.media.FormatKeys.FrameRateKey;
|
||||
import static org.monte.media.FormatKeys.MIME_AVI;
|
||||
import static org.monte.media.FormatKeys.MIME_QUICKTIME;
|
||||
import static org.monte.media.FormatKeys.MediaTypeKey;
|
||||
import static org.monte.media.FormatKeys.MimeTypeKey;
|
||||
import static org.monte.media.VideoFormatKeys.COMPRESSOR_NAME_QUICKTIME_ANIMATION;
|
||||
import static org.monte.media.VideoFormatKeys.CompressorNameKey;
|
||||
import static org.monte.media.VideoFormatKeys.DepthKey;
|
||||
import static org.monte.media.VideoFormatKeys.ENCODING_BUFFERED_IMAGE;
|
||||
import static org.monte.media.VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION;
|
||||
import static org.monte.media.VideoFormatKeys.HeightKey;
|
||||
import static org.monte.media.VideoFormatKeys.WidthKey;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.PointerInfo;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Robot;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteOrder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.DataLine;
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.TargetDataLine;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.monte.media.AudioFormatKeys;
|
||||
import org.monte.media.Buffer;
|
||||
import org.monte.media.Codec;
|
||||
import org.monte.media.Format;
|
||||
import org.monte.media.MovieWriter;
|
||||
import org.monte.media.Registry;
|
||||
import org.monte.media.FormatKeys.MediaType;
|
||||
import org.monte.media.avi.AVIWriter;
|
||||
import org.monte.media.beans.AbstractStateModel;
|
||||
import org.monte.media.color.Colors;
|
||||
import org.monte.media.image.Images;
|
||||
import org.monte.media.math.Rational;
|
||||
import org.monte.media.quicktime.QuickTimeWriter;
|
||||
|
||||
public class TestCaseScreenRecorder extends AbstractStateModel {
|
||||
|
||||
public enum State {
|
||||
DONE, FAILED, RECORDING
|
||||
}
|
||||
private State state=State.DONE;
|
||||
|
||||
/**
|
||||
* "Encoding" for black mouse cursor. */
|
||||
public final static String ENCODING_BLACK_CURSOR = "black";
|
||||
/**
|
||||
* "Encoding" for white mouse cursor. */
|
||||
public final static String ENCODING_WHITE_CURSOR = "white";
|
||||
/**
|
||||
* The file format. "AVI" or "QuickTime" */
|
||||
private Format fileFormat;
|
||||
/**
|
||||
* The video format for cursor capture. "black" or "white". */
|
||||
private Format mouseFormat;
|
||||
/**
|
||||
* The video format for screen capture. */
|
||||
private Format screenFormat;
|
||||
/**
|
||||
* The audio format for audio capture. */
|
||||
private Format audioFormat;
|
||||
/**
|
||||
* The writer for the movie file. */
|
||||
private MovieWriter w;
|
||||
/**
|
||||
* The start time of the recording. */
|
||||
private long startTime;
|
||||
/**
|
||||
* The stoop time of the recording. */
|
||||
private long stopTime;
|
||||
/**
|
||||
* The time the previous screen frame was captured. */
|
||||
private long prevScreenCaptureTime;
|
||||
/**
|
||||
* The AWT Robot which we use for capturing the screen. */
|
||||
private Robot robot;
|
||||
/**
|
||||
* The bounds of the graphics device that we capture with AWT Robot. */
|
||||
private Rectangle rect;
|
||||
/**
|
||||
* Holds the screen capture made with AWT Robot. */
|
||||
private BufferedImage screenCapture;
|
||||
/**
|
||||
* Holds the mouse captures made with {@code MouseInfo}. */
|
||||
private ArrayBlockingQueue<MouseCapture> mouseCaptures;
|
||||
/** Holds the composed image (screen capture and super-imposed mouse cursor).
|
||||
* This is the image that is written into the video track of the file.
|
||||
*/
|
||||
private BufferedImage videoImg;
|
||||
/**
|
||||
* Graphics object for drawing into {@code videoImg}. */
|
||||
private Graphics2D videoGraphics;
|
||||
/**
|
||||
* Timer for screen captures. */
|
||||
private ScheduledThreadPoolExecutor screenTimer;
|
||||
/**
|
||||
* Timer for mouse captures. */
|
||||
private ScheduledThreadPoolExecutor mouseTimer;
|
||||
/**
|
||||
* Mouse cursor. */
|
||||
private BufferedImage cursorImg;
|
||||
/**
|
||||
* Hot spot of the mouse cursor in cursorImg. */
|
||||
private Point cursorOffset = new Point(-8, -5);
|
||||
/**
|
||||
* Object for thread synchronization. */
|
||||
private final Object sync = new Object();
|
||||
/**
|
||||
* This variable holds the Runnable for audio capture. */
|
||||
private volatile Thread audioRunner;
|
||||
/**
|
||||
* With QuickTime, we can use a variable frame rate. We don't want to
|
||||
* have frames with a sampleDuration longer than 1000 milliseconds though.
|
||||
*/
|
||||
private long maxFrameDuration = 1000;
|
||||
private volatile Thread writerThread;
|
||||
private ArrayBlockingQueue<Buffer> writerQueue;
|
||||
/** This codec encodes a video frame. */
|
||||
private Codec frameEncoder;
|
||||
/** outputTime and ffrDuration are needed for conversion of the
|
||||
* video stream from variable frame rate to fixed frame rate. */
|
||||
private Rational outputTime;
|
||||
private Rational ffrDuration;
|
||||
|
||||
/** Creates a screen recorder.
|
||||
*
|
||||
* @param cfg Graphics configuration of the capture screen.
|
||||
*/
|
||||
public TestCaseScreenRecorder(GraphicsConfiguration cfg) throws IOException, AWTException {
|
||||
this(cfg,
|
||||
// the file format
|
||||
new Format(MediaTypeKey, MediaType.FILE,
|
||||
MimeTypeKey, MIME_QUICKTIME),
|
||||
//
|
||||
// the output format for screen capture
|
||||
new Format(MediaTypeKey, MediaType.VIDEO,
|
||||
EncodingKey, ENCODING_QUICKTIME_ANIMATION,
|
||||
CompressorNameKey, COMPRESSOR_NAME_QUICKTIME_ANIMATION,
|
||||
DepthKey, 24, FrameRateKey, new Rational(15, 1)),
|
||||
//
|
||||
// the output format for mouse capture
|
||||
new Format(MediaTypeKey, MediaType.VIDEO,
|
||||
EncodingKey, ENCODING_BLACK_CURSOR,
|
||||
FrameRateKey, new Rational(30, 1)),
|
||||
//
|
||||
// the output format for audio capture
|
||||
new Format(MediaTypeKey, MediaType.AUDIO,
|
||||
EncodingKey, ENCODING_QUICKTIME_TWOS_PCM,
|
||||
FrameRateKey, new Rational(48000, 1),
|
||||
SampleSizeInBitsKey, 16,
|
||||
ChannelsKey, 2, SampleRateKey, new Rational(48000, 1),
|
||||
SignedKey, true, ByteOrderKey, ByteOrder.BIG_ENDIAN));
|
||||
}
|
||||
|
||||
/** Creates a screen recorder.
|
||||
*
|
||||
* @param cfg Graphics configuration of the capture screen.
|
||||
* @param fileFormat The file format "AVI" or "QuickTime".
|
||||
* @param screenFormat The video format for screen capture.
|
||||
* @param mouseFormat The video format for mouse capture. The {@code EncodingKey}
|
||||
* must be ENCODING_BLACK_CURSOR or ENCODING_WHITE_CURSOR. The {@code SampleRateKey} can be
|
||||
* independent from the {@code screenFormat}. Specify null if you
|
||||
* don't want to capture the mouse cursor.
|
||||
* @param audioFormat The audio format for audio capture. Specify null
|
||||
* if you don't want audio capture.
|
||||
*/
|
||||
public TestCaseScreenRecorder(GraphicsConfiguration cfg,
|
||||
Format fileFormat,
|
||||
Format screenFormat,
|
||||
Format mouseFormat,
|
||||
Format audioFormat) throws IOException, AWTException {
|
||||
|
||||
this.fileFormat = fileFormat;
|
||||
this.screenFormat = screenFormat;
|
||||
this.mouseFormat = mouseFormat;
|
||||
if (this.mouseFormat == null) {
|
||||
this.mouseFormat = new Format(FrameRateKey, new Rational(0, 0), EncodingKey, ENCODING_BLACK_CURSOR);
|
||||
}
|
||||
this.audioFormat = audioFormat;
|
||||
|
||||
rect = cfg.getBounds();
|
||||
robot = new Robot(cfg.getDevice());
|
||||
if (screenFormat.get(DepthKey) == 24) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_RGB);
|
||||
} else if (screenFormat.get(DepthKey) == 16) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_USHORT_555_RGB);
|
||||
} else if (screenFormat.get(DepthKey) == 8) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_INDEXED, Colors.createMacColors());
|
||||
} else {
|
||||
throw new IOException("Unsupported color depth " + screenFormat.get(DepthKey));
|
||||
}
|
||||
videoGraphics = videoImg.createGraphics();
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
|
||||
if (mouseFormat != null && mouseFormat.get(FrameRateKey).intValue() > 0) {
|
||||
mouseCaptures = new ArrayBlockingQueue<MouseCapture>(mouseFormat.get(FrameRateKey).intValue());
|
||||
if (this.mouseFormat.get(EncodingKey).equals(ENCODING_BLACK_CURSOR)) {
|
||||
cursorImg = Images.toBufferedImage(Images.createImage(TestCaseScreenRecorder.class, "/org/monte/media/images/Cursor.black.png"));
|
||||
} else {
|
||||
cursorImg = Images.toBufferedImage(Images.createImage(TestCaseScreenRecorder.class, "/org/monte/media/images/Cursor.white.png"));
|
||||
}
|
||||
}
|
||||
createMovieWriter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
protected void createMovieWriter() throws IOException {
|
||||
File folder;
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
|
||||
folder = new File(System.getProperty("user.home") + File.separator + "Videos");
|
||||
} else {
|
||||
folder = new File(System.getProperty("user.home") + File.separator + "Movies");
|
||||
}
|
||||
|
||||
if (!folder.exists()) {
|
||||
folder.mkdirs();
|
||||
} else if (!folder.isDirectory()) {
|
||||
throw new IOException("\"" + folder + "\" is not a directory.");
|
||||
}
|
||||
|
||||
Rational videoRate = Rational.max(screenFormat.get(FrameRateKey), mouseFormat.get(FrameRateKey));
|
||||
ffrDuration = videoRate.inverse();
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd 'at' HH.mm.ss");
|
||||
Format inputFormat = new Format(MediaTypeKey, MediaType.VIDEO,
|
||||
EncodingKey, ENCODING_BUFFERED_IMAGE,
|
||||
WidthKey, rect.width,
|
||||
HeightKey, rect.height,
|
||||
FrameRateKey, videoRate).append(screenFormat);
|
||||
Format outputFormat = new Format(
|
||||
WidthKey, rect.width,
|
||||
HeightKey, rect.height,
|
||||
FrameRateKey, videoRate,
|
||||
MimeTypeKey, fileFormat.get(MimeTypeKey)).append(screenFormat);
|
||||
|
||||
// FIXME - There should be no need for format-specific code.
|
||||
File f;
|
||||
if (fileFormat.get(MimeTypeKey).equals(MIME_AVI)) {
|
||||
AVIWriter aviw;
|
||||
w = aviw = new AVIWriter(f = new File(folder,//
|
||||
"ScreenRecording " + dateFormat.format(new Date()) + ".avi"));
|
||||
w.addTrack(outputFormat);
|
||||
if (screenFormat.get(DepthKey) == 8) {
|
||||
aviw.setPalette(0, (IndexColorModel) videoImg.getColorModel());
|
||||
}
|
||||
if (audioFormat != null) {
|
||||
aviw.addTrack(audioFormat);
|
||||
}
|
||||
} else if (fileFormat.get(MimeTypeKey).equals(MIME_QUICKTIME)) {
|
||||
QuickTimeWriter qtw;
|
||||
w = qtw = new QuickTimeWriter(f = new File(folder,//
|
||||
"ScreenRecording " + dateFormat.format(new Date()) + ".mov"));
|
||||
w.addTrack(outputFormat);
|
||||
if (screenFormat.get(DepthKey) == 8) {
|
||||
qtw.setVideoColorTable(0, (IndexColorModel) videoImg.getColorModel());
|
||||
}
|
||||
if (audioFormat != null) {
|
||||
qtw.addTrack(audioFormat);
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Unsupported format " + fileFormat);
|
||||
}
|
||||
System.out.println("Writing movie to file: " + f);
|
||||
|
||||
// Create the video encoder
|
||||
Codec encoder = Registry.getInstance().getEncoder(w.getFormat(0));
|
||||
if (encoder == null) {
|
||||
throw new IOException("No encoder for format " + w.getFormat(0));
|
||||
}
|
||||
frameEncoder = encoder;
|
||||
frameEncoder.setInputFormat(inputFormat);
|
||||
frameEncoder.setOutputFormat(outputFormat);
|
||||
if (frameEncoder.getOutputFormat()==null) {
|
||||
throw new IOException("Unable to encode video frames in this format.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public TestCaseScreenRecorder(GraphicsConfiguration cfg,
|
||||
Format fileFormat,
|
||||
Format screenFormat,
|
||||
Format mouseFormat,
|
||||
Format audioFormat, String file) throws IOException, AWTException {
|
||||
|
||||
this.fileFormat = fileFormat;
|
||||
this.screenFormat = screenFormat;
|
||||
this.mouseFormat = mouseFormat;
|
||||
if (this.mouseFormat == null) {
|
||||
this.mouseFormat = new Format(FrameRateKey, new Rational(0, 0), EncodingKey, ENCODING_BLACK_CURSOR);
|
||||
}
|
||||
this.audioFormat = audioFormat;
|
||||
|
||||
rect = cfg.getBounds();
|
||||
robot = new Robot(cfg.getDevice());
|
||||
if (screenFormat.get(DepthKey) == 24) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_RGB);
|
||||
} else if (screenFormat.get(DepthKey) == 16) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_USHORT_555_RGB);
|
||||
} else if (screenFormat.get(DepthKey) == 8) {
|
||||
videoImg = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_INDEXED, Colors.createMacColors());
|
||||
} else {
|
||||
throw new IOException("Unsupported color depth " + screenFormat.get(DepthKey));
|
||||
}
|
||||
videoGraphics = videoImg.createGraphics();
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
|
||||
videoGraphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
|
||||
if (mouseFormat != null && mouseFormat.get(FrameRateKey).intValue() > 0) {
|
||||
mouseCaptures = new ArrayBlockingQueue<MouseCapture>(mouseFormat.get(FrameRateKey).intValue());
|
||||
if (this.mouseFormat.get(EncodingKey).equals(ENCODING_BLACK_CURSOR)) {
|
||||
cursorImg = Images.toBufferedImage(Images.createImage(TestCaseScreenRecorder.class, "/org/monte/media/images/Cursor.black.png"));
|
||||
} else {
|
||||
cursorImg = Images.toBufferedImage(Images.createImage(TestCaseScreenRecorder.class, "/org/monte/media/images/Cursor.white.png"));
|
||||
}
|
||||
}
|
||||
createMovieWriter(file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
protected void createMovieWriter(String file) throws IOException {
|
||||
Rational videoRate = Rational.max(screenFormat.get(FrameRateKey), mouseFormat.get(FrameRateKey));
|
||||
ffrDuration = videoRate.inverse();
|
||||
|
||||
Format inputFormat = new Format(MediaTypeKey, MediaType.VIDEO,
|
||||
EncodingKey, ENCODING_BUFFERED_IMAGE,
|
||||
WidthKey, rect.width,
|
||||
HeightKey, rect.height,
|
||||
FrameRateKey, videoRate).append(screenFormat);
|
||||
Format outputFormat = new Format(
|
||||
WidthKey, rect.width,
|
||||
HeightKey, rect.height,
|
||||
FrameRateKey, videoRate,
|
||||
MimeTypeKey, fileFormat.get(MimeTypeKey)).append(screenFormat);
|
||||
|
||||
// FIXME - There should be no need for format-specific code.
|
||||
File f;
|
||||
if (fileFormat.get(MimeTypeKey).equals(MIME_AVI)) {
|
||||
AVIWriter aviw;
|
||||
w = aviw = new AVIWriter(f = new File(file + ".avi"));
|
||||
w.addTrack(outputFormat);
|
||||
if (screenFormat.get(DepthKey) == 8) {
|
||||
aviw.setPalette(0, (IndexColorModel) videoImg.getColorModel());
|
||||
}
|
||||
if (audioFormat != null) {
|
||||
aviw.addTrack(audioFormat);
|
||||
}
|
||||
} else if (fileFormat.get(MimeTypeKey).equals(MIME_QUICKTIME)) {
|
||||
QuickTimeWriter qtw;
|
||||
w = qtw = new QuickTimeWriter(f = new File(file + ".mov"));
|
||||
w.addTrack(outputFormat);
|
||||
if (screenFormat.get(DepthKey) == 8) {
|
||||
qtw.setVideoColorTable(0, (IndexColorModel) videoImg.getColorModel());
|
||||
}
|
||||
if (audioFormat != null) {
|
||||
qtw.addTrack(audioFormat);
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Unsupported format " + fileFormat);
|
||||
}
|
||||
System.out.println("Writing movie to file: " + f);
|
||||
|
||||
// Create the video encoder
|
||||
Codec encoder = Registry.getInstance().getEncoder(w.getFormat(0));
|
||||
if (encoder == null) {
|
||||
throw new IOException("No encoder for format " + w.getFormat(0));
|
||||
}
|
||||
frameEncoder = encoder;
|
||||
frameEncoder.setInputFormat(inputFormat);
|
||||
frameEncoder.setOutputFormat(outputFormat);
|
||||
if (frameEncoder.getOutputFormat()==null) {
|
||||
throw new IOException("Unable to encode video frames in this format.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Returns the state of the recorder. */
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/** Starts the screen recorder. */
|
||||
public void start() {
|
||||
startTime = prevScreenCaptureTime = System.currentTimeMillis();
|
||||
stopTime = Long.MAX_VALUE;
|
||||
|
||||
outputTime = new Rational(0, 0);
|
||||
startWriter();
|
||||
startScreenCapture();
|
||||
if (mouseFormat != null && mouseFormat.get(FrameRateKey).intValue() > 0) {
|
||||
startMouseCapture();
|
||||
}
|
||||
if (audioFormat != null) {
|
||||
startAudioCapture();
|
||||
}
|
||||
state= State.RECORDING;
|
||||
fireStateChanged();
|
||||
}
|
||||
|
||||
/** Starts screen capture. */
|
||||
private void startScreenCapture() {
|
||||
screenTimer = new ScheduledThreadPoolExecutor(1);
|
||||
int delay = max(1, (int) (1000 / screenFormat.get(FrameRateKey).doubleValue()));
|
||||
screenTimer.scheduleAtFixedRate(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
grabScreen();
|
||||
} catch (Throwable ex) {
|
||||
ex.printStackTrace();
|
||||
screenTimer.shutdown();
|
||||
recordingFailed();
|
||||
}
|
||||
}
|
||||
}, delay, delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/** Starts mouse capture. */
|
||||
private void startMouseCapture() {
|
||||
mouseTimer = new ScheduledThreadPoolExecutor(1);
|
||||
int delay = max(1, (int) (1000 / mouseFormat.get(FrameRateKey).doubleValue()));
|
||||
mouseTimer.scheduleAtFixedRate(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
grabMouse();
|
||||
} catch (Throwable ex) {
|
||||
ex.printStackTrace();
|
||||
mouseTimer.shutdown();
|
||||
recordingFailed();
|
||||
}
|
||||
}
|
||||
}, delay, delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/** Starts audio capture. */
|
||||
private void startAudioCapture() {
|
||||
DataLine.Info info = new DataLine.Info(
|
||||
TargetDataLine.class, AudioFormatKeys.toAudioFormat(audioFormat));
|
||||
|
||||
final TargetDataLine line;
|
||||
try {
|
||||
line = (TargetDataLine) AudioSystem.getLine(info);
|
||||
line.open();
|
||||
line.start();
|
||||
audioRunner = new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Buffer buf = new Buffer();
|
||||
AudioFormat lineFormat = line.getFormat();
|
||||
buf.format = fromAudioFormat(lineFormat);
|
||||
|
||||
// For even sample rates, we select a buffer size that can
|
||||
// hold half a second of audio. This allows audio/video interlave
|
||||
// twice a second, as recommended for AVI and QuickTime movies.
|
||||
// For odd sample rates, we have to select a buffer size that can hold
|
||||
// one second of audio.
|
||||
int bufferSize = lineFormat.getFrameSize() * (int) lineFormat.getSampleRate();
|
||||
if (((int) lineFormat.getSampleRate() & 1) == 0) {
|
||||
bufferSize /= 2;
|
||||
}
|
||||
|
||||
byte bdat[] = new byte[bufferSize];
|
||||
buf.data = bdat;
|
||||
Rational sampleRate = Rational.valueOf(lineFormat.getSampleRate());
|
||||
Rational frameRate = Rational.valueOf(lineFormat.getFrameRate());
|
||||
long totalSampleCount = 0;
|
||||
try {
|
||||
while (audioRunner == this) {
|
||||
int count = line.read(bdat, 0, bdat.length);
|
||||
if (count > 0) {
|
||||
buf.sampleCount = count * 8 / (lineFormat.getSampleSizeInBits() * lineFormat.getChannels());
|
||||
buf.sampleDuration = sampleRate.inverse();
|
||||
buf.offset = 0;
|
||||
buf.length = count;
|
||||
buf.track = 1;
|
||||
buf.timeStamp = new Rational(totalSampleCount, 1).divide(frameRate);
|
||||
totalSampleCount += buf.sampleCount;
|
||||
|
||||
write(buf);
|
||||
|
||||
synchronized (sync) {
|
||||
if (buf.timeStamp.add(buf.sampleDuration.multiply(buf.sampleCount)).compareTo(new Rational(stopTime, 1000)) > 0) {
|
||||
// FIXME - Truncate the buffer
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
line.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
audioRunner.start();
|
||||
} catch (LineUnavailableException ex) {
|
||||
// FIXME - Instead of silently suppressing audio recording, we should
|
||||
// print an error message to the user
|
||||
ex.printStackTrace();
|
||||
recordingFailed();
|
||||
}
|
||||
}
|
||||
|
||||
/** Starts file writing. */
|
||||
private void startWriter() {
|
||||
writerQueue = new ArrayBlockingQueue<Buffer>(screenFormat.get(FrameRateKey).intValue() + 1);
|
||||
writerThread = new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while (writerThread == this) {
|
||||
try {
|
||||
Buffer buf = writerQueue.take();
|
||||
doWrite(buf);
|
||||
} catch (InterruptedException ex) {
|
||||
// We have been interrupted, terminate
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
recordingFailed();
|
||||
}
|
||||
}
|
||||
};
|
||||
writerThread.start();
|
||||
}
|
||||
|
||||
private void recordingFailed() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
state= State.FAILED;
|
||||
stop();
|
||||
} catch (IOException ex2) {
|
||||
ex2.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Stops the screen recorder. */
|
||||
public void stop() throws IOException {
|
||||
System.out.println("Stopping ScreenRecorder...");
|
||||
|
||||
synchronized (sync) {
|
||||
stopTime = System.currentTimeMillis();
|
||||
}
|
||||
if (mouseTimer != null) {
|
||||
mouseTimer.shutdown();
|
||||
}
|
||||
if (screenTimer != null) {
|
||||
screenTimer.shutdown();
|
||||
}
|
||||
Thread pendingAudioCaptureThread = audioRunner;
|
||||
audioRunner = null;
|
||||
|
||||
try {
|
||||
if (mouseTimer != null) {
|
||||
mouseTimer.awaitTermination((int) (1000 / mouseFormat.get(FrameRateKey).doubleValue()), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
if (screenTimer != null) {
|
||||
screenTimer.awaitTermination((int) (1000 / screenFormat.get(FrameRateKey).doubleValue()), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
if (pendingAudioCaptureThread != null) {
|
||||
pendingAudioCaptureThread.join();
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
Thread pendingWriterThread = writerThread;
|
||||
writerThread = null;
|
||||
|
||||
try {
|
||||
if (pendingWriterThread != null) {
|
||||
pendingWriterThread.interrupt();
|
||||
pendingWriterThread.join();
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
// nothing to do
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("...ScreenRecorder stopped");
|
||||
System.out.println("Closing File...");
|
||||
for (int i = 0, n = w.getTrackCount(); i < n; i++) {
|
||||
System.out.println(" Track " + i + " duration=" + w.getDuration(i));
|
||||
}
|
||||
|
||||
synchronized (sync) {
|
||||
w.close();
|
||||
w = null;
|
||||
}
|
||||
videoGraphics.dispose();
|
||||
videoImg.flush();
|
||||
System.out.println("...File closed");
|
||||
if (state == State.RECORDING) {
|
||||
state=State.DONE;
|
||||
}
|
||||
fireStateChanged();
|
||||
}
|
||||
|
||||
private long previousGrab = 0;
|
||||
|
||||
/** Grabs a screen, generates video images with pending mouse captures
|
||||
* and writes them into the movie file.
|
||||
*/
|
||||
private void grabScreen() throws IOException {
|
||||
|
||||
// Capture the screen
|
||||
BufferedImage previousScreenCapture = screenCapture;
|
||||
long timeBeforeCapture = System.currentTimeMillis();
|
||||
previousGrab = timeBeforeCapture;
|
||||
screenCapture = robot.createScreenCapture(new Rectangle(0, 0, rect.width, rect.height));
|
||||
long timeAfterCapture = System.currentTimeMillis();
|
||||
if (previousScreenCapture == null) {
|
||||
previousScreenCapture = screenCapture;
|
||||
}
|
||||
videoGraphics.drawImage(previousScreenCapture, 0, 0, null);
|
||||
|
||||
Buffer buf = new Buffer();
|
||||
buf.format = new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_BUFFERED_IMAGE);
|
||||
// Generate video frames with mouse cursor painted on them
|
||||
boolean hasMouseCapture = false;
|
||||
if (mouseFormat != null && mouseFormat.get(FrameRateKey).intValue() > 0) {
|
||||
Point previous = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
while (!mouseCaptures.isEmpty() && mouseCaptures.peek().time < timeAfterCapture) {
|
||||
MouseCapture mouseCapture = mouseCaptures.poll();
|
||||
if (mouseCapture.time > prevScreenCaptureTime) {
|
||||
if (mouseCapture.time > timeBeforeCapture) {
|
||||
previousScreenCapture = screenCapture;
|
||||
videoGraphics.drawImage(previousScreenCapture, 0, 0, null);
|
||||
}
|
||||
|
||||
hasMouseCapture = true;
|
||||
Point p = mouseCapture.p;
|
||||
p.x -= rect.x;
|
||||
p.y -= rect.y;
|
||||
synchronized (sync) {
|
||||
if (mouseCapture.time > stopTime) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (p.x != previous.x || p.y != previous.y || mouseCapture.time - prevScreenCaptureTime > maxFrameDuration) {
|
||||
previous.x = p.x;
|
||||
previous.y = p.y;
|
||||
|
||||
// draw cursor
|
||||
videoGraphics.drawImage(cursorImg, p.x + cursorOffset.x, p.y + cursorOffset.y, null);
|
||||
try {
|
||||
buf.clearFlags();
|
||||
buf.data = videoImg;
|
||||
buf.sampleDuration = new Rational(mouseCapture.time - prevScreenCaptureTime, 1000);
|
||||
buf.timeStamp = new Rational(prevScreenCaptureTime - startTime, 1000);
|
||||
buf.track = 0;
|
||||
write(buf);
|
||||
} catch (Throwable t) {
|
||||
System.out.flush();
|
||||
t.printStackTrace();
|
||||
System.err.flush();
|
||||
System.exit(10);
|
||||
}
|
||||
prevScreenCaptureTime = mouseCapture.time;
|
||||
// erase cursor
|
||||
videoGraphics.drawImage(previousScreenCapture, //
|
||||
p.x + cursorOffset.x, p.y + cursorOffset.y,//
|
||||
p.x + cursorOffset.x + cursorImg.getWidth() - 1, p.y + cursorOffset.y + cursorImg.getHeight() - 1,//
|
||||
p.x + cursorOffset.x, p.y + cursorOffset.y,//
|
||||
p.x + cursorOffset.x + cursorImg.getWidth() - 1, p.y + cursorOffset.y + cursorImg.getHeight() - 1,//
|
||||
null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasMouseCapture) {
|
||||
Point p = null;
|
||||
if (mouseFormat != null) {
|
||||
PointerInfo info = MouseInfo.getPointerInfo();
|
||||
p = info.getLocation();
|
||||
videoGraphics.drawImage(cursorImg, p.x + cursorOffset.x, p.x + cursorOffset.y, null);
|
||||
}
|
||||
buf.data = videoImg;
|
||||
buf.sampleDuration = new Rational(timeAfterCapture - prevScreenCaptureTime, 1000);
|
||||
buf.timeStamp = new Rational(prevScreenCaptureTime - startTime, 1000);
|
||||
buf.track = 0;
|
||||
write(buf);
|
||||
prevScreenCaptureTime = timeAfterCapture;
|
||||
if (p != null) {
|
||||
// erase cursor
|
||||
videoGraphics.drawImage(previousScreenCapture, //
|
||||
p.x + cursorOffset.x, p.y + cursorOffset.y,//
|
||||
p.x + cursorOffset.x + cursorImg.getWidth() - 1, p.y + cursorOffset.y + cursorImg.getHeight() - 1,//
|
||||
p.x + cursorOffset.x, p.y + cursorOffset.y,//
|
||||
p.x + cursorOffset.x + cursorImg.getWidth() - 1, p.y + cursorOffset.y + cursorImg.getHeight() - 1,//
|
||||
null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buf.data = videoImg;
|
||||
buf.sampleDuration = new Rational(timeAfterCapture - prevScreenCaptureTime, 1000);
|
||||
buf.timeStamp = new Rational(prevScreenCaptureTime - startTime, 1000);
|
||||
buf.track = 0;
|
||||
write(buf);
|
||||
prevScreenCaptureTime = timeAfterCapture;
|
||||
}
|
||||
}
|
||||
|
||||
/** Captures the mouse cursor. */
|
||||
private void grabMouse() {
|
||||
long now = System.currentTimeMillis();
|
||||
PointerInfo info = MouseInfo.getPointerInfo();
|
||||
|
||||
mouseCaptures.offer(new MouseCapture(now, info.getLocation()));
|
||||
}
|
||||
|
||||
/** Holds a mouse capture. */
|
||||
private static class MouseCapture {
|
||||
|
||||
public long time;
|
||||
public Point p;
|
||||
|
||||
public MouseCapture(long time, Point p) {
|
||||
this.time = time;
|
||||
this.p = p;
|
||||
}
|
||||
}
|
||||
|
||||
/** Writes a buffer into the movie. Since the file system may not be
|
||||
* immediately available at all times, we do this asynchronously.
|
||||
* <p>
|
||||
* The buffer is copied and passed to the writer queue, which is consumed
|
||||
* by the writer thread. See method startWriter().
|
||||
* <p>
|
||||
* AVI does not support a variable frame rate for the video track. Since
|
||||
* we can not capture frames at a fixed frame rate we have to resend the
|
||||
* same captured screen multiple times to the writer.
|
||||
*
|
||||
* @param buf
|
||||
* @throws IOException
|
||||
*/
|
||||
private void write(Buffer buf) throws IOException {
|
||||
MovieWriter writer = this.w;
|
||||
if (writer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a clone of the buffer
|
||||
// Note that this creates a lot of memory garbage.
|
||||
// The Java garbage collector seems to handle it well.
|
||||
// In a "real" application we would probably reuse the buffers with a
|
||||
// ring buffer.
|
||||
if (buf.track == 0) {// video track
|
||||
if (writer.isVFRSupported()) {// variable frame rate is supported => easy
|
||||
Buffer wbuf = new Buffer();
|
||||
frameEncoder.process(buf, wbuf);
|
||||
writerQueue.offer(wbuf);
|
||||
} else {// variable frame rate not supported => convert to fixed frame rate
|
||||
Rational inputTime = buf.timeStamp.add(buf.sampleDuration);
|
||||
boolean isFirst = true;
|
||||
while (outputTime.compareTo(inputTime) < 0) {
|
||||
buf.timeStamp = outputTime;
|
||||
buf.sampleDuration = ffrDuration;
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
buf.setFlag(SAME_DATA);
|
||||
}
|
||||
Buffer wbuf = new Buffer();
|
||||
if (frameEncoder.process(buf, wbuf) != Codec.CODEC_OK) {
|
||||
throw new IOException("Codec failed or could not process frame in a single step.");
|
||||
}
|
||||
writerQueue.offer(wbuf);
|
||||
outputTime = outputTime.add(ffrDuration);
|
||||
}
|
||||
}
|
||||
} else {// audio track
|
||||
Buffer wbuf = new Buffer();
|
||||
wbuf.setMetaTo(buf);
|
||||
wbuf.data = ((byte[]) buf.data).clone();
|
||||
wbuf.length = buf.length;
|
||||
wbuf.offset = buf.offset;
|
||||
writerQueue.offer(wbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual writing of the buffer happens here.
|
||||
* <p>
|
||||
* This method is called from the writer thread in startWriter().
|
||||
*
|
||||
* @param buf
|
||||
* @throws IOException
|
||||
*/
|
||||
private void doWrite(Buffer buf) throws IOException {
|
||||
synchronized (sync) {
|
||||
w.write(buf.track, buf);
|
||||
|
||||
// Close file on a separate thread if file is full or an hour
|
||||
// has passed.
|
||||
long now = System.currentTimeMillis();
|
||||
if (w.isDataLimitReached() || now - startTime > 60 * 60 * 1000) {
|
||||
final MovieWriter closingWriter = w;
|
||||
new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
closingWriter.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}.start();
|
||||
createMovieWriter();
|
||||
startTime = now;
|
||||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.talend.mdm.cases.dsc;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.DataStewardImpl;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestDSC extends Login {
|
||||
DataStewardImpl dsc;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
dsc = new DataStewardImpl(driver);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"task.name","task.type.resotion","task.default.source","task.fieldName1"})
|
||||
public void testCreateTaskWithTypeResolution(String taskName,String taskType,String source ,String filedName1){
|
||||
|
||||
dsc.createTaskWithTypeDefined(taskName, taskType, source,filedName1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"task.name","task.type.data","task.default.source","task.fieldName1"})
|
||||
public void testCreateTaskWithTypeData(String taskName,String taskType,String source ,String filedName1){
|
||||
|
||||
dsc.createTaskWithTypeDefined(taskName, taskType, source,filedName1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"task.name","task.type.data","task.default.source","task.fieldName1"})
|
||||
public void testTaskAssignment(String taskName,String taskType,String source ,String filedName1){
|
||||
|
||||
dsc.taskAssign(taskName, taskType, source,filedName1,"user","user","administrator","administrator");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AfterMethod
|
||||
@Override
|
||||
public void logout() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.talend.mdm.cases.license;
|
||||
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.LicenseImpl;
|
||||
import org.talend.mdm.impl.LogonImpl;
|
||||
import org.talend.mdm.impl.UserImpl;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestLicense extends Login {
|
||||
LicenseImpl license;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
license = new LicenseImpl(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"license.file.path"})
|
||||
public void testUploadValidLicense(String fileLicenseValid){
|
||||
license.uploadValidLicense(fileLicenseValid);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"license.file.path"})
|
||||
public void testUploadInValidLicense(String fileLicenseValid){
|
||||
license.uploadInValidLicense(fileLicenseValid);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"license.file.path"})
|
||||
public void testUploadExpiredLicense(String fileLicenseValid){
|
||||
license.uploadExpiredLicense(fileLicenseValid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.talend.mdm.cases.login;
|
||||
|
||||
import org.talend.mdm.Base;
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.LicenseImpl;
|
||||
import org.talend.mdm.impl.LogonImpl;
|
||||
import org.talend.mdm.impl.UserImpl;
|
||||
import org.talend.mdm.modules.Logon;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestLogin extends Base {
|
||||
LogonImpl log;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
log = new LogonImpl(driver);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "url", "root","user.name","user.password","message" })
|
||||
public void testRightLogin(String url,String root,String userName,String userPassword,String message,ITestContext context) {
|
||||
log.initWebdriver(url, root, context);
|
||||
log.loginAdministratorImpl( userName, userPassword , message);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "url", "root","user.name","user.password","message" })
|
||||
public void testLogoutCorrectly(String url,String root,String userName,String userPassword,String message,ITestContext context) {
|
||||
log.initWebdriver(url, root, context);
|
||||
log.loginAdministratorLogoutImpl( userName, userPassword , message);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "url", "root","user.name","user.password","message" ,"session.timeout"})
|
||||
public void testLoginAndSessionTimeout(String url,String root,String userName,String userPassword,String message,int timeout,ITestContext context) {
|
||||
log.initWebdriver(url, root, context);
|
||||
log.loginAdministratorSessionTimeoutImpl(userName, userPassword, message, timeout);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "url", "root","user.name","user.password","message.wrong.username" })
|
||||
public void testWongLogin(String url,String root,String userName,String userPassword,String message,ITestContext context) {
|
||||
log.initWebdriver(url, root, context);
|
||||
log.loginWithWrongNamePassImpl( userName, userPassword , message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImpl;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecord extends Login {
|
||||
RecordImpl recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImpl(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testDeleteRecord(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity,feild1Value,feild1Name);
|
||||
}
|
||||
|
||||
/*@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testExportRecord(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.ExportRecordImpl(container,modle,entity);
|
||||
}*/
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity" })
|
||||
public void testExportRecord(String container,String modle,String entity ) {
|
||||
recordImpl.ExportRecordImpl(container,modle,entity);
|
||||
}
|
||||
/*@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testJournalOpenRecord(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.JournalOpenRecordImpl(container,modle,entity,feild1Value,feild1Name);
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testDeleteRecordToRecycle(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.deleteRecordToRecycleImpl(container,modle,entity,feild1Value,feild1Name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testRestoreFromRecycle(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.restoreFromRecycleImpl(container, modle, entity, feild1Value, feild1Name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "feild2Value","feild2Name" })
|
||||
public void testCreateRecord(String container,String modle,String entity,String feild2Value,String feild2Name) {
|
||||
recordImpl.createRecordImpl(container, modle, entity, feild2Value, feild2Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value_old", "feild2Value","feild2Name" })
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name) {
|
||||
recordImpl.duplicateRecordImpl(container, modle, entity, feild2Value_old, feild2Value, feild2Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value_old", "feild2Value","feild2Name"})
|
||||
public void testUpdateRecord(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name) {
|
||||
recordImpl.updateRecordImpl(container, modle, entity,feild2Value_old, feild2Value, feild2Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByValue(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByValueImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByString(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByStringImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByDate(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByDateImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImplAgency;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecordAgency extends Login {
|
||||
RecordImplAgency recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImplAgency(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue"})
|
||||
public void testDeleteRecord(String container,String modle,String entity,String Identifie,String IdentifieValue ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity, Identifie,IdentifieValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "Name","NameValue","Identifie" ,"IdentifieValue","Zipcode","ZipcodeValue"})
|
||||
public void testCreateRecord(String container,String modle,String entity,String Name,String NameValue,String Identifie,String IdentifieValue,String Zipcode,String ZipcodeValue ) {
|
||||
recordImpl.createRecordImpl(container, modle, entity, Name,NameValue, Identifie,IdentifieValue,Zipcode,ZipcodeValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue","IdentifieValueDup" })
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String Identifie,String IdentifieValue,String IdentifieValueDup ) {
|
||||
recordImpl.duplicateRecordImpl(container, modle, entity, Identifie,IdentifieValue, IdentifieValueDup);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue","Zipcode","ZipcodeValue"})
|
||||
public void testUpdateRecord(String container,String modle,String entity,String Identifie,String IdentifieValue,String Zipcode,String ZipcodeValue ) {
|
||||
recordImpl.updateRecordImpl(container, modle, entity,Identifie,IdentifieValue,Zipcode,ZipcodeValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImplAgent;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecordAgent extends Login {
|
||||
RecordImplAgent recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImplAgent(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue"})
|
||||
public void testDeleteRecord(String container,String modle,String entity,String Identifie,String IdentifieValue ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity, Identifie,IdentifieValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue", "Firstname","FirstnameValue","Lastname","LastnameValue","CommissionCode" ,"CommissionCodeValue","StartDate","StartDateValue"})
|
||||
public void testCreateRecord(String container,String modle,String entity,String Identifie,String IdentifieValue,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
recordImpl.createRecordImpl(container, modle, entity,Identifie,IdentifieValue,Firstname,FirstnameValue,Lastname,LastnameValue,CommissionCode,CommissionCodeValue,StartDate,StartDateValue );
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue","CommissionCode" ,"CommissionCodeValue","CommissionCodeValueUpdate"})
|
||||
public void testUpdateRecord(String container,String modle,String entity,String Identifie,String IdentifieValue,String CommissionCode,String CommissionCodeValue,String CommissionCodeValueUpdate) {
|
||||
recordImpl.UpdateRecordImpl(container, modle, entity,Identifie,IdentifieValue,CommissionCode,CommissionCodeValue,CommissionCodeValueUpdate);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue","IdentifieValueDup", "Firstname","FirstnameValue"})
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String Identifie,String IdentifieValue,String IdentifieValueDup,String Firstname,String FirstnameValue) {
|
||||
recordImpl.DuplicateRecordImpl(container, modle, entity,Identifie,IdentifieValue,IdentifieValueDup,Firstname,FirstnameValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","Identifie" ,"IdentifieValue", "Firstname","FirstnameValue","Lastname","LastnameValue","CommissionCode" ,"CommissionCodeValue","StartDate","StartDateValue"})
|
||||
public void testCreateRecordWrongRule(String container,String modle,String entity,String Identifie,String IdentifieValue,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
recordImpl.createRecordWrongRuleImpl(container, modle, entity,Identifie,IdentifieValue,Firstname,FirstnameValue,Lastname,LastnameValue,CommissionCode,CommissionCodeValue,StartDate,StartDateValue );
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","Identifie" ,"IdentifieValue", "Firstname","FirstnameValue","Lastname","LastnameValue","CommissionCode" ,"CommissionCodeValue","StartDate","StartDateValue" })
|
||||
public void testChangeCommissionCodeNotApprovedWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String modle,String entity,String Identifie,String agentID,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
recordImpl.changeCommissionCodeNotApprovedWorkflow( userFrank, frankPass, userJennifer, jenniferPass,container, modle, entity,Identifie,agentID, Firstname, FirstnameValue, Lastname, LastnameValue, CommissionCode, CommissionCodeValue, StartDate, StartDateValue );
|
||||
}
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","Identifie" ,"IdentifieValue", "Firstname","FirstnameValue","Lastname","LastnameValue","CommissionCode" ,"CommissionCodeValue","StartDate","StartDateValue" })
|
||||
public void testChangeCommissionCodeApprovedWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String modle,String entity,String Identifie,String agentID,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
recordImpl.changeCommissionCodeApprovedWorkflow( userFrank, frankPass, userJennifer, jenniferPass,container, modle, entity,Identifie,agentID, Firstname, FirstnameValue, Lastname, LastnameValue, CommissionCode, CommissionCodeValue, StartDate, StartDateValue );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImplProduct;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecordProduct extends Login {
|
||||
RecordImplProduct recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImplProduct(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","UniqueId","UniqueIdValue" })
|
||||
public void testDeleteRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity,UniqueId,UniqueIdValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","UniqueId","UniqueIdValue" })
|
||||
public void testDeleteToRecycleRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue ) {
|
||||
recordImpl.deleteRecordToRecycleImpl(container,modle,entity,UniqueId,UniqueIdValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","UniqueId","UniqueIdValue" })
|
||||
public void testRestoreFromRecycleRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue ) {
|
||||
recordImpl.restoreFromRecycleImpl(container,modle,entity,UniqueId,UniqueIdValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "UniqueId","UniqueIdValue","Name","NameValue","Description","DescriptionValue","Price","PriceValue"})
|
||||
public void testCreateRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue,String Name,String NameValue,String Description,String DescriptionValue,String Price,String PriceValue) {
|
||||
recordImpl.createRecordImpl(container, modle, entity, UniqueId,UniqueIdValue,Name,NameValue,Description,DescriptionValue,Price,PriceValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "UniqueId","UniqueIdValue","UniqueIdValueDup"})
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue,String UniqueIdValueDup) {
|
||||
recordImpl.testDuplicateRecordImpl(container, modle, entity, UniqueId,UniqueIdValue,UniqueIdValueDup);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "UniqueId","UniqueIdValue","Price","PriceValue","flag","PriceValueOld"})
|
||||
public void testUpdatePriceRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue,String Price,String PriceValue,String flag,String PriceValueOld) {
|
||||
recordImpl.testUpdatePriceRecordImpl(container, modle, entity, UniqueId,UniqueIdValue,Price,PriceValue,flag,PriceValueOld);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","entity_Element","searchFeild","searchFeild_Element","opeartion", "value" })
|
||||
public void testSearchRecordByValue(String container,String modle,String entity,String entity_Element,String searchFeild,String searchFeild_Element,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByValueImpl(container, modle, entity,entity_Element ,searchFeild,searchFeild_Element,opeartion,value);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","entity_Element","searchFeild","searchFeild_Element","opeartion", "value" })
|
||||
public void testSearchRecordByString(String container,String modle,String entity,String entity_Element,String searchFeild,String searchFeild_Element,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByStringImpl(container, modle, entity, entity_Element ,searchFeild,searchFeild_Element,opeartion,value);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","UniqueIdValue"})
|
||||
public void testPriceChangeValidApprovedWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String productUniqID) {
|
||||
recordImpl.priceChangeWorkFlowValidApprovedImpl(userFrank, frankPass, userJennifer, jenniferPass, container, model, entity,productUniqID);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","UniqueIdValue"})
|
||||
public void testPriceValidNotApproveWorkFlow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String productUniqID) {
|
||||
recordImpl.priceChangeWorkFlowValidNotApprovedImpl(userFrank, frankPass, userJennifer, jenniferPass, container, model, entity,productUniqID);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","UniqueIdValue"})
|
||||
public void testPriceChangeInvalidWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String productUniqID) {
|
||||
recordImpl.priceChangeWorkFlowInValidImpl(userFrank, frankPass, userJennifer, jenniferPass, container, model, entity,productUniqID);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"container","modle","entity","UniqueIdValue"})
|
||||
public void testStoreShowOnMapProcess(String container,String model,String entity,String productUniqID) {
|
||||
recordImpl.storeShowOnMapProcessImpl(container, model, entity,productUniqID);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","UniqueIdValue","familyid","familyname","franksubmited.familyname"})
|
||||
public void testForeignKeyInforDisplay(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String productUniqID,String productFamilyId,String productFamilyName,String frankSubmitedFamilyName) {
|
||||
recordImpl.foreignKeyInfoDisplay(userFrank, frankPass, userJennifer, jenniferPass, container, model, entity,productUniqID, productFamilyId, productFamilyName, frankSubmitedFamilyName);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.frank.name","user.frank.password","user.jennifer.name","user.jennifer.password", "container","modle","entity","UniqueIdValue","familyid","familyname","franksubmited.familyname"})
|
||||
public void testTwoWaysOpenWorkFlow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String productUniqID,String productFamilyId,String productFamilyName,String frankSubmitedFamilyName) {
|
||||
recordImpl.openWorkflowTask(userFrank, frankPass, userJennifer, jenniferPass, container, model, entity,productUniqID, productFamilyId, productFamilyName, frankSubmitedFamilyName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImplProductFamily;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecordProductFamily extends Login {
|
||||
RecordImplProductFamily recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImplProductFamily(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value","feild2Name","feild1Name" })
|
||||
public void testDeleteRecord(String container,String modle,String entity,String feild2Value,String feild2Name,String feild1Name ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity,feild2Value,feild2Name,feild1Name);
|
||||
}
|
||||
|
||||
/*@Test
|
||||
@Parameters( { "container","modle","entity","feild1Value","feild1Name" })
|
||||
public void testExportRecord(String container,String modle,String entity,String feild1Value,String feild1Name ) {
|
||||
recordImpl.ExportRecordImpl(container,modle,entity);
|
||||
}*/
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity" })
|
||||
public void testExportRecord(String container,String modle,String entity ) {
|
||||
recordImpl.ExportRecordImpl(container,modle,entity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value","feild2Name" ,"feild1Name"})
|
||||
public void testDeleteRecordToRecycle(String container,String modle,String entity,String feild2Value,String feild2Name ,String feild1Name) {
|
||||
recordImpl.deleteRecordToRecycleImpl(container,modle,entity,feild2Value,feild2Name,feild1Name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value","feild2Name" })
|
||||
public void testRestoreFromRecycle(String container,String modle,String entity,String feild2Value,String feild2Name ) {
|
||||
recordImpl.restoreFromRecycleImpl(container, modle, entity, feild2Value, feild2Name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "feild2Value","feild2Name","feild1Name" })
|
||||
public void testCreateRecord(String container,String modle,String entity,String feild2Value,String feild2Name,String feild1Name) {
|
||||
recordImpl.createRecordImpl(container, modle, entity, feild2Value, feild2Name,feild1Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value_old", "feild2Value","feild2Name" ,"feild1Name" })
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name,String feild1Name) {
|
||||
recordImpl.duplicateRecordImpl(container, modle, entity, feild2Value_old, feild2Value, feild2Name,feild1Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","feild2Value_old", "feild2Value","feild2Name","feild1Name" })
|
||||
public void testUpdateRecord(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name,String feild1Name) {
|
||||
recordImpl.updateRecordImpl(container, modle, entity,feild2Value_old, feild2Value, feild2Name, feild1Name);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByValue(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByValueImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByString(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByStringImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","searchFeild", "opeartion", "value" })
|
||||
public void testSearchRecordByDate(String container,String modle,String entity,String searchFeild,String opeartion,String value) {
|
||||
recordImpl.SearchRecordByDateImpl(container, modle, entity, searchFeild,opeartion,value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.talend.mdm.cases.record;
|
||||
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.RecordImplStore;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestRecordStore extends Login {
|
||||
RecordImplStore recordImpl;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
recordImpl = new RecordImplStore(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","storeId","storeIdValue" })
|
||||
public void testDeleteRecord(String container,String modle,String entity,String UniqueId,String UniqueIdValue ) {
|
||||
recordImpl.deleteRecordImpl(container,modle,entity,UniqueId,UniqueIdValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "storeId","storeIdValue","address","addressValue"})
|
||||
public void testCreateRecord(String container,String modle,String entity,String storeId,String storeIdValue,String address,String addressValue) {
|
||||
recordImpl.createRecordImpl(container, modle, entity,storeId,storeIdValue,address,addressValue);
|
||||
}
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity", "storeId","storeIdValue","storeIdValueDup"})
|
||||
public void testDuplicateRecord(String container,String modle,String entity,String storeId,String storeIdValue,String storeIdValueDup) {
|
||||
recordImpl.testDuplicateRecordImpl(container, modle, entity,storeId, storeIdValue,storeIdValueDup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "container","modle","entity","storeId","storeIdValue","address","addressValue"})
|
||||
public void testUpdateAddressRecord(String container,String modle,String entity,String storeId,String storeIdValue,String address,String addressValue) {
|
||||
recordImpl.testUpdateAddressRecordImpl(container, modle, entity,storeId,storeIdValue,address,addressValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package org.talend.mdm.cases.user;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.LicenseImpl;
|
||||
import org.talend.mdm.impl.LogonImpl;
|
||||
import org.talend.mdm.impl.UserImpl;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestUser extends Login {
|
||||
UserImpl userImpl;
|
||||
LicenseImpl license;
|
||||
LogonImpl loger;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
loger = new LogonImpl(driver);
|
||||
userImpl = new UserImpl(driver);
|
||||
license = new LicenseImpl(driver);
|
||||
logger.info("Set Before Info");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "roles" })
|
||||
public void testAddUserAllowedAdmin(String roles) {
|
||||
license.openLicense();
|
||||
userImpl.addUserAllowed(roles, license.getAvailableAdmin());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserAdminOverAllowed(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles) {
|
||||
license.openLicense();
|
||||
userImpl.addUserOverAllowedAdmin(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles,license.getAvailableWeb());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "roles" })
|
||||
public void testAddUserAllowedWeb(String roles) {
|
||||
license.openLicense();
|
||||
userImpl.addUserAllowed(roles, license.getAvailableWeb());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( { "identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserWebOverAllowed(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles) {
|
||||
license.openLicense();
|
||||
userImpl.addUserOverAllowedWeb(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles,license.getAvailableWeb());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( { "identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserWebOverAllowedInactive(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles) {
|
||||
license.openLicense();
|
||||
userImpl.addUserOverAllowedWebInactive(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles,license.getAvailableWeb());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserMultipleRoles(String userNameAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.addUserWithMultipleRoles("test",identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testUserSelectedAfterSave(String userNameAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.userSelectedAfterSave(userNameAdministrator,identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","user.password","identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testUserLoginWithNewRole(String userNameAdministrator,String adminPass,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.userLoginWithNewRole(userNameAdministrator,adminPass,identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, (roles));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testaddUserWithMultipleRolesOneAllowedAnotherNot(String userNameAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.addUserWithMultipleRolesOneAllowedAnotherNot(userNameAdministrator,identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Parameters( {"identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserWithPasswordNotEqualsConfirmPassword(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.addUserWithPasswordNotEqualsConfirmPassword(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","user.password" ,"identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles" })
|
||||
public void testAddUserInactiveCheckLoginThenActive(String administrator,String adminPass,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
userImpl.AddUserInactiveCheckLoginThenActive(administrator, adminPass, identifier,
|
||||
firstName, lastName, password, confirmPassword, email, company,
|
||||
defaultVersion, active, (roles));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active"})
|
||||
public void testAddUserWithoutSelectRoles(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active) {
|
||||
userImpl.addUserWithoutSelectRoles(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"url","user.name"})
|
||||
public void testFlushCache(String url,String userName){
|
||||
userImpl.flushCache(userName,url);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","user.password" ,"identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active","roles.customize", "roles" })
|
||||
public void testaddUserWithCustomizeRoles(String administrator,String administratorPass,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String rolesCustomize,String rolesSystem) {
|
||||
userImpl.addUserWithCustomizeRoles(administrator,administratorPass,identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, rolesCustomize,rolesSystem);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters( {"user.name","user.password","identifier", "first.name", "last.name", "password", "confirm.password", "email", "company", "default.version", "active", "roles","container","modle","entity","UniqueId","Name","Description","Price"})
|
||||
public void testUserViewerReadOnlyAccess(String userNameAdministrator,String adminPass,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles,String container,String modle,String entity,String UniqueId,String Name,String Description,String Price) {
|
||||
userImpl.readOnlyAccessForViewer(userNameAdministrator,adminPass,identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, (roles),container,modle,entity, UniqueId, Name, Description, Price);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.talend.mdm.cases.welcome;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.Login;
|
||||
import org.talend.mdm.impl.LicenseImpl;
|
||||
import org.talend.mdm.impl.LogonImpl;
|
||||
import org.talend.mdm.impl.UserImpl;
|
||||
import org.talend.mdm.impl.WelcomeImpl;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class TestWelcomePage extends Login {
|
||||
WelcomeImpl welcom;
|
||||
@BeforeMethod
|
||||
public void beforeMethod(){
|
||||
welcom = new WelcomeImpl(driver);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWelcomLayoutResort() {
|
||||
welcom.reSortWindows();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name=" Product Family Record" parallel="false">
|
||||
<parameter name="user.name" value="jennifer" />
|
||||
<parameter name="user.password" value="jennifer" />
|
||||
<parameter name="message" value="User 'jennifer' is already logged in another session!" />
|
||||
<parameter name="container" value="DStar" />
|
||||
<parameter name="modle" value="DStar" />
|
||||
<parameter name="IdentifieValue" value="h001" />
|
||||
<parameter name="entity" value="Agency" />
|
||||
<parameter name="Identifie" value="Id" />
|
||||
|
||||
<test name="Agency create a record">
|
||||
<classes>
|
||||
|
||||
<parameter name="Name" value="Name" />
|
||||
<parameter name="NameValue" value="test" />
|
||||
<parameter name="Zipcode" value="Zip" />
|
||||
<parameter name="ZipcodeValue" value="11405" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgency">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agency update a record">
|
||||
<classes>
|
||||
<parameter name="Zipcode" value="Zip" />
|
||||
<parameter name="ZipcodeValue" value="60957" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgency">
|
||||
<methods>
|
||||
<include name="testUpdateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agency duplicate a record">
|
||||
<classes>
|
||||
<parameter name="Name" value="Name" />
|
||||
<parameter name="NameValue" value="testDup" />
|
||||
<parameter name="IdentifieValueDup" value="dup001" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgency">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agency delete record">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgency">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agency delete the duplicate record">
|
||||
<classes>
|
||||
<parameter name="IdentifieValue" value="dup001" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgency">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name=" Product Family Record" parallel="false">
|
||||
<parameter name="user.name" value="jennifer" />
|
||||
<parameter name="user.password" value="jennifer" />
|
||||
<parameter name="message" value="User 'jennifer' is already logged in another session!" />
|
||||
<parameter name="container" value="DStar" />
|
||||
<parameter name="modle" value="DStar" />
|
||||
<parameter name="entity" value="Agent" />
|
||||
<parameter name="Identifie" value="Id" />
|
||||
<parameter name="IdentifieValue" value="fcduo" />
|
||||
|
||||
|
||||
<test name="test change agent commission code workflow approved">
|
||||
<parameter name="IdentifieValue" value="AdrTa" />
|
||||
<parameter name="Firstname" value="Firstname" />
|
||||
<parameter name="FirstnameValue" value="Adrian" />
|
||||
<parameter name="Lastname" value="Lastname" />
|
||||
<parameter name="LastnameValue" value="Taft" />
|
||||
<parameter name="CommissionCode" value="CommissionCode" />
|
||||
<parameter name="CommissionCodeValue" value="1" />
|
||||
<parameter name="StartDate" value="StartDate" />
|
||||
<parameter name="StartDateValue" value="2009-06-06" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testChangeCommissionCodeApprovedWorkflow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test change agent commission code workflow not approved">
|
||||
<parameter name="IdentifieValue" value="BilNi" />
|
||||
<parameter name="Firstname" value="Firstname" />
|
||||
<parameter name="FirstnameValue" value="Bill" />
|
||||
<parameter name="Lastname" value="Lastname" />
|
||||
<parameter name="LastnameValue" value="Nixon" />
|
||||
<parameter name="CommissionCode" value="CommissionCode" />
|
||||
<parameter name="CommissionCodeValue" value="1" />
|
||||
<parameter name="StartDate" value="StartDate" />
|
||||
<parameter name="StartDateValue" value="2007-08-29" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testChangeCommissionCodeNotApprovedWorkflow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agent create a record according to validation rule">
|
||||
<classes>
|
||||
<parameter name="Firstname" value="Firstname" />
|
||||
<parameter name="FirstnameValue" value="fcdqaz" />
|
||||
<parameter name="Lastname" value="Lastname" />
|
||||
<parameter name="LastnameValue" value="uomijn" />
|
||||
<parameter name="CommissionCode" value="CommissionCode" />
|
||||
<parameter name="CommissionCodeValue" value="4" />
|
||||
<parameter name="StartDate" value="StartDate" />
|
||||
<parameter name="StartDateValue" value="2012-05-25" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="Agent create a record not according to validation rule">
|
||||
<classes>
|
||||
<parameter name="Firstname" value="Firstname" />
|
||||
<parameter name="FirstnameValue" value="ppmqaz" />
|
||||
<parameter name="Lastname" value="Lastname" />
|
||||
<parameter name="LastnameValue" value="oumijn" />
|
||||
<parameter name="CommissionCode" value="CommissionCode" />
|
||||
<parameter name="CommissionCodeValue" value="4" />
|
||||
<parameter name="StartDate" value="StartDate" />
|
||||
<parameter name="StartDateValue" value="2012-05-25" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testCreateRecordWrongRule"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
|
||||
|
||||
<test name="Agent update a record ">
|
||||
<classes>
|
||||
|
||||
<parameter name="CommissionCode" value="CommissionCode" />
|
||||
<parameter name="CommissionCodeValue" value="4" />
|
||||
<parameter name="CommissionCodeValueUpdate" value="2" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testUpdateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Agent duplicate a record according to validation rule">
|
||||
<classes>
|
||||
<parameter name="IdentifieValueDup" value="yhauo" />
|
||||
<parameter name="Firstname" value="Firstname" />
|
||||
<parameter name="FirstnameValue" value="yhazbcd" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="Agent delete record">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="Agent delete the duplicate record">
|
||||
<classes>
|
||||
<parameter name="IdentifieValue" value="yhauo" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordAgent">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
|
||||
<test name="test create task with type of resoluton">
|
||||
<parameter name="task.name" value="taskresolution" />
|
||||
<parameter name="task.type.resotion" value="Resolution" />
|
||||
<parameter name="task.default.source" value="Source" />
|
||||
<parameter name="task.fieldName1" value="testa" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.dsc.TestDSC">
|
||||
<methods>
|
||||
<include name="testCreateTaskWithTypeResolution"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test create task with type of data">
|
||||
<parameter name="task.name" value="taskredata" />
|
||||
<parameter name="task.type.data" value="Data" />
|
||||
<parameter name="task.default.source" value="Source" />
|
||||
<parameter name="task.fieldName1" value="testb" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.dsc.TestDSC">
|
||||
<methods>
|
||||
<include name="testCreateTaskWithTypeData"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test task assignment">
|
||||
<parameter name="task.name" value="taskredata" />
|
||||
<parameter name="task.type.data" value="Data" />
|
||||
<parameter name="task.default.source" value="Source" />
|
||||
<parameter name="task.fieldName1" value="testb" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.dsc.TestDSC">
|
||||
<methods>
|
||||
<include name="testTaskAssignment"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
|
||||
<test name="test upload invalid license">
|
||||
<parameter name="testlink.id" value="TMDMQA-5779"/>
|
||||
<parameter name="license.file.path"
|
||||
value="org/talend/mdm/resources/license_invalid" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.license.TestLicense" />
|
||||
<methods>
|
||||
<include name="testUploadInValidLicense"/>
|
||||
</methods>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test upload expired license">
|
||||
<parameter name="testlink.id" value="TMDMQA-5780"/>
|
||||
<parameter name="license.file.path"
|
||||
value="org/talend/mdm/resources/license_invalid" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.license.TestLicense" />
|
||||
<methods>
|
||||
<include name="testUploadExpiredLicense"/>
|
||||
</methods>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test upload valid license">
|
||||
<parameter name="testlink.id" value="TMDMQA-5778"/>
|
||||
<parameter name="license.file.path"
|
||||
value="org/talend/mdm/resources/license" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.license.TestLicense" />
|
||||
<methods>
|
||||
<include name="testUploadValidLicense"/>
|
||||
</methods>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
<parameter name ="session.timeout" value ="600000"/>
|
||||
|
||||
|
||||
<test name="test user right login">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.login.TestLogin">
|
||||
<methods>
|
||||
<include name="testRightLogin"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test user right login and logout">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.login.TestLogin">
|
||||
<methods>
|
||||
<include name="testLogoutCorrectly"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test user wrong login">
|
||||
<parameter name="message.wrong.username" value="Login failed. Please check your login and password" />
|
||||
<parameter name="user.name" value="test" />
|
||||
<parameter name="user.password" value="administrator" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.login.TestLogin">
|
||||
<methods>
|
||||
<include name="testWongLogin"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test><!--
|
||||
|
||||
|
||||
<test name="test user login and session timeout">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.login.TestLogin">
|
||||
<methods>
|
||||
<include name="testLoginAndSessionTimeout"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
--></suite>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name=" Product Family Record" parallel="false">
|
||||
<parameter name="user.name" value="jennifer" />
|
||||
<parameter name="user.password" value="jennifer" />
|
||||
<parameter name="message" value="User 'jennifer' is already logged in another session!" />
|
||||
|
||||
<test name="Product Family create a record" preserve-order="true">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value" value="Books" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Product Family update a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value_old" value="Books" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<parameter name="feild2Value" value="Books_update" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testUpdateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Product Family duplicate a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<parameter name="feild2Value_old" value="Books_update" />
|
||||
<parameter name="feild2Value" value="Books_dup" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="Product Family delete a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value" value="Books_update" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name="Product Family delete the duplicate record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value" value="Books_dup" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<!-- <test name="Product Family delete a record to recycle and restore the record " >
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value" value="Books_dup" />
|
||||
<parameter name="feild1Name" value="Id" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProductFamily">
|
||||
<methods>
|
||||
<include name="testDeleteRecordToRecycle"/>
|
||||
<include name="testRestoreFromRecycle"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test> -->
|
||||
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name=" Product entity Record" parallel="false">
|
||||
<parameter name="user.name" value="jennifer" />
|
||||
<parameter name="user.password" value="jennifer" />
|
||||
<parameter name="message" value="User 'jennifer' is already logged in another session!" />
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="UniqueId" value="Id" />
|
||||
<parameter name="UniqueIdValue" value="1671111134" />
|
||||
|
||||
|
||||
<test name="test two ways to open workflow task on map">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product" />
|
||||
|
||||
<parameter name="UniqueIdValue" value="231035933" />
|
||||
<parameter name="familyid" value="3" />
|
||||
<parameter name="familyname" value="Pets" />
|
||||
<parameter name="franksubmited.familyname" value="Mugs" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testTwoWaysOpenWorkFlow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test show foreign key info">
|
||||
<classes>
|
||||
|
||||
<parameter name="UniqueIdValue" value="231035933" />
|
||||
<parameter name="familyid" value="3" />
|
||||
<parameter name="familyname" value="Pets" />
|
||||
<parameter name="franksubmited.familyname" value="Mugs" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testForeignKeyInforDisplay"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test workflow change price valid and approved">
|
||||
<classes>
|
||||
|
||||
<parameter name="UniqueIdValue" value="231035934" />
|
||||
<parameter name="entity" value="Product" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testPriceChangeValidApprovedWorkflow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test workflow change price valid and not approve">
|
||||
<classes>
|
||||
<parameter name="UniqueIdValue" value="231035933" />
|
||||
<parameter name="entity" value="Product" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testPriceValidNotApproveWorkFlow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test workflow change price invalid">
|
||||
<classes>
|
||||
<parameter name="UniqueIdValue" value="231035933" />
|
||||
<parameter name="entity" value="Product" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testPriceChangeInvalidWorkflow"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test work flow process show on map">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="UniqueIdValue" value="231035933" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testStoreShowOnMapProcess"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name=" create a record" >
|
||||
<classes>
|
||||
<parameter name="Name" value="Name" />
|
||||
<parameter name="Description" value="Description" />
|
||||
<parameter name="Price" value="Price" />
|
||||
<parameter name="NameValue" value="Talend Large Mug_test" />
|
||||
<parameter name="DescriptionValue" value="this is a test Talend Large Mug_test" />
|
||||
<parameter name="PriceValue" value="16.91" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="update the record to set a price of +15%">
|
||||
<classes>
|
||||
<parameter name="Price" value="Price" />
|
||||
<parameter name="PriceValue" value="19.91" />
|
||||
<parameter name="PriceValueOld" value="16.91" />
|
||||
<parameter name="flag" value="0" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testUpdatePriceRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name="update the record to set a price of -15%">
|
||||
<classes>
|
||||
<parameter name="Price" value="Price" />
|
||||
<parameter name="PriceValue" value="13.91" />
|
||||
<parameter name="PriceValueOld" value="16.91" />
|
||||
<parameter name="flag" value="1" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testUpdatePriceRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="update the record to set a price of -15% and +15%">
|
||||
<classes>
|
||||
<parameter name="Price" value="Price" />
|
||||
<parameter name="PriceValue" value="15.91" />
|
||||
<parameter name="PriceValueOld" value="16.91" />
|
||||
<parameter name="flag" value="2" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testUpdatePriceRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name="duplicate a record" >
|
||||
<classes>
|
||||
<parameter name="UniqueIdValueDup" value="557175934" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="in Product view search a record by Unique Id the opeartion is lower than" >
|
||||
<classes>
|
||||
<parameter name="entity_Element" value="Product" />
|
||||
<parameter name="opeartion" value="is lower than" />
|
||||
<parameter name="value" value="16.91" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="searchFeild_Element" value="Price" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="in Product Family view search a record by name the opeartion contains the word(s)" >
|
||||
<classes>
|
||||
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="entity_Element" value="ProductFamily" />
|
||||
<parameter name="opeartion" value="contains the word(s)" />
|
||||
<parameter name="value" value="Pets" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="searchFeild_Element" value="Name" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="in Product Stores view search a record by Price the opeartion is lower than" >
|
||||
<classes>
|
||||
|
||||
<parameter name="entity" value="Product with Stores" />
|
||||
<parameter name="entity_Element" value="Product" />
|
||||
<parameter name="opeartion" value="is lower than" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="searchFeild_Element" value="Price" />
|
||||
<parameter name="value" value="16.91" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="in Product with Family view search a record by name the opeartion is contains the word(s)" >
|
||||
<classes>
|
||||
|
||||
<parameter name="entity" value="Product with Family" />
|
||||
<parameter name="entity_Element" value="Product" />
|
||||
<parameter name="opeartion" value="contains the word(s)" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="searchFeild_Element" value="Name" />
|
||||
<parameter name="value" value="Cap" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="in Store view search a record by Store Id the opeartion is contains the word(s)" >
|
||||
<classes>
|
||||
|
||||
<parameter name="entity" value="Store" />
|
||||
<parameter name="entity_Element" value="Store" />
|
||||
<parameter name="opeartion" value="contains the word(s)" />
|
||||
<parameter name="searchFeild" value="Store Id" />
|
||||
<parameter name="searchFeild_Element" value="Id" />
|
||||
<parameter name="value" value="TalendJP" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="in Unavailable Products view search a record by Name the opeartion is contains the word(s)" >
|
||||
<classes>
|
||||
|
||||
<parameter name="entity" value="Unavailable Products" />
|
||||
<parameter name="entity_Element" value="Product" />
|
||||
<parameter name="opeartion" value="contains the word(s)" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="searchFeild_Element" value="Name" />
|
||||
<parameter name="value" value="Cap" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name=" delete a record" >
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name=" delete the record to the recycle" >
|
||||
<classes>
|
||||
<parameter name="UniqueIdValue" value="557175934" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testDeleteToRecycleRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name=" restore the record from the recycle" >
|
||||
<classes>
|
||||
<parameter name="UniqueIdValue" value="557175934" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordProduct">
|
||||
<methods>
|
||||
<include name="testRestoreFromRecycleRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
@@ -0,0 +1,251 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Record" parallel="false">
|
||||
|
||||
<test name="create a record" preserve-order="true">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value" value="Books" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
<!-- <include name="testJournalOpenRecord"/> -->
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="export the record" >
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testExportRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="update a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value_old" value="Books" />
|
||||
<parameter name="feild2Value" value="Books_update" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testUpdateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<!--
|
||||
<test name="duplicate a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild2Name" value="Name" />
|
||||
<parameter name="feild2Value_old" value="Books_update" />
|
||||
<parameter name="feild2Value" value="Books_dup" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by date the opeartion equals">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="date" />
|
||||
<parameter name="opeartion" value="equals" />
|
||||
<parameter name="value" value="2010-01-27" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByDate"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by date the opeartion is after">
|
||||
<classes>
|
||||
<parameter name="entity" value="Customer" />
|
||||
<parameter name="searchFeild" value="date" />
|
||||
<parameter name="opeartion" value="is after" />
|
||||
<parameter name="value" value="2010-03-07" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByDate"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by date the opeartion is before">
|
||||
<classes>
|
||||
<parameter name="entity" value="Customer" />
|
||||
<parameter name="searchFeild" value="date" />
|
||||
<parameter name="opeartion" value="is before" />
|
||||
<parameter name="value" value="2010-03-07" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByDate"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test> -->
|
||||
|
||||
<test name="search records by value the opeartion is greater than">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is greater than" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by value the opeartion is equal to">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is equal to" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by value the opeartion is greater or equals">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is greater or equals" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by value the opeartion is lower than">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is lower than" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by value the opeartion is lower or equals">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is lower or equals" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by value the opeartion is not equal to">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Stores" />
|
||||
<parameter name="searchFeild" value="Price" />
|
||||
<parameter name="opeartion" value="is not equal to" />
|
||||
<parameter name="value" value="10.99" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByValue"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name="search records by string the opeartion contains the word(s)">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="opeartion" value="contains the word(s)" />
|
||||
<parameter name="value" value="Dog" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by string the opeartion contains a word starting with">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="opeartion" value="contains a word starting with" />
|
||||
<parameter name="value" value="Talend" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="search records by string the opeartion contains the sentence">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="searchFeild" value="Name" />
|
||||
<parameter name="opeartion" value="contains the sentence" />
|
||||
<parameter name="value" value="Golf Shirt" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testSearchRecordByString"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<!-- <test name="delete a record">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild1Name" value="Name" />
|
||||
<parameter name="feild1Value" value="Books" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
-->
|
||||
<test name="delete a record to recycle and restore the record " preserve-order="true">
|
||||
<classes>
|
||||
<parameter name="entity" value="Product Family" />
|
||||
<parameter name="feild1Name" value="Name" />
|
||||
<parameter name="feild1Value" value="Books_update" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecord">
|
||||
<methods>
|
||||
<include name="testDeleteRecordToRecycle"/>
|
||||
<include name="testRestoreFromRecycle"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name=" Product entity Record" parallel="false">
|
||||
<parameter name="user.name" value="jennifer" />
|
||||
<parameter name="user.password" value="jennifer" />
|
||||
<parameter name="message" value="User 'jennifer' is already logged in another session!" />
|
||||
<parameter name="entity" value="Store" />
|
||||
<parameter name="storeId" value="Id" />
|
||||
<parameter name="storeIdValue" value="t8129" />
|
||||
<parameter name="address" value="Address" />
|
||||
|
||||
<test name=" create a record" >
|
||||
<classes>
|
||||
<parameter name="addressValue" value="22, Jianguomenwai Avenue, Chaoyang District, Beijing" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordStore">
|
||||
<methods>
|
||||
<include name="testCreateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name=" update a record" >
|
||||
<classes>
|
||||
<parameter name="address" value="Address" />
|
||||
<parameter name="addressValue" value="5-10-13, Minami Aoyama Minato-ku. Tokyo" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordStore">
|
||||
<methods>
|
||||
<include name="testUpdateAddressRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test> -->
|
||||
|
||||
|
||||
<test name=" Duplicate a record" >
|
||||
<classes>
|
||||
<parameter name="storeIdValueDup" value="t8" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordStore">
|
||||
<methods>
|
||||
<include name="testDuplicateRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name=" delete the created record" >
|
||||
<classes>
|
||||
|
||||
<class name="org.talend.mdm.cases.record.TestRecordStore">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
<test name=" delete the duplicate record" >
|
||||
<classes>
|
||||
<parameter name="storeIdValue" value="t8" />
|
||||
<class name="org.talend.mdm.cases.record.TestRecordStore">
|
||||
<methods>
|
||||
<include name="testDeleteRecord"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
|
||||
<test name="Add users allowed admin">
|
||||
<classes>
|
||||
<parameter name="roles" value="System_Admin" />
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserAllowedAdmin"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add admin user over license allowed">
|
||||
<classes>
|
||||
<parameter name="identifier" value="testUserAdminOverLicense" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Admin" />
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserAdminOverAllowed"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add user with multiple roles one another">
|
||||
<parameter name="identifier" value="testUserMultipleRolesOneAnother" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web,System_Admin" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testaddUserWithMultipleRolesOneAllowedAnotherNot"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="Add users allowed web">
|
||||
<classes>
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserAllowedWeb"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test add web user over license allowed">
|
||||
<classes>
|
||||
<parameter name="identifier" value="testUserWebOverLicense" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserWebOverAllowed"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add web user over license allowed inactive">
|
||||
<classes>
|
||||
<parameter name="identifier" value="testWebUserOverInactive" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="false" />
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserWebOverAllowedInactive"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add user with multiple roles">
|
||||
<parameter name="identifier" value="testUserWithMultipleRoles" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web,System_Interactive" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserMultipleRoles"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test user selected after save successfully">
|
||||
<parameter name="identifier" value="testUserSelectedSaved" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password2" />
|
||||
<parameter name="confirm.password" value="password2" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web,System_Interactive" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testUserSelectedAfterSave"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add user with password not equals to confirm">
|
||||
<parameter name="identifier" value="testUserPasswordNotEqaulConfirm" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="confirmpassword" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web,System_Interactive" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserWithPasswordNotEqualsConfirmPassword"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test add user without select roles">
|
||||
<parameter name="identifier" value="testUserWithoutRoles" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="password" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="universe2" />
|
||||
<parameter name="active" value="true" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserWithoutSelectRoles"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test set user inactive as active check login">
|
||||
<parameter name="identifier" value="testUserInactiveThenActive" />
|
||||
<parameter name="first.name" value="firstname2" />
|
||||
<parameter name="last.name" value="lastname2" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="password" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="" />
|
||||
<parameter name="active" value="false" />
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testAddUserInactiveCheckLoginThenActive"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test flush cache">
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testFlushCache"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test add user with customize role">
|
||||
<parameter name="identifier" value="testUserCustomize" />
|
||||
<parameter name="first.name" value="customize" />
|
||||
<parameter name="last.name" value="user" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="password" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles.customize" value="Demo_User" />
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testaddUserWithCustomizeRoles"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
|
||||
<test name="test login with new user created">
|
||||
<parameter name="identifier" value="testNewUserLogin" />
|
||||
<parameter name="first.name" value="NewUserLogin" />
|
||||
<parameter name="last.name" value="user" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="password" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_Web" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testUserLoginWithNewRole"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
<test name="test read only access for viewer">
|
||||
<parameter name="identifier" value="testViewerAccess" />
|
||||
<parameter name="first.name" value="viewerReadOnly" />
|
||||
<parameter name="last.name" value="user" />
|
||||
<parameter name="password" value="password" />
|
||||
<parameter name="confirm.password" value="password" />
|
||||
<parameter name="email" value="eamil@administrator2" />
|
||||
<parameter name="company" value="company2" />
|
||||
<parameter name="default.version" value="" />
|
||||
<parameter name="active" value="true" />
|
||||
<parameter name="roles" value="System_View" />
|
||||
<parameter name="entity" value="Product" />
|
||||
<parameter name="UniqueId" value="Id" />
|
||||
<parameter name="Name" value="Name" />
|
||||
<parameter name="Description" value="Description" />
|
||||
<parameter name="Price" value="Price" />
|
||||
<classes>
|
||||
<class name="org.talend.mdm.cases.user.TestUser">
|
||||
<methods>
|
||||
<include name="testUserViewerReadOnlyAccess"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<suite name="Suite" parallel="false">
|
||||
<test name="test welcome">
|
||||
<classes>
|
||||
<parameter name="testlink.id" value="TMDMQA-5185"/>
|
||||
<class name="org.talend.mdm.cases.welcome.TestWelcomePage" />
|
||||
<methods>
|
||||
<include name="testWelcomLayoutResort"/>
|
||||
</methods>
|
||||
</classes>
|
||||
</test>
|
||||
|
||||
</suite>
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.modules.DataSteward;
|
||||
import org.talend.mdm.modules.User;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class DataStewardImpl extends DataSteward{
|
||||
|
||||
public DataStewardImpl(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void createTaskWithTypeDefined(String taskName,String taskType,String source,String filedName1){
|
||||
this.openMenuGoven();
|
||||
this.openMenuDSC();
|
||||
this.sleepCertainTime(5000);
|
||||
this.switchDriver(driver.switchTo().frame("TDSCFrame"));
|
||||
this.clickTaskNavigatorAdministrationCreateTask();
|
||||
this.typeTaskName(taskName);
|
||||
this.typeTaskDefaultSourceName(source);
|
||||
this.selectTaskType(taskType);
|
||||
this.clickAddColumButton();
|
||||
this.sleepCertainTime(2000);
|
||||
this.typeColumFieldName(filedName1);
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickSaveColumButton();
|
||||
this.clickOKOnTaskSchemaCreatPanel();
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickSaveOnTaskSchemaEditView();
|
||||
this.checkTaskSchemaSaveSuccessAndClickOk();
|
||||
this.clickTaskNavigatorCommonNewTasks();
|
||||
Assert.assertTrue(this.getValue(this.waitfor(By.xpath(this.getString(locator, "xpath.datatewardshipconsole.tasks.list.byname.row.status", taskName)), WAIT_TIME_MIN)).equals("new"));
|
||||
Assert.assertTrue(this.getValue(this.waitfor(By.xpath(this.getString(locator, "xpath.datatewardshipconsole.tasks.list.byname.row.tasktype", taskName)), WAIT_TIME_MIN)).equals(taskType));
|
||||
}
|
||||
|
||||
public void taskAssign(String taskName,String taskType,String source,String filedName1,String userAssighTo,String userPass,String userAdministrator,String userAdminpass){
|
||||
this.openMenuGoven();
|
||||
this.openMenuDSC();
|
||||
this.sleepCertainTime(5000);
|
||||
this.switchDriver(driver.switchTo().frame("TDSCFrame"));
|
||||
this.selectATaskByNameInCommonAlltasks(taskName);
|
||||
this.taskAssignToUser("user");
|
||||
this.driver.switchTo().defaultContent();
|
||||
LogonImpl log = new LogonImpl(this.driver);
|
||||
log.logout();
|
||||
log.loginUserForce("user", "user");
|
||||
this.openMenuGoven();
|
||||
this.openMenuDSC();
|
||||
this.sleepCertainTime(5000);
|
||||
this.switchDriver(driver.switchTo().frame("TDSCFrame"));
|
||||
this.selectATaskByNameInCommonAlltasks(taskName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.Base;
|
||||
import org.talend.mdm.modules.License;
|
||||
import org.talend.mdm.modules.User;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class LicenseImpl extends License{
|
||||
|
||||
public LicenseImpl(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void openLicense(){
|
||||
this.openAdministration();
|
||||
this.gotoLicensePage();
|
||||
|
||||
}
|
||||
|
||||
public void uploadValidLicense(String fileLicenseValid){
|
||||
this.openLicense();
|
||||
this.clickEditlicenseKey();
|
||||
logger.info("the license file ready to upload is :"+fileLicenseValid);
|
||||
logger.info(Base.class.getClassLoader());
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseValid));
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseValid));
|
||||
|
||||
File file = null;
|
||||
try {
|
||||
file = new File(LicenseImpl.class.getClassLoader().getResource(fileLicenseValid).toURI());
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(file.getAbsolutePath());
|
||||
this.typeInlicenseFile(file.getAbsolutePath());
|
||||
this.clickUploadLicenseButton();
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.uploading.inprogressbar.wating")), WAIT_TIME_MID), "uploading license bar err");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.upload.sending")), WAIT_TIME_MID), "uploading license bar err");
|
||||
this.sleepCertainTime(5000);
|
||||
}
|
||||
|
||||
public void uploadInValidLicense(String fileLicenseInValid){
|
||||
this.openLicense();
|
||||
this.clickEditlicenseKey();
|
||||
logger.info("the license file ready to upload is :"+fileLicenseInValid);
|
||||
logger.info(Base.class.getClassLoader());
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseInValid));
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseInValid));
|
||||
|
||||
File file = null;
|
||||
try {
|
||||
file = new File(LicenseImpl.class.getClassLoader().getResource(fileLicenseInValid).toURI());
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(file.getAbsolutePath());
|
||||
this.typeInlicenseFile(file.getAbsolutePath());
|
||||
this.clickUploadLicenseButton();
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.invalidlicense.warning")), WAIT_TIME_MID), "uploading license bar err");
|
||||
this.clickElementByXpath(locator.getString("xpath.license.invalidlicense.ok.button"));
|
||||
}
|
||||
|
||||
public void uploadExpiredLicense(String fileLicenseInValid){
|
||||
this.openLicense();
|
||||
this.clickEditlicenseKey();
|
||||
logger.info("the license file ready to upload is :"+fileLicenseInValid);
|
||||
logger.info(Base.class.getClassLoader());
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseInValid));
|
||||
logger.info(Base.class.getClassLoader().getResource(fileLicenseInValid));
|
||||
|
||||
File file = null;
|
||||
try {
|
||||
file = new File(LicenseImpl.class.getClassLoader().getResource(fileLicenseInValid).toURI());
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(file.getAbsolutePath());
|
||||
this.typeInlicenseFile(file.getAbsolutePath());
|
||||
this.clickUploadLicenseButton();
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.invalidlicense.warning")), WAIT_TIME_MID), "uploading license bar err");
|
||||
this.clickElementByXpath(locator.getString("xpath.license.invalidlicense.ok.button"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Logon;
|
||||
import org.talend.mdm.modules.User;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class LogonImpl extends Logon{
|
||||
|
||||
public LogonImpl(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public void loginAdministrator(String userName,String userPassword ,String message){
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.suit.name")));
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.edition.name")));
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
if(this.isTextPresent(message)) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.sheet.welcome")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
public void loginUserForce(String userName,String userPassword){
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.suit.name")));
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.edition.name")));
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
if(this.isTextPresent(this.getString(locator, "login.user.forcelogin.message", userName))) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.sheet.welcome")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
public void loginAdministratorImpl(String userName,String userPassword ,String message){
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.suit.name")));
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.edition.name")));
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
if(this.isTextPresent(message)) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.sheet.welcome")), WAIT_TIME_MAX));
|
||||
this.logout();
|
||||
this.killBroswer();
|
||||
}
|
||||
|
||||
|
||||
public void loginWithExistInactiveUserImpl(String inactiveName,String inactivePass,String wrongMessage){
|
||||
logger.info("test login with wrong password .");
|
||||
this.configureLogin(inactiveName, inactivePass);
|
||||
this.clickLogin();
|
||||
this.sleepCertainTime(5000);
|
||||
this.logger.info(wrongMessage);
|
||||
this.acceptAlert(wrongMessage);
|
||||
this.sleepCertainTime(5000);
|
||||
this.refreshBrowser();
|
||||
}
|
||||
|
||||
|
||||
public void loginWithWrongNamePassImpl(String wrongName,String wrongPass,String wrongMessage){
|
||||
logger.info("test login with wrong password .");
|
||||
this.configureLogin(wrongName, wrongPass);
|
||||
this.clickLogin();
|
||||
this.sleepCertainTime(5000);
|
||||
this.logger.info(wrongMessage);
|
||||
Assert.assertTrue(this.isTextPresent(wrongMessage));
|
||||
this.configureLogin("", "");
|
||||
this.clickLogin();
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isTextPresent(wrongMessage));
|
||||
this.killBroswer();
|
||||
}
|
||||
|
||||
public void loginAdministratorLogoutImpl(String userName,String userPassword ,String message){
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.suit.name")));
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("mdm.edition.name")));
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.clickLogin();
|
||||
if(this.isTextPresent(message)) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.configureLogin(userName, userPassword);
|
||||
} else {
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.sheet.welcome")), WAIT_TIME_MAX));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.login.logout")), WAIT_TIME_MAX));
|
||||
this.logout();
|
||||
this.killBroswer();
|
||||
}
|
||||
|
||||
public void loginAdministratorSessionTimeoutImpl(String userName,String userPassword ,String message,int sessionTimeout){
|
||||
this.configureLogin(userName, userPassword);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickLogin();
|
||||
if(this.isTextPresent(message)) {
|
||||
this.getElementByLinkText("Force user to logout").click();
|
||||
this.configureLogin(userName, userPassword);
|
||||
} else {
|
||||
logger.info("Force Login MDM");
|
||||
}
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.sheet.welcome")), WAIT_TIME_MAX));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.login.logout")), WAIT_TIME_MAX));
|
||||
this.sleepCertainTime(sessionTimeout);
|
||||
this.clickLogout();
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isTextPresent(locator.getString("session.timeout.info")));
|
||||
this.clickElementByXpath(locator.getString("xpath.login.session.timeout.button.ok"));
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.login.username")), WAIT_TIME_MAX));
|
||||
this.killBroswer();
|
||||
}
|
||||
|
||||
public void flushCache(WebDriver driver1 ,WebDriver driver2){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void forceQuit(){
|
||||
this.killBroswer();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Record;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class RecordImpl extends Record{
|
||||
|
||||
public RecordImpl(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void ExportRecordImpl(String container,String modle,String entity){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
clickExport();
|
||||
this.sleepCertainTime(8000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void restoreFromRecycleImpl(String container,String modle,String entity,String feild1Value,String feild1Name){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
clickRecycle();
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.recycle.click.record",feild1Value));
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.recycle.click.record.restore",feild1Value));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.recycle.click.record.restore.yes"));
|
||||
if (this.isElementPresent(By.xpath("//span[contains(text(),'Please input all necessary search ')]"),WAIT_TIME_MIN)){
|
||||
this.clickElementByXpath("//button[text()='Ok']");}
|
||||
//assert the record restore in the entity
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.databrowser"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.entity.arrows"));
|
||||
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.entity",entity)), WAIT_TIME_MIN);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.entity",entity));
|
||||
this.sleepCertainTime(5000);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parameters={entity,feild1Name,feild1Value};
|
||||
//this.clickElementByXpath(this.getString(locator, "xpath.record.choose.delete.record",parameters));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.delete.record",parameters)), WAIT_TIME_MIN),"the record restore in the entity");
|
||||
chooseRcord(entity,feild1Name,feild1Value);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
}
|
||||
public void deleteRecordImpl(String container,String modle,String entity,String feild1Value,String feild1Name){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
chooseRcord(entity,feild1Name,feild1Value);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
}
|
||||
public void JournalOpenRecordImpl(String entity,String feild1Value){
|
||||
String[] parameters={entity,feild1Value};
|
||||
//click the journal
|
||||
clickJournal();
|
||||
//input the search condition
|
||||
this.typeTextByXpath(locator.getString("xpath.record.choose.journal.entity"), entity);
|
||||
this.typeTextByXpath(locator.getString("xpath.record.choose.journal.key"), feild1Value);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.journal.operation.arrows"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.journal.operation.choose"));
|
||||
this.sleepCertainTime(2000);
|
||||
try {
|
||||
Robot bot = new Robot();
|
||||
bot.keyPress(KeyEvent.VK_TAB);
|
||||
bot.keyRelease(KeyEvent.VK_TAB);
|
||||
bot.keyPress(KeyEvent.VK_TAB);
|
||||
bot.keyRelease(KeyEvent.VK_TAB);
|
||||
bot.keyPress(KeyEvent.VK_TAB);
|
||||
bot.keyRelease(KeyEvent.VK_TAB);
|
||||
|
||||
bot.keyPress(KeyEvent.VK_ENTER);
|
||||
} catch (AWTException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.journal.choose.record", feild1Value)), WAIT_TIME_MIN);
|
||||
this.doubleClick(this.getElementByXpath(this.getString(locator, "xpath.record.choose.journal.choose.record", feild1Value)));
|
||||
this.isElementPresent(By.xpath("//button[text()='Open Record']"), WAIT_TIME_MIN);
|
||||
this.clickElementByXpath("//button[text()='Open Record']");
|
||||
//assert can see the record detail
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.journal.assert.open",parameters)), WAIT_TIME_MIN),"open detail");
|
||||
}
|
||||
public void deleteRecordToRecycleImpl(String container,String modle,String entity,String feild1Value,String feild1Name){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parameters_container={feild1Value,container};
|
||||
String[] parameters_modle={feild1Value,modle};
|
||||
String[] parameters_entity={feild1Value,entity};
|
||||
chooseRcord(entity,feild1Name,feild1Value);
|
||||
this.sleepCertainTime(5000);
|
||||
logger.info(this.getString(locator, "xpath.record.delete.record",entity));
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.delete.record",entity));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.choose"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.choose.ok"));
|
||||
if (this.isElementPresent(By.xpath(locator.getString("xpath.record.delete.record.warn")),WAIT_TIME_MIN)){
|
||||
this.clickElementByXpath("//button[text()='No']");
|
||||
}
|
||||
// assert the record which been deleted in the recycle
|
||||
clickRecycle();
|
||||
//this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.assert.clickRefresh"));
|
||||
logger.info(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.container",parameters_container));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.container",parameters_container)), WAIT_TIME_MIN ),"container");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.modle",parameters_modle)), WAIT_TIME_MIN ),"modle");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.entity",parameters_entity)), WAIT_TIME_MIN ),"entity");
|
||||
}
|
||||
public void duplicateRecordImpl(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild2Value={entity,feild2Value_old};
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
chooseRcord(entity,feild2Name,feild2Value_old);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.click"));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.Duplicate.input",parametersFeild2)), WAIT_TIME_MAX),"duplicateARecord");
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.Duplicate.close.origin",parametersFeild2Value));
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersFeild2)), feild2Value);
|
||||
//this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), feild2Value);
|
||||
//this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild3",parametersFeild3)), feild3Value);
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.saveAndClose"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MAX),"createARecord");
|
||||
}
|
||||
public void createRecordImpl(String container,String modle,String entity,String feild2Value,String feild2Name){
|
||||
/* String feild1Value;*/
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
logger.info(feild2Name);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.waitforElementDisplayed(By.xpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), WAIT_TIME_MAX);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2), feild2Value);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
|
||||
//Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild1",parametersFeild1Assert)), WAIT_TIME_MAX),"createARecord");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MAX),"createARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
/* feild1Value=this.getText();*/
|
||||
// JournalOpenRecordImpl(entity,feild1Value);
|
||||
}
|
||||
public void updateRecordImpl(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
chooseRcord(entity,feild2Name,feild2Value_old);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), 3000));
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), feild2Value);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
if (this.isTextPresent("No change since last save")){
|
||||
this.clickElementByXpath("//button[text()='Ok']");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MAX),"updateARecord");
|
||||
}
|
||||
}
|
||||
public void SearchRecordByValueImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
searchValueAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
public void SearchRecordByStringImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
searchStringAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
|
||||
public void SearchRecordByDateImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
searchDateAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Record;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class RecordImplAgency extends Record{
|
||||
String OperationType,key,source;
|
||||
|
||||
boolean result;
|
||||
|
||||
public RecordImplAgency(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public void deleteRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue){
|
||||
OperationType="PHYSICAL_DELETE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
JournalResultCount();
|
||||
}
|
||||
public void duplicateRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue,String IdentifieValueDup ) {
|
||||
String[] parametersID={entity,Identifie};
|
||||
String[] parametersIDclose={entity,IdentifieValue};
|
||||
String[] parametersIDAssert={entity,Identifie,IdentifieValueDup};
|
||||
String[] parametersIDValueAssert={Identifie,IdentifieValueDup};
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.click"));
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.Duplicate.close.origin",parametersIDclose));
|
||||
this.sleepCertainTime(10000);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersID)), IdentifieValueDup);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.sleepCertainTime(10000);
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
this.sleepCertainTime(3000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersIDAssert)), WAIT_TIME_MAX),"duplicateARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,IdentifieValueDup,OperationType,source);
|
||||
this.sleepCertainTime(3000);
|
||||
JournalCheckResult(IdentifieValueDup,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",parametersIDValueAssert )), WAIT_TIME_MIN));
|
||||
|
||||
}
|
||||
public void createRecordImpl(String container,String modle,String entity,String Name,String NameValue,String Identifie,String IdentifieValue ,String Zipcode,String ZipcodeValue) {
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
String city,state,region,moreinfo;
|
||||
String[] parametersName={entity,Name};
|
||||
String[] parametersID={entity,Identifie};
|
||||
String[] parametersZip={entity,Zipcode};
|
||||
String[] parametersNameAssert={entity,Name,NameValue};
|
||||
String[] parametersIDAssert={entity,Identifie,IdentifieValue};
|
||||
String[] parametersZipAssert={entity,Zipcode,ZipcodeValue};
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersID), IdentifieValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersName), NameValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersZip), ZipcodeValue);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.sleepCertainTime(5000);
|
||||
//get the auto genatate value
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(10000);
|
||||
city=this.getValueInput(By.xpath("//input[@name='Agency/City']"));
|
||||
state=this.getValueInput(By.xpath("//input[@name='Agency/State']"));
|
||||
region=this.getValueInput(By.xpath("//input[@name='Agency/Region']"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath("//a[text()='Map']//following-sibling::img");
|
||||
moreinfo=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersNameAssert)), WAIT_TIME_MAX),"createARecord");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersZipAssert)), WAIT_TIME_MAX),"createARecord");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersIDAssert)), WAIT_TIME_MAX),"createARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
String[] IdAssert={Identifie,IdentifieValue};
|
||||
String[] NameAssert={Name,NameValue};
|
||||
String[] ZipAssert={Zipcode,ZipcodeValue};
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",IdAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",NameAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",ZipAssert )), WAIT_TIME_MIN));
|
||||
OperationType="UPDATE";
|
||||
source="DStar_EnrichAgencyLocation";
|
||||
this.clickElementByXpath("//span[@class='x-tab-strip-inner']//span[text()='Data Browser']");
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.city", city)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.State", state)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.Region",region)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.MoreInfo",moreinfo)), WAIT_TIME_MIN));
|
||||
}
|
||||
public void updateRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue ,String Zipcode,String ZipcodeValue) {
|
||||
String city,state,region,moreinfo;
|
||||
String cityOld,stateOld,regionOld,moreinfoOld;
|
||||
String[] parametersZip={entity,Zipcode};
|
||||
OperationType="UPDATE";
|
||||
source="DStar_EnrichAgencyLocation";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
//get the old value
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(3000);
|
||||
cityOld=this.getValueInput(By.xpath("//input[@name='Agency/City']"));
|
||||
stateOld=this.getValueInput(By.xpath("//input[@name='Agency/State']"));
|
||||
regionOld=this.getValueInput(By.xpath("//input[@name='Agency/Region']"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath("//a[text()='Map']//following-sibling::img");
|
||||
moreinfoOld=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
this.sleepCertainTime(5000);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersZip)), ZipcodeValue);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
//get the value after update
|
||||
this.sleepCertainTime(5000);
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(5000);
|
||||
city=this.getValueInput(By.xpath("//input[@name='Agency/City']"));
|
||||
state=this.getValueInput(By.xpath("//input[@name='Agency/State']"));
|
||||
region=this.getValueInput(By.xpath("//input[@name='Agency/Region']"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath("//a[text()='Map']//following-sibling::img");
|
||||
this.sleepCertainTime(3000);
|
||||
moreinfo=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
//assert in the journal
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.city", cityOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.State", stateOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.Region",regionOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.MoreInfo",moreinfoOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.city", city)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.State", state)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.Region",region)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.MoreInfo",moreinfo)), WAIT_TIME_MIN));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Record;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class RecordImplAgent extends Record{
|
||||
String OperationType,key,source;
|
||||
|
||||
boolean result;
|
||||
|
||||
public RecordImplAgent(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public void selectAgentRecordBySearch(String entity,String fieldName,String agentID){
|
||||
this.searchCondition("Identifier", "is equal to", agentID);
|
||||
this.chooseRcord(entity, fieldName, agentID);
|
||||
}
|
||||
|
||||
public void deleteRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue){
|
||||
OperationType="PHYSICAL_DELETE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(8000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
this.sleepCertainTime(8000);
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
JournalResultCount();
|
||||
}
|
||||
public void createRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
String[] parametersFirstname={entity,Firstname};
|
||||
String[] parametersLastname={entity,Lastname};
|
||||
String[] parametersID={entity,Identifie};
|
||||
String[] parametersStartDate={entity,StartDate};
|
||||
String[] IdAssert={Identifie,IdentifieValue};
|
||||
String[] FirstnameAssert={Firstname,FirstnameValue};
|
||||
String[] LastnameAssert={Lastname,LastnameValue};
|
||||
String[] CommissionCodeAssert={CommissionCode,CommissionCodeValue};
|
||||
String[] StartDateAssert={StartDate,StartDateValue};
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersID), IdentifieValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFirstname), FirstnameValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersLastname), LastnameValue);
|
||||
this.clickElementByXpath("//input[@name='Agent/CommissionCode']//following-sibling::img");
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.click.CommissionCode", CommissionCodeValue));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersStartDate), StartDateValue);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.sleepCertainTime(10000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
this.sleepCertainTime(3000);
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",IdAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",FirstnameAssert)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",LastnameAssert)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",CommissionCodeAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",StartDateAssert)), WAIT_TIME_MIN));
|
||||
}
|
||||
|
||||
public void DuplicateRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue,String IdentifieValueDup,String Firstname,String FirstnameValue) {
|
||||
String[] parametersIDclose={entity,IdentifieValue};
|
||||
String[] parametersFirstname={entity,Firstname};
|
||||
String[] parametersID={entity,Identifie};
|
||||
String[] IdAssert={Identifie,IdentifieValueDup};
|
||||
String[] FirstnameAssert={Firstname,FirstnameValue};
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.click"));
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.Duplicate.close.origin",parametersIDclose));
|
||||
this.sleepCertainTime(3000);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersID)), IdentifieValueDup);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersFirstname)), FirstnameValue);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
//this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,Identifie,IdentifieValueDup);
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,IdentifieValueDup,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValueDup,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",IdAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",FirstnameAssert)), WAIT_TIME_MIN));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void UpdateRecordImpl(String container,String modle,String entity,String Identifie,String IdentifieValue,String CommissionCode,String CommissionCodeValue,String CommissionCodeValueUpdate) {
|
||||
String[] CommissionCodeAssert={CommissionCode,CommissionCodeValue};
|
||||
String[] CommissionCodeUpdateAssert={CommissionCode,CommissionCodeValueUpdate};
|
||||
OperationType="UPDATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.lastpage"));
|
||||
chooseRcord(entity,Identifie,IdentifieValue);
|
||||
this.sleepCertainTime(3000);
|
||||
//update the CommissionCodeValue
|
||||
this.clickElementByXpath("//input[@name='Agent/CommissionCode']//following-sibling::img");
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.click.CommissionCode", CommissionCodeValueUpdate));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
openJournal(entity,IdentifieValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(IdentifieValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
//assert the old and new value
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",CommissionCodeAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",CommissionCodeUpdateAssert )), WAIT_TIME_MIN));
|
||||
}
|
||||
|
||||
|
||||
public void createRecordWrongRuleImpl(String container,String modle,String entity,String Identifie,String IdentifieValue,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue ) {
|
||||
String[] parametersFirstname={entity,Firstname};
|
||||
String[] parametersLastname={entity,Lastname};
|
||||
String[] parametersID={entity,Identifie};
|
||||
String[] parametersStartDate={entity,StartDate};
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersID), IdentifieValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFirstname), FirstnameValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersLastname), LastnameValue);
|
||||
this.clickElementByXpath("//input[@name='Agent/CommissionCode']//following-sibling::img");
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.click.CommissionCode", CommissionCodeValue));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersStartDate), StartDateValue);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
if (this.isElementPresent(By.xpath("//span[contains(text(),'Unable to save item Agent., validation rule')]"), WAIT_TIME_MIN))
|
||||
{
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeCommissionCodeApprovedWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String Identifie,String agentID,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue){
|
||||
LogonImpl log = new LogonImpl(this.driver);
|
||||
log.logout();
|
||||
log.loginUserForce(userFrank, frankPass);
|
||||
String[] parametersID={entity,Identifie};
|
||||
chooseContainer(container);
|
||||
chooseModle(model);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.maxDataBrowserBoard();
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.sleepCertainTime(3000);
|
||||
|
||||
//verify that frank can not modify agent properties directly
|
||||
Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.commissioncode.input")).isEnabled(), "frank can not modify commission code test failed!");
|
||||
|
||||
//get the initial agent properties.commissionCode
|
||||
String initialCode = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input")));
|
||||
String initialStatus = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input")));
|
||||
logger.info("for agent :"+agentID+"The initial commission code is:"+initialCode+",the initial status is:"+initialStatus);
|
||||
this.maxARecordPanel();
|
||||
|
||||
//open journal to verify number of action entry for frank ,and update entry for administrator ,then close journal
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int beforeProcess = this.getElementsByXpath(locator.getString("xpath.journal.entry.action.frank")).size();
|
||||
int beforeProcessUpdateAdministrator = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("beforeProcess action entry for frank is:"+beforeProcess);
|
||||
logger.info("beforeProcess update entry for administrator is:"+beforeProcessUpdateAdministrator);
|
||||
this.closeJournal();
|
||||
|
||||
//frank launch com code change request process
|
||||
this.launchProcess("Com Change Request");
|
||||
this.checkProcessDoneAndClickOK();
|
||||
this.sleepCertainTime(3000);
|
||||
|
||||
//click the refresh button ,and check status change to pending
|
||||
this.clickElementByXpath(locator.getString("xpath.record.panel.refresh.button"));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.record.agent.comchange.processdone.clickrefresh.conform.info")), WAIT_TIME_MIN).isDisplayed());
|
||||
this.clickElementByXpath(locator.getString("xpath.record.agent.comchange.processdone.clickrefresh.conform.yes.button"));
|
||||
this.sleepCertainTime(5000);
|
||||
String statusBeforeSubmitAfterProcess = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input"))).trim();
|
||||
logger.info("after process done ,status expected is pending, infact it is :"+statusBeforeSubmitAfterProcess);
|
||||
Assert.assertFalse(initialStatus.equals(statusBeforeSubmitAfterProcess));
|
||||
Assert.assertTrue(statusBeforeSubmitAfterProcess.equals("pending"));
|
||||
|
||||
//open journal and verify number of action entry for frank +1, update entry for administrator +1 ,then close journal
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int afterProcess = this.getElementsByXpath(locator.getString("xpath.journal.entry.action.frank")).size();
|
||||
int afterProcessUpdateAdministrator = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("afterProcess action entry for frank is :"+afterProcess);
|
||||
logger.info("afterProcess update entry for administrator is :"+afterProcessUpdateAdministrator);
|
||||
Assert.assertTrue(afterProcess-beforeProcess==1);
|
||||
Assert.assertTrue(afterProcessUpdateAdministrator-beforeProcessUpdateAdministrator==1);
|
||||
|
||||
//check action entry in data changes viewer for frank
|
||||
OperationType="ACTION";
|
||||
source="genericUI";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, initialCode, true);
|
||||
this.closeDatachangesViewer();
|
||||
|
||||
//check update ectry in data changes viewer for administrator
|
||||
OperationType="UPDATE";
|
||||
source="workflow";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("Status", initialStatus, statusBeforeSubmitAfterProcess, false);
|
||||
this.closeDatachangesViewer();
|
||||
this.closeJournal();
|
||||
|
||||
//for frank ,open workflow created and change the commission code ,then submit
|
||||
WorkFlowTaskImpl flow = new WorkFlowTaskImpl(this.driver);
|
||||
flow.openMenuGoven();
|
||||
flow.openMenuWorkFlowTask();
|
||||
this.sleepCertainTime(5000);
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
this.sleepCertainTime(10000);
|
||||
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.firstname.input")).isEnabled(), "frank can not modify first name in opened task test failed!");
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.lastname.input")).isEnabled(), "frank can not modify last name in opened task test failed!");
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.identifer.input")).isEnabled(), "frank can not modify identifer in opened task test failed!");
|
||||
String codeSubmitted = flow.changeAgentCommissionCodeValidImpl(Integer.parseInt(initialCode), 2);
|
||||
this.sleepCertainTime(10000);
|
||||
|
||||
//close data browser first,to check status and commission code is not changed
|
||||
this.closeDataBrowser();
|
||||
flow.uncheckHideFinishedTask();
|
||||
flow.clickSearch();
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
flow.openRelatedRecord();
|
||||
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input"))).equals(initialCode), "test frank can not change commission code directly failed");
|
||||
Assert.assertTrue(this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input"))).trim().equals("pending"));
|
||||
flow.closeRelatedAgentRecord();
|
||||
|
||||
//reopen data browser from welcome page
|
||||
this.switchtoTabWelcome();
|
||||
this.openDataBrowserFromWelcome();
|
||||
this.sleepCertainTime(5000);
|
||||
this.switchtoTabDataBrowser();
|
||||
this.chooseEntityDirectlyInDataBrowser(entity);
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.maxARecordPanel();
|
||||
this.openJournalFromDataBrowser();
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, initialCode, true);
|
||||
|
||||
//logout frank ,login jennifer
|
||||
log.logout();
|
||||
log.loginUserForce( userJennifer, jenniferPass);
|
||||
chooseContainer(container);
|
||||
chooseModle(model);
|
||||
clickSave();
|
||||
this.chooseEntity(entity);
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int beforeApprove = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("beforeApprove ,the update entry for administrator is :"+beforeApprove);
|
||||
this.closeJournal();
|
||||
//open work flow task page
|
||||
flow.openMenuGoven();
|
||||
flow.openMenuWorkFlowTask();
|
||||
this.sleepCertainTime(10000);
|
||||
//sort work flow task by date and open the first work
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
|
||||
|
||||
//jennifer approved and submit
|
||||
flow.approveCommissionCodeChange("yes");
|
||||
flow.clickSubmit();
|
||||
this.waitfor(By.xpath(locator.getString("xpath.workflowtask.open.produce.submited.success.info")), WAIT_TIME_MID);
|
||||
this.clickElementByXpath(locator.getString("xpath.workflowtask.open.product.submited.success.ok.button"));
|
||||
this.sleepCertainTime(5000);
|
||||
|
||||
flow.uncheckHideFinishedTask();
|
||||
flow.clickSearch();
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
this.sleepCertainTime(3000);
|
||||
flow.openAWorkTask();
|
||||
this.sleepCertainTime(10000);
|
||||
flow.openRelatedRecord();
|
||||
this.sleepCertainTime(10000);
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.workflowtask.agent.openrelatedrecord.open.closeTab")), WAIT_TIME_MIN)!=null);
|
||||
|
||||
//verify commission code is really changed.
|
||||
//close the data browser first ,for xpath duplicated
|
||||
this.closeDataBrowser();
|
||||
this.sleepCertainTime(3000);
|
||||
String codeApproved = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input")));
|
||||
logger.info("afterapproved ,the commission code is:"+codeApproved);
|
||||
// Assert.assertTrue(price.equals(priceSubmited));
|
||||
Assert.assertTrue(codeApproved.equals(codeSubmitted));
|
||||
Assert.assertFalse(codeApproved.equals(initialCode));
|
||||
|
||||
//reopen data browser
|
||||
this.clickElementByXpath("//span[contains(@class,'x-panel-header-text') and text()='Home']");
|
||||
this.clickElementByXpath("//div[contains(@id,'menu-browserecords')]");
|
||||
this.chooseEntity(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
|
||||
//close the record opened
|
||||
flow.closeRelatedAgentRecord();
|
||||
|
||||
//close the work task
|
||||
flow.closeAWorkTask();
|
||||
|
||||
//verify in journal that an update entry for jennifer added
|
||||
this.switchtoTabDataBrowser();
|
||||
this.sleepCertainTime(3000);
|
||||
this.maxDataBrowserBoard();
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.sleepCertainTime(5000) ;
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int afterApprove = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("afterApprove,the update entry for administrator is :"+afterApprove);
|
||||
Assert.assertTrue(afterApprove-beforeApprove==1);
|
||||
|
||||
OperationType="UPDATE";
|
||||
source="workflow";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, codeSubmitted, false);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("Status", statusBeforeSubmitAfterProcess, initialStatus, false);
|
||||
//close datachangesviewer page.
|
||||
this.closeDatachangesViewer();
|
||||
this.closeJournal();
|
||||
}
|
||||
|
||||
|
||||
public void changeCommissionCodeNotApprovedWorkflow(String userFrank,String frankPass,String userJennifer,String jenniferPass,String container,String model,String entity,String Identifie,String agentID,String Firstname,String FirstnameValue,String Lastname,String LastnameValue,String CommissionCode,String CommissionCodeValue,String StartDate,String StartDateValue){
|
||||
LogonImpl log = new LogonImpl(this.driver);
|
||||
log.logout();
|
||||
log.loginUserForce(userFrank, frankPass);
|
||||
String[] parametersID={entity,Identifie};
|
||||
chooseContainer(container);
|
||||
chooseModle(model);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
this.maxDataBrowserBoard();
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.sleepCertainTime(3000);
|
||||
|
||||
//verify that frank can not modify agent properties directly
|
||||
Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.commissioncode.input")).isEnabled(), "frank can not modify commission code test failed!");
|
||||
|
||||
//get the initial agent properties.commissionCode
|
||||
String initialCode = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input")));
|
||||
String initialStatus = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input")));
|
||||
logger.info("for agent :"+agentID+"The initial commission code is:"+initialCode+",the initial status is:"+initialStatus);
|
||||
this.maxARecordPanel();
|
||||
|
||||
//open journal to verify number of action entry for frank ,and update entry for administrator ,then close journal
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int beforeProcess = this.getElementsByXpath(locator.getString("xpath.journal.entry.action.frank")).size();
|
||||
int beforeProcessUpdateAdministrator = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("beforeProcess action entry for frank is:"+beforeProcess);
|
||||
logger.info("beforeProcess update entry for administrator is:"+beforeProcessUpdateAdministrator);
|
||||
this.closeJournal();
|
||||
|
||||
//frank launch com code change request process
|
||||
this.launchProcess("Com Change Request");
|
||||
this.checkProcessDoneAndClickOK();
|
||||
this.sleepCertainTime(3000);
|
||||
|
||||
//click the refresh button ,and check status change to pending
|
||||
this.clickElementByXpath(locator.getString("xpath.record.panel.refresh.button"));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.record.agent.comchange.processdone.clickrefresh.conform.info")), WAIT_TIME_MIN).isDisplayed());
|
||||
this.clickElementByXpath(locator.getString("xpath.record.agent.comchange.processdone.clickrefresh.conform.yes.button"));
|
||||
this.sleepCertainTime(5000);
|
||||
String statusBeforeSubmitAfterProcess = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input"))).trim();
|
||||
logger.info("after process done ,status expected is pending, infact it is :"+statusBeforeSubmitAfterProcess);
|
||||
Assert.assertFalse(initialStatus.equals(statusBeforeSubmitAfterProcess));
|
||||
Assert.assertTrue(statusBeforeSubmitAfterProcess.equals("pending"));
|
||||
|
||||
//open journal and verify number of action entry for frank +1, update entry for administrator +1 ,then close journal
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int afterProcess = this.getElementsByXpath(locator.getString("xpath.journal.entry.action.frank")).size();
|
||||
int afterProcessUpdateAdministrator = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("afterProcess action entry for frank is :"+afterProcess);
|
||||
logger.info("afterProcess update entry for administrator is :"+afterProcessUpdateAdministrator);
|
||||
Assert.assertTrue(afterProcess-beforeProcess==1);
|
||||
Assert.assertTrue(afterProcessUpdateAdministrator-beforeProcessUpdateAdministrator==1);
|
||||
|
||||
//check action entry in data changes viewer for frank
|
||||
OperationType="ACTION";
|
||||
source="genericUI";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, initialCode, true);
|
||||
this.closeDatachangesViewer();
|
||||
|
||||
//check update ectry in data changes viewer for administrator
|
||||
OperationType="UPDATE";
|
||||
source="workflow";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("Status", initialStatus, statusBeforeSubmitAfterProcess, false);
|
||||
this.closeDatachangesViewer();
|
||||
this.closeJournal();
|
||||
|
||||
//for frank ,open workflow created and change the commission code ,then submit
|
||||
WorkFlowTaskImpl flow = new WorkFlowTaskImpl(this.driver);
|
||||
flow.openMenuGoven();
|
||||
flow.openMenuWorkFlowTask();
|
||||
this.sleepCertainTime(5000);
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
this.sleepCertainTime(10000);
|
||||
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.firstname.input")).isEnabled(), "frank can not modify first name in opened task test failed!");
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.lastname.input")).isEnabled(), "frank can not modify last name in opened task test failed!");
|
||||
// Assert.assertFalse(this.getElementByXpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.identifer.input")).isEnabled(), "frank can not modify identifer in opened task test failed!");
|
||||
String codeSubmitted = flow.changeAgentCommissionCodeValidImpl(Integer.parseInt(initialCode), 2);
|
||||
this.sleepCertainTime(10000);
|
||||
|
||||
//close data browser first,to check status and commission code is not changed
|
||||
this.closeDataBrowser();
|
||||
flow.uncheckHideFinishedTask();
|
||||
flow.clickSearch();
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
this.sleepCertainTime(10000);
|
||||
flow.openRelatedRecord();
|
||||
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input"))).equals(initialCode), "test frank can not change commission code directly failed");
|
||||
Assert.assertTrue(this.getValueInput(By.xpath(locator.getString("xpath.record.agent.status.input"))).trim().equals("pending"));
|
||||
flow.closeRelatedAgentRecord();
|
||||
|
||||
//reopen data browser from welcome page
|
||||
this.switchtoTabWelcome();
|
||||
this.openDataBrowserFromWelcome();
|
||||
this.sleepCertainTime(5000);
|
||||
this.switchtoTabDataBrowser();
|
||||
this.chooseEntityDirectlyInDataBrowser(entity);
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.maxARecordPanel();
|
||||
this.openJournalFromDataBrowser();
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, initialCode, true);
|
||||
|
||||
//logout frank ,login jennifer
|
||||
log.logout();
|
||||
log.loginUserForce( userJennifer, jenniferPass);
|
||||
chooseContainer(container);
|
||||
chooseModle(model);
|
||||
clickSave();
|
||||
this.chooseEntity(entity);
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int beforeApprove = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("beforeApprove ,the update entry for administrator is :"+beforeApprove);
|
||||
this.closeJournal();
|
||||
//open work flow task page
|
||||
flow.openMenuGoven();
|
||||
flow.openMenuWorkFlowTask();
|
||||
this.sleepCertainTime(10000);
|
||||
//sort work flow task by date and open the first work
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
flow.openAWorkTask();
|
||||
|
||||
|
||||
//jennifer not approved and submit
|
||||
flow.approveCommissionCodeChange("no");
|
||||
flow.clickSubmit();
|
||||
this.waitfor(By.xpath(locator.getString("xpath.workflowtask.open.produce.submited.success.info")), WAIT_TIME_MID);
|
||||
this.clickElementByXpath(locator.getString("xpath.workflowtask.open.product.submited.success.ok.button"));
|
||||
this.sleepCertainTime(5000);
|
||||
|
||||
flow.uncheckHideFinishedTask();
|
||||
flow.clickSearch();
|
||||
flow.sortWorkFlowTaskBydate();
|
||||
this.sleepCertainTime(3000);
|
||||
flow.openAWorkTask();
|
||||
this.sleepCertainTime(10000);
|
||||
flow.openRelatedRecord();
|
||||
this.sleepCertainTime(10000);
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.workflowtask.agent.openrelatedrecord.open.closeTab")), WAIT_TIME_MIN)!=null);
|
||||
|
||||
//verify commission code is really changed.
|
||||
//close the data browser first ,for xpath duplicated
|
||||
this.closeDataBrowser();
|
||||
this.sleepCertainTime(3000);
|
||||
String codeApproved = this.getValueInput(By.xpath(locator.getString("xpath.record.agent.commissioncode.input")));
|
||||
logger.info("afterapproved ,the commission code is:"+codeApproved);
|
||||
// Assert.assertTrue(price.equals(priceSubmited));
|
||||
Assert.assertTrue(codeApproved.equals(initialCode));
|
||||
Assert.assertFalse(codeApproved.equals(codeSubmitted));
|
||||
|
||||
//reopen data browser
|
||||
this.clickElementByXpath("//span[contains(@class,'x-panel-header-text') and text()='Home']");
|
||||
this.clickElementByXpath("//div[contains(@id,'menu-browserecords')]");
|
||||
this.chooseEntity(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
|
||||
//close the record opened
|
||||
flow.closeRelatedAgentRecord();
|
||||
|
||||
//close the work task
|
||||
flow.closeAWorkTask();
|
||||
|
||||
//verify in journal that an update entry for jennifer added
|
||||
this.switchtoTabDataBrowser();
|
||||
this.sleepCertainTime(3000);
|
||||
this.maxDataBrowserBoard();
|
||||
this.selectAgentRecordBySearch(entity,Identifie,agentID);
|
||||
this.sleepCertainTime(5000) ;
|
||||
this.openJournalFromDataBrowser();
|
||||
this.sleepCertainTime(5000);
|
||||
int afterApprove = this.getElementsByXpath(locator.getString("xpath.journal.entry.update.administrator")).size();
|
||||
logger.info("afterApprove,the update entry for administrator is :"+afterApprove);
|
||||
Assert.assertTrue(afterApprove-beforeApprove==0);
|
||||
|
||||
OperationType="UPDATE";
|
||||
source="workflow";
|
||||
this.JournalCheckResult(agentID, OperationType);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("CommissionCode", initialCode, initialCode, true);
|
||||
this.checkPropertiesBeforeAfterInDatachangesViewer("Status", statusBeforeSubmitAfterProcess, "rejected", false);
|
||||
//close datachangesviewer page.
|
||||
this.closeDatachangesViewer();
|
||||
this.closeJournal();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,262 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Record;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class RecordImplProductFamily extends Record{
|
||||
String OperationType,key,source;
|
||||
|
||||
boolean result;
|
||||
|
||||
public RecordImplProductFamily(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void ExportRecordImpl(String container,String modle,String entity){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
clickExport();
|
||||
this.sleepCertainTime(8000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void restoreFromRecycleImpl(String container,String modle,String entity,String feild2Value,String feild2Name){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
clickRecycle();
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.recycle.click.record",feild2Value));
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.recycle.click.record.restore",feild2Value));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.recycle.click.record.restore.yes"));
|
||||
if (this.isElementPresent(By.xpath("//span[contains(text(),'Please input all necessary search ')]"),WAIT_TIME_MIN)){
|
||||
this.clickElementByXpath("//button[text()='Ok']");}
|
||||
//assert the record restore in the entity
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.databrowser"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.entity.arrows"));
|
||||
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.entity",entity)), WAIT_TIME_MIN);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.entity",entity));
|
||||
this.sleepCertainTime(5000);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parameters={entity,feild2Name,feild2Value};
|
||||
//this.clickElementByXpath(this.getString(locator, "xpath.record.choose.delete.record",parameters));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.delete.record",parameters)), WAIT_TIME_MIN),"the record restore in the entity");
|
||||
chooseRcord(entity,feild2Name,feild2Value);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
}
|
||||
public void deleteRecordImpl(String container,String modle,String entity,String feild2Value,String feild2Name,String feild1Name){
|
||||
OperationType="PHYSICAL_DELETE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild1={entity,feild2Name,feild2Value,entity,feild1Name};
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,feild2Name,feild2Value);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1)));
|
||||
logger.info(key);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,key,OperationType,source);
|
||||
JournalResultCount();
|
||||
}
|
||||
|
||||
public void deleteRecordToRecycleImpl(String container,String modle,String entity,String feild2Value,String feild2Name,String feild1Name){
|
||||
OperationType="LOGIC_DELETE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parameters_container={feild2Value,container};
|
||||
String[] parameters_modle={feild2Value,modle};
|
||||
String[] parameters_entity={feild2Value,entity};
|
||||
String[] parametersFeild1={entity,feild2Name,feild2Value,entity,feild1Name};
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,feild2Name,feild2Value);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1)));
|
||||
this.sleepCertainTime(5000);
|
||||
logger.info(this.getString(locator, "xpath.record.delete.record",entity));
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.delete.record",entity));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.choose"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.choose.ok"));
|
||||
if (this.isElementPresent(By.xpath(locator.getString("xpath.record.delete.record.warn")),WAIT_TIME_MIN)){
|
||||
this.clickElementByXpath("//button[text()='No']");
|
||||
}
|
||||
//go to journal to check
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,key,OperationType,source);
|
||||
// assert the record which been deleted in the recycle
|
||||
clickRecycle();
|
||||
//this.clickElementByXpath(locator.getString("xpath.record.delete.record.to.recycle.assert.clickRefresh"));
|
||||
this.sleepCertainTime(3000);
|
||||
logger.info(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.container",parameters_container));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.container",parameters_container)), WAIT_TIME_MIN ),"container");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.modle",parameters_modle)), WAIT_TIME_MIN ),"modle");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.delete.record.to.recycle.assert.entity",parameters_entity)), WAIT_TIME_MIN ),"entity");
|
||||
|
||||
}
|
||||
public void duplicateRecordImpl(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name,String feild1Name){
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild1={entity,feild2Name,feild2Value_old,entity,feild1Name};
|
||||
String[] parametersFeild1_dup={entity,feild2Name,feild2Value,entity,feild1Name};
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
String[] Feild2Value={feild2Name,feild2Value};
|
||||
this.sleepCertainTime(10000);
|
||||
chooseRcord(entity,feild2Name,feild2Value_old);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.click"));
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.Duplicate.input",parametersFeild2)), WAIT_TIME_MAX),"duplicateARecord");
|
||||
this.sleepCertainTime(5000);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1)));
|
||||
logger.info(key);
|
||||
String[] parametersFeild2Value={entity,key};
|
||||
String[] parametersFeild2ValueAssert={feild2Name,feild2Value};
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.Duplicate.close.origin",parametersFeild2Value));
|
||||
this.sleepCertainTime(5000);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersFeild2)), feild2Value);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
this.sleepCertainTime(5000);
|
||||
chooseRcord(entity,feild2Name,feild2Value);
|
||||
this.sleepCertainTime(5000);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1_dup)));
|
||||
logger.info(key);
|
||||
this.sleepCertainTime(3000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MAX),"createARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,key,OperationType,source);
|
||||
this.sleepCertainTime(3000);
|
||||
JournalCheckResult(key,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
logger.info(this.getString(locator, "xpath.record.ceate.jouranl",Feild2Value ));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",parametersFeild2ValueAssert )), WAIT_TIME_MIN));
|
||||
|
||||
}
|
||||
public void createRecordImpl(String container,String modle,String entity,String feild2Value,String feild2Name,String feild1Name){
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild1={entity,feild2Name,feild2Value,entity,feild1Name};
|
||||
String[] NameAssert={feild2Name,feild2Value};
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
logger.info(feild2Name);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.waitforElementDisplayed(By.xpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), WAIT_TIME_MAX);
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2), feild2Value);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.waitfor(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MIN).isDisplayed(),"createARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1)));
|
||||
String[] IdAssert={feild1Name,key};
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,key,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(key,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",IdAssert )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",NameAssert )), WAIT_TIME_MIN));
|
||||
|
||||
}
|
||||
public void updateRecordImpl(String container,String modle,String entity,String feild2Value_old,String feild2Value,String feild2Name,String feild1Name){
|
||||
OperationType="UPDATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
entity=entity.replaceAll(" ","");
|
||||
String[] parametersFeild2={entity,feild2Name};
|
||||
String[] parametersFeild2Assert={entity,feild2Name,feild2Value};
|
||||
String[] NameAssert={feild2Name,feild2Value};
|
||||
chooseRcord(entity,feild2Name,feild2Value_old);
|
||||
|
||||
String[] parametersFeild1={entity,feild2Name,feild2Value,entity,feild1Name};
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), 3000));
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersFeild2)), feild2Value);
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
if (this.isTextPresent("No change since last save")){
|
||||
this.clickElementByXpath("//button[text()='Ok']");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
this.sleepCertainTime(3000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersFeild2Assert)), WAIT_TIME_MAX),"updateARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
key=this.getValue(this.getElementByXpath(this.getString(locator,"xpath.record.get.uuid",parametersFeild1)));
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,key,OperationType,source);
|
||||
JournalCheckResult(key,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.jouranl",NameAssert )), WAIT_TIME_MIN));
|
||||
}
|
||||
}
|
||||
public void SearchRecordByValueImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
this.sleepCertainTime(3000);
|
||||
searchValueAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
public void SearchRecordByStringImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
this.sleepCertainTime(3000);
|
||||
searchStringAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
|
||||
public void SearchRecordByDateImpl(String container,String modle,String entity,String searchFeild,String opeartion,String value){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
searchCondition(searchFeild,opeartion,value);
|
||||
this.sleepCertainTime(3000);
|
||||
searchDateAssert(searchFeild,opeartion,value,entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Record;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class RecordImplStore extends Record{
|
||||
String OperationType,key,source;
|
||||
|
||||
|
||||
public RecordImplStore(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void ExportRecordImpl(String container,String modle,String entity){
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
clickExport();
|
||||
this.sleepCertainTime(8000);
|
||||
}
|
||||
|
||||
public void deleteRecordImpl(String container,String modle,String entity,String storeId,String storeIdValue){
|
||||
OperationType="PHYSICAL_DELETE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
chooseRcord(entity,storeId,storeIdValue);
|
||||
this.sleepCertainTime(5000);
|
||||
deleteTheRecord(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,storeIdValue,OperationType,source);
|
||||
JournalResultCount();
|
||||
}
|
||||
|
||||
public void testDuplicateRecordImpl(String container,String modle,String entity,String storeId,String storeIdValue,String storeIdValueDup) {
|
||||
String[] parametersStoreId={entity,storeId};
|
||||
String[] parametersStoreIdAssert={entity,storeId,storeIdValueDup};
|
||||
String[] parametersStoreIdValue={entity,storeIdValue};
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
this.sleepCertainTime(3000);
|
||||
chooseRcord(entity,storeId,storeIdValue);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.Duplicate.click"));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.Duplicate.close.origin",parametersStoreIdValue));
|
||||
this.sleepCertainTime(3000);
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.Duplicate.input",parametersStoreId)), storeIdValueDup);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
this.sleepCertainTime(10000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersStoreIdAssert)), WAIT_TIME_MAX),"duplicateARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,storeIdValueDup,OperationType,source);
|
||||
JournalCheckResult(storeIdValueDup,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.storeId",storeIdValueDup )), WAIT_TIME_MIN));
|
||||
}
|
||||
public void createRecordImpl(String container,String modle,String entity,String storeId,String storeIdValue,String address,String addressValue) {
|
||||
OperationType="CREATE";
|
||||
source="genericUI";
|
||||
String lat,longNew,map;
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
String[] parametersStoreId={entity,storeId};
|
||||
String[] parametersAddress={entity,address};
|
||||
String[] parametersStoreIdAssert={entity,storeId,storeIdValue};
|
||||
this.sleepCertainTime(8000);
|
||||
this.clickCreateRecord();
|
||||
// this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersStoreId),storeIdValue);
|
||||
this.typeTextByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersAddress), addressValue);
|
||||
this.sleepCertainTime(8000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.sleepCertainTime(8000);
|
||||
chooseRcord(entity,storeId,storeIdValue);
|
||||
lat=this.getValueInput(By.xpath("//input[@name='Store/Lat']"));
|
||||
longNew=this.getValueInput(By.xpath("//input[@name='Store/Long']"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath("//a[text()='Google Map']//following-sibling::img");
|
||||
map=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
this.sleepCertainTime(8000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.record.assert.feild2",parametersStoreIdAssert)), WAIT_TIME_MAX),"createARecord");
|
||||
this.sleepCertainTime(3000);
|
||||
openJournal(entity,storeIdValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(storeIdValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.storeId",storeIdValue )), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.ceate.address",addressValue )), WAIT_TIME_MIN));
|
||||
this.clickElementByXpath("//span[@class='x-tab-strip-inner']//span[text()='Data Browser']");
|
||||
OperationType="UPDATE";
|
||||
source="GoogleMap";
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,storeIdValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(storeIdValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
logger.info(this.getString(locator,"xpath.record.ceate.lat", lat));
|
||||
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.lat", lat)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.long", longNew)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.googleMap", map)), WAIT_TIME_MIN));
|
||||
|
||||
}
|
||||
|
||||
public void testUpdateAddressRecordImpl(String container,String modle,String entity,String storeId,String storeIdValue,String address,String addressValue) {
|
||||
OperationType="UPDATE";
|
||||
source="GoogleMap";
|
||||
String latOld,longOld,mapOld,lat,longNew,map;
|
||||
String[] parametersAddress={entity,address};
|
||||
chooseContainer(container);
|
||||
chooseModle(modle);
|
||||
clickSave();
|
||||
chooseEntity(entity);
|
||||
chooseRcord(entity,storeId,storeIdValue);
|
||||
this.sleepCertainTime(8000);
|
||||
//get the old value
|
||||
latOld=this.getValueInput(By.xpath("//input[@name='Store/Lat']"));
|
||||
longOld=this.getValueInput(By.xpath("//input[@name='Store/Long']"));
|
||||
this.clickElementByXpath("//a[text()='Google Map']//following-sibling::img");
|
||||
mapOld=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
this.sleepCertainTime(8000);
|
||||
//modify the address
|
||||
logger.info(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersAddress));
|
||||
this.modifyText(this.getElementByXpath(this.getString(locator, "xpath.record.choose.update.input.address",parametersAddress)), addressValue);
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create.input.save"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.refresh"));
|
||||
//get the update value
|
||||
chooseRcord(entity,storeId,storeIdValue);
|
||||
lat=this.getValueInput(By.xpath("//input[@name='Store/Lat']"));
|
||||
longNew=this.getValueInput(By.xpath("//input[@name='Store/Long']"));
|
||||
this.clickElementByXpath("//a[text()='Google Map']//following-sibling::img");
|
||||
map=this.getValueInput(By.xpath("//label[text()='Url:']//following-sibling::div//div//input"));
|
||||
this.clickElementByXpath("//button[text()='Cancel']");
|
||||
this.sleepCertainTime(8000);
|
||||
|
||||
this.sleepCertainTime(5000);
|
||||
openJournal(entity,storeIdValue,OperationType,source);
|
||||
this.sleepCertainTime(5000);
|
||||
JournalCheckResult(storeIdValue,OperationType);
|
||||
this.sleepCertainTime(5000);
|
||||
//assert the old and new value
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.lat", latOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.long", longOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.googleMap", mapOld)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.lat", lat)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.long", longNew)), WAIT_TIME_MIN));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.ceate.googleMap", map)), WAIT_TIME_MIN));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void openJournalFromDataBrowser(){
|
||||
this.clickJournal();
|
||||
}
|
||||
|
||||
public void closeJournal(){
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.journal.tab.close"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.modules.User;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class UserImpl extends User{
|
||||
public LogonImpl log;
|
||||
public UserImpl(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
log = new LogonImpl(this.driver);
|
||||
}
|
||||
|
||||
|
||||
public void logoutThenloginAdministratorAndDeleteUser(String userName,String userPassword,String message,String userDelete){
|
||||
log.logout();
|
||||
log.loginAdministrator(userName, userPassword, message);
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.deleteUser(userDelete);
|
||||
}
|
||||
|
||||
public void addUserImpl(String identifier,String firstName,String lastName,String password,String confirmPassword,
|
||||
String email, String company, String defaultVersion, boolean active, String[] roles){
|
||||
this.gotoUserManagePage();
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
}
|
||||
|
||||
protected void addUserWithinLicenseAllowed(String roles,int n) {
|
||||
logger.info("Start to add N users: ");
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
String identifier="testUser"+i;
|
||||
String password="password"+i;
|
||||
String confirmPassword=password;
|
||||
String firstName="testfirstName"+i;
|
||||
String lastName="testlastName"+i;
|
||||
String email="test@email"+i+".com";
|
||||
String company="testcompany"+i;
|
||||
String defaultVersion="testdefaultVersion";
|
||||
boolean active=true;
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
|
||||
}
|
||||
logger.info("N users added successfull! ");
|
||||
}
|
||||
|
||||
|
||||
public void addUserAllowed(String roles,int n){
|
||||
if(n!=0){
|
||||
this.gotoUserManagePage();
|
||||
this.addUserWithinLicenseAllowed(roles, n);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addUserOverAllowedAdmin(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles,int n){
|
||||
logger.info("click administration to display menu user manage");
|
||||
logger.info("click menu user manage");
|
||||
this.gotoUserManagePage();
|
||||
logger.info("user manage page opened!");
|
||||
logger.info("user manage page opened!");
|
||||
this.clickAddNewUser();
|
||||
logger.info("new user button clicked");
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
this.clickSave();
|
||||
logger.info("save new user button clicked");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("user.add.admin.over")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void addUserOverAllowedWeb(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles,int n){
|
||||
logger.info("click administration to display menu user manage");
|
||||
logger.info("click menu user manage");
|
||||
this.gotoUserManagePage();
|
||||
logger.info("user manage page opened!");
|
||||
logger.info("user manage page opened!");
|
||||
this.clickAddNewUser();
|
||||
logger.info("new user button clicked");
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
this.clickSave();
|
||||
logger.info("save new user button clicked");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("user.add.webuser.over")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
|
||||
public void addUserOverAllowedWebInactive(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion,boolean active,String roles,int n){
|
||||
logger.info("click administration to display menu user manage");
|
||||
logger.info("click menu user manage");
|
||||
Assert.assertTrue(n==0, "users within license!");
|
||||
this.gotoUserManagePage();
|
||||
logger.info("user manage page opened!");
|
||||
logger.info("user manage page opened!");
|
||||
this.clickAddNewUser();
|
||||
logger.info("new user button clicked");
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, splitParameter(roles));
|
||||
this.clickSaveAndCheckExpectedTrue(identifier);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.status", identifier));
|
||||
Assert.assertTrue(this.getValue(this.getElementByXpath(this.getString(locator, "xpath.user.status", identifier))).equals("false"), "Inactive user "+identifier+" added failed!");
|
||||
}
|
||||
|
||||
public void addUserWithMultipleRoles(String userTest,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.deleteAllUsersStartWith(userTest);
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
this.deleteUser(identifier);
|
||||
}
|
||||
|
||||
public void userSelectedAfterSave(String userNameAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
logger.info("Ready to test user selected after saved succefully.");
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
logger.info("expend administration and loged into user manage page ok.");
|
||||
logger.info("select user administrator at first.");
|
||||
this.selectAUser(userNameAdministrator);
|
||||
logger.info("select user administrator first ok.");
|
||||
logger.info("configure a new user and save.");
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
logger.info("configure a new user and saved ok.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.selecteduser.row", identifier)), WAIT_TIME_MAX));
|
||||
logger.info("test user selected after saved ok ,with new user selected.");
|
||||
this.deleteUser(identifier);
|
||||
logger.info("the new add user delete ok.");
|
||||
}
|
||||
|
||||
public void addUserWithMultipleRolesOneAllowedAnotherNot(String userNameAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.clickAddNewUser();
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
this.clickSave();
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("user.add.admin.over")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
public void addUserWithoutSelectRoles(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active){
|
||||
logger.info("Ready to test add user without select any roles");
|
||||
this.openMenuAdministrator();
|
||||
logger.info("open administration ok.");
|
||||
|
||||
this.gotoUserManagePage();
|
||||
logger.info("click user manage and log into user manage ok.");
|
||||
this.clickAddNewUser();
|
||||
logger.info("click add new user button ok.");
|
||||
this.confBaseUserInfo(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
logger.info("configure user's information without select roles ok.");
|
||||
this.clickSave();
|
||||
logger.info("save user button click ok.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.user.add.user.without.roles.warning")), WAIT_TIME_MAX));
|
||||
logger.info("test add user without select any roles ok , warning message appeared.");
|
||||
}
|
||||
|
||||
public void addUserWithPasswordNotEqualsConfirmPassword(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
logger.info("Ready to test add user with confiugre user password not equals to confirm password.");
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
logger.info("expend administration and loged into user manage page ok.");
|
||||
this.clickAddNewUser();
|
||||
logger.info("click add new user button ok.");
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
logger.info("configure user information with password not equals to confirm password ok");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.user.add.password.confirm.alert.img")), WAIT_TIME_MID));
|
||||
logger.info("test add user with configure user password not equals to confirm password ok ,alert img appeared .");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void addUserInactive(String userNameAdministrator,String userPassAdministrator,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.clickAddNewUser();
|
||||
this.configureUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, false, roles);
|
||||
this.clickSaveAndCheckExpectedTrue(identifier);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.status", identifier));
|
||||
Assert.assertTrue(this.getValue(this.getElementByXpath(this.getString(locator, "xpath.user.status", identifier))).equals("false"), "Inactive user "+identifier+" added failed!");
|
||||
}
|
||||
|
||||
public void activeAnUserInactive(String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String[] roles){
|
||||
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.status", identifier));
|
||||
Assert.assertTrue(this.getValue(this.getElementByXpath(this.getString(locator, "xpath.user.status", identifier))).equals("false"), "Inactive user "+identifier+" added failed!");
|
||||
this.clickActive();
|
||||
this.clickSave();
|
||||
this.clickFlushCacheOK();
|
||||
this.selectAUser(identifier);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.status", identifier));
|
||||
Assert.assertTrue(this.getValue(this.getElementByXpath(this.getString(locator, "xpath.user.status", identifier))).equals("true"), "Active user "+identifier+" failed!");
|
||||
|
||||
}
|
||||
|
||||
public void AddUserInactiveCheckLoginThenActive(String administrator,String adminPass,String identifier,String firstName,String lastName,String password,String confirmPassword,String email,String company,String defaultVersion, boolean active,String roles) {
|
||||
this.addUserInactive(administrator, adminPass, identifier,
|
||||
firstName, lastName, password, confirmPassword, email, company,
|
||||
defaultVersion, active, splitParameter(roles));
|
||||
log.logout();
|
||||
log.loginWithExistInactiveUserImpl(identifier, password, locator
|
||||
.getString("login.exist.user.inactive.allert.message"));
|
||||
log.loginAdministrator(administrator, adminPass, locator
|
||||
.getString("login.administrator.forcelogin.message"));
|
||||
this.activeAnUserInactive(identifier, firstName, lastName,
|
||||
password, confirmPassword, email, company, defaultVersion,
|
||||
active, splitParameter(roles));
|
||||
log.logout();
|
||||
log.loginAdministrator(identifier, password, locator
|
||||
.getString("login.administrator.forcelogin.message"));
|
||||
this.logoutThenloginAdministratorAndDeleteUser(administrator, adminPass, locator.getString("login.administrator.forcelogin.message"), identifier);
|
||||
}
|
||||
|
||||
public void flushCache(String userName,String cacheUrl){
|
||||
logger.info("Ready to test flush cache!");
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
logger.info("login ok and into user mange page ok.");
|
||||
WebDriver driver2 = this.initNewDriver();
|
||||
this.openURL(driver2, cacheUrl+locator.getString("flushcache.url"));
|
||||
this.sleepCertainTime(5000);
|
||||
logger.info("open url to check flush cache ok.");
|
||||
logger.info("first time check without click flush cache button.");
|
||||
this.typeString(this.findElementDefineDriver(driver2, By.xpath(locator.getString("xpath.user.flushcache.urlopen.parainput"))), locator.getString("flushcache.para"));
|
||||
this.findElementDefineDriver(driver2, By.xpath(locator.getString("xpath.user.flushcache.urlopen.para.submit"))).click();
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertTrue(driver2.findElement(By.tagName("body")).getText().contains(userName));
|
||||
logger.info("first time checked ok ,with string administrator appear");
|
||||
logger.info("second time ,select user adminisrator and click flush cache button");
|
||||
this.selectAUser(userName);
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickFlushCacheButton();
|
||||
this.clickFlushCacheOK();
|
||||
logger.info("second time click flush cache button ok.");
|
||||
driver2.navigate().back();
|
||||
logger.info("driver2 controls browser back again.");
|
||||
this.typeString(this.findElementDefineDriver(driver2, By.xpath(locator.getString("xpath.user.flushcache.urlopen.parainput"))), locator.getString("flushcache.para"));
|
||||
this.findElementDefineDriver(driver2, By.xpath(locator.getString("xpath.user.flushcache.urlopen.para.submit"))).click();
|
||||
this.sleepCertainTime(5000);
|
||||
Assert.assertFalse(driver2.findElement(By.tagName("body")).getText().contains(userName));
|
||||
logger.info("second time check with click flush cache button ok,string administraor not appeared.");
|
||||
driver2.quit();
|
||||
logger.info("driver2 controls browser to quit.");
|
||||
|
||||
}
|
||||
|
||||
public void addUserWithCustomizeRoles(String administrator,String administratorPass,String identifier, String firstName, String lastName, String password, String confirmPassword, String email, String company,String defaultVersion,boolean active, String rolesCustomize,String rolesSystem){
|
||||
|
||||
logger.info("Ready to test add user with customized roles");
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
logger.info("login ok and into user mange page ok.");
|
||||
this.clickAddNewUser();
|
||||
logger.info("click add new user ok.");
|
||||
logger.info("ready to configure new user's base infomation.");
|
||||
this.confBaseUserInfo(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
logger.info(" user's base infomation configure ok.");
|
||||
this.selectRoles(rolesCustomize);
|
||||
logger.info("add demo roles only for user ok.");
|
||||
this.clickSave();
|
||||
logger.info("user save button click ok.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.user.add.user.without.system.roles.warning")), WAIT_TIME_MAX));
|
||||
logger.info("warning information let you to add system roles appear ok.");
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.user.without.system.roles.warning.ok"));
|
||||
this.selectRoles(rolesSystem);
|
||||
logger.info("click ok button and select a system role for user");
|
||||
this.clickSaveAndCheckExpectedTrue(identifier);
|
||||
logger.info("after select a system role for user and click save user button ,checked new user added ok.");
|
||||
log.logout();
|
||||
log.loginUserForce(identifier, password);
|
||||
this.logoutThenloginAdministratorAndDeleteUser(administrator, administratorPass, locator.getString("login.administrator.forcelogin.message"), identifier);
|
||||
|
||||
}
|
||||
|
||||
public void userLoginWithNewRole(String userNameAdministrator,String adminPass,String identifier, String firstName,String lastName, String password, String confirmPassword, String email,String company, String defaultVersion, boolean active, String roles){
|
||||
|
||||
logger.info("Ready to test user login with new role.");
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
logger.info("expend administration and loged into user manage page ok.");
|
||||
logger.info("configure a new user and save.");
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
logger.info("configure a new user and saved ok.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.selecteduser.row", identifier)), WAIT_TIME_MAX));
|
||||
logger.info("new user added ok,ready to check new user login.");
|
||||
log.logout();
|
||||
log.loginUserForce(identifier, password);
|
||||
logger.info("test login with new user ok.");
|
||||
logger.info("login administrator and delete the new user added just now.");
|
||||
this.logoutThenloginAdministratorAndDeleteUser(userNameAdministrator, adminPass, locator.getString("login.administrator.forcelogin.message"), identifier);
|
||||
logger.info("delete the new user added ok.");
|
||||
}
|
||||
|
||||
public void readOnlyAccessForViewer(String userNameAdministrator,String adminPass,String identifier, String firstName,String lastName, String password, String confirmPassword, String email,String company, String defaultVersion, boolean active, String roles,String container,String modle,String entity,String UniqueId,String Name,String Description,String Price){
|
||||
RecordImplProduct rec = new RecordImplProduct(this.driver);
|
||||
this.openMenuAdministrator();
|
||||
this.gotoUserManagePage();
|
||||
this.addUser(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active, roles);
|
||||
log.logout();
|
||||
log.loginUserForce(identifier, password);
|
||||
rec.chooseContainer(container);
|
||||
rec.chooseModle(modle);
|
||||
rec.clickSave();
|
||||
rec.chooseEntity(entity);
|
||||
this.sleepCertainTime(5000);
|
||||
rec.clickCreateRecord();
|
||||
String[] parametersUniqueId={entity,UniqueId};
|
||||
String[] parametersName={entity,Name};
|
||||
String[] parametersDescription={entity,Description};
|
||||
String[] parametersPrice={entity,Price};
|
||||
Assert.assertFalse(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersUniqueId)).isEnabled());
|
||||
Assert.assertFalse(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersName)).isEnabled());
|
||||
Assert.assertFalse(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersDescription)).isEnabled());
|
||||
Assert.assertFalse(this.getElementByXpath(this.getString(locator, "xpath.record.choose.create.input.feild2",parametersPrice)).isEnabled());
|
||||
this.logoutThenloginAdministratorAndDeleteUser(userNameAdministrator, adminPass, locator.getString("login.administrator.forcelogin.message"), identifier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.modules.Welcome;
|
||||
|
||||
public class WelcomeImpl extends Welcome{
|
||||
|
||||
public WelcomeImpl(WebDriver driver) {
|
||||
super(driver);
|
||||
this.driver = driver;
|
||||
|
||||
}
|
||||
|
||||
public void reSortWindows(){
|
||||
this.checkGetStartedWindow();
|
||||
this.reSortWindowLayout("xpath.ui.window.getstarted.title","xpath.ui.window.search.title",0,20);
|
||||
this.checkAlertsWindow();
|
||||
this.reSortWindowLayout("xpath.ui.window.processes.title","xpath.ui.window.alerts.title", 0, 20);
|
||||
this.checkSearchWindow();
|
||||
this.reSortWindowLayout("xpath.ui.window.search.title", "xpath.ui.window.alerts.title", 0, 20);
|
||||
this.checkTasksWindow();
|
||||
this.reSortWindowLayout("xpath.ui.window.alerts.title", "xpath.ui.window.getstarted.title", 0,20);
|
||||
this.checkProcessWindow();
|
||||
}
|
||||
|
||||
public void openWorkFlowTaskFromWelcome(){
|
||||
this.checkTasksWindow();
|
||||
this.openTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.talend.mdm.impl;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.talend.mdm.modules.DataSteward;
|
||||
import org.talend.mdm.modules.User;
|
||||
import org.talend.mdm.modules.WorkFlowTask;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class WorkFlowTaskImpl extends WorkFlowTask{
|
||||
|
||||
public WorkFlowTaskImpl(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public String changeProductPriceValidImpl(double d,double e){
|
||||
double value = d*(1+e-0.05);
|
||||
this.typeString(this.getElementByXpath("//label[text()='Price:']//ancestor::div[contains(@class,'x-form-item ')]//input"), value+"");
|
||||
String submited = this.getValueInput(By.xpath("//label[text()='Price:']//ancestor::div[contains(@class,'x-form-item ')]//input"));
|
||||
this.clickSubmit();
|
||||
this.waitfor(By.xpath("//span[contains(text(),'Successfully submitted.')]"), WAIT_TIME_MID);
|
||||
this.clickElementByXpath("//span[contains(text(),'Successfully submitted.')]//ancestor::div[contains(@class,'x-window-bwrap')]//button[text()='OK']");
|
||||
return submited.substring(0,5);
|
||||
}
|
||||
|
||||
public String changeAgentCommissionCodeValidImpl(int initialCode,int step){
|
||||
int code = initialCode+step;
|
||||
this.seletDropDownList(By.xpath(locator.getString("xpath.record.agent.comchangeworkflow.taskopened.commissioncode.dropdownlist.arrow")), code+"");
|
||||
this.clickSubmit();
|
||||
this.waitfor(By.xpath("//span[contains(text(),'Successfully submitted.')]"), WAIT_TIME_MID);
|
||||
this.clickElementByXpath("//span[contains(text(),'Successfully submitted.')]//ancestor::div[contains(@class,'x-window-bwrap')]//button[text()='OK']");
|
||||
return code+"";
|
||||
}
|
||||
|
||||
public String changeProductPriceInvalidImpl(double d,double e){
|
||||
double value = d*(1+e+0.15);
|
||||
this.typeString(this.getElementByXpath("//label[text()='Price:']//ancestor::div[contains(@class,'x-form-item ')]//input"), value+"");
|
||||
String submited = this.getValueInput(By.xpath("//label[text()='Price:']//ancestor::div[contains(@class,'x-form-item ')]//input"));
|
||||
this.clickSubmit();
|
||||
this.waitfor(By.xpath("//span[contains(text(),'Successfully submitted.')]"), WAIT_TIME_MID);
|
||||
this.clickElementByXpath("//span[contains(text(),'Successfully submitted.')]//ancestor::div[contains(@class,'x-window-bwrap')]//button[text()='OK']");
|
||||
return submited.substring(0,5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package org.talend.mdm.modules;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.RenderingHints.Key;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriverBackedSelenium;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.remote.ExecuteMethod;
|
||||
import org.talend.mdm.Base;
|
||||
import org.talend.mdm.impl.LogonImpl;
|
||||
import org.testng.Assert;
|
||||
|
||||
import com.thoughtworks.selenium.Selenium;
|
||||
|
||||
|
||||
public class DataSteward extends Base{
|
||||
|
||||
|
||||
|
||||
public void switchDriver(WebDriver dri){
|
||||
|
||||
this.driver=dri;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void openMenuGoven() {
|
||||
|
||||
this.waitfor(By.xpath(locator.getString("xpath.menu.goven")), WAIT_TIME_MIN);
|
||||
this.clickElementByXpath(locator.getString("xpath.menu.goven"));
|
||||
|
||||
}
|
||||
|
||||
public void openMenuDSC() {
|
||||
|
||||
this.waitfor(By.id(locator.getString("id.menu.datastewardship")), WAIT_TIME_MIN);
|
||||
this.clickElementById(locator.getString("id.menu.datastewardship"));
|
||||
|
||||
}
|
||||
|
||||
public void selectATaskByNameInCommonAlltasks(String taskName){
|
||||
this.clickTaskNavigatorCommonAllTasks();
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.datatewardshipconsole.tasks.list.byname.row",taskName));
|
||||
}
|
||||
|
||||
public void taskAssignToUser(String userName){
|
||||
this.clickTaskNavigatorAdministrationAssignTasks();
|
||||
this.clickElementByXpath("//div[contains(@class,'x-view x-component')]//td[contains(text(),'user')]//ancestor::tr//input[contains(@class,'x-view-item-checkbox')]");
|
||||
this.clickElementByXpath("//div[contains(@class,'x-view x-component')]//ancestor::div[contains(@class,'x-window-bwrap')]//button[contains(text(),'Ok')]");
|
||||
|
||||
}
|
||||
|
||||
public void clickTaskNavigatorAdministrationCreateTask() {
|
||||
this.clickElementByXpath("//span[contains(text(),'Task Navigator')]//ancestor::div[contains(@class,'x-panel-noborder x-panel x-component')]//div[contains(@class,'x-icon-btn x-nodrag icon-reload x-component')]");
|
||||
this.waitfor(By.xpath(locator.getString("xpath.datatewardship.administration.createtask")), WAIT_TIME_MIN);
|
||||
logger.info("create task button xpath is :"+locator.getString("xpath.datatewardship.administration.createtask"));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask"));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.datatewardship.administration.createtask.panel.title")), WAIT_TIME_MIN)!=null,"open create task panel failed!");
|
||||
|
||||
}
|
||||
|
||||
public void clickTaskNavigatorAdministrationAssignTasks() {
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.assigntasks"));
|
||||
logger.info("Task navigator Assigh tasks click ok.");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.datatewardship.assigntasks.window.title")), WAIT_TIME_MIN).isDisplayed());
|
||||
logger.info("Task navigator Assign tasks click ok ,and assign task pannel opened ok.");
|
||||
}
|
||||
|
||||
public void clickTaskNavigatorCommonNewTasks() {
|
||||
this.clickElementByXpath(locator
|
||||
.getString("xpath.datatewardship.common.newtasks"));
|
||||
logger.info("Task navigator New tasks click ok.");
|
||||
}
|
||||
|
||||
public void clickTaskNavigatorCommonAllTasks() {
|
||||
this.clickElementByXpath(locator
|
||||
.getString("xpath.datatewardship.common.alltasks"));
|
||||
logger.info("Task navigator All tasks click ok.");
|
||||
}
|
||||
|
||||
public void typeTaskName(String taskName){
|
||||
|
||||
this.typeString(this.getElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskproperties.taskname.input")), taskName);
|
||||
|
||||
}
|
||||
|
||||
public void typeTaskDefaultSourceName(String source){
|
||||
|
||||
this.typeString(this.getElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskproperties.sourcename.input")), source);
|
||||
|
||||
}
|
||||
|
||||
public void selectTaskType(String taskType){
|
||||
|
||||
this.seletDropDownList(By.xpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskproperties.tasktype.arrow")), taskType);
|
||||
|
||||
}
|
||||
|
||||
public void clickAddColumButton(){
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.add.button"));
|
||||
|
||||
}
|
||||
|
||||
public void clickSaveColumButton(){
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskschemadata.save.button"));
|
||||
|
||||
}
|
||||
|
||||
public void keyBoardTypeString(int key){
|
||||
Robot a;
|
||||
try {
|
||||
a = new Robot();
|
||||
a.keyPress(key);
|
||||
} catch (AWTException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void typeColumFieldName(String fieldName){
|
||||
Assert.assertTrue(this.driver.findElement(By.xpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskschemadata.fieldname.input"))).isEnabled());
|
||||
|
||||
WebElement e = this.driver.findElement(By.xpath("//span[contains(@class,'x-fieldset-header-text') and text()='Task properties']//ancestor::fieldset[contains(@class,'x-fieldset x-component')]//label[contains(text(),'Task Name:')]//ancestor::div[contains(@class,'x-window-mr')]//div[contains(@class,'x-row-editor-body x-box-layout-ct')]//div[contains(@class,'x-form-field-wrap x-row-editor-field x-component x-box-item') and contains(@gxt-dindex,'name')]"));
|
||||
|
||||
(new Actions(driver)).click(e);
|
||||
this.typeStringByRobot(fieldName);
|
||||
logger.info("#########################################################################"+this.getElementsByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskschemadata.fieldname.input")).size());
|
||||
logger.info(this.driver.findElement(By.xpath(locator.getString("xpath.datatewardship.administration.createtask.panel.taskschemadata.fieldname.input"))).getAttribute("value"));
|
||||
|
||||
}
|
||||
|
||||
public void clickOKOnTaskSchemaCreatPanel(){
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.ok.button"));
|
||||
logger.info("click task schema creation pannel Ok button");
|
||||
}
|
||||
|
||||
public void clickCANCELOnTaskSchemaCreatPanel(){
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.administration.createtask.panel.cancel.button"));
|
||||
logger.info("click task schema creation pannel cancel button");
|
||||
}
|
||||
|
||||
public void clickSaveOnTaskSchemaEditView(){
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.taskschemaeditview.save.button"));
|
||||
logger.info("click save button on task schema edit view ok.");
|
||||
}
|
||||
|
||||
public void checkTaskSchemaSaveSuccessAndClickOk(){
|
||||
|
||||
this.waitfor(By.xpath(locator.getString("xpath.datatewardship.taskschemaeditview.save.success.info")), WAIT_TIME_MIN).isDisplayed();
|
||||
logger.info("task schema saved ok promt appeared");
|
||||
this.clickElementByXpath(locator.getString("xpath.datatewardship.taskschemaeditview.save.success.ok.button"));
|
||||
logger.info("task schema saved ok button clicked.");
|
||||
}
|
||||
|
||||
public void typeStringByRobot(String value){
|
||||
for(int i = 0; i < value.length(); i++){
|
||||
char a =value.charAt(i);
|
||||
|
||||
int b = a-32;
|
||||
try {
|
||||
Robot r = new Robot();
|
||||
r.keyPress(b);
|
||||
r.keyRelease(b);
|
||||
} catch (AWTException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package org.talend.mdm.modules;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.talend.mdm.Base;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class License extends Base{
|
||||
|
||||
public License(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****
|
||||
* click menu license to jump to license page
|
||||
*/
|
||||
protected void openAdministration(){
|
||||
this.logger.info("open Administration page");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.Administration.menu")), WAIT_TIME_MAX));
|
||||
this.clickElementByXpath(locator.getString("xpath.Administration.menu"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****
|
||||
* click menu license to jump to license page
|
||||
*/
|
||||
protected void gotoLicensePage(){
|
||||
|
||||
this.clickElementByXpath("//span[text()='License']");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.edit")), this.WAIT_TIME_MAX));
|
||||
this.logger.info("go to license page ok");
|
||||
}
|
||||
|
||||
protected void uploadLicense(){
|
||||
|
||||
}
|
||||
|
||||
protected void clickEditlicenseKey(){
|
||||
logger.info("Read to click edit license key button.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.edit")), WAIT_TIME_MAX), "The button edit license key is not displayed right now.");
|
||||
this.clickElementByXpath(locator.getString("xpath.license.edit"));
|
||||
logger.info("click edit license key button ok");
|
||||
}
|
||||
|
||||
protected void clickBrowseLicenseButton(){
|
||||
logger.info("Read to click browse license button.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.edit.browse.input")), WAIT_TIME_MAX), "The button browse license is not displayed right now.");
|
||||
this.clickElementByXpath(locator.getString("xpath.license.edit.browse.input"));
|
||||
|
||||
logger.info("click browse license button ok");
|
||||
}
|
||||
|
||||
protected void clickUploadLicenseButton(){
|
||||
logger.info("Read to click upload license button.");
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.license.ok")), WAIT_TIME_MAX), "The button browse license is not displayed right now.");
|
||||
this.clickElementByXpath(locator.getString("xpath.license.ok"));
|
||||
|
||||
logger.info("click upload license button ok");
|
||||
}
|
||||
|
||||
protected void typeInlicenseFile(String file){
|
||||
logger.info("Read to type in license file.");
|
||||
Assert.assertTrue(this.isElementPresent(By.id(locator.getString("id.license.edit.inputlicense.input")), WAIT_TIME_MAX), "The input filed for license is not displayed right now.");
|
||||
this.typeTextByXpath("//button[contains(text(),'Browse')]/ancestor::table[1]/preceding-sibling::input[1]", file);
|
||||
logger.info("type in license file ok.");
|
||||
}
|
||||
|
||||
protected String getUsersAllowedCountAdmin(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.id(locator.getString("id.license.input.admincount")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementById((locator.getString("id.license.input.admincount"))));
|
||||
}
|
||||
|
||||
protected String getUsersExistCountAdmin(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.xpath(locator.getString("xpath.license.existadmin.user.count.text")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementByXpath((locator.getString("xpath.license.existadmin.user.count.text"))));
|
||||
}
|
||||
|
||||
protected String getUsersAllowedCountWeb(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.id(locator.getString("id.license.input.webuser")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementById((locator.getString("id.license.input.webuser"))));
|
||||
}
|
||||
|
||||
protected String getUsersExistCountWeb(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.xpath(locator.getString("xpath.license.existweb.user.count.text")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementByXpath((locator.getString("xpath.license.existweb.user.count.text"))));
|
||||
}
|
||||
|
||||
protected String getUsersAllowedCountInteractive(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.id(locator.getString("id.license.input.interactiveuser")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementById((locator.getString("id.license.input.interactiveuser"))));
|
||||
}
|
||||
|
||||
protected String getUsersExistCountInteractive(){
|
||||
this.clickElementByXpath(locator.getString("xpath.license.refresh.button"));
|
||||
this.waitforElementDisplayed(By.xpath(locator.getString("xpath.license.existinteractive.user.count.text")), WAIT_TIME_MAX);
|
||||
return this.getValue(this.getElementByXpath((locator.getString("xpath.license.existinteractive.user.count.text"))));
|
||||
}
|
||||
|
||||
protected int transformExistUserNum(String str){
|
||||
System.err.println(str);
|
||||
String s=(str.substring(str.indexOf("/")-1, str.length()));
|
||||
return Integer.parseInt(s.split("/")[0]);
|
||||
}
|
||||
|
||||
protected int transformTotalUserNum(String str){
|
||||
System.err.println(str);
|
||||
String s=(str.substring(str.indexOf("/")-1, str.length()));
|
||||
return Integer.parseInt(s.split("/")[1]);
|
||||
}
|
||||
|
||||
public int getExistInteractive(){
|
||||
return (this.transformExistUserNum(this.getUsersExistCountInteractive()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****
|
||||
* get already exist System_Admin users Num
|
||||
* @return
|
||||
*/
|
||||
public int getExistAdmin(){
|
||||
return (this.transformExistUserNum(this.getUsersExistCountAdmin()));
|
||||
}
|
||||
|
||||
|
||||
/****
|
||||
* get System_Admin user within license
|
||||
* @return
|
||||
*/
|
||||
public int getAvailableAdmin(){
|
||||
return (this.transformTotalUserNum(this.getUsersExistCountAdmin())-this.transformExistUserNum(this.getUsersExistCountAdmin()));
|
||||
}
|
||||
|
||||
|
||||
/*****
|
||||
* get System_Web user left within license
|
||||
* @return
|
||||
*/
|
||||
public int getAvailableWeb(){
|
||||
return (this.transformTotalUserNum(this.getUsersExistCountWeb())-this.transformExistUserNum(this.getUsersExistCountWeb()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.talend.mdm.modules;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxProfile;
|
||||
import org.talend.mdm.Base;
|
||||
import org.talend.mdm.Login;
|
||||
import org.testng.Assert;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Parameters;
|
||||
|
||||
|
||||
public class Logon extends Base{
|
||||
|
||||
|
||||
|
||||
public void initWebdriver(String url, String root, ITestContext context){
|
||||
|
||||
URL file = Login.class.getClassLoader().getResource("org/talend/mdm/resources");
|
||||
PropertyConfigurator.configure( file.getPath() + "/log4j.properties" );
|
||||
|
||||
FirefoxProfile firefoxProfile = new FirefoxProfile();
|
||||
firefoxProfile.setPreference("browser.download.folderList",2);
|
||||
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
|
||||
firefoxProfile.setPreference("browser.download.dir",Login.class.getClassLoader().getResource("org/talend/mdm/download").getPath());
|
||||
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");
|
||||
|
||||
driver = new FirefoxDriver(firefoxProfile);
|
||||
logger.info("Set Firefox Driver with Profile");
|
||||
logger.info("URL - " +url + root);
|
||||
|
||||
driver.get(url + root);
|
||||
super.setDriver(driver);
|
||||
windowMaximize();
|
||||
|
||||
onTestListener(context, Login.class.getClassLoader().getResource("org/talend/mdm/download").getPath());
|
||||
}
|
||||
|
||||
|
||||
public Logon(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void configureLogin(String userName, String userPassword) {
|
||||
|
||||
WebElement userE = this.getElementByName(locator.getString("id.login.username"));
|
||||
userE.clear();
|
||||
userE.sendKeys(userName);
|
||||
WebElement passwordE = this.getElementByName(locator.getString("id.login.password"));
|
||||
passwordE.clear();
|
||||
passwordE.sendKeys(userPassword);
|
||||
}
|
||||
public void clickLogin(){
|
||||
this.waitfor(By.name(locator.getString("name.login.login")), WAIT_TIME_MID);
|
||||
Assert.assertTrue(this.isElementPresent(By.name(locator.getString("name.login.login")), WAIT_TIME_MID), "login button is not displayed right now.");
|
||||
this.getElementByName(locator.getString("name.login.login")).click();
|
||||
logger.info("Login MDM");
|
||||
}
|
||||
|
||||
public void clickLogout(){
|
||||
this.getElementByXpath(locator.getString("xpath.login.logout")).click();
|
||||
}
|
||||
|
||||
public void logout() {
|
||||
logger.info("Click MDM logout button");
|
||||
this.clickLogout();
|
||||
logger.info("Logout MDM");
|
||||
Assert.assertTrue(this.isElementPresent(By.name(locator.getString("id.login.username")), WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
public void killBroswer() {
|
||||
driver.quit();
|
||||
logger.info("WebDriver Quit");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
package org.talend.mdm.modules;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Point;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.talend.mdm.Base;
|
||||
import org.testng.Assert;
|
||||
|
||||
public class Record extends Base{
|
||||
public Record(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
public void deleteTheRecord(String entity){
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.choose"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.delete.record.choose.yes"));
|
||||
/* if (this.isElementPresent(By.xpath(locator.getString("xpath.record.delete.record.warn")),WAIT_TIME_MIN)){
|
||||
this.clickElementByXpath("//button[text()='No']");
|
||||
}*/
|
||||
}
|
||||
public void openJournal(String entity,String key,String OperationType,String source){
|
||||
|
||||
enterJournal(entity,key,OperationType,source);
|
||||
//JournalResultCount();
|
||||
}
|
||||
|
||||
|
||||
public void launchProcess(String processOption){
|
||||
this.seletDropDownList(By.xpath(locator.getString("xpath.record.launchprocess.select.img")), processOption);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.launchprocess.button"));
|
||||
}
|
||||
|
||||
public void checkProcessDoneAndClickOK(){
|
||||
this.waitfor(By.xpath(locator.getString("xpath.record.launchprocess.success.status.info")), WAIT_TIME_MID);
|
||||
//click process ok button to verify can open bonita workflow console
|
||||
this.clickElementByXpath(locator.getString("xpath.record.launchprocess.success.ok.button"));
|
||||
|
||||
}
|
||||
|
||||
public void enterJournal(String entity,String key,String OperationType,String source){
|
||||
clickJournal();
|
||||
this.sleepCertainTime(5000);
|
||||
this.modifyText(this.getElementByXpath(locator.getString("xpath.record.choose.journal.entity")),entity);
|
||||
this.modifyText(this.getElementByXpath(locator.getString("xpath.record.choose.journal.key")),key);
|
||||
this.modifyText(this.getElementByXpath(locator.getString("xpath.record.choose.journal.source")),source);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.journal.operation.arrows"));
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.choose.journal.operation.choose",OperationType));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.journal.search"));
|
||||
this.sleepCertainTime(5000);
|
||||
}
|
||||
public void JournalResultCount(){
|
||||
int recordCount;
|
||||
boolean result;
|
||||
String recordSearchResult;
|
||||
recordSearchResult=this.getElementByXpath(locator.getString("xpath.record.update.journal.price")).getText();
|
||||
if (recordSearchResult.contains("No data to display"))
|
||||
{ recordCount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordCount=Integer.parseInt(this.getElementByXpath(locator.getString("xpath.record.journal.count")).getText().split("of")[1].trim());}
|
||||
if (recordCount>0)
|
||||
{result=true;}
|
||||
else
|
||||
{ result=false;}
|
||||
Assert.assertTrue(result);
|
||||
}
|
||||
|
||||
public void JournalCheckResult(String key,String OperationType){
|
||||
String[] parameters={key,OperationType};
|
||||
this.moveToElement(driver.findElement(By.xpath("//div[text()='Operation Time']")));
|
||||
this.sleepCertainTime(2000);
|
||||
// this.clickVisibleElementByXpath("//div[contains(@class,'x-grid3-hd-inner x-grid3-hd-6')]//a[@class='x-grid3-hd-btn']");
|
||||
this.clickVisibleElementByXpath("//span[text()='Journal']//ancestor::div[@class='extpj']//div[contains(@class,'x-grid3-hd-inner x-grid3-hd-6')]//a[@class='x-grid3-hd-btn']");
|
||||
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickVisibleElementByXpath("//a[text()='Sort Descending']");
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.journal.choose.record", parameters));
|
||||
this.doubleClick(this.getElementByXpath(this.getString(locator, "xpath.record.choose.journal.choose.record", parameters)));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.journal.click.info"));
|
||||
this.sleepCertainTime(3000);
|
||||
|
||||
}
|
||||
public void searchDateAssert(String searchFeild,String opeartion,String value,String entity_Element){
|
||||
int recordCount;
|
||||
Date[] dates;
|
||||
Date searchDate = null;
|
||||
boolean result = false;
|
||||
String recordSearchResult;
|
||||
String[] parametersSearch={entity_Element,searchFeild};
|
||||
logger.info(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText());
|
||||
recordSearchResult=this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText();
|
||||
if (recordSearchResult.contains("No data to display"))
|
||||
{
|
||||
recordCount=0;
|
||||
logger.info("No data to display");
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordCount=Integer.parseInt(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText().split("of")[1].trim());
|
||||
logger.info(recordCount);
|
||||
dates = new Date[recordCount];
|
||||
try {
|
||||
searchDate=new SimpleDateFormat("yyyy-MM-dd").parse(value);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (int i=0; i<=recordCount-1; i++)
|
||||
{ String dates_text=this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parametersSearch)).get(i).getText();
|
||||
if( !dates_text.equals(" ")){
|
||||
try {
|
||||
dates[i]= (new SimpleDateFormat("yyyy-MM-dd")).parse(this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parametersSearch)).get(i).getText());
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (opeartion.contains("equals"))
|
||||
{
|
||||
if (dates[i].equals(searchDate))
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is before"))
|
||||
{
|
||||
if (dates[i].before(searchDate) )
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is after"))
|
||||
{
|
||||
if (dates[i].after(searchDate))
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.assertTrue(result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void searchStringAssert(String searchFeild,String opeartion,String value,String entity_Element){
|
||||
int recordCount;
|
||||
String[] names;
|
||||
String[] parameters={entity_Element,searchFeild};
|
||||
boolean result = false;
|
||||
String recordSearchResult;
|
||||
|
||||
logger.info(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText());
|
||||
recordSearchResult=this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText();
|
||||
if (recordSearchResult.contains("No data to display"))
|
||||
{ recordCount=0;
|
||||
logger.info("No data to display");
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordCount=Integer.parseInt(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText().split("of")[1].trim());
|
||||
names = new String[recordCount];
|
||||
for (int i=0; i<=recordCount-1; i++)
|
||||
{
|
||||
String names_text=this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parameters)).get(i).getText();
|
||||
if( !names_text.equals(" ")){
|
||||
names[i]=this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parameters)).get(i).getText();
|
||||
if (opeartion.contains("contains the word(s)"))
|
||||
{
|
||||
if (names[i].contains(value) )
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("contains a word starting with"))
|
||||
{
|
||||
if (names[i].contains(value) && names[i].startsWith(value) )
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("contains the sentence"))
|
||||
{
|
||||
// value = value.replace(" ", "/ ");
|
||||
if (names[i].contains(value))
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Assert.assertTrue(result);
|
||||
|
||||
}
|
||||
public void searchValueAssert(String searchFeild,String opeartion,String value,String entity_Element){
|
||||
//String[] parametersSearch={entity,searchFeild};
|
||||
int recordCount;
|
||||
String recordSearchResult;
|
||||
double[] ages;
|
||||
boolean result = false;
|
||||
String[] parameters={entity_Element,searchFeild};
|
||||
logger.info(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText());
|
||||
recordSearchResult=this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText();
|
||||
if (recordSearchResult.contains("No data to display"))
|
||||
{
|
||||
recordCount=0;
|
||||
logger.info("No data to display");
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordCount=Integer.parseInt(this.getElementByXpath(locator.getString("xpath.record.search.record.count")).getText().split("of")[1].trim());
|
||||
logger.info(recordCount);
|
||||
ages = new double[recordCount];
|
||||
for (int i=0; i<=recordCount-1; i++)
|
||||
{
|
||||
String age_text=this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parameters)).get(i).getText();
|
||||
if( !age_text.equals(" ")){
|
||||
ages[i]=Double.parseDouble(this.getElementsByXpath(this.getString(locator, "xpath.record.search.record.value",parameters)).get(i).getText());
|
||||
logger.info(ages[i]);
|
||||
if (opeartion.contains("is greater than"))
|
||||
{
|
||||
if (Double.parseDouble(value) < ages[i])
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is equal to"))
|
||||
{
|
||||
if (Double.parseDouble(value) == ages[i])
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is greater or equals"))
|
||||
{
|
||||
if (Double.parseDouble(value) <= ages[i])
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is lower than"))
|
||||
{
|
||||
if (Double.parseDouble(value) > ages[i])
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is lower or equals"))
|
||||
{
|
||||
if ( ages[i] <= Double.parseDouble(value))
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
if (opeartion.contains("is not equal to"))
|
||||
{
|
||||
if ( ages[i] !=Double.parseDouble(value))
|
||||
{
|
||||
result=true;
|
||||
}
|
||||
else
|
||||
result=false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}}
|
||||
Assert.assertTrue(result);
|
||||
|
||||
}
|
||||
public void searchCondition(String searchFeild,String opeartion,String value) {
|
||||
searchFeild(searchFeild);
|
||||
searchOpeartion(opeartion);
|
||||
searchValue(value);
|
||||
//click the search button
|
||||
this.clickElementByXpath(locator.getString("xpath.record.search.click"));
|
||||
this.sleepCertainTime(3000);
|
||||
}
|
||||
|
||||
public void searchFeild(String searchFeild){
|
||||
//choose the search feild
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.record.search.feild.arrows")), 3000));
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.search.feild.arrows"));
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.search.feild",searchFeild)), WAIT_TIME_MAX);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.search.feild",searchFeild));
|
||||
}
|
||||
|
||||
public void searchOpeartion(String opeartion){
|
||||
//choose the search operator
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.record.search.operator.arrows")), 3000));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.search.operator.arrows"));
|
||||
this.isElementPresent(By.xpath(this.getString(locator,"xpath.record.search.operator",opeartion)), WAIT_TIME_MAX);
|
||||
this.clickElementByXpath(this.getString(locator,"xpath.record.search.operator",opeartion));
|
||||
}
|
||||
|
||||
public void searchValue(String value){
|
||||
//input the search value
|
||||
this.modifyText(this.getElementByXpath(locator.getString("xpath.record.search.value")), value);
|
||||
}
|
||||
|
||||
public void chooseContainer(String container) {
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.containe.arrows"));
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.container", container));
|
||||
|
||||
}
|
||||
|
||||
public void chooseModle(String modle) {
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.modle.arrows"));
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.modle",modle));
|
||||
}
|
||||
|
||||
public void clickSave() {
|
||||
this.clickElementByXpath(locator.getString("xpath.record.chooseCM.save"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.chooseCM.save.ok"));
|
||||
}
|
||||
|
||||
public void chooseEntity(String entity) {
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.DataBrowser"));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.record.choose.entity.arrows")), WAIT_TIME_MIN).isDisplayed());
|
||||
/* this.seletDropDownList(By.xpath(locator.getString("xpath.record.choose.entity.arrows")), entity);*/
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.entity.arrows"));
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.entity",entity)), WAIT_TIME_MAX);
|
||||
//this.sleepCertainTime(10000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.entity",entity));
|
||||
}
|
||||
|
||||
public void chooseEntityDirectlyInDataBrowser(String entity) {
|
||||
this.sleepCertainTime(3000);
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.record.choose.entity.arrows")), WAIT_TIME_MIN).isDisplayed());
|
||||
/* this.seletDropDownList(By.xpath(locator.getString("xpath.record.choose.entity.arrows")), entity);*/
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.entity.arrows"));
|
||||
this.isElementPresent(By.xpath(this.getString(locator, "xpath.record.choose.entity",entity)), WAIT_TIME_MAX);
|
||||
//this.sleepCertainTime(10000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.entity",entity));
|
||||
}
|
||||
|
||||
public void clickCreateRecord(){
|
||||
this.sleepCertainTime(20000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.create"));
|
||||
this.sleepCertainTime(20000);
|
||||
}
|
||||
|
||||
public void closeDatachangesViewer(){
|
||||
this.clickElementByXpath(locator.getString("xpath.datachangesviewer.tab.close"));
|
||||
}
|
||||
|
||||
public void closeDataBrowser(){
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.databrowser.tab.close"));
|
||||
}
|
||||
|
||||
public void openDataBrowserFromWelcome(){
|
||||
this.clickElementByXpath(locator.getString("xpath.welcome.tab"));
|
||||
this.clickElementByXpath(locator.getString("xpath.ui.window.getstarted.item.link.databrowser"));
|
||||
}
|
||||
|
||||
public void chooseRcord(String entity,String feild1Name, String feild1Value) {
|
||||
String[] parameters={entity,feild1Name,feild1Value};
|
||||
this.sleepCertainTime(5000);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.record.choose.delete.record",parameters));
|
||||
this.sleepCertainTime(5000);
|
||||
}
|
||||
public void clickRecycle() {
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.record.recycle.click.brower"));
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.recycle.click.recycle"));
|
||||
}
|
||||
public void clickJournal() {
|
||||
this.sleepCertainTime(3000);
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.journal"));
|
||||
}
|
||||
|
||||
public void openJournalFromDataBrowser(){
|
||||
this.clickJournal();
|
||||
// this.clickElementByXpath("//div[contains(@class,'x-small-editor x-toolbar ItemDetailToolBar x-component x-toolbar-layout-ct')]//button[contains(text(),'Journal')]");
|
||||
|
||||
}
|
||||
|
||||
public void switchtoTabWelcome(){
|
||||
|
||||
this.clickElementByXpath(locator.getString("xpath.welcome.tab"));
|
||||
}
|
||||
|
||||
public void switchtoTabDataBrowser(){
|
||||
this.clickElementByXpath(locator.getString("xpath.datavrowser.tab"));
|
||||
}
|
||||
|
||||
public void checkPropertiesBeforeAfterInDatachangesViewer(String properties,String valueBefore,String valueAfter,boolean compareType){
|
||||
|
||||
String before = this.getValue(this.getElementByXpath("//span[text()='Before']//ancestor::div[@id='documentHistoryPanel1']//span[contains(text(),'"+properties+"')]")).trim();
|
||||
logger.info("in update detail panel,value before is :"+before);
|
||||
logger.info("parameters for value before is :"+valueBefore);
|
||||
Assert.assertTrue(before.contains(valueBefore));
|
||||
String after = this.getValue(this.getElementByXpath("//span[text()='After']//ancestor::div[@id='documentHistoryPanel2']//span[contains(text(),'"+properties+"')]")).trim();
|
||||
logger.info("in update detail panel,value after is :"+after);
|
||||
logger.info("parameters for value after is :"+valueAfter);
|
||||
//true ,means before = after.
|
||||
if(compareType){
|
||||
Assert.assertTrue(before.equals(after));
|
||||
Assert.assertTrue(after.contains(valueAfter));
|
||||
}
|
||||
else{
|
||||
Assert.assertFalse(after.equals(before));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void closeJournal(){
|
||||
this.clickElementByXpath(locator.getString("xpath.journal.tab.close"));
|
||||
}
|
||||
|
||||
public void clickExport() {
|
||||
this.clickElementByXpath(locator.getString("xpath.record.click.importAndExport"));
|
||||
this.clickElementByXpath(locator.getString("xpath.record.choose.export"));
|
||||
}
|
||||
|
||||
public void maxARecordPanel(){
|
||||
Point b = this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.databrowser.bigger"))).getLocation();
|
||||
Point a = this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.expend.record.pannel"))).getLocation();
|
||||
|
||||
logger.info("maxARecordPanel-" + b.x + " "+b.y);
|
||||
logger.info("maxARecordPanel-" + a.x + " "+a.y);
|
||||
logger.info("move to left by:"+(a.x-b.x-50));
|
||||
|
||||
Actions builder = new Actions(driver);
|
||||
builder.clickAndHold(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.expend.record.pannel"))))
|
||||
.moveToElement(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.choose.create"))), 2, -2).release().build().perform();
|
||||
|
||||
// this.dragAndDropBy(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.expend.record.pannel"))), -a.x+b.x+50, 0);
|
||||
}
|
||||
|
||||
public void maxDataBrowserBoard(){
|
||||
Point b = this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.databrowser.bigger"))).getLocation();
|
||||
|
||||
logger.info("maxDataBrowserBoard Point " + b.x + "," + b.y);
|
||||
|
||||
logger.info("move to left by:"+(b.x-100));
|
||||
|
||||
Actions builder = new Actions(driver);
|
||||
builder.clickAndHold(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.databrowser.bigger"))))
|
||||
.moveToElement(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.menuboard.menu"))), 10, 0).release().build().perform();
|
||||
// this.dragAndDropBy(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.record.databrowser.bigger"))), -b.x+100, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
package org.talend.mdm.modules;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
import org.talend.mdm.Base;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class User extends Base{
|
||||
|
||||
public User(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* public User(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
}*/
|
||||
|
||||
public void openMenuAdministrator(){
|
||||
this.logger.info("open Administration page");
|
||||
this.waitfor(By.xpath(locator.getString("xpath.Administration.menu")), WAIT_TIME_MAX);
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.Administration.menu")), WAIT_TIME_MAX));
|
||||
this.clickElementByXpath(locator.getString("xpath.Administration.menu"));
|
||||
}
|
||||
|
||||
public void gotoUserManagePage(){
|
||||
this.clickElementByXpath(locator.getString("xpath.mangeuser.menu"));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(locator.getString("xpath.user.button.add")), this.WAIT_TIME_MAX));
|
||||
}
|
||||
|
||||
public void selectRoles(String[] roles){
|
||||
for(String role: roles) {
|
||||
/*this.clickElementByXpath(locator.getString("xpath.user.add.role.img"));
|
||||
this.waitfor(By.xpath(this.getString(locator, "xpath.user.add.role.select", role)), 30);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.add.role.select", role));
|
||||
*/
|
||||
Select select = new Select(driver.findElement(By.xpath(locator.getString("xpath.user.roles.select"))));
|
||||
select.selectByVisibleText(role);
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.add"));
|
||||
this.waitforElementDisplayed(By.xpath(this.getString(locator, "xpath.user.add.role.added.listview", roles)),WAIT_TIME_MAX);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void selectRoles(String roles){
|
||||
/*this.logger.info("click to open roles selection drop down list!");
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.img"));
|
||||
this.logger.info("roles selection drop down list opened ok!");
|
||||
this.logger.info("select role to add");
|
||||
this.waitforElementDisplayed(By.xpath(this.getString(locator, "xpath.user.add.role.select", roles)), WAIT_TIME_MAX);
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.add.role.select", roles));
|
||||
*/
|
||||
Select select = new Select(driver.findElement(By.xpath(locator.getString("xpath.user.roles.select"))));
|
||||
select.selectByVisibleText(roles);
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.add"));
|
||||
this.waitforElementDisplayed(By.xpath(this.getString(locator, "xpath.user.add.role.added.listview", roles)),WAIT_TIME_MAX);
|
||||
this.logger.info("select role to add");
|
||||
}
|
||||
|
||||
public void confBaseUserInfo(String identifier,String firstName,String lastName,String password,String confirmPassword,
|
||||
String email, String company, String defaultVersion, boolean active){
|
||||
this.typeTextByName(locator.getString("name.user.add.name"), identifier);
|
||||
this.typeTextByName(locator.getString("name.user.add.password"), password);
|
||||
this.typeTextByXpath(locator.getString("xpath.user.add.password.confirm"), confirmPassword);
|
||||
this.typeTextByName(locator.getString("name.user.add.givenName"), firstName);
|
||||
this.typeTextByName(locator.getString("name.user.add.familyName"), lastName);
|
||||
this.typeTextByName(locator.getString("name.user.add.realEmail"), email);
|
||||
this.typeTextByName(locator.getString("name.user.add.company"), company);
|
||||
this.typeTextByName(locator.getString("name.user.add.universe"), defaultVersion);
|
||||
if(active) {
|
||||
this.getElementByName(locator.getString("name.user.add.enabled")).click();
|
||||
this.logger.info("click add user active button!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void configureUser(String identifier,String firstName,String lastName,String password,String confirmPassword,
|
||||
String email, String company, String defaultVersion, boolean active, String[] roles) {
|
||||
|
||||
this.confBaseUserInfo(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
this.selectRoles(roles);
|
||||
}
|
||||
|
||||
protected void addUser(String identifier,String firstName,String lastName,String password,String confirmPassword,
|
||||
String email, String company, String defaultVersion, boolean active, String[] roles) {
|
||||
this.clickAddNewUser();
|
||||
this.confBaseUserInfo(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
this.selectRoles(roles);
|
||||
this.minUserConfigPanel();
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.save"));
|
||||
this.getElementByXpath(locator.getString("xpath.user.add.role.flashcache.ok")).click();
|
||||
Assert.assertTrue((this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.identifier", identifier)), WAIT_TIME_MAX)));
|
||||
this.logger.info("user "+identifier+" had been added succussfull!");
|
||||
// Assert.assertNotNull("Haven't add the user " + identifier + "successfully!", getUserDeleteElement(identifier));
|
||||
}
|
||||
|
||||
protected void addUser(String identifier,String firstName,String lastName,String password,String confirmPassword,
|
||||
String email, String company, String defaultVersion, boolean active, String roles) {
|
||||
|
||||
|
||||
this.clickAddNewUser();
|
||||
this.confBaseUserInfo(identifier, firstName, lastName, password, confirmPassword, email, company, defaultVersion, active);
|
||||
this.selectRoles(roles);
|
||||
this.minUserConfigPanel();
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.save"));
|
||||
this.logger.info("click add user save button!");
|
||||
this.getElementByXpath(locator.getString("xpath.user.add.role.flashcache.ok")).click();
|
||||
this.logger.info("click add flush cache ok button!");
|
||||
Assert.assertTrue((this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.identifier", identifier)), WAIT_TIME_MAX)));
|
||||
this.logger.info("user "+identifier+" had been added succussfull!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void deleteUser(String userName) {
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.delete", userName)), WAIT_TIME_MAX), "the user to delete not present right now.");
|
||||
this.sleepCertainTime(1000);
|
||||
this.selectAUser("administrator");
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.delete", userName));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.user.delete.yes")),WAIT_TIME_MIN).isDisplayed());
|
||||
this.sleepCertainTime(2000);
|
||||
this.clickElementByXpath(locator.getString("xpath.user.delete.yes"));
|
||||
this.sleepCertainTime(3000);
|
||||
Assert.assertTrue(this.waitfor(By.xpath(this.getString(locator, "xpath.user.delete", userName)),3)==null);
|
||||
logger.info("user "+userName +" deleted successful!");
|
||||
}
|
||||
|
||||
protected void deleteAllUsersStartWith(String userExcept){
|
||||
|
||||
|
||||
|
||||
List a = this.getElementsByXpath(locator.getString("xpath.user.listdisplay.identiferlist"));
|
||||
List b = new ArrayList<String>();
|
||||
for(int i=0;i<a.size();i++){
|
||||
String userName = this.getValue((WebElement)a.get(i));
|
||||
logger.info(userName);
|
||||
/* if(userName.equals(userExcept)){
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
b.add(this.getValue((WebElement)a.get(i)));
|
||||
logger.info("b+++++++++++++++++++++++++++++++++++++++++++++++++++++"+userName);
|
||||
}*/
|
||||
|
||||
if(userName.startsWith(userExcept)){
|
||||
b.add(this.getValue((WebElement)a.get(i)));
|
||||
}
|
||||
// System.err.println("total user number is :"+this.getElementsByXpath(locator.getString("xpath.user.listdisplay.identiferlist")).size());
|
||||
}
|
||||
|
||||
for(int j=0;j <b.size();j++){
|
||||
String userName = b.get(j).toString();
|
||||
logger.info("The "+j+" time to delete user name is :"+userName);
|
||||
this.deleteUser(userName);
|
||||
|
||||
}
|
||||
this.sleepCertainTime(3000);
|
||||
System.err.println("after delete,total user number is :"+this.getElementsByXpath(locator.getString("xpath.user.listdisplay.identiferlist")).size());
|
||||
Assert.assertTrue(this.getElementsByXpath(locator.getString("xpath.user.listdisplay.identiferlist")).size()==4);
|
||||
|
||||
}
|
||||
|
||||
public void searchUser(String userName) {
|
||||
this.modifyTextByXpath(locator.getString("xpath.user.search.input"), userName);
|
||||
this.clickElementByXpath(locator.getString("xpath.user.search"));
|
||||
}
|
||||
|
||||
public void clickAddNewUser(){
|
||||
this.maxUserConfigPanel();
|
||||
this.clickElementByXpath(locator.getString("xpath.user.button.add"));
|
||||
|
||||
}
|
||||
|
||||
public void maxUserConfigPanel(){
|
||||
Actions builder = new Actions(driver);
|
||||
builder.clickAndHold(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.user.max.configure.panel.line"))))
|
||||
.moveToElement(this.findElementDefineDriver(this.driver, By.xpath(this.getString(locator, "xpath.user.identifier", "administrator"))), 2, -2).release().build().perform();
|
||||
|
||||
}
|
||||
|
||||
public void minUserConfigPanel(){
|
||||
Actions builder = new Actions(driver);
|
||||
builder.clickAndHold(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.user.max.configure.panel.line"))))
|
||||
.moveToElement(this.findElementDefineDriver(this.driver, By.xpath(locator.getString("xpath.user.add.role.save"))), 0, -10).release().build().perform();
|
||||
|
||||
}
|
||||
public WebElement getUserDeleteElement(String userName) {
|
||||
return this.getElementByXpath(this.getString(locator, "xpath.user.delete", userName));
|
||||
}
|
||||
|
||||
public void typeUserName(String userName) {
|
||||
this.typeTextByName(locator.getString("name.user.add.name"), userName);
|
||||
}
|
||||
public void typePassword(String password) {
|
||||
this.typeTextByName(locator.getString("name.user.add.password"), password);
|
||||
}
|
||||
public void typeConfirmPassword(String password) {
|
||||
this.typeTextByXpath(locator.getString("xpath.user.add.password.confirm"), password);
|
||||
}
|
||||
public void typeFirstName(String firstName) {
|
||||
this.typeTextByName(locator.getString("name.user.add.givenName"), firstName);
|
||||
}
|
||||
public void typeLastName(String lastName) {
|
||||
this.typeTextByName(locator.getString("name.user.add.familyName"), lastName);
|
||||
}
|
||||
public void typeEmail(String email) {
|
||||
this.typeTextByName(locator.getString("name.user.add.realEmail"), email);
|
||||
}
|
||||
public void typeCompany(String company) {
|
||||
this.typeTextByName(locator.getString("name.user.add.company"), company);
|
||||
}
|
||||
public void typeUniVerse(String universe) {
|
||||
this.typeTextByName(locator.getString("name.user.add.universe"), universe);
|
||||
}
|
||||
|
||||
public void clickActive() {
|
||||
this.getElementByName(locator.getString("name.user.add.enabled")).click();
|
||||
}
|
||||
|
||||
public void clickFlushCacheButton(){
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.flashcache.button"));
|
||||
}
|
||||
|
||||
public void clickFlushCacheOK(){
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.flashcache.ok"));
|
||||
}
|
||||
public boolean isActive(){
|
||||
return this.getElementByXpath(locator.getString("xpath.user.add.enabled.true")) != null;
|
||||
}
|
||||
|
||||
public void addRoles(String[] roles) {
|
||||
for(String role: roles) {
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.img"));
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.add.role.select", role));
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.add"));
|
||||
}
|
||||
}
|
||||
public void deleteRoles(String[] roles) {
|
||||
for(String role: roles) {
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.delete.role.select", role));
|
||||
this.clickElementByXpath(locator.getString("xpath.user.delete.role.delete"));
|
||||
}
|
||||
}
|
||||
|
||||
// unfinished
|
||||
public List<String> getRoles(){
|
||||
List<String> roles = new ArrayList<String>();
|
||||
List<WebElement> elements = this.getElementsByXpath(locator.getString("xpath.user.added.roles"));
|
||||
|
||||
for(WebElement element : elements) {
|
||||
roles.add(element.getText());
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
||||
public void clickSave(){
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.save"));
|
||||
}
|
||||
|
||||
public void clickSaveAndCheckExpectedTrue(String userName){
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.save"));
|
||||
this.clickElementByXpath(locator.getString("xpath.user.add.role.flashcache.ok"));
|
||||
Assert.assertTrue(this.isElementPresent(By.xpath(this.getString(locator, "xpath.user.identifier", userName)), WAIT_TIME_MID), "user"+userName+"added failed!");
|
||||
}
|
||||
|
||||
public void selectAUser(String userName) {
|
||||
this.clickElementByXpath(this.getString(locator, "xpath.user.select", userName));
|
||||
}
|
||||
|
||||
public boolean isUserSheetExist(){
|
||||
return this.getElementsByXpath(locator.getString("xpath.user.sheet")) != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.talend.mdm.modules;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Point;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.talend.mdm.Base;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
||||
public class Welcome extends Base{
|
||||
|
||||
public Welcome(WebDriver driver) {
|
||||
super.setDriver(driver);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void checkGetStartedWindow(){
|
||||
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.getstarted")), WAIT_TIME_MIN)!=null, "element getstarted window is not displayed right now");
|
||||
logger.info("check welcome page UI getting started window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.getstarted.item.labeltext")), WAIT_TIME_MIN)!=null, "element getstarted window is not displayed right now");
|
||||
logger.info("check welcome page UI getting started window.label ok.");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.getstarted.item.link.databrowser")), WAIT_TIME_MIN)!=null, "element getstarted window is not displayed right now");
|
||||
logger.info("check welcome page UI getting started window.item.databrowser ok.");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.getstarted.item.link.journal")), WAIT_TIME_MIN)!=null, "element getstarted window is not displayed right now");
|
||||
logger.info("check welcome page UI getting started window.item.journal ok.");
|
||||
|
||||
}
|
||||
|
||||
public void checkProcessWindow(){
|
||||
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.processes")), WAIT_TIME_MIN)!=null, "element processess window is not displayed right now");
|
||||
logger.info("check welcome page UI processes window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.processes.title")), WAIT_TIME_MIN)!=null, "element processess window.title is not displayed right now");
|
||||
logger.info("check welcome page UI processes window.title ok.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void checkAlertsWindow(){
|
||||
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.alerts")), WAIT_TIME_MIN)!=null, "element alerts window is not displayed right now");
|
||||
logger.info("check welcome page UI processes window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.alerts.title")), WAIT_TIME_MIN)!=null, "element alerts window.title is not displayed right now");
|
||||
logger.info("check welcome page UI alerts window.title ok.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void checkTasksWindow(){
|
||||
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.tasks")), WAIT_TIME_MIN)!=null, "element tasks window is not displayed right now");
|
||||
logger.info("check welcome page UI processes window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.tasks.title")), WAIT_TIME_MIN)!=null, "element tasks window.title is not displayed right now");
|
||||
logger.info("check welcome page UI tasks window.title ok.");
|
||||
|
||||
}
|
||||
|
||||
public void openTasks(){
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.tasks.workflow.entry")), WAIT_TIME_MIN).isDisplayed());
|
||||
this.clickElementByXpath(locator.getString("xpath.ui.window.tasks.workflow.entry"));
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.workflowtaskspage.search.button")),WAIT_TIME_MIN).isDisplayed());
|
||||
}
|
||||
|
||||
public void checkSearchWindow(){
|
||||
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.search")), WAIT_TIME_MIN)!=null, "element search window is not displayed right now");
|
||||
logger.info("check welcome page UI processes window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.search.title")), WAIT_TIME_MIN)!=null, "element search window.title is not displayed right now");
|
||||
logger.info("check welcome page UI search window.title ok.");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.search.item.search.input")), WAIT_TIME_MIN)!=null, "element search window.item.search.input is not displayed right now");
|
||||
logger.info("check welcome page UI processes window ok");
|
||||
Assert.assertTrue(this.waitfor(By.xpath(locator.getString("xpath.ui.window.search.item.search.button")), WAIT_TIME_MIN)!=null, "element search window.item.search.button is not displayed right now");
|
||||
logger.info("check welcome page UI search window.item.search.button ok.");
|
||||
}
|
||||
|
||||
public Point getWindowPosition(WebElement ele){
|
||||
return ele.getLocation();
|
||||
}
|
||||
|
||||
public void reSortWindowLayout(String srcXpathLocatorKey, String destXpathLocatorKey, int xP,int yP){
|
||||
WebElement srcElementOld = (this.getElementByXpath(locator.getString(srcXpathLocatorKey)));
|
||||
Point pointOld = this.getWindowPosition(srcElementOld);
|
||||
Actions builder = new Actions(driver);
|
||||
builder.clickAndHold(this.getElementByXpath(locator.getString(srcXpathLocatorKey)))
|
||||
.moveToElement(this.getElementByXpath(locator.getString(destXpathLocatorKey)), xP, yP).release().build().perform();
|
||||
|
||||
this.sleepCertainTime(5000);
|
||||
WebElement srcElementNew = (this.getElementByXpath(locator.getString(srcXpathLocatorKey)));
|
||||
Point pointNew = this.getWindowPosition(srcElementNew);
|
||||
Assert.assertFalse(pointNew.equals(pointOld), "lay out resort failed");
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user