Compare commits
1105
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f852195ac | ||
|
|
90ebd53227 | ||
|
|
04bd74ac09 | ||
|
|
104d1e6663 | ||
|
|
04aec3f7c8 | ||
|
|
f5814b9822 | ||
|
|
0710c82101 | ||
|
|
e8b0d378f3 | ||
|
|
cd4c43ce82 | ||
|
|
d384dc5a43 | ||
|
|
f7c1f921bb | ||
|
|
d31db26d00 | ||
|
|
dff8ee60a3 | ||
|
|
9be50ef142 | ||
|
|
3a8bbd0ebb | ||
|
|
0dbaf81dbb | ||
|
|
d9d0f88bce | ||
|
|
0f7ce1e33f | ||
|
|
4c80d1c5c3 | ||
|
|
ed4b7addff | ||
|
|
300b499a10 | ||
|
|
6fa1ed5c3d | ||
|
|
dfddbf0e07 | ||
|
|
24053b5bd9 | ||
|
|
bc3b4218a1 | ||
|
|
9a2a313b8f | ||
|
|
b5a3e6be29 | ||
|
|
a5c7b87bf1 | ||
|
|
e89141a714 | ||
|
|
dc3b8c6918 | ||
|
|
54dd53c6ff | ||
|
|
96f6cc3a43 | ||
|
|
9d0740294c | ||
|
|
4fe9328b4c | ||
|
|
349c1bc919 | ||
|
|
e69f2976a0 | ||
|
|
dd87b213d7 | ||
|
|
96debdd3a5 | ||
|
|
bdc9bb1829 | ||
|
|
07c09e1e99 | ||
|
|
5fd2e2942c | ||
|
|
2bb71c8b89 | ||
|
|
64f79d8462 | ||
|
|
ac7d82a7f0 | ||
|
|
27340def2c | ||
|
|
e8a8a82671 | ||
|
|
7a1ac3b3bf | ||
|
|
416e2b80f8 | ||
|
|
176577aae8 | ||
|
|
2500a692a7 | ||
|
|
076972789e | ||
|
|
0c737e04c5 | ||
|
|
46d1253210 | ||
|
|
2719530f7a | ||
|
|
72ff3a5f26 | ||
|
|
0028b6f0fd | ||
|
|
e77b10ebdc | ||
|
|
88fc3f362b | ||
|
|
1d19cc6992 | ||
|
|
d831a8b96d | ||
|
|
3453a7a1f3 | ||
|
|
2f58e63b45 | ||
|
|
cbe2e9e433 | ||
|
|
17e6e553e5 | ||
|
|
4453eaf5d3 | ||
|
|
21e0c82e65 | ||
|
|
7a5f707e9a | ||
|
|
cbe4932b85 | ||
|
|
be2b8416da | ||
|
|
57acd7d046 | ||
|
|
622e22f801 | ||
|
|
8bc660e9b0 | ||
|
|
b431522ceb | ||
|
|
aa5d00dc85 | ||
|
|
675017c0b7 | ||
|
|
79f3938a10 | ||
|
|
55ee6af50c | ||
|
|
02684cb212 | ||
|
|
8169857a28 | ||
|
|
145b79633e | ||
|
|
eb6282f885 | ||
|
|
a66095eead | ||
|
|
5cc8c43531 | ||
|
|
1036b44975 | ||
|
|
8510970467 | ||
|
|
782adad8a5 | ||
|
|
f3df1dd4f5 | ||
|
|
94fed2aa62 | ||
|
|
bca8dae206 | ||
|
|
a7f42e8caa | ||
|
|
8a315b9f9f | ||
|
|
bcbc089094 | ||
|
|
2fbf25e765 | ||
|
|
4e0c1083bb | ||
|
|
1ae05df898 | ||
|
|
699cbc525b | ||
|
|
e1a80b64f4 | ||
|
|
52bb721afc | ||
|
|
bb1782e7cc | ||
|
|
004f14ea7f | ||
|
|
b1d842c6f6 | ||
|
|
f5acb815b3 | ||
|
|
feed19eea4 | ||
|
|
7dbfa0d551 | ||
|
|
a222d55b0c | ||
|
|
16996c7601 | ||
|
|
3a3072612d | ||
|
|
f7dee5449f | ||
|
|
f1434d833d | ||
|
|
195c398ca4 | ||
|
|
5a86c0f00a | ||
|
|
a9a00f0619 | ||
|
|
db0d113b52 | ||
|
|
8fac856d87 | ||
|
|
083c393c0b | ||
|
|
07e81c2c87 | ||
|
|
5b9a7d291b | ||
|
|
3bb1c7f4d8 | ||
|
|
7e9c8ccbfc | ||
|
|
3686edd55c | ||
|
|
62a51e4063 | ||
|
|
5b11ed7b20 | ||
|
|
4e9247a130 | ||
|
|
81296dcf8b | ||
|
|
a704326574 | ||
|
|
3cab716a97 | ||
|
|
596264d5cd | ||
|
|
50d4b8d187 | ||
|
|
cf5cbb1635 | ||
|
|
a71c7fd1d9 | ||
|
|
ea3d6407c5 | ||
|
|
b4bba97efc | ||
|
|
84be18b5fb | ||
|
|
2a64e26c10 | ||
|
|
67a638ad4e | ||
|
|
8f4096e6dc | ||
|
|
a26beacc40 | ||
|
|
1a40920dd7 | ||
|
|
6de9b48fd3 | ||
|
|
1000c82d5e | ||
|
|
f03f517593 | ||
|
|
3155c65a74 | ||
|
|
7e1880c3de | ||
|
|
794d48e665 | ||
|
|
5d033e7986 | ||
|
|
279b5fa209 | ||
|
|
d562e5feb3 | ||
|
|
18481f45d7 | ||
|
|
683ed9b0b8 | ||
|
|
d4e131e81f | ||
|
|
484fe04245 | ||
|
|
b0f429b477 | ||
|
|
13f40c4026 | ||
|
|
2ea35f2f0b | ||
|
|
9e4197e4b9 | ||
|
|
7a021f4be9 | ||
|
|
03c22ee4a0 | ||
|
|
4fbaaa307d | ||
|
|
7275d8b14e | ||
|
|
199e754e9b | ||
|
|
db028503d9 | ||
|
|
8a028567d1 | ||
|
|
7a97e558c3 | ||
|
|
b83ac7d6a4 | ||
|
|
6bdbbcb0d7 | ||
|
|
45a5e6bd26 | ||
|
|
8d2182a29e | ||
|
|
5479c135eb | ||
|
|
3c5aaad6d6 | ||
|
|
eb13420f35 | ||
|
|
26158aba2c | ||
|
|
c89832b1ff | ||
|
|
6e3f63d4d4 | ||
|
|
eedd3473f5 | ||
|
|
5ebb4cfad2 | ||
|
|
8baa0a6988 | ||
|
|
1f900b7a55 | ||
|
|
c18278b973 | ||
|
|
7fe00834ed | ||
|
|
83d3cfba1d | ||
|
|
30e67b530f | ||
|
|
a4eb0c9275 | ||
|
|
39a7aff33c | ||
|
|
07e7484c5a | ||
|
|
a1ce48da06 | ||
|
|
8dd522d600 | ||
|
|
b489ddae99 | ||
|
|
80552ca895 | ||
|
|
e6aa4471b8 | ||
|
|
79d2ed8889 | ||
|
|
2a6ba436aa | ||
|
|
4e9f63873c | ||
|
|
895fd68e84 | ||
|
|
614bacc074 | ||
|
|
e7d0c1d0ec | ||
|
|
fc927e7bac | ||
|
|
d52dbb705c | ||
|
|
ea07d3c5ee | ||
|
|
50fc0d3d7f | ||
|
|
1587631797 | ||
|
|
3f9ed092df | ||
|
|
63f6edc1d4 | ||
|
|
0f237fc3dc | ||
|
|
0776265f6d | ||
|
|
312be7b171 | ||
|
|
3b26d54de5 | ||
|
|
1ba667e925 | ||
|
|
1bc0e70453 | ||
|
|
1be313a21c | ||
|
|
37e936b19a | ||
|
|
3aaf7603f9 | ||
|
|
f6c790f13c | ||
|
|
f0ebd7d2c7 | ||
|
|
e307143074 | ||
|
|
f5b288b59f | ||
|
|
bef0cfa885 | ||
|
|
5e895ec306 | ||
|
|
9122d0a261 | ||
|
|
98c4ea9c77 | ||
|
|
a1aa3a5455 | ||
|
|
20ea984885 | ||
|
|
5dbe8d5eab | ||
|
|
d267d4cb2c | ||
|
|
24a11c5e5e | ||
|
|
f639788ebc | ||
|
|
b622174c95 | ||
|
|
31fa1c4413 | ||
|
|
2f6b724540 | ||
|
|
0814e10937 | ||
|
|
18e9019a14 | ||
|
|
86e35bc871 | ||
|
|
a85379bafb | ||
|
|
d1d06c144f | ||
|
|
7352fa05e4 | ||
|
|
fad3ed061f | ||
|
|
b90110b605 | ||
|
|
5d5e5106d1 | ||
|
|
032e906778 | ||
|
|
84de8e64c4 | ||
|
|
4f873754f8 | ||
|
|
7531426c0b | ||
|
|
65e93d8500 | ||
|
|
f065874a96 | ||
|
|
1956e0e582 | ||
|
|
e1877d0cb4 | ||
|
|
505d6b72ac | ||
|
|
74a5282dbb | ||
|
|
94a1a7e34d | ||
|
|
2cbda4ed42 | ||
|
|
9c80a480f4 | ||
|
|
af76c5c9b6 | ||
|
|
4503d4431e | ||
|
|
29a0956614 | ||
|
|
2aeb912938 | ||
|
|
a92e11967c | ||
|
|
b6e7310e39 | ||
|
|
1c7749bcb4 | ||
|
|
3242b07782 | ||
|
|
361d9fa69e | ||
|
|
ede66e8fa4 | ||
|
|
7f200295b3 | ||
|
|
83d6ed4f6a | ||
|
|
949282e638 | ||
|
|
239f33f44c | ||
|
|
7f4f85200e | ||
|
|
02a3a9e0a5 | ||
|
|
b83c773cec | ||
|
|
22f3ee5fc5 | ||
|
|
9722e882e8 | ||
|
|
677d855a4c | ||
|
|
0c427262fd | ||
|
|
05ee6abd95 | ||
|
|
93d4244859 | ||
|
|
40ec339c3e | ||
|
|
3df4e98916 | ||
|
|
be8d6b3d95 | ||
|
|
21b28d3429 | ||
|
|
fc034019e3 | ||
|
|
9c4322f3cf | ||
|
|
3e811defc5 | ||
|
|
18c7759040 | ||
|
|
726fcbc8e4 | ||
|
|
aab2051f5f | ||
|
|
39c7dcf6ce | ||
|
|
18133fc98b | ||
|
|
7a80da65cb | ||
|
|
975150c93a | ||
|
|
5795a91119 | ||
|
|
7386cae700 | ||
|
|
68257e6eb9 | ||
|
|
244719e80e | ||
|
|
94aa44b0c5 | ||
|
|
03dc62a840 | ||
|
|
63c16c729e | ||
|
|
afad33e363 | ||
|
|
f48d05d8a6 | ||
|
|
679b8ef364 | ||
|
|
288f5a2d99 | ||
|
|
c3e12ccb22 | ||
|
|
b7e6c92f4b | ||
|
|
525f8f19f4 | ||
|
|
1ecf6fa3e6 | ||
|
|
e3b03034a4 | ||
|
|
ff7f278079 | ||
|
|
ecf9c94d92 | ||
|
|
ab7a295a46 | ||
|
|
9769568b27 | ||
|
|
c703e6f640 | ||
|
|
c6a34b9e4d | ||
|
|
7e473ceed6 | ||
|
|
fe1a90a15e | ||
|
|
d6ab287416 | ||
|
|
d01134d095 | ||
|
|
f1cbb3595f | ||
|
|
e597d04fbe | ||
|
|
abff643d2a | ||
|
|
741f7441e4 | ||
|
|
8a9a5d60b1 | ||
|
|
f2643692a2 | ||
|
|
654fb6f08c | ||
|
|
77af02b5ba | ||
|
|
155a353871 | ||
|
|
37ed66906a | ||
|
|
e93c8f3ff0 | ||
|
|
b5696ae9f3 | ||
|
|
f7f6246a55 | ||
|
|
b765998bb8 | ||
|
|
beae24ac6d | ||
|
|
1810de536a | ||
|
|
e970fe0ab1 | ||
|
|
7bd657784a | ||
|
|
980b199933 | ||
|
|
e28e6e3c31 | ||
|
|
86e43a57b2 | ||
|
|
f22a9642ee | ||
|
|
a68f18b78f | ||
|
|
9730b78492 | ||
|
|
98c9912dd6 | ||
|
|
69c647126e | ||
|
|
6f93f301bc | ||
|
|
d27622480d | ||
|
|
8d041af4ba | ||
|
|
3438ec12a6 | ||
|
|
5d79759e40 | ||
|
|
7480a7bafa | ||
|
|
5e523f9a47 | ||
|
|
7a64807645 | ||
|
|
70bbf2860b | ||
|
|
a332ee0abf | ||
|
|
28e176f22d | ||
|
|
6236ebf049 | ||
|
|
d81acbf96e | ||
|
|
ce9217a4e5 | ||
|
|
0376033c44 | ||
|
|
5dc101e3f3 | ||
|
|
9c4bc28bd0 | ||
|
|
753e2a932f | ||
|
|
383d7e050b | ||
|
|
65eed51ead | ||
|
|
bd5ba98f29 | ||
|
|
3f4da24b17 | ||
|
|
f2efe8bcda | ||
|
|
2eeddd3efe | ||
|
|
688de64360 | ||
|
|
b7b250bb2f | ||
|
|
c9e9dab8fe | ||
|
|
e4c7ee0c77 | ||
|
|
8ed3b16e15 | ||
|
|
9f5a72cf96 | ||
|
|
3a0d8a9411 | ||
|
|
a5dbe2a46a | ||
|
|
dfc8fb9791 | ||
|
|
51d42575a7 | ||
|
|
f2643d2f97 | ||
|
|
a5f2a634b3 | ||
|
|
4a7105d502 | ||
|
|
cff3cfcdb6 | ||
|
|
dbb49e107a | ||
|
|
17b758ed27 | ||
|
|
82cb46643d | ||
|
|
59efb5ed2f | ||
|
|
c9a12d8c34 | ||
|
|
daad4b58ef | ||
|
|
432743e00b | ||
|
|
057b9a2846 | ||
|
|
749d8d779a | ||
|
|
c9bfd3dacd | ||
|
|
bc935f9d32 | ||
|
|
4dc4f0a505 | ||
|
|
1e7ed9d5c0 | ||
|
|
1083997359 | ||
|
|
1ccc351cdb | ||
|
|
728401ee63 | ||
|
|
4a1940ac94 | ||
|
|
835a82bf2f | ||
|
|
017df65d8b | ||
|
|
097a56b66a | ||
|
|
64ac912f92 | ||
|
|
8901f564b0 | ||
|
|
d2296a0fb6 | ||
|
|
8fb887daf5 | ||
|
|
636314ed49 | ||
|
|
e5bbd98738 | ||
|
|
559df47acf | ||
|
|
c31cba30f5 | ||
|
|
b5818fd0b5 | ||
|
|
f2cf44166f | ||
|
|
5d71b9a05c | ||
|
|
4727b8ae44 | ||
|
|
cdf29a20d7 | ||
|
|
71c84b8803 | ||
|
|
a9a53215c0 | ||
|
|
87ac2c5c2b | ||
|
|
e9cd78d0f8 | ||
|
|
2e85fedc91 | ||
|
|
9fb3f5fcad | ||
|
|
6daeb80aa1 | ||
|
|
726e0b44d6 | ||
|
|
88369d8fbd | ||
|
|
8ab2235f9c | ||
|
|
72f3d82cda | ||
|
|
8d5783900b | ||
|
|
29a8ec164a | ||
|
|
b1013ad3a6 | ||
|
|
b5220141f8 | ||
|
|
c47e51a130 | ||
|
|
26f2a09c9a | ||
|
|
bd3d77a4e5 | ||
|
|
38413ffc09 | ||
|
|
dd6b62cf13 | ||
|
|
68d580cdb3 | ||
|
|
530361cd4c | ||
|
|
6a8cdd6376 | ||
|
|
7e1706b55f | ||
|
|
bc7a1916c8 | ||
|
|
f5695051e7 | ||
|
|
73e3cf48c6 | ||
|
|
2f56f04fc9 | ||
|
|
abd48a4f8c | ||
|
|
5e0bc0eabd | ||
|
|
cfcf6e6b18 | ||
|
|
95fd955841 | ||
|
|
dc0b720a2b | ||
|
|
8371f2816a | ||
|
|
7a020a93b0 | ||
|
|
19e44f0990 | ||
|
|
f19b598f51 | ||
|
|
a33bf852ca | ||
|
|
f78ddf501b | ||
|
|
d449731f9d | ||
|
|
beccd79b29 | ||
|
|
12b8ed756d | ||
|
|
eba9f99d02 | ||
|
|
c0d776a7ce | ||
|
|
9933671937 | ||
|
|
9183fcb9e4 | ||
|
|
5f645b6cf2 | ||
|
|
cd394c906d | ||
|
|
eee4f10a21 | ||
|
|
8862924874 | ||
|
|
34f295d3e3 | ||
|
|
3bda3337aa | ||
|
|
db3e868b1d | ||
|
|
2983d87407 | ||
|
|
30be0af6a2 | ||
|
|
6610b63223 | ||
|
|
7c82fd84f8 | ||
|
|
f15308f18a | ||
|
|
f54c11e321 | ||
|
|
d5bb3634f9 | ||
|
|
7d0c268340 | ||
|
|
89e0def4f7 | ||
|
|
caf7be5bea | ||
|
|
0ce0653d64 | ||
|
|
bd94526ce2 | ||
|
|
37df0dca9d | ||
|
|
05e83cb275 | ||
|
|
c06be56a54 | ||
|
|
196a1937e1 | ||
|
|
3ff3226f43 | ||
|
|
ff0e98610d | ||
|
|
08a431ad6f | ||
|
|
1b8922fc8c | ||
|
|
159ed52397 | ||
|
|
2088049bf6 | ||
|
|
3a1ff78ab4 | ||
|
|
7a93e41f09 | ||
|
|
25efa940f2 | ||
|
|
84f184a1f0 | ||
|
|
b83c36cf9e | ||
|
|
bab32993e3 | ||
|
|
6137573286 | ||
|
|
c6d5ab94c7 | ||
|
|
3b50aeb33d | ||
|
|
b309a3268a | ||
|
|
68d22b8748 | ||
|
|
ad79ed3daa | ||
|
|
6bed9e6791 | ||
|
|
57810705ab | ||
|
|
644e48f8ad | ||
|
|
ba31ccffc3 | ||
|
|
b4aff053ba | ||
|
|
b846aa56c2 | ||
|
|
a7f50c1450 | ||
|
|
1e1d64c041 | ||
|
|
6ca492a11d | ||
|
|
b9405370ea | ||
|
|
170b223561 | ||
|
|
e7b137368e | ||
|
|
25a4ee37d4 | ||
|
|
737a489a0d | ||
|
|
a859cf1639 | ||
|
|
48ce57e631 | ||
|
|
6b0eed42af | ||
|
|
26680fc9c5 | ||
|
|
b880273e52 | ||
|
|
b0b9c41c50 | ||
|
|
a398bb964c | ||
|
|
d0cc3a858b | ||
|
|
63ed7704c6 | ||
|
|
6bd8269083 | ||
|
|
16ac534ca9 | ||
|
|
1f42252bb2 | ||
|
|
9a0447d8e7 | ||
|
|
a71209a8e3 | ||
|
|
a7135c46a7 | ||
|
|
49ca25ca7f | ||
|
|
a393f6f3d0 | ||
|
|
c34a8cdd0c | ||
|
|
715db982b7 | ||
|
|
693e0404c7 | ||
|
|
1a3dd76e44 | ||
|
|
b7c495b7ec | ||
|
|
b79e6371bb | ||
|
|
af08563a22 | ||
|
|
aa88901c54 | ||
|
|
0e0707a745 | ||
|
|
f21edf0676 | ||
|
|
a534e51c5b | ||
|
|
ec3557fd5c | ||
|
|
5c68528f66 | ||
|
|
0a79fbc0da | ||
|
|
42195c2e94 | ||
|
|
529785d9dc | ||
|
|
3b4eee4308 | ||
|
|
a4b5712e5c | ||
|
|
b80d726fd0 | ||
|
|
f4ddbf5c33 | ||
|
|
ea5bfa4be0 | ||
|
|
2102e689f8 | ||
|
|
dec952328a | ||
|
|
f4a098bbd6 | ||
|
|
1c77c7d896 | ||
|
|
14dbf15b4f | ||
|
|
d37d844513 | ||
|
|
ca57da7683 | ||
|
|
c618521bd7 | ||
|
|
50c2ffac49 | ||
|
|
c8847d66b6 | ||
|
|
c6a7b09056 | ||
|
|
8903f65547 | ||
|
|
1aeaa69747 | ||
|
|
19a3e4ced1 | ||
|
|
99262748d0 | ||
|
|
a61b242444 | ||
|
|
eea9580f54 | ||
|
|
a5b988cd4b | ||
|
|
448a5f817f | ||
|
|
9969e146a3 | ||
|
|
4f7c5a7f99 | ||
|
|
d73545928a | ||
|
|
89c3e20e43 | ||
|
|
fa71fd145e | ||
|
|
30a02e5ea0 | ||
|
|
02f5686aa5 | ||
|
|
0d3cbf9983 | ||
|
|
8e4253dcaf | ||
|
|
98f2e883c8 | ||
|
|
5c3dae18af | ||
|
|
fc55795967 | ||
|
|
8845986198 | ||
|
|
c283c0e9f3 | ||
|
|
0d430ab61e | ||
|
|
eee561f79d | ||
|
|
2899c21bc0 | ||
|
|
63036905a4 | ||
|
|
846b832695 | ||
|
|
4c3ca044c2 | ||
|
|
0b1e1885bc | ||
|
|
b16ce04487 | ||
|
|
d4a2ef98b2 | ||
|
|
8d2096ac96 | ||
|
|
f1ba224b4d | ||
|
|
568026c325 | ||
|
|
f77044b48a | ||
|
|
2b0655447e | ||
|
|
d48d3fb2c5 | ||
|
|
5d74deda1b | ||
|
|
5aef9077bc | ||
|
|
6e4bb2bde7 | ||
|
|
6c2996253d | ||
|
|
75d6becf23 | ||
|
|
1c47a34e21 | ||
|
|
8583b560d7 | ||
|
|
f2be557682 | ||
|
|
04fc3eb489 | ||
|
|
2bb557611f | ||
|
|
fa3bdf3095 | ||
|
|
6baa4b1513 | ||
|
|
0c094743c4 | ||
|
|
bdc42311b9 | ||
|
|
5571bcbab1 | ||
|
|
b56fe51346 | ||
|
|
aa26ff24da | ||
|
|
295e79f2d9 | ||
|
|
ce685646ed | ||
|
|
2ec0896945 | ||
|
|
1157919a64 | ||
|
|
7a9ccf113d | ||
|
|
75e8727b0a | ||
|
|
f2ccc6f82f | ||
|
|
760b05436e | ||
|
|
0a1aec1969 | ||
|
|
3291d5bd21 | ||
|
|
48e692718d | ||
|
|
fe18db0b9b | ||
|
|
3258c51ad9 | ||
|
|
37f5cf0a51 | ||
|
|
b42f88eea3 | ||
|
|
b29a9072b4 | ||
|
|
402075dab1 | ||
|
|
284addaeb5 | ||
|
|
9a5def6c91 | ||
|
|
18851098a8 | ||
|
|
6d1830be74 | ||
|
|
c2a7ad454c | ||
|
|
1463c2502d | ||
|
|
21c2cfee90 | ||
|
|
f77d913d3e | ||
|
|
0928eba4db | ||
|
|
bf34e2b483 | ||
|
|
660a508d0a | ||
|
|
63f237c7d6 | ||
|
|
e3c32f5355 | ||
|
|
b9b546411c | ||
|
|
5e0b95a6f5 | ||
|
|
a442571c3a | ||
|
|
e35b8ae3b0 | ||
|
|
e3114f29c6 | ||
|
|
105b98f0ee | ||
|
|
eea5a27196 | ||
|
|
0fc66177e0 | ||
|
|
67e73b6165 | ||
|
|
42e966f7bc | ||
|
|
4a6c006741 | ||
|
|
81acf16099 | ||
|
|
b11093eace | ||
|
|
09f2615e26 | ||
|
|
30f217ef6e | ||
|
|
aa11388cbe | ||
|
|
a251356d2e | ||
|
|
e5b9849e36 | ||
|
|
2e337af091 | ||
|
|
e21ed79d3f | ||
|
|
db193872b2 | ||
|
|
d3cc4d8454 | ||
|
|
e22ed33ee1 | ||
|
|
c72abc8d69 | ||
|
|
74a6356f92 | ||
|
|
df57012a84 | ||
|
|
013caa14c9 | ||
|
|
618330cacb | ||
|
|
b4451ec013 | ||
|
|
2f9da59fd5 | ||
|
|
b8fe4e3c8f | ||
|
|
e31d94af95 | ||
|
|
1dfb02b8f5 | ||
|
|
2a7f54f694 | ||
|
|
2aab5de022 | ||
|
|
82e8de22cb | ||
|
|
c713db1328 | ||
|
|
6a5791785c | ||
|
|
d863a8b90d | ||
|
|
a7c0f2e755 | ||
|
|
f3cfd576c2 | ||
|
|
27194f2617 | ||
|
|
4f38a4f4d8 | ||
|
|
1e2b1ea8e1 | ||
|
|
345367f8e0 | ||
|
|
600ca3cfd0 | ||
|
|
e256b29d60 | ||
|
|
54d468bdbc | ||
|
|
739f21aca6 | ||
|
|
3872e0ec36 | ||
|
|
632b54e665 | ||
|
|
0eb2b07a1e | ||
|
|
73692d0c4b | ||
|
|
9a7a8e2681 | ||
|
|
00cfdaa170 | ||
|
|
2ce7fa6c3f | ||
|
|
acc424672a | ||
|
|
e3a0d9e6cc | ||
|
|
60b190b8f5 | ||
|
|
55487a4b0a | ||
|
|
f9e8000928 | ||
|
|
9706c451b3 | ||
|
|
26de62b0f1 | ||
|
|
5bef6b6161 | ||
|
|
b18bafba99 | ||
|
|
c3187eed04 | ||
|
|
94d64aaa73 | ||
|
|
3efb7dc1b1 | ||
|
|
fe3ece4bd6 | ||
|
|
ffe6da3b03 | ||
|
|
cb74de9ea1 | ||
|
|
2ba9064186 | ||
|
|
fe019fe8a1 | ||
|
|
ed9ea6a619 | ||
|
|
ebf770fd0c | ||
|
|
8ca9a6bf21 | ||
|
|
89308e8358 | ||
|
|
d9b8637fde | ||
|
|
96451c0d03 | ||
|
|
8d2baa17a8 | ||
|
|
f24ef3a4f2 | ||
|
|
6979ce88ca | ||
|
|
bd67ee4aed | ||
|
|
34e62bf3af | ||
|
|
7c8ef33957 | ||
|
|
4a7eb53ecc | ||
|
|
970aba2ebc | ||
|
|
729d7a4d35 | ||
|
|
c3230d1e40 | ||
|
|
33060c85e6 | ||
|
|
1d03bbea38 | ||
|
|
91b6d78bf9 | ||
|
|
43125e461e | ||
|
|
6aa2e9ad06 | ||
|
|
f034dba42b | ||
|
|
5d185f91e6 | ||
|
|
2745352940 | ||
|
|
4af230007f | ||
|
|
5b77729006 | ||
|
|
f663a4d9a2 | ||
|
|
4c297865db | ||
|
|
7febaa084f | ||
|
|
7407708025 | ||
|
|
0181865985 | ||
|
|
cb8ade66a5 | ||
|
|
c2f4b8aaa6 | ||
|
|
df099a6587 | ||
|
|
294a1f2bdb | ||
|
|
6791e830fa | ||
|
|
dbf34dfd03 | ||
|
|
4e13a133ea | ||
|
|
74d6ad3ed0 | ||
|
|
bbe2db3e87 | ||
|
|
6a5e37d9d6 | ||
|
|
a46c8eac31 | ||
|
|
4178971111 | ||
|
|
4d30751614 | ||
|
|
d1949adc9e | ||
|
|
84b08ca168 | ||
|
|
a740bf3c3b | ||
|
|
01bf6eb912 | ||
|
|
68808cfd0c | ||
|
|
17154f2819 | ||
|
|
eae5ec5706 | ||
|
|
e3d56940db | ||
|
|
0c7d95d6d3 | ||
|
|
935a4b2ecb | ||
|
|
00dec45b55 | ||
|
|
bc164ee2ad | ||
|
|
8638e736da | ||
|
|
5cc39843fd | ||
|
|
44e48ee939 | ||
|
|
9021f3476e | ||
|
|
13213f8656 | ||
|
|
54fbf38afa | ||
|
|
522b554897 | ||
|
|
62f7cd833a | ||
|
|
862d5979e7 | ||
|
|
8be6367956 | ||
|
|
ad288c772f | ||
|
|
50c01bf69b | ||
|
|
a97ee4145e | ||
|
|
aefea6bfc8 | ||
|
|
fce01302f5 | ||
|
|
8fd60081eb | ||
|
|
ab1734835d | ||
|
|
4ccded750d | ||
|
|
722ca7c27c | ||
|
|
684a44068c | ||
|
|
a266871335 | ||
|
|
c010a0b14a | ||
|
|
05f8f5552b | ||
|
|
2e03b45de9 | ||
|
|
bf5a465b98 | ||
|
|
f75e8f187c | ||
|
|
fdfaa45629 | ||
|
|
45be6e8ee4 | ||
|
|
07478d898d | ||
|
|
0efe9ae6a4 | ||
|
|
4aa0f4cc79 | ||
|
|
cedc14f60f | ||
|
|
35e581613a | ||
|
|
2e2d7530db | ||
|
|
ff86174c92 | ||
|
|
af7212f28e | ||
|
|
ffba359e78 | ||
|
|
d8aeb35a82 | ||
|
|
aa44132a56 | ||
|
|
6b950395bd | ||
|
|
9079813c8d | ||
|
|
bbaa241ec0 | ||
|
|
6fbaf2fb82 | ||
|
|
95375f8de8 | ||
|
|
1c775ce373 | ||
|
|
6e4dbcf59b | ||
|
|
58c43024cd | ||
|
|
988c8b580a | ||
|
|
90ed06b783 | ||
|
|
7a80c50ab3 | ||
|
|
e15de852fa | ||
|
|
d620623abe | ||
|
|
805eb6963f | ||
|
|
f3a738b8da | ||
|
|
d5656c255f | ||
|
|
9d0f7a491f | ||
|
|
1ec49dd2da | ||
|
|
09950c6a67 | ||
|
|
5457679954 | ||
|
|
58c762062a | ||
|
|
a754c0f934 | ||
|
|
e12bb3e533 | ||
|
|
2e078f85c6 | ||
|
|
b19258ab77 | ||
|
|
f1d005b241 | ||
|
|
a5db5d2557 | ||
|
|
2044ceb8c0 | ||
|
|
3b9d06a6b3 | ||
|
|
0c63b65c1e | ||
|
|
ef58c25d3f | ||
|
|
a7f2fd22b6 | ||
|
|
86a057f17e | ||
|
|
ecdcbdbfdf | ||
|
|
a3aaea4c9c | ||
|
|
b4560afed5 | ||
|
|
cfb9e5e0c6 | ||
|
|
1da4a1acb8 | ||
|
|
81c1254c29 | ||
|
|
ab92098d09 | ||
|
|
6f87fbc8c1 | ||
|
|
0b33e4fa25 | ||
|
|
3146122771 | ||
|
|
d513f1e7ab | ||
|
|
2cf4942e54 | ||
|
|
6e808eef58 | ||
|
|
13e19e7b85 | ||
|
|
b21c5ecc11 | ||
|
|
b6e84319a4 | ||
|
|
30ff136cac | ||
|
|
b103dd4583 | ||
|
|
69c5beaa15 | ||
|
|
6a1fbf0637 | ||
|
|
e30feffa2b | ||
|
|
de61b461ca | ||
|
|
b2bde1c080 | ||
|
|
76a3781990 | ||
|
|
456622067a | ||
|
|
af30d7a749 | ||
|
|
828d0a30a1 | ||
|
|
a73b5578de | ||
|
|
a95a5f7140 | ||
|
|
84e45db213 | ||
|
|
ad08fe6178 | ||
|
|
9fa48229a5 | ||
|
|
82241eb162 | ||
|
|
919ac0c1ea | ||
|
|
4616ecd18f | ||
|
|
500db0c5ff | ||
|
|
fa53e32c9a | ||
|
|
47d889615e | ||
|
|
c5b311ccb0 | ||
|
|
294dea3e6a | ||
|
|
92f0c91d2d | ||
|
|
dcfbe8e752 | ||
|
|
878d2be5bb | ||
|
|
f04265ee6b | ||
|
|
3c307190a8 | ||
|
|
4c222760bc | ||
|
|
c2b83e39f3 | ||
|
|
b7a025ff15 | ||
|
|
f56cdc2cab | ||
|
|
4e390e0432 | ||
|
|
b25fff7dac | ||
|
|
8162084251 | ||
|
|
d3d94046e6 | ||
|
|
af044ceeff | ||
|
|
4b4da4cdab | ||
|
|
689a5a65c8 | ||
|
|
6366a00e54 | ||
|
|
4b019c6ab1 | ||
|
|
1a73aa6478 | ||
|
|
7c94affc93 | ||
|
|
4077517ac6 | ||
|
|
a83959df53 | ||
|
|
4e449bf576 | ||
|
|
57746486d4 | ||
|
|
cd1adb7575 | ||
|
|
aeb5a50a07 | ||
|
|
567e5fb3c0 | ||
|
|
29ddaa0120 | ||
|
|
9214fc4074 | ||
|
|
6399f836fd | ||
|
|
a3ec7a7aef | ||
|
|
247a211559 | ||
|
|
d54f418555 | ||
|
|
21601766e6 | ||
|
|
57c3ce69ec | ||
|
|
f72bbcb999 | ||
|
|
3a11bec690 | ||
|
|
bf3e39bc7c | ||
|
|
4e03b0c850 | ||
|
|
d941cbb4da | ||
|
|
78f1db717d | ||
|
|
b0fc868d8e | ||
|
|
71807c341d | ||
|
|
10399fde84 | ||
|
|
9aaf5e4fa6 | ||
|
|
8cd7d76481 | ||
|
|
08baa1b591 | ||
|
|
3537f85523 | ||
|
|
e059718e01 | ||
|
|
4e1ef316ba | ||
|
|
c3eb11bec8 | ||
|
|
1dfbc8d1bc | ||
|
|
f7edb577ad | ||
|
|
4b49654d53 | ||
|
|
0afeaef3bd | ||
|
|
ad88c947e1 | ||
|
|
bfb2bf4c4a | ||
|
|
344765aa4b | ||
|
|
341b69f310 | ||
|
|
99fed9c309 | ||
|
|
fd2720f0a8 | ||
|
|
ff8588978d | ||
|
|
7818bf654e | ||
|
|
229914aba7 | ||
|
|
7dae2b214b | ||
|
|
c2c0d87a89 | ||
|
|
a3aa59d6c8 | ||
|
|
a19609318e | ||
|
|
4c07461f44 | ||
|
|
1c0a3e24c3 | ||
|
|
f788112ddd | ||
|
|
d83fbb8027 | ||
|
|
73d3a38637 | ||
|
|
c1687e1f1c | ||
|
|
5fe4e6b7e8 | ||
|
|
49217069b2 | ||
|
|
3206e470f0 | ||
|
|
301c95c730 | ||
|
|
3ba9dce42a | ||
|
|
13b284aca7 | ||
|
|
93dbadfd4d | ||
|
|
d1a2860441 | ||
|
|
b70981a73e | ||
|
|
a1f14417db | ||
|
|
e5cdc96fc1 | ||
|
|
1627f7d453 | ||
|
|
0961b76476 | ||
|
|
bd60742f28 | ||
|
|
a0ce1ffc78 | ||
|
|
6ccfb10e1a | ||
|
|
3864da367b | ||
|
|
a02f6b0655 | ||
|
|
002b9384c9 | ||
|
|
f8cdd88ffa | ||
|
|
f71d94b4da | ||
|
|
cdb2893cab | ||
|
|
d09c82cdc5 | ||
|
|
c7dded715f | ||
|
|
30b45edbe4 | ||
|
|
d153c0766d | ||
|
|
a8f051adaa | ||
|
|
d99c1b77a1 | ||
|
|
d68bb857d8 | ||
|
|
16dc863f34 | ||
|
|
511f9f0b17 | ||
|
|
2334dcb213 | ||
|
|
4ff2cbb9e4 | ||
|
|
03b38f3d8c | ||
|
|
c1c17ab1d4 | ||
|
|
b7010ea35e | ||
|
|
f485300e53 | ||
|
|
609b8f3df4 | ||
|
|
bcce01d22f | ||
|
|
edf5dcbc82 | ||
|
|
0656dc7909 | ||
|
|
a3116ede4a | ||
|
|
4a70e9ed80 | ||
|
|
8b96d24f49 | ||
|
|
44b2714ba2 | ||
|
|
891b96afbf | ||
|
|
a14466fdc1 | ||
|
|
ac0b16019e | ||
|
|
0b510c4c91 | ||
|
|
8964648510 | ||
|
|
8445793a76 | ||
|
|
4bbf559cb1 | ||
|
|
a8cdaa70cc | ||
|
|
b305ebd129 | ||
|
|
00eb6a9593 | ||
|
|
50d8c9293e | ||
|
|
6985ce00b9 | ||
|
|
9f859066c3 | ||
|
|
50958d3604 | ||
|
|
715d03aa13 | ||
|
|
41d61d490e | ||
|
|
065d99f6b3 | ||
|
|
016fc24c3a | ||
|
|
0a941cbf8e | ||
|
|
562189670f | ||
|
|
3d18153c52 | ||
|
|
a73067ab00 | ||
|
|
d23eaa78eb | ||
|
|
68c824d86a | ||
|
|
b64231db0d | ||
|
|
0bf38b901b | ||
|
|
af6de47af7 | ||
|
|
b78f5ac37b | ||
|
|
93c7357313 | ||
|
|
cc4c7a837b | ||
|
|
225b2ec574 | ||
|
|
5d8341b93f | ||
|
|
8fd17f424e | ||
|
|
44bbff26d6 | ||
|
|
7d8815ac6b | ||
|
|
a729f8fcc8 | ||
|
|
b60e3a4cd6 | ||
|
|
aec28d31b9 | ||
|
|
a2a68fa4a5 | ||
|
|
85b62f945c | ||
|
|
a6aa370f6f | ||
|
|
e9e79414f3 | ||
|
|
bd79687d8d | ||
|
|
f4ae5c5a05 | ||
|
|
d83b4ae087 | ||
|
|
146e483815 | ||
|
|
0899d7a8cc | ||
|
|
ec479df423 | ||
|
|
d8d2a68426 | ||
|
|
eb2cf067d0 | ||
|
|
f58b700016 | ||
|
|
cdc3cd04b4 | ||
|
|
660df5aa08 | ||
|
|
1f6c067320 | ||
|
|
5396708078 | ||
|
|
7613ccf708 | ||
|
|
f554f6e630 | ||
|
|
f242b4cdb5 | ||
|
|
12150df652 | ||
|
|
250256d45d | ||
|
|
918526dd43 | ||
|
|
37cc894e8f | ||
|
|
2a7cd21eed | ||
|
|
5415ff1a18 | ||
|
|
cfa9579419 | ||
|
|
bb2dc3ade2 | ||
|
|
5bf79e76e8 | ||
|
|
72ff05f585 | ||
|
|
912abbf475 | ||
|
|
a53fc71a63 | ||
|
|
3d3f37bf43 | ||
|
|
63a1b1da83 | ||
|
|
813322bd4f | ||
|
|
3c51a4f212 | ||
|
|
a60944b91d | ||
|
|
bd08c99e80 | ||
|
|
0da986b46d | ||
|
|
faed7844f0 | ||
|
|
4925a971ff | ||
|
|
d7d7ee425d | ||
|
|
3268609655 | ||
|
|
1afb1267d1 | ||
|
|
9ab5d4af56 | ||
|
|
f1a8b97031 | ||
|
|
cb042f3bb5 | ||
|
|
d625349ccf | ||
|
|
f283fe7195 | ||
|
|
38fa7a3b5d | ||
|
|
1093fd74cb | ||
|
|
3e0d2517e4 | ||
|
|
fc512dcf1c | ||
|
|
247d08595d | ||
|
|
01c1b86e0e | ||
|
|
f6cbcb8c58 | ||
|
|
34c7b09247 | ||
|
|
e37974fdad | ||
|
|
9b10a1b9b6 | ||
|
|
fe40dac890 | ||
|
|
41053a5082 | ||
|
|
f4509113a1 | ||
|
|
b7e383d43f |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
FROM ubuntu:noble@sha256:a08e551cb33850e4740772b38217fc1796a66da2506d312abe51acda354ff061
|
||||
FROM ubuntu:noble@sha256:66460d557b25769b102175144d538d88219c077c678a49af4afca6fbfc1b5252
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ENV ANDROID_HOME=/usr/lib/android-sdk
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ steps:
|
||||
commands:
|
||||
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
|
||||
- sed -i s'#showOnlyFailingTestsInReports = ciBuild#showOnlyFailingTestsInReports = false#' build.gradle
|
||||
- sed -i s'#showOnlyFailingTestsInReports = ciBuild#showOnlyFailingTestsInReports = false#' build.gradle.kts
|
||||
- scripts/wait_for_emulator.sh
|
||||
- scripts/runAllScreenshotCombinations noCI false
|
||||
- scripts/screenshotSummary.sh
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -27,6 +27,7 @@ concurrency:
|
||||
jobs:
|
||||
analysis:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Disabled on forks
|
||||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
|
||||
@@ -51,13 +52,13 @@ jobs:
|
||||
echo "repo=${{ github.event.pull_request.head.repo.full_name }}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: ${{ steps.get-vars.outputs.repo }}
|
||||
ref: ${{ steps.get-vars.outputs.branch }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -70,10 +71,9 @@ jobs:
|
||||
run: |
|
||||
mkdir -p "$HOME/.gradle"
|
||||
{
|
||||
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
|
||||
echo "org.gradle.caching=true"
|
||||
echo "org.gradle.parallel=true"
|
||||
echo "org.gradle.jvmargs=-Xmx5g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
|
||||
echo "org.gradle.configureondemand=true"
|
||||
echo "org.gradle.configuration-cache=false"
|
||||
echo "kapt.incremental.apt=true"
|
||||
} > "$HOME/.gradle/gradle.properties"
|
||||
scripts/analysis/analysis-wrapper.sh "${{ steps.get-vars.outputs.branch }}" "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" "$GITHUB_RUN_NUMBER" "${{ steps.get-vars.outputs.pr }}"
|
||||
@@ -22,13 +22,13 @@ jobs:
|
||||
matrix:
|
||||
flavor: [ Generic, Gplay, Huawei ]
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
- uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||
- uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
|
||||
- name: Build ${{ matrix.flavor }}
|
||||
run: |
|
||||
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" >> gradle.properties
|
||||
|
||||
@@ -22,9 +22,9 @@ jobs:
|
||||
matrix:
|
||||
task: [ detekt, spotlessKotlinCheck ]
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
language: [ 'java' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set Swap Space
|
||||
@@ -43,11 +43,11 @@ jobs:
|
||||
with:
|
||||
swap-size-gb: 10
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -57,4 +57,4 @@ jobs:
|
||||
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
|
||||
./gradlew assembleDebug
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
|
||||
@@ -20,9 +20,9 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
#
|
||||
|
||||
## This file is intended to be sourced by other scripts
|
||||
|
||||
|
||||
function err() {
|
||||
echo >&2 "$@"
|
||||
}
|
||||
|
||||
|
||||
function curl_gh() {
|
||||
if [[ -n "$GITHUB_TOKEN" ]]
|
||||
then
|
||||
curl \
|
||||
--silent \
|
||||
--header "Authorization: token $GITHUB_TOKEN" \
|
||||
"$@"
|
||||
else
|
||||
err "WARNING: No GITHUB_TOKEN found. Skipping API call"
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: 2019-2025 Nextcloud GmbH and Nextcloud contributors
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
+46
-44
@@ -1,53 +1,55 @@
|
||||
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]e>
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
|
||||
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-FileCopyrightText: 2023 Andy Scherzinger <[email protected]e>
|
||||
# SPDX-License-Identifier: MIT
|
||||
name: "QA"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, stable-* ]
|
||||
pull_request:
|
||||
branches: [ main, master, stable-* ]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: qa-build-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
group: qa-build-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
qa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if secrets are available
|
||||
run: echo "ok=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT"
|
||||
id: check-secrets
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
- name: Build QA
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
env:
|
||||
KS_PASS: ${{ secrets.KS_PASS }}
|
||||
KEY_PASS: ${{ secrets.KEY_PASS }}
|
||||
LOG_USERNAME: ${{ secrets.LOG_USERNAME }}
|
||||
LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
mkdir -p $HOME/.gradle
|
||||
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > $HOME/.gradle/gradle.properties
|
||||
echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties
|
||||
echo "org.gradle.parallel=true" >> $HOME/.gradle/gradle.properties
|
||||
echo "org.gradle.configureondemand=true" >> $HOME/.gradle/gradle.properties
|
||||
echo "kapt.incremental.apt=true" >> $HOME/.gradle/gradle.properties
|
||||
sed -i "/qa/,/\}/ s/versionCode .*/versionCode ${{github.event.number}} /" app/build.gradle
|
||||
sed -i "/qa/,/\}/ s/versionName .*/versionName \"${{github.event.number}}\"/" app/build.gradle
|
||||
./gradlew assembleQaDebug
|
||||
$(find /usr/local/lib/android/sdk/build-tools/*/apksigner | sort | tail -n1) sign --ks-pass pass:$KS_PASS --key-pass pass:$KEY_PASS --ks-key-alias key0 --ks scripts/QA_keystore.jks app/build/outputs/apk/qa/debug/qa-debug-*.apk
|
||||
scripts/uploadArtifact.sh $LOG_USERNAME $LOG_PASSWORD ${{github.event.number}} ${{github.event.number}} $GITHUB_TOKEN
|
||||
qa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if secrets are available
|
||||
run: echo "ok=${{ secrets.KS_PASS != '' }}" >> "$GITHUB_OUTPUT"
|
||||
id: check-secrets
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
- name: Build QA
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
env:
|
||||
KS_PASS: ${{ secrets.KS_PASS }}
|
||||
KEY_PASS: ${{ secrets.KEY_PASS }}
|
||||
LOG_USERNAME: ${{ secrets.LOG_USERNAME }}
|
||||
LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
mkdir -p "$HOME/.gradle"
|
||||
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > "$HOME/.gradle/gradle.properties"
|
||||
echo "org.gradle.caching=true; org.gradle.parallel=true; org.gradle.configureondemand=true; kapt.incremental.apt=true" >> "$HOME/.gradle/gradle.properties"
|
||||
sed -i "/qa/,/\}/ s/versionCode.*/versionCode = ${{ github.event.number }}/" app/build.gradle.kts
|
||||
sed -i "/qa/,/\}/ s/versionName.*/versionName = \"${{ github.event.number }}\"/" app/build.gradle.kts
|
||||
./gradlew assembleQaDebug
|
||||
$(find /usr/local/lib/android/sdk/build-tools/*/apksigner | sort | tail -n1) sign --ks-pass pass:"$KS_PASS" --key-pass pass:"$KEY_PASS" --ks-key-alias key0 --ks ".github/workflows/QA_keystore.jks" app/build/outputs/apk/qa/debug/*qa-debug*.apk
|
||||
.github/workflows/uploadArtifact.sh "$LOG_USERNAME" "$LOG_PASSWORD" "${{github.event.number}}" "${{github.event.number}}" "$GITHUB_TOKEN"
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ jobs:
|
||||
runs-on: ubuntu-latest-low
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: REUSE Compliance Check
|
||||
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
|
||||
uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0
|
||||
@@ -29,12 +29,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
@@ -42,6 +42,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -25,17 +25,17 @@ jobs:
|
||||
color: [ blue ]
|
||||
api-level: [ 27 ]
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
- name: AVD cache
|
||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||
id: avd-cache
|
||||
with:
|
||||
path: |
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
~/.android/adb*
|
||||
key: avd-${{ matrix.api-level }}
|
||||
|
||||
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
||||
- name: Archive Espresso results
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: Report-${{ matrix.color }}-${{ matrix.scheme }}
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
|
||||
with:
|
||||
days-before-stale: 28
|
||||
days-before-close: 14
|
||||
|
||||
@@ -21,9 +21,9 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
if: ${{ always() }}
|
||||
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
|
||||
- name: Run unit tests with coverage
|
||||
run: ./gradlew jacocoTestGplayDebugUnitTest
|
||||
- name: Upload failing results
|
||||
@@ -42,14 +42,14 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "test" "Unit" ${{github.event.number}}
|
||||
- name: Upload coverage to codecov
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
||||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: unit
|
||||
fail_ci_if_error: true
|
||||
- name: Upload jacoco artifacts
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||
with:
|
||||
name: test-results
|
||||
path: app/build/reports/tests/testGplayDebugUnitTest/
|
||||
@@ -20,24 +20,25 @@ PR=$4
|
||||
GITHUB_TOKEN=$5
|
||||
DAV_URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-artifacts/
|
||||
|
||||
source scripts/lib.sh
|
||||
source .github/workflows/lib.sh
|
||||
REPO=$(cat scripts/repo)
|
||||
|
||||
if ! test -e app/build/outputs/apk/qa/debug/qa-debug-*.apk ; then
|
||||
if ! test -e app/build/outputs/apk/qa/debug/*qa-debug*.apk ; then
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploaded artifact to $DAV_URL/$BUILD.apk"
|
||||
|
||||
# delete all old comments, starting with "APK file:"
|
||||
oldComments=$(curl_gh -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("github-actions") | tostring) + "|" + (.body | test("APK file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
oldComments=$(curl_gh -X GET https://api.github.com/repos/nextcloud/$REPO/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("github-actions") | tostring) + "|" + (.body | test("APK file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
|
||||
echo $oldComments | while read comment ; do
|
||||
curl_gh -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
curl_gh -X DELETE https://api.github.com/repos/nextcloud/$REPO/issues/comments/$comment
|
||||
done
|
||||
|
||||
sudo apt-get -y install qrencode
|
||||
|
||||
qrencode -o $PR.png "$PUBLIC_URL/$BUILD.apk"
|
||||
|
||||
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.apk --upload-file app/build/outputs/apk/qa/debug/qa-debug-*.apk
|
||||
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.apk --upload-file app/build/outputs/apk/qa/debug/*qa-debug*.apk
|
||||
curl -u $USER:$PASS -X PUT $DAV_URL/$BUILD.png --upload-file $PR.png
|
||||
curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments -d "{ \"body\" : \"APK file: $PUBLIC_URL/$BUILD.apk <br/><br/>  <br/><br/>To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app. \" }"
|
||||
curl_gh -X POST https://api.github.com/repos/nextcloud/$REPO/issues/$PR/comments -d "{ \"body\" : \"APK file: $PUBLIC_URL/$BUILD.apk <br/><br/>  <br/><br/>To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app. \" }"
|
||||
@@ -1,3 +1,95 @@
|
||||
## 3.33.0 (September 10, 2025)
|
||||
|
||||
- Migrate to Glide 4
|
||||
- Performance improvements
|
||||
- Fix gallery image scaling
|
||||
- Bugfixes
|
||||
|
||||
Minimum: NC 18 Server, Android 8.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/112
|
||||
|
||||
## 3.32.3 (August 21, 2025)
|
||||
|
||||
- Bugfixes
|
||||
|
||||
Minimum: NC 18 Server, Android 8.0 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/114
|
||||
|
||||
## 3.32.2 (July 18, 2025)
|
||||
|
||||
- Resolved image blurriness issue.
|
||||
- Fixed crash occurring in the conflict resolution dialog.
|
||||
- Addressed crash in the upload finish receiver event handler.
|
||||
|
||||
Minimum: NC 18 Server, Android 8.0 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/115
|
||||
|
||||
## 3.32.1 (July 14, 2025)
|
||||
|
||||
- Bug fixes.
|
||||
|
||||
Minimum: NC 18 Server, Android 8.0 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/113
|
||||
|
||||
## 3.32.0 (July 2, 2025)
|
||||
|
||||
- Minimum supported Android version is 8.0.
|
||||
- Scrolling performance has been increased in the media tab.
|
||||
- Multi-select feature added to the media tab.
|
||||
- Custom share permissions have been added.
|
||||
- Bug fixes.
|
||||
|
||||
Minimum: NC 18 Server, Android 8.0 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/107
|
||||
|
||||
## 3.31.4 (June 3, 2025)
|
||||
|
||||
- Add missing auto migration
|
||||
|
||||
Minimum: NC 18 Server, Android 7.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/110
|
||||
|
||||
## 3.31.3 (May 28, 2025)
|
||||
|
||||
- fix simple sign up
|
||||
- bugfixes
|
||||
- update translations
|
||||
|
||||
Minimum: NC 18 Server, Android 7.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/110
|
||||
|
||||
## 3.31.2 (May 20, 2025)
|
||||
|
||||
- bring back MANAGE_EXTERNAL_STORAGE permission
|
||||
|
||||
Minimum: NC 18 Server, Android 7.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/108
|
||||
|
||||
## 3.31.1 (April 3, 2025)
|
||||
|
||||
- Various bug fixes and performance enhancements
|
||||
|
||||
Minimum: NC 18 Server, Android 7.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/108
|
||||
|
||||
## 3.31.0 (February 25, 2025)
|
||||
|
||||
- New share layout
|
||||
- Various bug fixes and performance enhancements
|
||||
|
||||
Minimum: NC 18 Server, Android 7.1 Nougat
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/100
|
||||
|
||||
## 3.30.7 (January 6, 2025)
|
||||
|
||||
- Fix crash of auto upload settings
|
||||
|
||||
@@ -12,6 +12,9 @@ height="80">](https://play.google.com/store/apps/details?id=com.nextcloud.client
|
||||
[<img src="https://f-droid.org/badge/get-it-on.png"
|
||||
alt="Get it on F-Droid"
|
||||
height="80">](https://f-droid.org/packages/com.nextcloud.client/)
|
||||
[<img src="https://github.com/user-attachments/assets/713d71c5-3dec-4ec4-a3f2-8d28d025a9c6"
|
||||
alt="Get it with Obtainium"
|
||||
height="80">](https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22com.nextcloud.client%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2Fnextcloud%2Fandroid%22%2C%22author%22%3A%22nextcloud%22%2C%22name%22%3A%22Nextcloud%22%2C%22preferredApkIndex%22%3A0%2C%22additionalSettings%22%3A%22%7B%5C%22includePrereleases%5C%22%3Afalse%2C%5C%22fallbackToOlderReleases%5C%22%3Atrue%2C%5C%22filterReleaseTitlesByRegEx%5C%22%3A%5C%22%5C%22%2C%5C%22filterReleaseNotesByRegEx%5C%22%3A%5C%22%5C%22%2C%5C%22verifyLatestTag%5C%22%3Afalse%2C%5C%22sortMethodChoice%5C%22%3A%5C%22date%5C%22%2C%5C%22useLatestAssetDateAsReleaseDate%5C%22%3Afalse%2C%5C%22releaseTitleAsVersion%5C%22%3Afalse%2C%5C%22trackOnly%5C%22%3Afalse%2C%5C%22versionExtractionRegEx%5C%22%3A%5C%22%5C%22%2C%5C%22matchGroupToUse%5C%22%3A%5C%22%5C%22%2C%5C%22versionDetection%5C%22%3Atrue%2C%5C%22releaseDateAsVersion%5C%22%3Afalse%2C%5C%22useVersionCodeAsOSVersion%5C%22%3Afalse%2C%5C%22apkFilterRegEx%5C%22%3A%5C%22%5Enextcloud.*%5C%22%2C%5C%22invertAPKFilter%5C%22%3Afalse%2C%5C%22autoApkFilterByArch%5C%22%3Atrue%2C%5C%22appName%5C%22%3A%5C%22%5C%22%2C%5C%22appAuthor%5C%22%3A%5C%22%5C%22%2C%5C%22shizukuPretendToBeGooglePlay%5C%22%3Afalse%2C%5C%22allowInsecure%5C%22%3Afalse%2C%5C%22exemptFromBackgroundUpdates%5C%22%3Afalse%2C%5C%22skipUpdateNotifications%5C%22%3Afalse%2C%5C%22about%5C%22%3A%5C%22Nextcloud%20ist%20eine%20Cloudanwendung%2C%20die%20selbst%20gehostet%20werden%20kann.%5C%22%2C%5C%22refreshBeforeDownload%5C%22%3Atrue%7D%22%2C%22overrideSource%22%3Anull%7D)
|
||||
|
||||
Signing certificate fingerprint to [verify](https://developer.android.com/studio/command-line/apksigner#usage-verify) the APK:
|
||||
- APK with "gplay" name, found [here](https://github.com/nextcloud/android/releases) or distributed via Google Play Store
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<!--
|
||||
~ SPDX-FileCopyrightText: 2025 Saeed <[email protected]>
|
||||
~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
-->
|
||||
# تطبيق [Nextcloud](https://nextcloud.com)لأجهزة أندرويد 📱
|
||||
|
||||
[](https://api.reuse.software/info/github.com/nextcloud/android)
|
||||
[](https://drone.nextcloud.com/nextcloud/android)
|
||||
[](https://app.codacy.com/gh/nextcloud/android/dashboard)
|
||||
[](https://github.com/nextcloud/android/releases/latest)
|
||||
|
||||
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" alt="تحميل من Google Play" height="80">](https://play.google.com/store/apps/details?id=com.nextcloud.client)
|
||||
[<img src="https://f-droid.org/badge/get-it-on.png" alt="احصل عليه من F-Droid" height="80">](https://f-droid.org/packages/com.nextcloud.client/)
|
||||
|
||||
## التحقق من توقيع التطبيق 🔐
|
||||
|
||||
للتأكد من صحة ملف APK:
|
||||
|
||||
- ملف APK باسم "gplay" متوفر [هنا](https://github.com/nextcloud/android/releases) أو عبر متجر Google Play
|
||||
- ملف APK باسم "nextcloud" متوفر [هنا](https://github.com/nextcloud/android/releases)
|
||||
- غير مناسب لتحميلات F-Droid، لأن F-Droid يقوم بتوقيعه بنفسه
|
||||
|
||||
```plaintext
|
||||
SHA-256: fb009522f65e25802261b67b10a45fd70e610031976f40b28a649e152ded0373
|
||||
SHA-1: 74aa1702e714941be481e1f7ce4a8f779c19dcea
|
||||
```
|
||||
|
||||
**تطبيق Nextcloud لأندرويد يتيح لك إدارة بياناتك بسهولة على خادم Nextcloud الخاص بك.**
|
||||
|
||||
## الحصول على الدعم 🆘
|
||||
|
||||
إذا واجهت مشكلة أو لديك سؤال، يمكنك زيارة [منتدى الدعم](https://help.nextcloud.com/c/clients/android).
|
||||
إذا اكتشفت خطأ أو لديك اقتراح لتحسين التطبيق، يمكنك [فتح قضية جديدة على GitHub](https://github.com/nextcloud/android/issues).
|
||||
|
||||
إذا لم تكن متأكدًا ما إذا كانت المشكلة ناتجة عن التطبيق أو الإعدادات أو الخادم، فابدأ بالسؤال في المنتدى، ثم عد إلى GitHub إذا لزم الأمر.
|
||||
|
||||
> ملاحظة: هذا المستودع خاص بتطبيق أندرويد فقط. إذا كانت المشكلة في الخادم، يرجى التواصل مع [فريق خادم Nextcloud](https://github.com/nextcloud/server).
|
||||
|
||||
## كيف تساهم في المشروع 🚀
|
||||
|
||||
هناك العديد من الطرق للمساهمة، سواء كنت مبرمجًا أو لا:
|
||||
|
||||
- مساعدة المستخدمين في المنتدى: https://help.nextcloud.com
|
||||
- ترجمة التطبيق عبر [Transifex](https://app.transifex.com/nextcloud/nextcloud/android/)
|
||||
- الإبلاغ عن المشاكل أو تقديم اقتراحات عبر [GitHub Issues](https://github.com/nextcloud/android/issues/new/choose)
|
||||
- تنفيذ إصلاحات أو تحسينات عبر Pull Requests
|
||||
- مراجعة [طلبات الدمج](https://github.com/nextcloud/android/pulls)
|
||||
- اختبار النسخ التجريبية أو اليومية أو المرشحة للإصدار
|
||||
- تحسين [التوثيق](https://github.com/nextcloud/documentation/)
|
||||
- اختبار الميزات الأساسية في آخر إصدار مستقر
|
||||
- تعلم كيفية جمع سجلات الأخطاء (logcat) لتقديم تقارير دقيقة
|
||||
|
||||
## إرشادات المساهمة والترخيص 📜
|
||||
|
||||
- الترخيص: [GPLv2](https://github.com/nextcloud/android/blob/master/LICENSE.txt)
|
||||
- جميع المساهمات بعد 16 يونيو 2016 تعتبر مرخصة تحت AGPLv3 أو أي إصدار لاحق
|
||||
- لا حاجة لتوقيع اتفاقية مساهم (CLA)
|
||||
- يُفضل إضافة السطر التالي في رأس الملف عند إجراء تغييرات كبيرة:
|
||||
|
||||
```plaintext
|
||||
SPDX-FileCopyrightText: <السنة> <اسمك> <بريدك الإلكتروني>
|
||||
```
|
||||
|
||||
يرجى قراءة [مدونة السلوك](https://nextcloud.com/community/code-of-conduct/) لضمان بيئة تعاون إيجابية.
|
||||
راجع أيضًا [إرشادات المساهمة](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## ابدأ بالمساهمة 🔧
|
||||
|
||||
- اقرأ [SETUP.md](https://github.com/nextcloud/android/blob/master/SETUP.md) و[CONTRIBUTING.md](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md)
|
||||
- قم بعمل fork للمستودع وابدأ بإرسال Pull Requests إلى فرع master
|
||||
- يمكنك البدء بمراجعة [طلبات الدمج](https://github.com/nextcloud/android/pulls) أو العمل على [القضايا المبتدئة](https://github.com/nextcloud/android/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
|
||||
|
||||
## جمع سجلات الأخطاء (logcat) 🔍
|
||||
|
||||
### على لينكس:
|
||||
|
||||
- فعّل USB-Debugging على هاتفك
|
||||
- افتح الطرفية وأدخل:
|
||||
|
||||
```bash
|
||||
adb logcat --pid=$(adb shell pidof -s 'com.nextcloud.client') > logcatOutput.txt
|
||||
```
|
||||
|
||||
> تأكد من تثبيت [adb](https://developer.android.com/studio/releases/platform-tools.html)
|
||||
|
||||
### على ويندوز:
|
||||
|
||||
- حمّل [Minimal ADB and Fastboot](https://forum.xda-developers.com/t/tool-minimal-adb-and-fastboot-2-9-18.2317790/#post-42407269)
|
||||
- فعّل USB-Debugging
|
||||
- افتح البرنامج وأدخل:
|
||||
|
||||
```bash
|
||||
adb shell pidof -s 'com.nextcloud.client'
|
||||
```
|
||||
|
||||
- استخدم الناتج كـ `<processID>` في الأمر التالي:
|
||||
|
||||
```bash
|
||||
adb logcat --pid=<processID> > "%USERPROFILE%\Downloads\logcatOutput.txt"
|
||||
```
|
||||
|
||||
### على الجهاز (مع صلاحيات root):
|
||||
|
||||
```bash
|
||||
su
|
||||
logcat -d --pid $(pidof -s com.nextcloud.client) -f /sdcard/logcatOutput.txt
|
||||
```
|
||||
|
||||
أو استخدم تطبيقات مثل [CatLog](https://play.google.com/store/apps/details?id=com.nolanlawson.logcat) أو [aLogcat](https://play.google.com/store/apps/details?id=org.jtb.alogcat)
|
||||
|
||||
## النسخة التطويرية 🛠️
|
||||
|
||||
- [تحميل مباشر للـ APK](https://download.nextcloud.com/android/dev/latest.apk)
|
||||
- [F-Droid النسخة التجريبية](https://f-droid.org/en/packages/com.nextcloud.android.beta/)
|
||||
|
||||
## المشاكل المعروفة والأسئلة الشائعة
|
||||
|
||||
### الإشعارات الفورية لا تعمل في نسخ F-Droid
|
||||
|
||||
بسبب اعتمادها على خدمات Google Play، لا تعمل الإشعارات الفورية في نسخ F-Droid حاليًا.
|
||||
@@ -1,518 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2024 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2024 Andy Scherzinger <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Álvaro Brey Vilas <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
import com.github.spotbugs.snom.Confidence
|
||||
import com.github.spotbugs.snom.Effort
|
||||
import com.github.spotbugs.snom.SpotBugsTask
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$androidPluginVersion"
|
||||
classpath libs.spotbugs.gradle.plugin
|
||||
classpath libs.kotlin.gradle.plugin
|
||||
classpath libs.detekt.gradle.plugin
|
||||
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
classpath "com.karumi:shot:6.1.0"
|
||||
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
|
||||
classpath "org.jacoco:org.jacoco.report:$jacoco_version"
|
||||
classpath "org.jacoco:org.jacoco.agent:$jacoco_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
alias(libs.plugins.spotless)
|
||||
alias(libs.plugins.kapt)
|
||||
alias(libs.plugins.ksp) apply false
|
||||
}
|
||||
|
||||
apply plugin: "com.android.application"
|
||||
|
||||
apply plugin: "kotlin-android"
|
||||
apply plugin: "kotlin-parcelize"
|
||||
apply plugin: "checkstyle"
|
||||
apply plugin: "pmd"
|
||||
apply from: "$rootProject.projectDir/jacoco.gradle"
|
||||
apply plugin: "com.github.spotbugs"
|
||||
apply plugin: "io.gitlab.arturbosch.detekt"
|
||||
|
||||
// needed to make renovate run without shot, as shot requires Android SDK
|
||||
// https://github.com/pedrovgs/Shot/issues/300
|
||||
if (shotTest) {
|
||||
apply plugin: "shot"
|
||||
}
|
||||
apply plugin: "com.google.devtools.ksp"
|
||||
|
||||
|
||||
println "Gradle uses Java ${Jvm.current()}"
|
||||
|
||||
configurations {
|
||||
configureEach {
|
||||
exclude group: "org.jetbrains", module: "annotations-java5" // via prism4j, already using annotations explicitly
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
configurations.configureEach {
|
||||
resolutionStrategy.eachDependency {
|
||||
if (requested.group == "org.checkerframework" && requested.name != "checker-compat-qual") {
|
||||
useVersion(checkerVersion)
|
||||
because("https://github.com/google/ExoPlayer/issues/10007")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// semantic versioning for version code
|
||||
def versionMajor = 3
|
||||
def versionMinor = 33
|
||||
def versionPatch = 0
|
||||
def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
|
||||
|
||||
|
||||
def ndkEnv = new HashMap<String, String>()
|
||||
file("$project.rootDir/ndk.env").readLines().each() {
|
||||
def (key, value) = it.tokenize("=")
|
||||
ndkEnv.put(key, value)
|
||||
}
|
||||
|
||||
def perfAnalysis = project.hasProperty("perfAnalysis")
|
||||
|
||||
android {
|
||||
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
|
||||
ndkVersion = "${ndkEnv.get("NDK_VERSION")}"
|
||||
|
||||
|
||||
namespace = "com.owncloud.android"
|
||||
testNamespace = "${namespace}.test"
|
||||
|
||||
androidResources {
|
||||
generateLocaleConfig = true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.nextcloud.client"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
compileSdk = 35
|
||||
|
||||
buildConfigField "boolean", "CI", ciBuild.toString()
|
||||
buildConfigField "boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString()
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
|
||||
// arguments to be passed to functional tests
|
||||
if (shotTest) {
|
||||
testInstrumentationRunner "com.karumi.shot.ShotTestRunner"
|
||||
} else {
|
||||
testInstrumentationRunner "com.nextcloud.client.TestRunner"
|
||||
}
|
||||
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
|
||||
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
|
||||
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
|
||||
testInstrumentationRunnerArguments disableAnalytics: "true"
|
||||
|
||||
versionCode versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
|
||||
|
||||
if (versionBuild > 89) {
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
} else if (versionBuild > 50) {
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch} RC" + (versionBuild - 50)
|
||||
} else {
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha" + (versionBuild + 1)
|
||||
}
|
||||
|
||||
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
||||
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
||||
|
||||
flavorDimensions += "default"
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
testCoverageEnabled = project.hasProperty("coverage")
|
||||
resConfigs "xxxhdpi"
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
// used for f-droid
|
||||
generic {
|
||||
applicationId "com.nextcloud.client"
|
||||
dimension "default"
|
||||
}
|
||||
|
||||
gplay {
|
||||
applicationId "com.nextcloud.client"
|
||||
dimension "default"
|
||||
}
|
||||
|
||||
huawei {
|
||||
applicationId "com.nextcloud.client"
|
||||
dimension "default"
|
||||
}
|
||||
|
||||
versionDev {
|
||||
applicationId "com.nextcloud.android.beta"
|
||||
dimension "default"
|
||||
versionCode 20220322
|
||||
versionName "20220322"
|
||||
}
|
||||
|
||||
qa {
|
||||
applicationId "com.nextcloud.android.qa"
|
||||
dimension "default"
|
||||
versionCode 1
|
||||
versionName "1"
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.returnDefaultValues = true
|
||||
animationsDisabled = true
|
||||
}
|
||||
}
|
||||
|
||||
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
||||
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += "META-INF/LICENSE*"
|
||||
excludes += "META-INF/versions/9/OSGI-INF/MANIFEST*"
|
||||
pickFirst "MANIFEST.MF" // workaround for duplicated manifest on some dependencies
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("checkstyle", Checkstyle) {
|
||||
configFile = file("${rootProject.projectDir}/checkstyle.xml")
|
||||
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
|
||||
source "src"
|
||||
include "**/*.java"
|
||||
exclude "**/gen/**"
|
||||
classpath = files()
|
||||
}
|
||||
|
||||
tasks.register("pmd", Pmd) {
|
||||
ruleSetFiles = files("${project.rootDir}/ruleset.xml")
|
||||
ignoreFailures = true // should continue checking
|
||||
ruleSets = []
|
||||
|
||||
source "src"
|
||||
include "**/*.java"
|
||||
exclude "**/gen/**"
|
||||
|
||||
reports {
|
||||
xml {
|
||||
destination = layout.buildDirectory.file("reports/pmd/pmd.xml").get().asFile
|
||||
}
|
||||
html {
|
||||
destination = layout.buildDirectory.file("reports/pmd/pmd.html").get().asFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn "checkstyle", "spotbugsGplayDebug", "pmd", "lint", "spotlessKotlinCheck", "detekt"
|
||||
|
||||
buildFeatures {
|
||||
dataBinding = true
|
||||
viewBinding = true
|
||||
aidl = true
|
||||
compose = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
lint {
|
||||
abortOnError = false
|
||||
checkGeneratedSources = true
|
||||
disable "MissingTranslation", "GradleDependency", "VectorPath", "IconMissingDensityFolder", "IconDensities", "GoogleAppIndexingWarning", "MissingDefaultResource", "InvalidPeriodicWorkRequestInterval", "StringFormatInvalid", "MissingQuantity"
|
||||
htmlOutput = layout.buildDirectory.file("reports/lint/lint.html").get().asFile
|
||||
htmlReport = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
// Adds exported schema location as test app assets.
|
||||
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
||||
}
|
||||
|
||||
kapt {
|
||||
useBuildCache = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.github.nextcloud:android-library:$androidLibraryVersion") {
|
||||
exclude group: "org.ogce", module: "xpp3" // unused in Android and brings wrong Junit version
|
||||
}
|
||||
|
||||
// splash screen dependency ref: https://developer.android.com/develop/ui/views/launch/splash-screen/migrate
|
||||
implementation libs.splashscreen
|
||||
|
||||
// Jetpack Compose
|
||||
implementation(platform(libs.compose.bom))
|
||||
implementation(libs.compose.ui)
|
||||
implementation(libs.compose.ui.graphics)
|
||||
implementation(libs.compose.material3)
|
||||
debugImplementation(libs.compose.ui.tooling)
|
||||
implementation(libs.compose.ui.tooling.preview)
|
||||
|
||||
// Media3
|
||||
implementation libs.media3.ui
|
||||
implementation libs.media3.session
|
||||
implementation libs.media3.exoplayer
|
||||
implementation libs.media3.datasource
|
||||
|
||||
// Room
|
||||
implementation libs.room.runtime
|
||||
ksp "androidx.room:room-compiler:$roomVersion"
|
||||
androidTestImplementation libs.room.testing
|
||||
|
||||
// Espresso
|
||||
androidTestImplementation libs.espresso.core
|
||||
androidTestImplementation libs.espresso.contrib
|
||||
androidTestImplementation libs.espresso.web
|
||||
androidTestImplementation libs.espresso.accessibility
|
||||
androidTestImplementation libs.espresso.intents
|
||||
androidTestImplementation libs.espresso.idling.resource
|
||||
|
||||
// Glide
|
||||
implementation libs.glide
|
||||
ksp libs.ksp
|
||||
|
||||
compileOnly "org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2"
|
||||
// remove after entire switch to lib v2
|
||||
implementation "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
implementation "org.apache.jackrabbit:jackrabbit-webdav:2.13.5" // remove after entire switch to lib v2
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
implementation "com.google.android.material:material:1.12.0"
|
||||
implementation "com.jakewharton:disklrucache:2.0.2"
|
||||
implementation "androidx.appcompat:appcompat:$appCompatVersion"
|
||||
implementation "androidx.webkit:webkit:1.14.0"
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
implementation "androidx.exifinterface:exifinterface:1.4.1"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.2"
|
||||
implementation "androidx.lifecycle:lifecycle-service:2.9.2"
|
||||
implementation "androidx.work:work-runtime:$workRuntime"
|
||||
implementation "androidx.work:work-runtime-ktx:$workRuntime"
|
||||
implementation "androidx.fragment:fragment-ktx:1.8.8"
|
||||
implementation "com.github.albfernandez:juniversalchardet:2.5.0" // need this version for Android <7
|
||||
compileOnly "com.google.code.findbugs:annotations:3.0.1u2"
|
||||
implementation "commons-io:commons-io:2.20.0"
|
||||
implementation "org.greenrobot:eventbus:3.3.1"
|
||||
implementation "com.googlecode.ez-vcard:ez-vcard:0.12.1"
|
||||
implementation "org.lukhnos:nnio:0.3.1"
|
||||
implementation "org.bouncycastle:bcpkix-jdk18on:1.81"
|
||||
implementation "com.google.code.gson:gson:2.13.1"
|
||||
implementation "com.github.nextcloud-deps:sectioned-recyclerview:0.6.1"
|
||||
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.29"
|
||||
implementation "com.github.nextcloud-deps:qrcodescanner:0.1.2.4" // "com.github.blikoon:QRCodeScanner:0.1.2"
|
||||
implementation "com.google.android.flexbox:flexbox:3.0.0"
|
||||
|
||||
implementation "com.caverock:androidsvg:1.4"
|
||||
implementation "androidx.annotation:annotation:1.9.1"
|
||||
implementation "com.vanniktech:emoji-google:0.21.0"
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.2")
|
||||
|
||||
// document scanner not available on FDroid (generic) due to OpenCV binaries
|
||||
gplayImplementation project(":appscan")
|
||||
huaweiImplementation project(":appscan")
|
||||
qaImplementation project(":appscan")
|
||||
|
||||
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0"
|
||||
spotbugsPlugins "com.mebigfatguy.fb-contrib:fb-contrib:7.6.12"
|
||||
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
implementation "com.google.dagger:dagger-android:$daggerVersion"
|
||||
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
|
||||
|
||||
implementation "org.conscrypt:conscrypt-android:2.5.3"
|
||||
|
||||
implementation "me.zhanghai.android.fastscroll:library:1.3.0"
|
||||
|
||||
// Shimmer animation
|
||||
implementation "io.github.elye:loaderviewlibrary:3.0.0"
|
||||
|
||||
// dependencies for markdown rendering
|
||||
implementation "io.noties.markwon:core:$markwonVersion"
|
||||
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
||||
implementation "io.noties.markwon:ext-tables:$markwonVersion"
|
||||
implementation "io.noties.markwon:ext-tasklist:$markwonVersion"
|
||||
implementation "io.noties.markwon:html:$markwonVersion"
|
||||
|
||||
implementation "io.noties.markwon:syntax-highlight:$markwonVersion"
|
||||
implementation "io.noties:prism4j:$prismVersion"
|
||||
kapt "io.noties:prism4j-bundler:$prismVersion"
|
||||
|
||||
// dependencies for image cropping and rotation
|
||||
implementation "com.vanniktech:android-image-cropper:4.6.0"
|
||||
|
||||
implementation "org.osmdroid:osmdroid-android:6.1.20"
|
||||
|
||||
implementation("org.mnode.ical4j:ical4j:3.0.0") {
|
||||
["org.apache.commons", "commons-logging"].each {
|
||||
exclude group: "$it"
|
||||
}
|
||||
}
|
||||
|
||||
if (perfAnalysis) {
|
||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.14"
|
||||
}
|
||||
|
||||
// dependencies for local unit tests
|
||||
testImplementation "junit:junit:4.13.2"
|
||||
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
testImplementation "androidx.test:core:$androidxTestVersion"
|
||||
testImplementation "org.json:json:20250517"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
testImplementation "androidx.arch.core:core-testing:2.2.0"
|
||||
testImplementation "io.mockk:mockk:$mockkVersion"
|
||||
testImplementation "io.mockk:mockk-android:$mockkVersion"
|
||||
|
||||
// dependencies for instrumented tests
|
||||
// JUnit4 Rules
|
||||
androidTestImplementation "androidx.test.ext:junit:1.2.1"
|
||||
androidTestImplementation "androidx.test:rules:$androidxTestVersion"
|
||||
// Android JUnit Runner
|
||||
androidTestImplementation "androidx.test:runner:1.6.2"
|
||||
androidTestUtil "androidx.test:orchestrator:1.5.1"
|
||||
androidTestImplementation "androidx.test:core-ktx:$androidxTestVersion"
|
||||
|
||||
// Mocking support
|
||||
androidTestImplementation "com.github.tmurakami:dexopener:2.0.5" // required to allow mocking on API 27 and older
|
||||
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
androidTestImplementation("org.mockito:mockito-android:$mockitoVersion")
|
||||
androidTestImplementation "io.mockk:mockk-android:$mockkVersion"
|
||||
androidTestImplementation "androidx.arch.core:core-testing:2.2.0"
|
||||
androidTestImplementation "com.facebook.testing.screenshot:core:0.15.0"
|
||||
|
||||
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
|
||||
// androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
|
||||
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
|
||||
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
|
||||
androidTestImplementation "tools.fastlane:screengrab:2.1.1"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
implementation "com.github.stateless4j:stateless4j:2.6.0"
|
||||
|
||||
// upon each update first test: new registration, receive push
|
||||
gplayImplementation "com.google.firebase:firebase-messaging:24.1.2"
|
||||
gplayImplementation "com.google.android.gms:play-services-base:18.5.0"
|
||||
gplayImplementation "com.google.android.play:review-ktx:2.0.2"
|
||||
|
||||
implementation "com.github.nextcloud.android-common:ui:$androidCommonLibraryVersion"
|
||||
|
||||
implementation "io.coil-kt:coil:2.7.0"
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
resolutionStrategy {
|
||||
force "org.objenesis:objenesis:3.4"
|
||||
eachDependency { details ->
|
||||
if ("org.jacoco" == details.requested.group) {
|
||||
details.useVersion "$jacoco_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run the compiler as a separate process
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.fork = true
|
||||
|
||||
// Enable Incremental Compilation
|
||||
options.incremental = true
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
// Run tests in parallel
|
||||
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
||||
|
||||
// increased logging for tests
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
variant.outputs.configureEach { output -> outputFileName = "${output.baseName}-${variant.versionCode}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
spotless {
|
||||
kotlin {
|
||||
target "**/*.kt"
|
||||
ktlint()
|
||||
}
|
||||
}
|
||||
|
||||
detekt {
|
||||
config.setFrom("detekt.yml")
|
||||
}
|
||||
|
||||
if (shotTest) {
|
||||
shot {
|
||||
showOnlyFailingTestsInReports = ciBuild
|
||||
// CI environment renders some shadows slightly different from local VMs
|
||||
// Add a 0.5% tolerance to account for that
|
||||
tolerance = ciBuild ? 0.1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = "$jacoco_version"
|
||||
}
|
||||
|
||||
spotbugs {
|
||||
ignoreFailures = true // should continue checking
|
||||
effort = Effort.MAX
|
||||
reportLevel = Confidence.valueOf("MEDIUM")
|
||||
}
|
||||
|
||||
tasks.withType(SpotBugsTask){task ->
|
||||
String variantNameCap = task.name.replace("spotbugs", "")
|
||||
String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
|
||||
dependsOn "compile${variantNameCap}Sources"
|
||||
|
||||
classes = fileTree(layout.buildDirectory.get().asFile.toString()+"/intermediates/javac/${variantName}/compile${variantNameCap}JavaWithJavac/classes/")
|
||||
excludeFilter = file("${project.rootDir}/scripts/analysis/spotbugs-filter.xml")
|
||||
reports {
|
||||
xml {
|
||||
required = true
|
||||
}
|
||||
html {
|
||||
required = true
|
||||
outputLocation = layout.buildDirectory.file("reports/spotbugs/spotbugs.html").get().asFile
|
||||
stylesheet = "fancy.xsl"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Jimly Asshiddiqy <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
@file:Suppress("UnstableApiUsage", "DEPRECATION")
|
||||
|
||||
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
import com.github.spotbugs.snom.Confidence
|
||||
import com.github.spotbugs.snom.Effort
|
||||
import com.github.spotbugs.snom.SpotBugsTask
|
||||
import com.karumi.shot.ShotExtension
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
val shotTest = System.getenv("SHOT_TEST") == "true"
|
||||
val ciBuild = System.getenv("CI") == "true"
|
||||
val perfAnalysis = project.hasProperty("perfAnalysis")
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
alias(libs.plugins.spotless)
|
||||
alias(libs.plugins.kapt)
|
||||
alias(libs.plugins.ksp)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.kotlin.parcelize)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.spotbugs)
|
||||
alias(libs.plugins.detekt)
|
||||
// needed to make renovate run without shot, as shot requires Android SDK
|
||||
// https://github.com/pedrovgs/Shot/issues/300
|
||||
if (System.getenv("SHOT_TEST") == "true") alias(libs.plugins.shot)
|
||||
id("checkstyle")
|
||||
id("pmd")
|
||||
}
|
||||
apply(from = "${rootProject.projectDir}/jacoco.gradle.kts")
|
||||
|
||||
println("Gradle uses Java ${Jvm.current()}")
|
||||
|
||||
configurations.configureEach {
|
||||
// via prism4j, already using annotations explicitly
|
||||
exclude(group = "org.jetbrains", module = "annotations-java5")
|
||||
|
||||
resolutionStrategy {
|
||||
force(libs.objenesis)
|
||||
|
||||
eachDependency {
|
||||
if (requested.group == "org.checkerframework" && requested.name != "checker-compat-qual") {
|
||||
useVersion(libs.versions.checker.get())
|
||||
because("https://github.com/google/ExoPlayer/issues/10007")
|
||||
} else if (requested.group == "org.jacoco") {
|
||||
useVersion(libs.versions.jacoco.get())
|
||||
} else if (requested.group == "commons-logging" && requested.name == "commons-logging") {
|
||||
useTarget(libs.slfj)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// semantic versioning for version code
|
||||
val versionMajor = 3
|
||||
val versionMinor = 35
|
||||
val versionPatch = 0
|
||||
val versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
|
||||
|
||||
val ndkEnv = buildMap {
|
||||
file("${project.rootDir}/ndk.env").readLines().forEach {
|
||||
val (key, value) = it.split("=")
|
||||
put(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
val configProps = Properties().apply {
|
||||
val file = rootProject.file(".gradle/config.properties")
|
||||
if (file.exists()) load(FileInputStream(file))
|
||||
}
|
||||
|
||||
val ncTestServerUsername = configProps["NC_TEST_SERVER_USERNAME"]
|
||||
val ncTestServerPassword = configProps["NC_TEST_SERVER_PASSWORD"]
|
||||
val ncTestServerBaseUrl = configProps["NC_TEST_SERVER_BASEURL"]
|
||||
|
||||
android {
|
||||
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
|
||||
ndkVersion = "${ndkEnv["NDK_VERSION"]}"
|
||||
|
||||
namespace = "com.owncloud.android"
|
||||
testNamespace = "${namespace}.test"
|
||||
|
||||
androidResources.generateLocaleConfig = true
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.nextcloud.client"
|
||||
minSdk = 27
|
||||
targetSdk = 36
|
||||
compileSdk = 36
|
||||
|
||||
buildConfigField("boolean", "CI", ciBuild.toString())
|
||||
buildConfigField("boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString())
|
||||
|
||||
javaCompileOptions.annotationProcessorOptions {
|
||||
arguments += mapOf("room.schemaLocation" to "$projectDir/schemas")
|
||||
}
|
||||
|
||||
// arguments to be passed to functional tests
|
||||
testInstrumentationRunner = if (shotTest) "com.karumi.shot.ShotTestRunner"
|
||||
else "com.nextcloud.client.TestRunner"
|
||||
|
||||
testInstrumentationRunnerArguments += mapOf(
|
||||
"TEST_SERVER_URL" to ncTestServerBaseUrl.toString(),
|
||||
"TEST_SERVER_USERNAME" to ncTestServerUsername.toString(),
|
||||
"TEST_SERVER_PASSWORD" to ncTestServerPassword.toString()
|
||||
)
|
||||
testInstrumentationRunnerArguments["disableAnalytics"] = "true"
|
||||
|
||||
versionCode = versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
|
||||
versionName = when {
|
||||
versionBuild > 89 -> "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
versionBuild > 50 -> "${versionMajor}.${versionMinor}.${versionPatch} RC" + (versionBuild - 50)
|
||||
else -> "${versionMajor}.${versionMinor}.${versionPatch} Alpha" + (versionBuild + 1)
|
||||
}
|
||||
|
||||
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
||||
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
||||
|
||||
flavorDimensions += "default"
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
buildConfigField("String", "NC_TEST_SERVER_DATA_STRING", "\"\"")
|
||||
}
|
||||
|
||||
debug {
|
||||
enableUnitTestCoverage = project.hasProperty("coverage")
|
||||
resConfigs("xxxhdpi")
|
||||
|
||||
buildConfigField(
|
||||
"String",
|
||||
"NC_TEST_SERVER_DATA_STRING",
|
||||
"\"nc://login/user:${ncTestServerUsername}&password:${ncTestServerPassword}&server:${ncTestServerBaseUrl}\""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
// used for f-droid
|
||||
register("generic") {
|
||||
applicationId = "com.nextcloud.client"
|
||||
dimension = "default"
|
||||
}
|
||||
|
||||
register("gplay") {
|
||||
applicationId = "com.nextcloud.client"
|
||||
dimension = "default"
|
||||
}
|
||||
|
||||
register("huawei") {
|
||||
applicationId = "com.nextcloud.client"
|
||||
dimension = "default"
|
||||
}
|
||||
|
||||
register("versionDev") {
|
||||
applicationId = "com.nextcloud.android.beta"
|
||||
dimension = "default"
|
||||
versionCode = 20220322
|
||||
versionName = "20220322"
|
||||
}
|
||||
|
||||
register("qa") {
|
||||
applicationId = "com.nextcloud.android.qa"
|
||||
dimension = "default"
|
||||
versionCode = 1
|
||||
versionName = "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.configureEach {
|
||||
outputs.configureEach {
|
||||
if (this is ApkVariantOutputImpl) this.outputFileName = "${this.baseName}-${this.versionCode}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isReturnDefaultValues = true
|
||||
animationsDisabled = true
|
||||
}
|
||||
|
||||
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
||||
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
||||
packaging.resources {
|
||||
excludes.addAll(listOf("META-INF/LICENSE*", "META-INF/versions/9/OSGI-INF/MANIFEST*"))
|
||||
pickFirsts.add("MANIFEST.MF") // workaround for duplicated manifest on some dependencies
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
dataBinding = true
|
||||
viewBinding = true
|
||||
aidl = true
|
||||
compose = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
lint {
|
||||
abortOnError = false
|
||||
checkGeneratedSources = true
|
||||
disable.addAll(
|
||||
listOf(
|
||||
"MissingTranslation",
|
||||
"GradleDependency",
|
||||
"VectorPath",
|
||||
"IconMissingDensityFolder",
|
||||
"IconDensities",
|
||||
"GoogleAppIndexingWarning",
|
||||
"MissingDefaultResource",
|
||||
"InvalidPeriodicWorkRequestInterval",
|
||||
"StringFormatInvalid",
|
||||
"MissingQuantity"
|
||||
)
|
||||
)
|
||||
htmlOutput = layout.buildDirectory.file("reports/lint/lint.html").get().asFile
|
||||
htmlReport = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
// Adds exported schema location as test app assets.
|
||||
getByName("androidTest") {
|
||||
assets.srcDirs(files("$projectDir/schemas"))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
kapt.useBuildCache = true
|
||||
|
||||
ksp.arg("room.schemaLocation", "$projectDir/schemas")
|
||||
|
||||
kotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
|
||||
|
||||
spotless.kotlin {
|
||||
target("**/*.kt")
|
||||
ktlint()
|
||||
}
|
||||
|
||||
detekt.config.setFrom("detekt.yml")
|
||||
|
||||
if (shotTest) configure<ShotExtension> {
|
||||
showOnlyFailingTestsInReports = ciBuild
|
||||
// CI environment renders some shadows slightly different from local VMs
|
||||
// Add a 0.5% tolerance to account for that
|
||||
tolerance = if (ciBuild) 0.1 else 0.0
|
||||
}
|
||||
|
||||
|
||||
spotbugs {
|
||||
ignoreFailures = true // should continue checking
|
||||
effort = Effort.MAX
|
||||
reportLevel = Confidence.valueOf("MEDIUM")
|
||||
}
|
||||
|
||||
tasks.register<Checkstyle>("checkstyle") {
|
||||
configFile = file("${rootProject.projectDir}/checkstyle.xml")
|
||||
setConfigProperties(
|
||||
"checkstyleSuppressionsPath" to file("${rootProject.rootDir}/suppressions.xml").absolutePath
|
||||
)
|
||||
source("src")
|
||||
include("**/*.java")
|
||||
exclude("**/gen/**")
|
||||
classpath = files()
|
||||
}
|
||||
|
||||
tasks.register<Pmd>("pmd") {
|
||||
ruleSetFiles = files("${rootProject.rootDir}/ruleset.xml")
|
||||
ignoreFailures = true // should continue checking
|
||||
ruleSets = emptyList()
|
||||
|
||||
source("src")
|
||||
include("**/*.java")
|
||||
exclude("**/gen/**")
|
||||
|
||||
reports {
|
||||
xml.outputLocation.set(layout.buildDirectory.file("reports/pmd/pmd.xml").get().asFile)
|
||||
html.outputLocation.set(layout.buildDirectory.file("reports/pmd/pmd.html").get().asFile)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<SpotBugsTask>().configureEach {
|
||||
val variantNameCap = name.replace("spotbugs", "")
|
||||
val variantName = variantNameCap.substring(0, 1).lowercase() + variantNameCap.substring(1)
|
||||
dependsOn("compile${variantNameCap}Sources")
|
||||
|
||||
classes = fileTree(
|
||||
layout.buildDirectory.get().asFile.toString() +
|
||||
"/intermediates/javac/${variantName}/compile${variantNameCap}JavaWithJavac/classes/"
|
||||
)
|
||||
excludeFilter.set(file("${project.rootDir}/scripts/analysis/spotbugs-filter.xml"))
|
||||
|
||||
reports.create("xml") {
|
||||
required.set(true)
|
||||
}
|
||||
reports.create("html") {
|
||||
required.set(true)
|
||||
outputLocation.set(layout.buildDirectory.file("reports/spotbugs/spotbugs.html"))
|
||||
setStylesheet("fancy.xsl")
|
||||
}
|
||||
}
|
||||
|
||||
// Run the compiler as a separate process
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.isFork = true
|
||||
|
||||
// Enable Incremental Compilation
|
||||
options.isIncremental = true
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
// Run tests in parallel
|
||||
maxParallelForks = Runtime.getRuntime().availableProcessors().div(2)
|
||||
|
||||
// increased logging for tests
|
||||
testLogging.events("passed", "skipped", "failed")
|
||||
}
|
||||
|
||||
tasks.named("check").configure {
|
||||
dependsOn("checkstyle", "spotbugsGplayDebug", "pmd", "lint", "spotlessKotlinCheck", "detekt")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// region Nextcloud library
|
||||
implementation(libs.android.library) {
|
||||
exclude(group = "org.ogce", module = "xpp3") // unused in Android and brings wrong Junit version
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Splash Screen
|
||||
implementation(libs.splashscreen)
|
||||
// endregion
|
||||
|
||||
// region Jetpack Compose
|
||||
implementation(platform(libs.compose.bom))
|
||||
implementation(libs.material.icons.core)
|
||||
implementation(libs.compose.ui)
|
||||
implementation(libs.compose.ui.graphics)
|
||||
implementation(libs.compose.material3)
|
||||
implementation(libs.compose.ui.tooling.preview)
|
||||
debugImplementation(libs.compose.ui.tooling)
|
||||
// endregion
|
||||
|
||||
// region Media3
|
||||
implementation(libs.bundles.media3)
|
||||
// endregion
|
||||
|
||||
// region Room
|
||||
implementation(libs.room.runtime)
|
||||
ksp(libs.room.compiler)
|
||||
androidTestImplementation(libs.room.testing)
|
||||
// endregion
|
||||
|
||||
// region Espresso
|
||||
androidTestImplementation(libs.bundles.espresso)
|
||||
// endregion
|
||||
|
||||
// region Glide
|
||||
implementation(libs.glide)
|
||||
ksp(libs.ksp)
|
||||
// endregion
|
||||
|
||||
// region UI
|
||||
implementation(libs.bundles.ui)
|
||||
// endregion
|
||||
|
||||
// region Worker
|
||||
implementation(libs.work.runtime)
|
||||
implementation(libs.work.runtime.ktx)
|
||||
// endregion
|
||||
|
||||
// region Lifecycle
|
||||
implementation(libs.lifecycle.viewmodel.ktx)
|
||||
implementation(libs.lifecycle.service)
|
||||
implementation(libs.lifecycle.runtime.ktx)
|
||||
// endregion
|
||||
|
||||
// region JUnit
|
||||
androidTestImplementation(libs.junit)
|
||||
androidTestImplementation(libs.rules)
|
||||
androidTestImplementation(libs.runner)
|
||||
androidTestUtil(libs.orchestrator)
|
||||
androidTestImplementation(libs.core.ktx)
|
||||
androidTestImplementation(libs.core.testing)
|
||||
// endregion
|
||||
|
||||
// region other libraries
|
||||
compileOnly(libs.org.jbundle.util.osgi.wrapped.org.apache.http.client)
|
||||
implementation(libs.commons.httpclient.commons.httpclient) // remove after entire switch to lib v2
|
||||
implementation(libs.jackrabbit.webdav) // remove after entire switch to lib v2
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(libs.legacy.support.v4)
|
||||
implementation(libs.material)
|
||||
implementation(libs.disklrucache)
|
||||
implementation(libs.juniversalchardet) // need this version for Android <7
|
||||
compileOnly(libs.annotations)
|
||||
implementation(libs.commons.io)
|
||||
implementation(libs.eventbus)
|
||||
implementation(libs.ez.vcard)
|
||||
implementation(libs.nnio)
|
||||
implementation(libs.bcpkix.jdk18on)
|
||||
implementation(libs.gson)
|
||||
implementation(libs.sectioned.recyclerview)
|
||||
implementation(libs.photoview)
|
||||
implementation(libs.android.gif.drawable)
|
||||
implementation(libs.qrcodescanner) // "com.github.blikoon:QRCodeScanner:0.1.2"
|
||||
implementation(libs.flexbox)
|
||||
implementation(libs.androidsvg)
|
||||
implementation(libs.annotation)
|
||||
implementation(libs.emoji.google)
|
||||
// endregion
|
||||
|
||||
// region AppScan, document scanner not available on FDroid (generic) due to OpenCV binaries
|
||||
"gplayImplementation"(project(":appscan"))
|
||||
"huaweiImplementation"(project(":appscan"))
|
||||
"qaImplementation"(project(":appscan"))
|
||||
// endregion
|
||||
|
||||
// region SpotBugs
|
||||
spotbugsPlugins(libs.findsecbugs.plugin)
|
||||
spotbugsPlugins(libs.fb.contrib)
|
||||
// endregion
|
||||
|
||||
// region Dagger
|
||||
implementation(libs.dagger)
|
||||
implementation(libs.dagger.android)
|
||||
implementation(libs.dagger.android.support)
|
||||
ksp(libs.dagger.compiler)
|
||||
ksp(libs.dagger.processor)
|
||||
// endregion
|
||||
|
||||
// region Crypto
|
||||
implementation(libs.conscrypt.android)
|
||||
// endregion
|
||||
|
||||
// region Library
|
||||
implementation(libs.library)
|
||||
// endregion
|
||||
|
||||
// region Shimmer
|
||||
implementation(libs.loaderviewlibrary)
|
||||
// endregion
|
||||
|
||||
// region Markdown rendering
|
||||
implementation(libs.bundles.markdown.rendering)
|
||||
kapt(libs.prism4j.bundler)
|
||||
// endregion
|
||||
|
||||
// region Image cropping / rotation
|
||||
implementation(libs.android.image.cropper)
|
||||
// endregion
|
||||
|
||||
// region Maps
|
||||
implementation(libs.osmdroid.android)
|
||||
// endregion
|
||||
|
||||
// region iCal4j
|
||||
implementation(libs.ical4j) {
|
||||
listOf("org.apache.commons", "commons-logging").forEach { groupName -> exclude(group = groupName) }
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region LeakCanary
|
||||
if (perfAnalysis) debugImplementation(libs.leakcanary)
|
||||
// endregion
|
||||
|
||||
// region Local Unit Test
|
||||
testImplementation(libs.bundles.unit.test)
|
||||
// endregion
|
||||
|
||||
// region Mocking support
|
||||
androidTestImplementation(libs.bundles.mocking)
|
||||
// endregion
|
||||
|
||||
// region UIAutomator
|
||||
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
|
||||
// androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0"
|
||||
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
|
||||
// androidTestImplementation("com.android.support:support-annotations:${supportLibraryVersion}"
|
||||
androidTestImplementation(libs.screengrab)
|
||||
// endregion
|
||||
|
||||
// region Kotlin
|
||||
implementation(libs.kotlin.stdlib)
|
||||
// endregion
|
||||
|
||||
// region Stateless
|
||||
implementation(libs.stateless4j)
|
||||
// endregion
|
||||
|
||||
// region Google Play dependencies, upon each update first test: new registration, receive push
|
||||
"gplayImplementation"(libs.bundles.gplay)
|
||||
// endregion
|
||||
|
||||
// region UI
|
||||
implementation(libs.ui)
|
||||
// endregion
|
||||
|
||||
// region Image loading
|
||||
implementation(libs.coil)
|
||||
// endregion
|
||||
|
||||
// kotlinx.serialization
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.nextcloud.test.GrantStoragePermissionRule;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.ui.activity.CommunityActivity;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
|
||||
public class CommunityActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<CommunityActivity> activityRule = new IntentsTestRule<>(CommunityActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.GrantStoragePermissionRule.Companion.grant
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.ui.activity.CommunityActivity
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestRule
|
||||
|
||||
class CommunityActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.nextcloud.client.CommunityActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
var storagePermissionRule: TestRule = grant()
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
launchActivity<CommunityActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,24 +5,24 @@
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.closeSoftKeyboard
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.contrib.NavigationViewActions
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.nextcloud.test.RetryTestRule
|
||||
import com.owncloud.android.AbstractOnServerIT
|
||||
import com.owncloud.android.R
|
||||
@@ -35,33 +35,39 @@ import com.owncloud.android.lib.resources.shares.ShareType
|
||||
import com.owncloud.android.operations.CreateFolderOperation
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.ui.adapter.OCFileListItemViewHolder
|
||||
import org.junit.Assert
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(
|
||||
FileDisplayActivity::class.java,
|
||||
true,
|
||||
false
|
||||
)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val retryRule = RetryTestRule() // showShares is flaky
|
||||
|
||||
// @ScreenshotTest // todo run without real server
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun showShares() {
|
||||
Assert.assertTrue(ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess)
|
||||
Assert.assertTrue(CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess)
|
||||
Assert.assertTrue(CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess)
|
||||
Assert.assertTrue(CreateFolderRemoteOperation("/shareViaLink/", true).execute(client).isSuccess)
|
||||
Assert.assertTrue(CreateFolderRemoteOperation("/noShare/", true).execute(client).isSuccess)
|
||||
// assertTrue(new CreateFolderRemoteOperation("/shareToCircle/", true).execute(client).isSuccess());
|
||||
assertTrue(ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess)
|
||||
assertTrue(CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess)
|
||||
assertTrue(CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess)
|
||||
assertTrue(CreateFolderRemoteOperation("/shareViaLink/", true).execute(client).isSuccess)
|
||||
assertTrue(CreateFolderRemoteOperation("/noShare/", true).execute(client).isSuccess)
|
||||
|
||||
// share folder to user "admin"
|
||||
Assert.assertTrue(
|
||||
assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
"/shareToAdmin/",
|
||||
ShareType.USER,
|
||||
@@ -73,7 +79,7 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
)
|
||||
|
||||
// share folder via public link
|
||||
Assert.assertTrue(
|
||||
assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
"/shareViaLink/",
|
||||
ShareType.PUBLIC_LINK,
|
||||
@@ -85,7 +91,7 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
)
|
||||
|
||||
// share folder to group
|
||||
Assert.assertTrue(
|
||||
assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
"/shareToGroup/",
|
||||
ShareType.GROUP,
|
||||
@@ -96,103 +102,55 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
).execute(client).isSuccess
|
||||
)
|
||||
|
||||
// share folder to circle
|
||||
// get share
|
||||
// RemoteOperationResult searchResult = new GetShareesRemoteOperation("publicCircle", 1, 50).execute(client);
|
||||
// assertTrue(searchResult.getLogMessage(), searchResult.isSuccess());
|
||||
//
|
||||
// JSONObject resultJson = (JSONObject) searchResult.getData().get(0);
|
||||
// String circleId = resultJson.getJSONObject("value").getString("shareWith");
|
||||
//
|
||||
// assertTrue(new CreateShareRemoteOperation("/shareToCircle/",
|
||||
// ShareType.CIRCLE,
|
||||
// circleId,
|
||||
// false,
|
||||
// "",
|
||||
// OCShare.DEFAULT_PERMISSION)
|
||||
// .execute(client).isSuccess());
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
|
||||
// click "shared"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_shared))
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
// screenshot(sut) // todo run without real server
|
||||
// click "shared"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_shared))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun allFiles() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
// given test folder
|
||||
assertTrue(
|
||||
CreateFolderOperation("/test/", user, targetContext, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
|
||||
// given test folder
|
||||
Assert.assertTrue(
|
||||
CreateFolderOperation("/test/", user, targetContext, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
// navigate into it
|
||||
val test = storageManager.getFileByPath("/test/")
|
||||
sut.file = test
|
||||
sut.startSyncFolderOperation(test, false)
|
||||
assertEquals(storageManager.getFileByPath("/test/"), sut.currentDir)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
// navigate into it
|
||||
val test = storageManager.getFileByPath("/test/")
|
||||
sut.file = test
|
||||
sut.startSyncFolderOperation(test, false)
|
||||
Assert.assertEquals(storageManager.getFileByPath("/test/"), sut.currentDir)
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
// click "all files"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_all_files))
|
||||
|
||||
// click "all files"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_all_files))
|
||||
|
||||
// then should be in root again
|
||||
shortSleep()
|
||||
Assert.assertEquals(storageManager.getFileByPath("/"), sut.currentDir)
|
||||
// then should be in root again
|
||||
assertEquals(storageManager.getFileByPath("/"), sut.currentDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
// fun checkToolbarTitleOnNavigation() {
|
||||
// // Create folder structure
|
||||
// val topFolder = "folder1"
|
||||
// val childFolder = "folder2"
|
||||
//
|
||||
// CreateFolderOperation("/$topFolder/", user, targetContext, storageManager)
|
||||
// .execute(client)
|
||||
//
|
||||
// CreateFolderOperation("/$topFolder/$childFolder/", user, targetContext, storageManager)
|
||||
// .execute(client)
|
||||
//
|
||||
// activityRule.launchActivity(null)
|
||||
//
|
||||
// shortSleep()
|
||||
//
|
||||
// // go into "foo"
|
||||
// onView(withText(topFolder)).perform(click())
|
||||
// shortSleep()
|
||||
//
|
||||
// // check title is right
|
||||
// checkToolbarTitle(topFolder)
|
||||
//
|
||||
// // go into "bar"
|
||||
// onView(withText(childFolder)).perform(click())
|
||||
// shortSleep()
|
||||
//
|
||||
// // check title is right
|
||||
// checkToolbarTitle(childFolder)
|
||||
//
|
||||
// // browse back up, we should be back in "foo"
|
||||
// Espresso.pressBack()
|
||||
// shortSleep()
|
||||
//
|
||||
// // check title is right
|
||||
// checkToolbarTitle(topFolder)
|
||||
// }
|
||||
|
||||
private fun checkToolbarTitle(childFolder: String) {
|
||||
onView(withId(R.id.appbar)).check(
|
||||
matches(
|
||||
@@ -203,8 +161,10 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun browseFavoriteAndBack() {
|
||||
EspressoIdlingResource.increment()
|
||||
// Create folder structure
|
||||
val topFolder = "folder1"
|
||||
|
||||
@@ -212,52 +172,68 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
.execute(client)
|
||||
ToggleFavoriteRemoteOperation(true, "/$topFolder/")
|
||||
.execute(client)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val sut = activityRule.launchActivity(null)
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// navigate to favorites
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_favorites))
|
||||
|
||||
// navigate to favorites
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_favorites))
|
||||
shortSleep()
|
||||
// check sort button is not shown, favorites are not sortable
|
||||
onView(
|
||||
withId(R.id.sort_button)
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
|
||||
// check sort button is not shown, favorites are not sortable
|
||||
onView(withId(R.id.sort_button)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
// browse into folder
|
||||
onView(withId(R.id.list_root))
|
||||
.perform(closeSoftKeyboard())
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
)
|
||||
)
|
||||
checkToolbarTitle(topFolder)
|
||||
// sort button should now be visible
|
||||
onView(withId(R.id.sort_button)).check(matches(ViewMatchers.isDisplayed()))
|
||||
|
||||
// browse into folder
|
||||
onView(withId(R.id.list_root))
|
||||
.perform(closeSoftKeyboard())
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
)
|
||||
)
|
||||
shortSleep()
|
||||
checkToolbarTitle(topFolder)
|
||||
// sort button should now be visible
|
||||
onView(withId(R.id.sort_button)).check(matches(ViewMatchers.isDisplayed()))
|
||||
|
||||
// browse back, should be back to All Files
|
||||
Espresso.pressBack()
|
||||
checkToolbarTitle(sut.getString(R.string.app_name))
|
||||
onView(withId(R.id.sort_button)).check(matches(ViewMatchers.isDisplayed()))
|
||||
// browse back, should be back to All Files
|
||||
Espresso.pressBack()
|
||||
checkToolbarTitle(sut.getString(R.string.app_name))
|
||||
onView(withId(R.id.sort_button)).check(matches(ViewMatchers.isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun switchToGridView() {
|
||||
activityRule.launchActivity(null)
|
||||
Assert.assertTrue(
|
||||
CreateFolderOperation("/test/", user, targetContext, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
onView(withId(R.id.switch_grid_view_button)).perform(click())
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
assertTrue(
|
||||
CreateFolderOperation("/test/", user, targetContext, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
onView(withId(R.id.switch_grid_view_button)).perform(click())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun openAccountSwitcher() {
|
||||
activityRule.launchActivity(null)
|
||||
onView(withId(R.id.switch_account_button)).perform(click())
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
onView(withId(R.id.switch_account_button)).perform(click())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.ui.fragment.EmptyListState
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
@@ -68,7 +69,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
||||
listOfFilesFragment?.let {
|
||||
it.setFabEnabled(false)
|
||||
resetScrolling(true)
|
||||
it.setEmptyListLoadingMessage()
|
||||
it.setEmptyListMessage(EmptyListState.LOADING)
|
||||
it.isLoading = false
|
||||
}
|
||||
}
|
||||
@@ -98,7 +99,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
||||
val fragment = sut.listOfFilesFragment
|
||||
Assert.assertNotNull(fragment)
|
||||
fragment!!.setFabEnabled(false)
|
||||
fragment.setEmptyListLoadingMessage()
|
||||
fragment.setEmptyListMessage(EmptyListState.LOADING)
|
||||
fragment.isLoading = false
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
@@ -113,7 +114,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
||||
|
||||
EspressoIdlingResource.increment()
|
||||
fragment.setFabEnabled(false)
|
||||
fragment.setEmptyListLoadingMessage()
|
||||
fragment.setEmptyListMessage(EmptyListState.LOADING)
|
||||
fragment.isLoading = false
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
@@ -146,7 +147,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
||||
|
||||
listOfFilesFragment?.let {
|
||||
it.setFabEnabled(false)
|
||||
it.setEmptyListLoadingMessage()
|
||||
it.setEmptyListMessage(EmptyListState.LOADING)
|
||||
it.isLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.nextcloud.client.onboarding.FirstRunActivity;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
public class FirstRunActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FirstRunActivity> activityRule = new IntentsTestRule<>(FirstRunActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.client.onboarding.FirstRunActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class FirstRunActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.nextcloud.client.FirstRunActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
launchActivity<FirstRunActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +1,109 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Looper
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.GrantStoragePermissionRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.GrantStoragePermissionRule.Companion.grant
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
|
||||
import com.owncloud.android.ui.activity.RequestCredentialsActivity
|
||||
import com.owncloud.android.ui.activity.SettingsActivity
|
||||
import com.owncloud.android.utils.EncryptionUtils
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestRule
|
||||
|
||||
@Suppress("FunctionNaming")
|
||||
class SettingsActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(
|
||||
SettingsActivity::class.java,
|
||||
true,
|
||||
false
|
||||
)
|
||||
private val testClassName = "com.nextcloud.client.SettingsActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val permissionRule = GrantStoragePermissionRule.grant()
|
||||
var storagePermissionRule: TestRule = grant()
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
screenshot(sut)
|
||||
launchActivity<SettingsActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showMnemonic_Error() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.handleMnemonicRequest(null)
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
launchActivity<SettingsActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
sut.handleMnemonicRequest(null)
|
||||
val screenShotName = createName(testClassName + "_" + "showMnemonic_Error", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
@UiThread
|
||||
fun showMnemonic() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
val intent = Intent()
|
||||
intent.putExtra(RequestCredentialsActivity.KEY_CHECK_RESULT, RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE)
|
||||
val arbitraryDataProvider = ArbitraryDataProviderImpl(targetContext)
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(user.accountName, EncryptionUtils.MNEMONIC, "Secret mnemonic")
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.runOnUiThread {
|
||||
sut.handleMnemonicRequest(intent)
|
||||
val intent = Intent().apply {
|
||||
putExtra(RequestCredentialsActivity.KEY_CHECK_RESULT, RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE)
|
||||
}
|
||||
|
||||
Looper.myLooper()?.quitSafely()
|
||||
Assert.assertTrue(true) // if we reach this, everything is ok
|
||||
ArbitraryDataProviderImpl(targetContext).run {
|
||||
storeOrUpdateKeyValue(user.accountName, EncryptionUtils.MNEMONIC, "Secret mnemonic")
|
||||
}
|
||||
|
||||
launchActivity<SettingsActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
sut.handleMnemonicRequest(intent)
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
Looper.myLooper()?.quitSafely()
|
||||
Assert.assertTrue(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.nextcloud.client.preferences.SubFolderRule;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.databinding.SyncedFoldersLayoutBinding;
|
||||
import com.owncloud.android.datamodel.MediaFolderType;
|
||||
import com.owncloud.android.datamodel.SyncedFolder;
|
||||
import com.owncloud.android.datamodel.SyncedFolderDisplayItem;
|
||||
import com.owncloud.android.ui.activity.SyncedFoldersActivity;
|
||||
import com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
|
||||
public class SyncedFoldersActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<SyncedFoldersActivity> activityRule = new IntentsTestRule<>(SyncedFoldersActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
SyncedFoldersActivity activity = activityRule.launchActivity(null);
|
||||
activity.adapter.clear();
|
||||
SyncedFoldersLayoutBinding sut = activity.binding;
|
||||
shortSleep();
|
||||
screenshot(sut.emptyList.emptyListView);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testSyncedFolderDialog() {
|
||||
SyncedFolderDisplayItem item = new SyncedFolderDisplayItem(1,
|
||||
"/sdcard/DCIM/",
|
||||
"/InstantUpload/",
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
"test@https://nextcloud.localhost",
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
1000,
|
||||
"Name",
|
||||
MediaFolderType.IMAGE,
|
||||
false,
|
||||
SubFolderRule.YEAR_MONTH,
|
||||
false,
|
||||
SyncedFolder.NOT_SCANNED_YET);
|
||||
SyncedFolderPreferencesDialogFragment sut = SyncedFolderPreferencesDialogFragment.newInstance(item, 0);
|
||||
|
||||
Intent intent = new Intent(targetContext, SyncedFoldersActivity.class);
|
||||
SyncedFoldersActivity activity = activityRule.launchActivity(intent);
|
||||
|
||||
sut.show(activity.getSupportFragmentManager(), "");
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
screenshot(Objects.requireNonNull(sut.requireDialog().getWindow()).getDecorView());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void showPowerCheckDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
Intent intent = new Intent(targetContext, SyncedFoldersActivity.class);
|
||||
SyncedFoldersActivity activity = activityRule.launchActivity(intent);
|
||||
|
||||
AlertDialog sut = activity.buildPowerCheckDialog();
|
||||
|
||||
activity.runOnUiThread(sut::show);
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
screenshot(Objects.requireNonNull(sut.getWindow()).getDecorView());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Looper
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.client.preferences.SubFolderRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.MediaFolderType
|
||||
import com.owncloud.android.datamodel.SyncedFolder
|
||||
import com.owncloud.android.datamodel.SyncedFolderDisplayItem
|
||||
import com.owncloud.android.ui.activity.SyncedFoldersActivity
|
||||
import com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment.Companion.newInstance
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class SyncedFoldersActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.nextcloud.client.SyncedFoldersActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
launchActivity<SyncedFoldersActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.adapter.clear()
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.binding.emptyList.emptyListView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testSyncedFolderDialog() {
|
||||
val item = SyncedFolderDisplayItem(
|
||||
1,
|
||||
"/sdcard/DCIM/",
|
||||
"/InstantUpload/",
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
"test@https://nextcloud.localhost",
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
1000,
|
||||
"Name",
|
||||
MediaFolderType.IMAGE,
|
||||
false,
|
||||
SubFolderRule.YEAR_MONTH,
|
||||
false,
|
||||
SyncedFolder.NOT_SCANNED_YET
|
||||
)
|
||||
val fragment = newInstance(item, 0)
|
||||
|
||||
val intent = Intent(targetContext, SyncedFoldersActivity::class.java)
|
||||
launchActivity<SyncedFoldersActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
fragment?.show(sut.supportFragmentManager, "")
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "testSyncedFolderDialog", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshot(fragment?.requireDialog()?.window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showPowerCheckDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
val intent = Intent(targetContext, SyncedFoldersActivity::class.java)
|
||||
|
||||
launchActivity<SyncedFoldersActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val dialog = sut.buildPowerCheckDialog()
|
||||
sut.showPowerCheckDialog()
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showPowerCheckDialog", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshot(dialog.window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.ui.activity.UploadListActivity;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
|
||||
public class UploadListActivityActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<UploadListActivity> activityRule = new IntentsTestRule<>(UploadListActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void openDrawer() {
|
||||
super.openDrawer(activityRule);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.ui.activity.UploadListActivity
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class UploadListActivityActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.nextcloud.client.UploadListActivityActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun openDrawer() {
|
||||
launchActivity<UploadListActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "openDrawer", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import android.net.Uri
|
||||
import android.os.Parcel
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount
|
||||
import com.owncloud.android.lib.common.OwnCloudBasicCredentials
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion
|
||||
import com.owncloud.android.lib.resources.status.NextcloudVersion
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNotSame
|
||||
@@ -31,7 +31,7 @@ class RegisteredUserTest {
|
||||
val ownCloudAccount = OwnCloudAccount(uri, credentials)
|
||||
val server = Server(
|
||||
uri = URI(uri.toString()),
|
||||
version = OwnCloudVersion.nextcloud_18
|
||||
version = NextcloudVersion.nextcloud_31
|
||||
)
|
||||
return RegisteredUser(
|
||||
account = account,
|
||||
|
||||
@@ -7,35 +7,64 @@
|
||||
*/
|
||||
package com.nextcloud.client.etm
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class EtmActivityTest : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(EtmActivity::class.java, true, false)
|
||||
private val testClassName = "com.nextcloud.client.etm.EtmActivityTest"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun overview() {
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
launchActivity<EtmActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "overview", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun accounts() {
|
||||
val sut: EtmActivity = activityRule.launchActivity(null)
|
||||
launchActivity<EtmActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.vm.onPageSelected(1)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
UiThreadStatement.runOnUiThread { sut.vm.onPageSelected(1) }
|
||||
|
||||
screenshot(sut)
|
||||
val screenShotName = createName(testClassName + "_" + "accounts", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class DeepLinkHandlerTest {
|
||||
fun createMockUser(serverBaseUrl: String): User {
|
||||
val user = mock<User>()
|
||||
val uri = URI.create(serverBaseUrl)
|
||||
val server = Server(uri = uri, version = OwnCloudVersion.nextcloud_19)
|
||||
val server = Server(uri = uri, version = OwnCloudVersion.nextcloud_20)
|
||||
whenever(user.server).thenReturn(server)
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.nextcloud.extensions
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import com.nextcloud.utils.rotateBitmapViaExif
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class BitmapRotationTests {
|
||||
|
||||
private fun createTestBitmap(): Bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888).apply {
|
||||
setPixel(0, 0, Color.RED)
|
||||
setPixel(1, 0, Color.GREEN)
|
||||
setPixel(0, 1, Color.BLUE)
|
||||
setPixel(1, 1, Color.YELLOW)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenNullBitmapShouldReturnNull() {
|
||||
val rotated = null.rotateBitmapViaExif(ExifInterface.ORIENTATION_ROTATE_90)
|
||||
assertEquals(null, rotated)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenNormalOrientationShouldReturnSameBitmap() {
|
||||
val bmp = createTestBitmap()
|
||||
val rotated = bmp.rotateBitmapViaExif(ExifInterface.ORIENTATION_NORMAL)
|
||||
assertEquals(bmp, rotated)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenRotate90ShouldReturnRotatedBitmap() {
|
||||
val bmp = createTestBitmap()
|
||||
val rotated = bmp.rotateBitmapViaExif(ExifInterface.ORIENTATION_ROTATE_90)!!
|
||||
assertEquals(bmp.width, rotated.height)
|
||||
assertEquals(bmp.height, rotated.width)
|
||||
|
||||
assertEquals(Color.BLUE, rotated.getPixel(0, 0))
|
||||
assertEquals(Color.RED, rotated.getPixel(1, 0))
|
||||
assertEquals(Color.YELLOW, rotated.getPixel(0, 1))
|
||||
assertEquals(Color.GREEN, rotated.getPixel(1, 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenRotate180ShouldReturnRotatedBitmap() {
|
||||
val bmp = createTestBitmap()
|
||||
val rotated = bmp.rotateBitmapViaExif(ExifInterface.ORIENTATION_ROTATE_180)!!
|
||||
assertEquals(bmp.width, rotated.width)
|
||||
assertEquals(bmp.height, rotated.height)
|
||||
|
||||
assertEquals(Color.YELLOW, rotated.getPixel(0, 0))
|
||||
assertEquals(Color.BLUE, rotated.getPixel(1, 0))
|
||||
assertEquals(Color.GREEN, rotated.getPixel(0, 1))
|
||||
assertEquals(Color.RED, rotated.getPixel(1, 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenFlipHorizontalShouldReturnFlippedBitmap() {
|
||||
val bmp = createTestBitmap()
|
||||
val rotated = bmp.rotateBitmapViaExif(ExifInterface.ORIENTATION_FLIP_HORIZONTAL)!!
|
||||
assertEquals(bmp.width, rotated.width)
|
||||
assertEquals(bmp.height, rotated.height)
|
||||
|
||||
assertEquals(Color.GREEN, rotated.getPixel(0, 0))
|
||||
assertEquals(Color.RED, rotated.getPixel(1, 0))
|
||||
assertEquals(Color.YELLOW, rotated.getPixel(0, 1))
|
||||
assertEquals(Color.BLUE, rotated.getPixel(1, 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRotateBitmapViaExifWhenGivenFlipVerticalShouldReturnFlippedBitmap() {
|
||||
val bmp = createTestBitmap()
|
||||
val rotated = bmp.rotateBitmapViaExif(ExifInterface.ORIENTATION_FLIP_VERTICAL)!!
|
||||
assertEquals(bmp.width, rotated.width)
|
||||
assertEquals(bmp.height, rotated.height)
|
||||
|
||||
assertEquals(Color.BLUE, rotated.getPixel(0, 0))
|
||||
assertEquals(Color.YELLOW, rotated.getPixel(1, 0))
|
||||
assertEquals(Color.RED, rotated.getPixel(0, 1))
|
||||
assertEquals(Color.GREEN, rotated.getPixel(1, 1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.nextcloud.extensions
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import com.nextcloud.utils.extensions.getExifOrientation
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import org.junit.After
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class GetExifOrientationTests {
|
||||
|
||||
private val tempFiles = mutableListOf<File>()
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
private fun createTempImageFile(): File {
|
||||
val file = File.createTempFile("test_image", ".jpg")
|
||||
tempFiles.add(file)
|
||||
|
||||
val bmp = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888).apply {
|
||||
setPixel(0, 0, Color.RED)
|
||||
setPixel(1, 0, Color.GREEN)
|
||||
setPixel(0, 1, Color.BLUE)
|
||||
setPixel(1, 1, Color.YELLOW)
|
||||
}
|
||||
|
||||
file.outputStream().use { out ->
|
||||
bmp.compress(Bitmap.CompressFormat.JPEG, 100, out)
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
@After
|
||||
fun cleanup() {
|
||||
tempFiles.forEach { it.delete() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetExifOrientationWhenExifIsRotate90ShouldReturnRotate90() {
|
||||
val file = createTempImageFile()
|
||||
|
||||
val exif = ExifInterface(file.absolutePath)
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_ROTATE_90.toString())
|
||||
exif.saveAttributes()
|
||||
|
||||
val orientation = getExifOrientation(file.absolutePath)
|
||||
|
||||
assertEquals(ExifInterface.ORIENTATION_ROTATE_90, orientation)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetExifOrientationWhenExifIsRotate180ShouldReturnRotate180() {
|
||||
val file = createTempImageFile()
|
||||
|
||||
val exif = ExifInterface(file.absolutePath)
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_ROTATE_180.toString())
|
||||
exif.saveAttributes()
|
||||
|
||||
val orientation = getExifOrientation(file.absolutePath)
|
||||
assertEquals(ExifInterface.ORIENTATION_ROTATE_180, orientation)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetExifOrientationWhenExifIsUndefinedShouldReturnUndefined() {
|
||||
val file = createTempImageFile()
|
||||
|
||||
val orientation = getExifOrientation(file.absolutePath)
|
||||
assertEquals(ExifInterface.ORIENTATION_UNDEFINED, orientation)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.nextcloud.extensions
|
||||
import com.nextcloud.utils.extensions.isNotBlankAndEquals
|
||||
import junit.framework.TestCase.assertFalse
|
||||
import junit.framework.TestCase.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
class StringExtensionTests {
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreNull() {
|
||||
val str1: String? = null
|
||||
val str2: String? = null
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenFirstStringIsNull() {
|
||||
val str1: String? = null
|
||||
val str2 = "hello"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenSecondStringIsNull() {
|
||||
val str1 = "hello"
|
||||
val str2: String? = null
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreEmpty() {
|
||||
val str1 = ""
|
||||
val str2 = ""
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenFirstStringIsEmpty() {
|
||||
val str1 = ""
|
||||
val str2 = "hello"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenSecondStringIsEmpty() {
|
||||
val str1 = "hello"
|
||||
val str2 = ""
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreWhitespaceOnly() {
|
||||
val str1 = " "
|
||||
val str2 = " \t "
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenFirstStringIsWhitespaceOnly() {
|
||||
val str1 = " "
|
||||
val str2 = "hello"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenSecondStringIsWhitespaceOnly() {
|
||||
val str1 = "hello"
|
||||
val str2 = " "
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenStringsAreDifferentButBothValid() {
|
||||
val str1 = "hello"
|
||||
val str2 = "world"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenStringsHaveDifferentCase() {
|
||||
val str1 = "Hello"
|
||||
val str2 = "hello"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenMixedCaseStrings() {
|
||||
val str1 = "HeLLo WoRLd"
|
||||
val str2 = "hello world"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenUppercaseStrings() {
|
||||
val str1 = "HELLO"
|
||||
val str2 = "hello"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreIdenticalAndValid() {
|
||||
val str1 = "hello"
|
||||
val str2 = "hello"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreIdenticalWithSpaces() {
|
||||
val str1 = "hello world"
|
||||
val str2 = "hello world"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreIdenticalSingleCharacter() {
|
||||
val str1 = "a"
|
||||
val str2 = "A"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreIdenticalWithSpecialCharacters() {
|
||||
val str1 = "hello@world!123"
|
||||
val str2 = "HELLO@WORLD!123"
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenOneHasLeadingWhitespaceAndOtherDoesNot() {
|
||||
val str1 = " hello"
|
||||
val str2 = "HELLO"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenOneHasTrailingWhitespaceAndOtherDoesNot() {
|
||||
val str1 = "hello"
|
||||
val str2 = "HELLO "
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenBothHaveIdenticalWhitespacePaddingDifferentCase() {
|
||||
val str1 = " hello "
|
||||
val str2 = " HELLO "
|
||||
assertTrue(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenMixedWhitespaceCharacters() {
|
||||
val str1 = "\t"
|
||||
val str2 = "\n"
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenOneIsNullAndOtherIsEmpty() {
|
||||
val str1: String? = null
|
||||
val str2 = ""
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsNotBlankAndEqualsWhenGivenOneIsNullAndOtherIsWhitespace() {
|
||||
val str1: String? = null
|
||||
val str2 = " "
|
||||
assertFalse(str1.isNotBlankAndEquals(str2))
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
@@ -10,115 +11,70 @@ package com.nextcloud.ui
|
||||
import android.graphics.BitmapFactory
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.utils.BitmapUtils
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class BitmapIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
private val testClassName = "com.nextcloud.ui.BitmapIT"
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun roundBitmap() {
|
||||
val file = getFile("christine.jpg")
|
||||
val bitmap = BitmapFactory.decodeFile(file.absolutePath)
|
||||
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val imageView = ImageView(activity).apply {
|
||||
setImageBitmap(bitmap)
|
||||
}
|
||||
|
||||
val bitmap2 = BitmapFactory.decodeFile(file.absolutePath)
|
||||
val imageView2 = ImageView(activity).apply {
|
||||
setImageBitmap(BitmapUtils.roundBitmap(bitmap2))
|
||||
}
|
||||
|
||||
val linearLayout = LinearLayout(activity).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setBackgroundColor(context.getColor(R.color.grey_200))
|
||||
}
|
||||
linearLayout.addView(imageView, 200, 200)
|
||||
linearLayout.addView(imageView2, 200, 200)
|
||||
activity.addView(linearLayout)
|
||||
|
||||
screenshot(activity)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @ScreenshotTest
|
||||
// fun glideSVG() {
|
||||
// val activity = testActivityRule.launchActivity(null)
|
||||
// val accountProvider = UserAccountManagerImpl.fromContext(activity)
|
||||
// val clientFactory = ClientFactoryImpl(activity)
|
||||
//
|
||||
// val linearLayout = LinearLayout(activity).apply {
|
||||
// orientation = LinearLayout.VERTICAL
|
||||
// setBackgroundColor(context.getColor(R.color.grey_200))
|
||||
// }
|
||||
//
|
||||
// val file = getFile("christine.jpg")
|
||||
// val bitmap = BitmapFactory.decodeFile(file.absolutePath)
|
||||
//
|
||||
// ImageView(activity).apply {
|
||||
// setImageBitmap(bitmap)
|
||||
// linearLayout.addView(this, 50, 50)
|
||||
// }
|
||||
//
|
||||
// downloadIcon(
|
||||
// client.baseUri.toString() + "/apps/files/img/app.svg",
|
||||
// activity,
|
||||
// linearLayout,
|
||||
// accountProvider,
|
||||
// clientFactory
|
||||
// )
|
||||
//
|
||||
// downloadIcon(
|
||||
// client.baseUri.toString() + "/core/img/actions/group.svg",
|
||||
// activity,
|
||||
// linearLayout,
|
||||
// accountProvider,
|
||||
// clientFactory
|
||||
// )
|
||||
//
|
||||
// activity.addView(linearLayout)
|
||||
//
|
||||
// longSleep()
|
||||
//
|
||||
// screenshot(activity)
|
||||
// }
|
||||
//
|
||||
// private fun downloadIcon(
|
||||
// url: String,
|
||||
// activity: TestActivity,
|
||||
// linearLayout: LinearLayout,
|
||||
// accountProvider: UserAccountManager,
|
||||
// clientFactory: ClientFactory
|
||||
// ) {
|
||||
// val view = ImageView(activity).apply {
|
||||
// linearLayout.addView(this, 50, 50)
|
||||
// }
|
||||
// val target = object : SimpleTarget<Drawable>() {
|
||||
// override fun onResourceReady(resource: Drawable?, glideAnimation: GlideAnimation<in Drawable>?) {
|
||||
// view.setColorFilter(targetContext.getColor(R.color.dark), PorterDuff.Mode.SRC_ATOP)
|
||||
// view.setImageDrawable(resource)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// testActivityRule.runOnUiThread {
|
||||
// DisplayUtils.downloadIcon(
|
||||
// accountProvider,
|
||||
// clientFactory,
|
||||
// activity,
|
||||
// url,
|
||||
// target,
|
||||
// R.drawable.ic_user
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun roundBitmap() {
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val file = getFile("christine.jpg")
|
||||
val bitmap = BitmapFactory.decodeFile(file.absolutePath)
|
||||
|
||||
val imageView = ImageView(activity).apply {
|
||||
setImageBitmap(bitmap)
|
||||
}
|
||||
|
||||
val bitmap2 = BitmapFactory.decodeFile(file.absolutePath)
|
||||
val imageView2 = ImageView(activity).apply {
|
||||
setImageBitmap(BitmapUtils.roundBitmap(bitmap2))
|
||||
}
|
||||
|
||||
val linearLayout = LinearLayout(activity).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setBackgroundColor(context.getColor(R.color.grey_200))
|
||||
}
|
||||
linearLayout.addView(imageView, 200, 200)
|
||||
linearLayout.addView(imageView2, 200, 200)
|
||||
activity.addView(linearLayout)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "roundBitmap", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(activity, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.ui
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.users.Status
|
||||
import com.owncloud.android.lib.resources.users.StatusType
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class SetOnlineStatusBottomSheetIT : AbstractIT() {
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun open() {
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = SetOnlineStatusBottomSheet(
|
||||
Status(StatusType.DND, "Working hard…", "🤖", -1)
|
||||
)
|
||||
sut.show(activity.supportFragmentManager, "")
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.ui
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.users.ClearAt
|
||||
import com.owncloud.android.lib.resources.users.PredefinedStatus
|
||||
import com.owncloud.android.lib.resources.users.Status
|
||||
import com.owncloud.android.lib.resources.users.StatusType
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SetStatusDialogFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(FileDisplayActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
fun open() {
|
||||
val sut = SetStatusDialogFragment.newInstance(user, Status(StatusType.DND, "Working hard…", "🤖", -1))
|
||||
val activity = activityRule.launchActivity(null)
|
||||
|
||||
sut.show(activity.supportFragmentManager, "")
|
||||
|
||||
val predefinedStatus: ArrayList<PredefinedStatus> = arrayListOf(
|
||||
PredefinedStatus("meeting", "📅", "In a meeting", ClearAt("period", "3600")),
|
||||
PredefinedStatus("commuting", "🚌", "Commuting", ClearAt("period", "1800")),
|
||||
PredefinedStatus("remote-work", "🏡", "Working remotely", ClearAt("end-of", "day")),
|
||||
PredefinedStatus("sick-leave", "🤒", "Out sick", ClearAt("end-of", "day")),
|
||||
PredefinedStatus("vacationing", "🌴", "Vacationing", null)
|
||||
)
|
||||
|
||||
shortSleep()
|
||||
|
||||
activity.runOnUiThread { sut.setPredefinedStatus(predefinedStatus) }
|
||||
|
||||
longSleep()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.nextcloud.ui
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.users.ClearAt
|
||||
import com.owncloud.android.lib.resources.users.PredefinedStatus
|
||||
import com.owncloud.android.lib.resources.users.Status
|
||||
import com.owncloud.android.lib.resources.users.StatusType
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class SetStatusMessageBottomSheetIT : AbstractIT() {
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun open() {
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = SetStatusMessageBottomSheet(
|
||||
user,
|
||||
Status(StatusType.DND, "Working hard…", "🤖", -1)
|
||||
)
|
||||
sut.show(activity.supportFragmentManager, "")
|
||||
val predefinedStatus: ArrayList<PredefinedStatus> = arrayListOf(
|
||||
PredefinedStatus("meeting", "📅", "In a meeting", ClearAt("period", "3600")),
|
||||
PredefinedStatus("commuting", "🚌", "Commuting", ClearAt("period", "1800")),
|
||||
PredefinedStatus("be-right-back", "⏳", "Be right back", ClearAt("period", "900")),
|
||||
PredefinedStatus("remote-work", "🏡", "Working remotely", ClearAt("end-of", "day")),
|
||||
PredefinedStatus("sick-leave", "🤒", "Out sick", ClearAt("end-of", "day")),
|
||||
PredefinedStatus("vacationing", "🌴", "Vacationing", null)
|
||||
)
|
||||
sut.setPredefinedStatus(predefinedStatus)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,4 +230,12 @@ class AutoRenameTests : AbstractOnServerIT() {
|
||||
val expectedFilename = "readme.txt"
|
||||
assert(result == expectedFilename) { "Expected $expectedFilename but got $result" }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFolderNameLowercase() {
|
||||
val filename = "Foo.Bar.Baz"
|
||||
val result = AutoRename.rename(filename, capability, isFolderPath = true)
|
||||
val expectedFilename = "Foo.Bar.Baz"
|
||||
assert(result == expectedFilename) { "Expected $expectedFilename but got $result" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
package com.nextcloud.utils
|
||||
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import junit.framework.TestCase.assertTrue
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
class FileHelperTest {
|
||||
|
||||
private lateinit var testDirectory: File
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
testDirectory = Files.createTempDirectory("test").toFile()
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
testDirectory.deleteRecursively()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenNullDirectoryShouldReturnEmptyList() {
|
||||
val result = FileHelper.listDirectoryEntries(null, 0, 10, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenNonExistentDirectoryShouldReturnEmptyList() {
|
||||
val nonExistent = File(testDirectory, "does_not_exist")
|
||||
val result = FileHelper.listDirectoryEntries(nonExistent, 0, 10, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenFileInsteadOfDirectoryShouldReturnEmptyList() {
|
||||
val file = File(testDirectory, "test.txt")
|
||||
file.createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(file, 0, 10, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenEmptyDirectoryShouldReturnEmptyList() {
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 10, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenFetchingFoldersShouldReturnOnlyFolders() {
|
||||
File(testDirectory, "folder1").mkdir()
|
||||
File(testDirectory, "folder2").mkdir()
|
||||
File(testDirectory, "file1.txt").createNewFile()
|
||||
File(testDirectory, "file2.txt").createNewFile()
|
||||
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 10, true)
|
||||
|
||||
assertEquals(2, result.size)
|
||||
assertTrue(result.all { it.isDirectory })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenFetchingFilesShouldReturnOnlyFiles() {
|
||||
File(testDirectory, "folder1").mkdir()
|
||||
File(testDirectory, "folder2").mkdir()
|
||||
File(testDirectory, "file1.txt").createNewFile()
|
||||
File(testDirectory, "file2.txt").createNewFile()
|
||||
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 10, false)
|
||||
|
||||
assertEquals(2, result.size)
|
||||
assertTrue(result.all { it.isFile })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenStartIndexProvidedShouldSkipCorrectNumberOfItems() {
|
||||
for (i in 1..5) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 2, 10, false)
|
||||
assertEquals(3, result.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenMaxItemsProvidedShouldLimitResults() {
|
||||
for (i in 1..10) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 5, false)
|
||||
assertEquals(5, result.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenStartIndexAndMaxItemsShouldReturnCorrectSubset() {
|
||||
for (i in 1..10) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 3, 4, false)
|
||||
assertEquals(4, result.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenStartIndexBeyondAvailableShouldReturnEmptyList() {
|
||||
for (i in 1..3) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 10, 5, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenMaxItemsBeyondAvailableShouldReturnAllItems() {
|
||||
for (i in 1..3) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 100, false)
|
||||
assertEquals(3, result.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenFetchingFoldersWithOffsetShouldSkipCorrectly() {
|
||||
for (i in 1..5) File(testDirectory, "folder$i").mkdir()
|
||||
for (i in 1..3) File(testDirectory, "file$i.txt").createNewFile()
|
||||
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 2, 10, true)
|
||||
|
||||
assertEquals(3, result.size)
|
||||
assertTrue(result.all { it.isDirectory })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenFetchingFilesWithOffsetShouldSkipCorrectly() {
|
||||
for (i in 1..3) File(testDirectory, "folder$i").mkdir()
|
||||
for (i in 1..5) File(testDirectory, "file$i.txt").createNewFile()
|
||||
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 2, 10, false)
|
||||
|
||||
assertEquals(3, result.size)
|
||||
assertTrue(result.all { it.isFile })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenOnlyFoldersAndFetchingFilesShouldReturnEmptyList() {
|
||||
for (i in 1..5) File(testDirectory, "folder$i").mkdir()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 10, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenOnlyFilesAndFetchingFoldersShouldReturnEmptyList() {
|
||||
for (i in 1..5) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 10, true)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenMaxItemsIsZeroShouldReturnEmptyList() {
|
||||
for (i in 1..5) File(testDirectory, "file$i.txt").createNewFile()
|
||||
val result = FileHelper.listDirectoryEntries(testDirectory, 0, 0, false)
|
||||
assertTrue(result.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenGivenMixedContentShouldFilterCorrectly() {
|
||||
for (i in 1..3) File(testDirectory, "folder$i").mkdir()
|
||||
for (i in 1..7) File(testDirectory, "file$i.txt").createNewFile()
|
||||
|
||||
val folders = FileHelper.listDirectoryEntries(testDirectory, 0, 10, true)
|
||||
val files = FileHelper.listDirectoryEntries(testDirectory, 0, 10, false)
|
||||
|
||||
assertEquals(3, folders.size)
|
||||
assertEquals(7, files.size)
|
||||
assertTrue(folders.all { it.isDirectory })
|
||||
assertTrue(files.all { it.isFile })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenPaginatingFoldersShouldWorkCorrectly() {
|
||||
for (i in 1..10) File(testDirectory, "folder$i").mkdir()
|
||||
|
||||
val page1 = FileHelper.listDirectoryEntries(testDirectory, 0, 3, true)
|
||||
val page2 = FileHelper.listDirectoryEntries(testDirectory, 3, 3, true)
|
||||
val page3 = FileHelper.listDirectoryEntries(testDirectory, 6, 3, true)
|
||||
val page4 = FileHelper.listDirectoryEntries(testDirectory, 9, 3, true)
|
||||
|
||||
assertEquals(3, page1.size)
|
||||
assertEquals(3, page2.size)
|
||||
assertEquals(3, page3.size)
|
||||
assertEquals(1, page4.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListDirectoryEntriesWhenPaginatingFilesShouldWorkCorrectly() {
|
||||
for (i in 1..10) File(testDirectory, "file$i.txt").createNewFile()
|
||||
|
||||
val page1 = FileHelper.listDirectoryEntries(testDirectory, 0, 4, false)
|
||||
val page2 = FileHelper.listDirectoryEntries(testDirectory, 4, 4, false)
|
||||
val page3 = FileHelper.listDirectoryEntries(testDirectory, 8, 4, false)
|
||||
|
||||
assertEquals(4, page1.size)
|
||||
assertEquals(4, page2.size)
|
||||
assertEquals(2, page3.size)
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,12 @@ class FileNameValidatorTests : AbstractOnServerIT() {
|
||||
assertEquals(targetContext.getString(R.string.filename_empty), result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testBlankFileName() {
|
||||
val result = FileNameValidator.checkFileName(" ", capability, targetContext)
|
||||
assertEquals(targetContext.getString(R.string.filename_empty), result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFileAlreadyExists() {
|
||||
val existingFiles = setOf("existingFile")
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.view.View;
|
||||
|
||||
import com.facebook.testing.screenshot.Screenshot;
|
||||
import com.facebook.testing.screenshot.internal.TestNameDetector;
|
||||
import com.nextcloud.android.common.ui.theme.MaterialSchemes;
|
||||
import com.nextcloud.android.common.ui.theme.MaterialSchemesImpl;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
@@ -53,6 +55,7 @@ import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
import com.owncloud.android.operations.CreateFolderOperation;
|
||||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.theme.MaterialSchemesProvider;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.After;
|
||||
@@ -293,7 +296,7 @@ public abstract class AbstractIT {
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
||||
}
|
||||
|
||||
protected void onIdleSync(Runnable recipient) {
|
||||
public void onIdleSync(Runnable recipient) {
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdle(recipient);
|
||||
}
|
||||
|
||||
@@ -397,11 +400,6 @@ public abstract class AbstractIT {
|
||||
public boolean isPowerSavingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingExclusionAvailable() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
@@ -452,7 +450,7 @@ public abstract class AbstractIT {
|
||||
screenshot(view, "");
|
||||
}
|
||||
|
||||
protected void screenshotViaName(Activity activity, String name) {
|
||||
public void screenshotViaName(Activity activity, String name) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
Screenshot.snapActivity(activity).setName(name).record();
|
||||
}
|
||||
@@ -542,4 +540,38 @@ public abstract class AbstractIT {
|
||||
protected static boolean removeAccount(Account account) {
|
||||
return AccountManager.get(targetContext).removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
protected MaterialSchemesProvider getMaterialSchemesProvider() {
|
||||
return new MaterialSchemesProvider() {
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForUser(@NonNull User user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForCapability(@NonNull OCCapability capability) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForCurrentUser() {
|
||||
return new MaterialSchemesImpl(R.color.primary, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getDefaultMaterialSchemes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForPrimaryBackground() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -173,9 +173,7 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
Assert.fail("Server not ready!");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -218,11 +216,6 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
public boolean isPowerSavingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingExclusionAvailable() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
|
||||
@@ -82,12 +82,6 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
public boolean isPowerSavingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingExclusionAvailable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public BatteryStatus getBattery() {
|
||||
@@ -237,11 +231,6 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingExclusionAvailable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public BatteryStatus getBattery() {
|
||||
|
||||
@@ -43,7 +43,6 @@ class ContentResolverHelperIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
|
||||
fun contentResolver_onAndroid26_usesNewAPI() {
|
||||
ContentResolverHelper
|
||||
.queryResolver(resolver, URI, PROJECTION, SELECTION, null, SORT_COLUMN, SORT_DIRECTION, LIMIT)
|
||||
|
||||
+5
-7
@@ -18,6 +18,7 @@ import com.nextcloud.client.account.CurrentAccountProvider;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.nextcloud.client.database.entity.UploadEntityKt;
|
||||
import com.nextcloud.test.RandomStringGenerator;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.MainApp;
|
||||
@@ -108,7 +109,7 @@ public class UploadStorageManagerTest extends AbstractIT {
|
||||
OCUpload upload = createUpload(account);
|
||||
|
||||
uploads.add(upload);
|
||||
uploadsStorageManager.storeUpload(upload);
|
||||
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(upload));
|
||||
}
|
||||
|
||||
OCUpload[] storedUploads = uploadsStorageManager.getAllStoredUploads();
|
||||
@@ -151,17 +152,14 @@ public class UploadStorageManagerTest extends AbstractIT {
|
||||
account.name);
|
||||
|
||||
corruptUpload.setLocalPath(null);
|
||||
|
||||
uploadsStorageManager.storeUpload(corruptUpload);
|
||||
|
||||
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(corruptUpload));
|
||||
uploadsStorageManager.getAllStoredUploads();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getById() {
|
||||
OCUpload upload = createUpload(account);
|
||||
long id = uploadsStorageManager.storeUpload(upload);
|
||||
|
||||
long id = uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(upload));
|
||||
OCUpload newUpload = uploadsStorageManager.getUploadById(id);
|
||||
|
||||
assertNotNull(newUpload);
|
||||
@@ -178,7 +176,7 @@ public class UploadStorageManagerTest extends AbstractIT {
|
||||
|
||||
private void insertUploads(Account account, int rowsToInsert) {
|
||||
for (int i = 0; i < rowsToInsert; i++) {
|
||||
uploadsStorageManager.storeUpload(createUpload(account));
|
||||
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(createUpload(account)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.owncloud.android.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
|
||||
inline fun <reified T : Activity> AbstractIT.launchAndCapture(
|
||||
testClassName: String,
|
||||
actionName: String,
|
||||
intent: Intent? = null,
|
||||
crossinline before: (T) -> Unit
|
||||
) {
|
||||
launchActivity<T>(intent).use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
before(activity)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenshotName = createName(testClassName + "_" + actionName, "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(activity, screenshotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,9 +46,6 @@ abstract class FileUploaderIT : AbstractOnServerIT() {
|
||||
override val isPowerSavingEnabled: Boolean
|
||||
get() = false
|
||||
|
||||
override val isPowerSavingExclusionAvailable: Boolean
|
||||
get() = false
|
||||
|
||||
override val battery: BatteryStatus
|
||||
get() = BatteryStatus()
|
||||
}
|
||||
|
||||
@@ -178,10 +178,10 @@ object DocumentsProviderUtils {
|
||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||
@VisibleForTesting
|
||||
internal suspend fun getLoadedCursor(timeout: Long = 15_000, query: () -> Cursor?) = withTimeout(timeout) {
|
||||
suspendCancellableCoroutine<Cursor> { cont ->
|
||||
suspendCancellableCoroutine { cont ->
|
||||
val cursor = query() ?: throw IOException("Initial query returned no results")
|
||||
cont.invokeOnCancellation { cursor.close() }
|
||||
val loading = cursor.extras.getBoolean(EXTRA_LOADING, false)
|
||||
val loading = cursor.extras?.getBoolean(EXTRA_LOADING, false) ?: false
|
||||
if (loading) {
|
||||
Log_OC.e("TEST", "Cursor was loading, wait for update...")
|
||||
cursor.registerContentObserver(
|
||||
|
||||
@@ -53,6 +53,14 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
|
||||
// DocumentsProvider#onCreate() is called when the application is started
|
||||
// which is *after* AbstractOnServerIT adds the accounts (when the app is freshly installed).
|
||||
// So we need to query our roots here to ensure that the internal storage map is initialized.
|
||||
storageManager.run {
|
||||
val updatedRootPath = getFileByEncryptedRemotePath(ROOT_PATH).apply {
|
||||
permissions = "RSMCKGWDNV"
|
||||
}
|
||||
|
||||
saveFile(updatedRootPath)
|
||||
}
|
||||
|
||||
contentResolver.query(DocumentsContract.buildRootsUri(authority), null, null, null)
|
||||
assertTrue("Storage root does not exist", rootDir.exists())
|
||||
assertTrue(rootDir.isDirectory)
|
||||
|
||||
+14
-14
@@ -1,32 +1,32 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.providers
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractOnServerIT
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class UsersAndGroupsSearchProviderIT : AbstractOnServerIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun searchUser() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
|
||||
shortSleep()
|
||||
|
||||
activity.runOnUiThread {
|
||||
// fragment.search("Admin")
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
longSleep()
|
||||
}
|
||||
}
|
||||
-327
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.nextcloud.utils.extensions.FileDataStorageManagerExtensionsKt;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.db.OCUpload;
|
||||
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ConflictsResolveActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<ConflictsResolveActivity> activityRule =
|
||||
new IntentsTestRule<>(ConflictsResolveActivity.class, true, false);
|
||||
private boolean returnCode;
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void screenshotTextFiles() {
|
||||
OCFile newFile = new OCFile("/newFile.txt");
|
||||
newFile.setRemoteId("0001");
|
||||
newFile.setFileLength(56000);
|
||||
newFile.setModificationTimestamp(1522019340);
|
||||
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
|
||||
OCFile existingFile = new OCFile("/newFile.txt");
|
||||
existingFile.setRemoteId("0002");
|
||||
existingFile.setFileLength(1024000);
|
||||
existingFile.setModificationTimestamp(1582019340);
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
|
||||
storageManager.saveNewFile(existingFile);
|
||||
|
||||
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
|
||||
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(
|
||||
FileDataStorageManagerExtensionsKt.getDecryptedPath(storageManager, existingFile),
|
||||
targetContext,
|
||||
newFile,
|
||||
existingFile,
|
||||
UserAccountManagerImpl
|
||||
.fromContext(targetContext)
|
||||
.getUser());
|
||||
dialog.showDialog(sut);
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
|
||||
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @ScreenshotTest // todo run without real server
|
||||
// public void screenshotImages() throws IOException {
|
||||
// FileDataStorageManager storageManager = new FileDataStorageManager(user,
|
||||
// targetContext.getContentResolver());
|
||||
//
|
||||
// OCFile newFile = new OCFile("/newFile.txt");
|
||||
// newFile.setFileLength(56000);
|
||||
// newFile.setModificationTimestamp(1522019340);
|
||||
// newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
//
|
||||
// File image = getFile("image.jpg");
|
||||
//
|
||||
// assertTrue(new UploadFileRemoteOperation(image.getAbsolutePath(),
|
||||
// "/image.jpg",
|
||||
// "image/jpg",
|
||||
// "10000000").execute(client).isSuccess());
|
||||
//
|
||||
// assertTrue(new RefreshFolderOperation(storageManager.getFileByPath("/"),
|
||||
// System.currentTimeMillis(),
|
||||
// false,
|
||||
// true,
|
||||
// storageManager,
|
||||
// user.toPlatformAccount(),
|
||||
// targetContext
|
||||
// ).execute(client).isSuccess());
|
||||
//
|
||||
// OCFile existingFile = storageManager.getFileByPath("/image.jpg");
|
||||
//
|
||||
// Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
// intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
// intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
//
|
||||
// ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
//
|
||||
// ConflictsResolveDialog.OnConflictDecisionMadeListener listener = decision -> {
|
||||
//
|
||||
// };
|
||||
//
|
||||
// ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
|
||||
// newFile,
|
||||
// UserAccountManagerImpl
|
||||
// .fromContext(targetContext)
|
||||
// .getUser()
|
||||
// );
|
||||
// dialog.showDialog(sut);
|
||||
// dialog.listener = listener;
|
||||
//
|
||||
// getInstrumentation().waitForIdleSync();
|
||||
// shortSleep();
|
||||
//
|
||||
// screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void cancel() {
|
||||
returnCode = false;
|
||||
|
||||
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.getAccountName());
|
||||
|
||||
OCFile existingFile = new OCFile("/newFile.txt");
|
||||
existingFile.setFileLength(1024000);
|
||||
existingFile.setModificationTimestamp(1582019340);
|
||||
|
||||
OCFile newFile = new OCFile("/newFile.txt");
|
||||
newFile.setFileLength(56000);
|
||||
newFile.setModificationTimestamp(1522019340);
|
||||
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
|
||||
storageManager.saveNewFile(existingFile);
|
||||
|
||||
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
|
||||
|
||||
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
sut.listener = decision -> {
|
||||
assertEquals(ConflictsResolveDialog.Decision.CANCEL, decision);
|
||||
returnCode = true;
|
||||
};
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
onView(withText("Cancel")).perform(click());
|
||||
|
||||
assertTrue(returnCode);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void keepExisting() {
|
||||
returnCode = false;
|
||||
|
||||
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.getAccountName());
|
||||
|
||||
OCFile existingFile = new OCFile("/newFile.txt");
|
||||
existingFile.setRemoteId("0001");
|
||||
existingFile.setFileLength(1024000);
|
||||
existingFile.setModificationTimestamp(1582019340);
|
||||
|
||||
OCFile newFile = new OCFile("/newFile.txt");
|
||||
newFile.setFileLength(56000);
|
||||
newFile.setRemoteId("0002");
|
||||
newFile.setModificationTimestamp(1522019340);
|
||||
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
|
||||
storageManager.saveNewFile(existingFile);
|
||||
|
||||
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
|
||||
|
||||
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
sut.listener = decision -> {
|
||||
assertEquals(ConflictsResolveDialog.Decision.KEEP_SERVER, decision);
|
||||
returnCode = true;
|
||||
};
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
onView(withId(R.id.right_checkbox)).perform(click());
|
||||
|
||||
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
|
||||
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
|
||||
onView(withText("OK")).perform(click());
|
||||
|
||||
assertTrue(returnCode);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void keepNew() {
|
||||
returnCode = false;
|
||||
|
||||
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.getAccountName());
|
||||
|
||||
OCFile existingFile = new OCFile("/newFile.txt");
|
||||
existingFile.setFileLength(1024000);
|
||||
existingFile.setModificationTimestamp(1582019340);
|
||||
existingFile.setRemoteId("00000123abc");
|
||||
|
||||
OCFile newFile = new OCFile("/newFile.txt");
|
||||
newFile.setFileLength(56000);
|
||||
newFile.setModificationTimestamp(1522019340);
|
||||
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
|
||||
storageManager.saveNewFile(existingFile);
|
||||
|
||||
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
|
||||
|
||||
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
sut.listener = decision -> {
|
||||
assertEquals(ConflictsResolveDialog.Decision.KEEP_LOCAL, decision);
|
||||
returnCode = true;
|
||||
};
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
onView(withId(R.id.left_checkbox)).perform(click());
|
||||
|
||||
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
|
||||
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
|
||||
onView(withText("OK")).perform(click());
|
||||
|
||||
assertTrue(returnCode);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void keepBoth() {
|
||||
returnCode = false;
|
||||
|
||||
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.getAccountName());
|
||||
|
||||
OCFile existingFile = new OCFile("/newFile.txt");
|
||||
existingFile.setRemoteId("0001");
|
||||
existingFile.setFileLength(1024000);
|
||||
existingFile.setModificationTimestamp(1582019340);
|
||||
|
||||
OCFile newFile = new OCFile("/newFile.txt");
|
||||
newFile.setFileLength(56000);
|
||||
newFile.setRemoteId("0002");
|
||||
newFile.setModificationTimestamp(1522019340);
|
||||
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
|
||||
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
|
||||
storageManager.saveNewFile(existingFile);
|
||||
|
||||
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
|
||||
|
||||
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
sut.listener = decision -> {
|
||||
assertEquals(ConflictsResolveDialog.Decision.KEEP_BOTH, decision);
|
||||
returnCode = true;
|
||||
};
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
onView(withId(R.id.right_checkbox)).perform(click());
|
||||
onView(withId(R.id.left_checkbox)).perform(click());
|
||||
|
||||
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
|
||||
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
|
||||
onView(withText("OK")).perform(click());
|
||||
|
||||
assertTrue(returnCode);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
getStorageManager().deleteAllFiles();
|
||||
}
|
||||
}
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl
|
||||
import com.nextcloud.utils.extensions.getDecryptedPath
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.db.OCUpload
|
||||
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Companion.newInstance
|
||||
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Decision
|
||||
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionMadeListener
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.FileStorageUtils
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import junit.framework.TestCase
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class ConflictsResolveActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.activity.ConflictsResolveActivityIT"
|
||||
private var returnCode = false
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun screenshotTextFiles() {
|
||||
val newFile = OCFile("/newFile.txt").apply {
|
||||
remoteId = "0001"
|
||||
fileLength = 56000
|
||||
modificationTimestamp = 1522019340
|
||||
setStoragePath(FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt")
|
||||
}
|
||||
|
||||
val existingFile = OCFile("/newFile.txt").apply {
|
||||
remoteId = "0002"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1582019340
|
||||
}
|
||||
|
||||
val storageManager = FileDataStorageManager(user, targetContext.contentResolver)
|
||||
storageManager.saveNewFile(existingFile)
|
||||
|
||||
val intent = Intent(targetContext, ConflictsResolveActivity::class.java).apply {
|
||||
putExtra(FileActivity.EXTRA_FILE, newFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile)
|
||||
}
|
||||
|
||||
launchActivity<ConflictsResolveActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val dialog = newInstance(
|
||||
storageManager.getDecryptedPath(existingFile),
|
||||
targetContext,
|
||||
newFile,
|
||||
existingFile,
|
||||
UserAccountManagerImpl
|
||||
.fromContext(targetContext)
|
||||
.getUser()
|
||||
)
|
||||
dialog.showDialog(sut)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "screenshotTextFiles", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(dialog.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun cancel() {
|
||||
val newUpload = OCUpload(
|
||||
FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.accountName
|
||||
)
|
||||
|
||||
val existingFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1582019340
|
||||
}
|
||||
|
||||
val newFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 56000
|
||||
modificationTimestamp = 1522019340
|
||||
setStoragePath(FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt")
|
||||
}
|
||||
|
||||
EspressoIdlingResource.increment()
|
||||
FileDataStorageManager(user, targetContext.contentResolver).run {
|
||||
saveNewFile(existingFile)
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val intent = Intent(targetContext, ConflictsResolveActivity::class.java).apply {
|
||||
putExtra(FileActivity.EXTRA_FILE, newFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.uploadId)
|
||||
}
|
||||
|
||||
launchActivity<ConflictsResolveActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
returnCode = false
|
||||
sut.listener = OnConflictDecisionMadeListener { decision: Decision? ->
|
||||
assertEquals(decision, Decision.CANCEL)
|
||||
returnCode = true
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(ViewMatchers.withText("Cancel")).perform(ViewActions.click())
|
||||
TestCase.assertTrue(returnCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun keepExisting() {
|
||||
returnCode = false
|
||||
|
||||
val newUpload = OCUpload(
|
||||
FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.accountName
|
||||
)
|
||||
|
||||
val existingFile = OCFile("/newFile.txt").apply {
|
||||
remoteId = "0001"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1582019340
|
||||
}
|
||||
|
||||
val newFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 56000
|
||||
remoteId = "0002"
|
||||
modificationTimestamp = 1522019340
|
||||
setStoragePath(FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt")
|
||||
}
|
||||
|
||||
EspressoIdlingResource.increment()
|
||||
FileDataStorageManager(user, targetContext.contentResolver).run {
|
||||
saveNewFile(existingFile)
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val intent = Intent(targetContext, ConflictsResolveActivity::class.java).apply {
|
||||
putExtra(FileActivity.EXTRA_FILE, newFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.uploadId)
|
||||
}
|
||||
|
||||
launchActivity<ConflictsResolveActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.listener = OnConflictDecisionMadeListener { decision: Decision? ->
|
||||
assertEquals(decision, Decision.KEEP_SERVER)
|
||||
returnCode = true
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(ViewMatchers.withId(R.id.right_checkbox)).perform(ViewActions.click())
|
||||
val dialog = sut.supportFragmentManager.findFragmentByTag("conflictDialog") as DialogFragment?
|
||||
val screenShotName = createName(testClassName + "_" + "keepExisting", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(dialog?.requireDialog()?.window?.decorView, screenShotName)
|
||||
|
||||
onView(ViewMatchers.withText("OK")).perform(ViewActions.click())
|
||||
assertTrue(returnCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun keepNew() {
|
||||
returnCode = false
|
||||
|
||||
val newUpload = OCUpload(
|
||||
FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.accountName
|
||||
)
|
||||
|
||||
val existingFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1582019340
|
||||
remoteId = "00000123abc"
|
||||
}
|
||||
|
||||
val newFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 56000
|
||||
modificationTimestamp = 1522019340
|
||||
setStoragePath(FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt")
|
||||
}
|
||||
|
||||
val storageManager = FileDataStorageManager(user, targetContext.contentResolver)
|
||||
storageManager.saveNewFile(existingFile)
|
||||
|
||||
val intent = Intent(targetContext, ConflictsResolveActivity::class.java)
|
||||
intent.putExtra(FileActivity.EXTRA_FILE, newFile)
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile)
|
||||
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.uploadId)
|
||||
|
||||
launchActivity<ConflictsResolveActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.listener = OnConflictDecisionMadeListener { decision: Decision? ->
|
||||
assertEquals(decision, Decision.KEEP_LOCAL)
|
||||
returnCode = true
|
||||
}
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(ViewMatchers.withId(R.id.left_checkbox)).perform(ViewActions.click())
|
||||
val dialog = sut.supportFragmentManager.findFragmentByTag("conflictDialog") as DialogFragment?
|
||||
val screenShotName = createName(testClassName + "_" + "keepNew", "")
|
||||
screenshotViaName(dialog?.requireDialog()?.window?.decorView, screenShotName)
|
||||
|
||||
onView(ViewMatchers.withText("OK")).perform(ViewActions.click())
|
||||
assertTrue(returnCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun keepBoth() {
|
||||
returnCode = false
|
||||
|
||||
val newUpload = OCUpload(
|
||||
FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt",
|
||||
"/newFile.txt",
|
||||
user.accountName
|
||||
)
|
||||
|
||||
val existingFile = OCFile("/newFile.txt").apply {
|
||||
remoteId = "0001"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1582019340
|
||||
}
|
||||
|
||||
val newFile = OCFile("/newFile.txt").apply {
|
||||
fileLength = 56000
|
||||
remoteId = "0002"
|
||||
modificationTimestamp = 1522019340
|
||||
setStoragePath(FileStorageUtils.getSavePath(user.accountName) + "/nonEmpty.txt")
|
||||
}
|
||||
|
||||
val storageManager = FileDataStorageManager(user, targetContext.contentResolver)
|
||||
storageManager.saveNewFile(existingFile)
|
||||
|
||||
val intent = Intent(targetContext, ConflictsResolveActivity::class.java).apply {
|
||||
putExtra(FileActivity.EXTRA_FILE, newFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile)
|
||||
putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.uploadId)
|
||||
}
|
||||
|
||||
launchActivity<ConflictsResolveActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.listener = OnConflictDecisionMadeListener { decision: Decision? ->
|
||||
assertEquals(decision, Decision.KEEP_BOTH)
|
||||
returnCode = true
|
||||
}
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(ViewMatchers.withId(R.id.right_checkbox)).perform(ViewActions.click())
|
||||
onView(ViewMatchers.withId(R.id.left_checkbox)).perform(ViewActions.click())
|
||||
|
||||
onView(ViewMatchers.withId(R.id.left_checkbox)).perform(ViewActions.click())
|
||||
val dialog = sut.supportFragmentManager.findFragmentByTag("conflictDialog") as DialogFragment?
|
||||
val screenShotName = createName(testClassName + "_" + "keepBoth", "")
|
||||
screenshotViaName(dialog?.requireDialog()?.window?.decorView, screenShotName)
|
||||
|
||||
onView(ViewMatchers.withText("OK")).perform(ViewActions.click())
|
||||
assertTrue(returnCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
override fun after() {
|
||||
storageManager.deleteAllFiles()
|
||||
}
|
||||
}
|
||||
+45
-16
@@ -8,19 +8,37 @@
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class ContactsPreferenceActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(ContactsPreferenceActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.activity.ContactsPreferenceActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun openVCF() {
|
||||
val file = getFile("vcard.vcf")
|
||||
@@ -29,23 +47,34 @@ class ContactsPreferenceActivityIT : AbstractIT() {
|
||||
|
||||
assertTrue(vcfFile.isDown)
|
||||
|
||||
val intent = Intent()
|
||||
intent.putExtra(ContactsPreferenceActivity.EXTRA_FILE, vcfFile)
|
||||
intent.putExtra(ContactsPreferenceActivity.EXTRA_USER, user)
|
||||
val sut = activityRule.launchActivity(intent)
|
||||
val intent = Intent(targetContext, ContactsPreferenceActivity::class.java).apply {
|
||||
putExtra(ContactsPreferenceActivity.EXTRA_FILE, vcfFile)
|
||||
putExtra(ContactsPreferenceActivity.EXTRA_USER, user)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
launchActivity<ContactsPreferenceActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "openVCF", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun openContactsPreference() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
launchActivity<ContactsPreferenceActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "openContactsPreference", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.nextcloud.test.RetryTestRule;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class DrawerActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final RetryTestRule retryTestRule = new RetryTestRule();
|
||||
|
||||
private static Account account1;
|
||||
private static User user1;
|
||||
private static Account account2;
|
||||
private static String account2Name;
|
||||
private static String account2DisplayName;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
|
||||
Uri baseUrl = Uri.parse(arguments.getString("TEST_SERVER_URL"));
|
||||
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
|
||||
for (Account account : platformAccountManager.getAccounts()) {
|
||||
platformAccountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
String loginName = "user1";
|
||||
String password = "user1";
|
||||
|
||||
Account temp = new Account(loginName + "@" + baseUrl, MainApp.getAccountType(targetContext));
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
Integer.toString(UserAccountManager.ACCOUNT_VERSION));
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString());
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId
|
||||
|
||||
account1 = userAccountManager.getAccountByName(loginName + "@" + baseUrl);
|
||||
user1 = userAccountManager.getUser(account1.name).orElseThrow(IllegalAccessError::new);
|
||||
|
||||
loginName = "user2";
|
||||
password = "user2";
|
||||
|
||||
temp = new Account(loginName + "@" + baseUrl, MainApp.getAccountType(targetContext));
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
Integer.toString(UserAccountManager.ACCOUNT_VERSION));
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString());
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId
|
||||
|
||||
account2 = userAccountManager.getAccountByName(loginName + "@" + baseUrl);
|
||||
account2Name = loginName + "@" + baseUrl;
|
||||
account2DisplayName = "User Two@" + baseUrl;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void switchAccountViaAccountList() {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
sut.setUser(user1);
|
||||
|
||||
assertEquals(account1, sut.getUser().get().toPlatformAccount());
|
||||
|
||||
onView(withId(R.id.switch_account_button)).perform(click());
|
||||
|
||||
onView(anyOf(withText(account2Name), withText(account2DisplayName))).perform(click());
|
||||
|
||||
waitForIdleSync();
|
||||
|
||||
assertEquals(account2, sut.getUser().get().toPlatformAccount());
|
||||
|
||||
onView(withId(R.id.switch_account_button)).perform(click());
|
||||
onView(withText(account1.name)).perform(click());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.accounts.Account
|
||||
import android.accounts.AccountManager
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.account.UserAccountManager
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl
|
||||
import com.nextcloud.test.RetryTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import org.hamcrest.Matchers
|
||||
import org.junit.Assert
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import java.util.function.Supplier
|
||||
|
||||
class DrawerActivityIT : AbstractIT() {
|
||||
@Rule
|
||||
@JvmField
|
||||
val retryTestRule = RetryTestRule()
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun switchAccountViaAccountList() {
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.setUser(user1)
|
||||
|
||||
Assert.assertEquals(account1, sut.user.get().toPlatformAccount())
|
||||
onView(ViewMatchers.withId(R.id.switch_account_button)).perform(ViewActions.click())
|
||||
onView(
|
||||
Matchers.anyOf<View?>(
|
||||
ViewMatchers.withText(account2Name),
|
||||
ViewMatchers.withText(
|
||||
account2DisplayName
|
||||
)
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
Assert.assertEquals(account2, sut.user.get().toPlatformAccount())
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
onView(ViewMatchers.withId(R.id.switch_account_button)).perform(ViewActions.click())
|
||||
onView(ViewMatchers.withText(account1?.name)).perform(ViewActions.click())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var account1: Account? = null
|
||||
private var user1: User? = null
|
||||
private var account2: Account? = null
|
||||
private var account2Name: String? = null
|
||||
private var account2DisplayName: String? = null
|
||||
|
||||
@JvmStatic
|
||||
@BeforeClass
|
||||
fun beforeClass() {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val baseUrl = Uri.parse(arguments.getString("TEST_SERVER_URL"))
|
||||
|
||||
val platformAccountManager = AccountManager.get(targetContext)
|
||||
val userAccountManager: UserAccountManager = UserAccountManagerImpl.fromContext(targetContext)
|
||||
|
||||
for (account in platformAccountManager.accounts) {
|
||||
platformAccountManager.removeAccountExplicitly(account)
|
||||
}
|
||||
|
||||
var loginName = "user1"
|
||||
var password = "user1"
|
||||
|
||||
var temp = Account("$loginName@$baseUrl", MainApp.getAccountType(targetContext))
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null)
|
||||
platformAccountManager.setUserData(
|
||||
temp,
|
||||
AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
UserAccountManager.ACCOUNT_VERSION.toString()
|
||||
)
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0")
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString())
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName) // same as userId
|
||||
|
||||
account1 = userAccountManager.getAccountByName("$loginName@$baseUrl")
|
||||
user1 = userAccountManager.getUser(account1!!.name)
|
||||
.orElseThrow<IllegalAccessError?>(Supplier { IllegalAccessError() })
|
||||
|
||||
loginName = "user2"
|
||||
password = "user2"
|
||||
|
||||
temp = Account("$loginName@$baseUrl", MainApp.getAccountType(targetContext))
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null)
|
||||
platformAccountManager.setUserData(
|
||||
temp,
|
||||
AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
UserAccountManager.ACCOUNT_VERSION.toString()
|
||||
)
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0")
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString())
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName) // same as userId
|
||||
|
||||
account2 = userAccountManager.getAccountByName("$loginName@$baseUrl")
|
||||
account2Name = "$loginName@$baseUrl"
|
||||
account2DisplayName = "User Two@$baseUrl"
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -27,8 +27,8 @@ public class FileDisplayActivityTest extends AbstractIT {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
|
||||
Activity activity =
|
||||
ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(RESUMED).iterator().next();
|
||||
if (activity instanceof WhatsNewActivity) {
|
||||
activity.onBackPressed();
|
||||
if (activity instanceof WhatsNewActivity whatsNewActivity) {
|
||||
whatsNewActivity.getOnBackPressedDispatcher().onBackPressed();
|
||||
}
|
||||
});
|
||||
scenario.recreate();
|
||||
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2019 Kilian Périsset <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
//@LargeTest
|
||||
public class FolderPickerActivityIT extends AbstractIT {
|
||||
@Rule
|
||||
public ActivityTestRule<FolderPickerActivity> activityRule =
|
||||
new ActivityTestRule<>(FolderPickerActivity.class);
|
||||
|
||||
@Test
|
||||
public void getActivityFile() {
|
||||
// Arrange
|
||||
FolderPickerActivity targetActivity = activityRule.getActivity();
|
||||
OCFile origin = new OCFile("/test/file.test");
|
||||
origin.setRemotePath("/remotePath/test");
|
||||
|
||||
// Act
|
||||
targetActivity.setFile(origin);
|
||||
OCFile target = targetActivity.getFile();
|
||||
|
||||
// Assert
|
||||
Assert.assertEquals(origin, target);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getParentFolder_isNotRootFolder() {
|
||||
// Arrange
|
||||
FolderPickerActivity targetActivity = activityRule.getActivity();
|
||||
OCFile origin = new OCFile("/test/");
|
||||
origin.setFileId(1);
|
||||
origin.setRemotePath("/test/");
|
||||
origin.setStoragePath("/test/");
|
||||
origin.setFolder();
|
||||
|
||||
// Act
|
||||
targetActivity.setFile(origin);
|
||||
OCFile target = targetActivity.getCurrentFolder();
|
||||
|
||||
// Assert
|
||||
Assert.assertEquals(origin, target);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getParentFolder_isRootFolder() {
|
||||
// Arrange
|
||||
FolderPickerActivity targetActivity = activityRule.getActivity();
|
||||
OCFile origin = new OCFile("/");
|
||||
origin.setFileId(1);
|
||||
origin.setRemotePath("/");
|
||||
origin.setStoragePath("/");
|
||||
origin.setFolder();
|
||||
|
||||
// Act
|
||||
targetActivity.setFile(origin);
|
||||
OCFile target = targetActivity.getCurrentFolder();
|
||||
|
||||
// Assert
|
||||
Assert.assertEquals(origin, target);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullFile() {
|
||||
// Arrange
|
||||
FolderPickerActivity targetActivity = activityRule.getActivity();
|
||||
OCFile rootFolder = targetActivity.getStorageManager().getFileByPath(OCFile.ROOT_PATH);
|
||||
|
||||
// Act
|
||||
targetActivity.setFile(null);
|
||||
OCFile target = targetActivity.getCurrentFolder();
|
||||
|
||||
// Assert
|
||||
Assert.assertEquals(rootFolder, target);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getParentFolder() {
|
||||
// Arrange
|
||||
FolderPickerActivity targetActivity = activityRule.getActivity();
|
||||
OCFile origin = new OCFile("/test/file.test");
|
||||
origin.setRemotePath("/test/file.test");
|
||||
|
||||
OCFile target = new OCFile("/test/");
|
||||
|
||||
// Act
|
||||
targetActivity.setFile(origin);
|
||||
|
||||
// Assert
|
||||
Assert.assertEquals(origin, target);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
FolderPickerActivity sut = activityRule.getActivity();
|
||||
OCFile origin = new OCFile("/test/file.txt");
|
||||
sut.setFile(origin);
|
||||
|
||||
sut.runOnUiThread(() -> {
|
||||
sut.findViewById(R.id.folder_picker_btn_copy).requestFocus();
|
||||
});
|
||||
waitForIdleSync();
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testMoveOrCopy() {
|
||||
Intent intent = new Intent();
|
||||
FolderPickerActivity targetActivity = activityRule.launchActivity(intent);
|
||||
|
||||
waitForIdleSync();
|
||||
screenshot(targetActivity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testChooseLocationAction() {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(FolderPickerActivity.EXTRA_ACTION, FolderPickerActivity.CHOOSE_LOCATION);
|
||||
FolderPickerActivity targetActivity = activityRule.launchActivity(intent);
|
||||
|
||||
waitForIdleSync();
|
||||
screenshot(targetActivity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Kilian Périsset <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class FolderPickerActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.activity.FolderPickerActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun getActivityFile() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val origin = OCFile("/test/file.test").apply {
|
||||
remotePath = "/remotePath/test"
|
||||
}
|
||||
|
||||
// Act
|
||||
sut.file = origin
|
||||
val target = sut.file
|
||||
|
||||
// Assert
|
||||
assertEquals(origin, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun getParentFolder_isNotRootFolder() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// Arrange
|
||||
val origin = OCFile("/test/").apply {
|
||||
fileId = 1
|
||||
remotePath = "/test/"
|
||||
setStoragePath("/test/")
|
||||
setFolder()
|
||||
}
|
||||
|
||||
// Act
|
||||
sut.file = origin
|
||||
val target = sut.currentFolder
|
||||
|
||||
// Assert
|
||||
assertEquals(origin, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun getParentFolder_isRootFolder() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// Arrange
|
||||
val origin = OCFile("/").apply {
|
||||
fileId = 1
|
||||
remotePath = "/"
|
||||
setStoragePath("/")
|
||||
setFolder()
|
||||
}
|
||||
|
||||
// Act
|
||||
sut.file = origin
|
||||
val target = sut.currentFolder
|
||||
|
||||
// Assert
|
||||
assertEquals(origin, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
@UiThread
|
||||
fun nullFile() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// Arrange
|
||||
val rootFolder = sut.storageManager.getFileByPath(OCFile.ROOT_PATH)
|
||||
|
||||
// Act
|
||||
sut.file = null
|
||||
val target = sut.currentFolder
|
||||
|
||||
// Assert
|
||||
assertEquals(rootFolder, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun getParentFolder() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
// Arrange
|
||||
val origin = OCFile("/test/file.test").apply {
|
||||
remotePath = "/test/file.test"
|
||||
}
|
||||
|
||||
val target = OCFile("/test/")
|
||||
|
||||
// Act
|
||||
sut.file = origin
|
||||
|
||||
// Assert
|
||||
assertEquals(origin, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
launchActivity<FolderPickerActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val origin = OCFile("/test/file.txt")
|
||||
sut.file = origin
|
||||
sut.findViewById<View>(R.id.folder_picker_btn_copy).requestFocus()
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testMoveOrCopy() {
|
||||
val intent = Intent(targetContext, FolderPickerActivity::class.java)
|
||||
launchActivity<FolderPickerActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "testMoveOrCopy", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testChooseLocationAction() {
|
||||
val intent = Intent(targetContext, FolderPickerActivity::class.java).apply {
|
||||
putExtra(FolderPickerActivity.EXTRA_ACTION, FolderPickerActivity.CHOOSE_LOCATION)
|
||||
}
|
||||
|
||||
launchActivity<FolderPickerActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "testChooseLocationAction", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.lib.common.Quota;
|
||||
import com.owncloud.android.lib.common.UserInfo;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
public class ManageAccountsActivityIT extends AbstractIT {
|
||||
@Rule
|
||||
public IntentsTestRule<ManageAccountsActivity> activityRule = new IntentsTestRule<>(ManageAccountsActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
||||
shortSleep();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void userInfoDetail() {
|
||||
ManageAccountsActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
User user = sut.accountManager.getUser();
|
||||
|
||||
UserInfo userInfo = new UserInfo("test",
|
||||
true,
|
||||
"Test User",
|
||||
"[email protected]",
|
||||
"+49 123 456",
|
||||
"Address 123, Berlin",
|
||||
"https://www.nextcloud.com",
|
||||
"https://twitter.com/Nextclouders",
|
||||
new Quota(),
|
||||
new ArrayList<>());
|
||||
|
||||
sut.showUser(user, userInfo);
|
||||
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
|
||||
screenshot(getCurrentActivity());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.common.Quota
|
||||
import com.owncloud.android.lib.common.UserInfo
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class ManageAccountsActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.activity.ManageAccountsActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
launchActivity<ManageAccountsActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun userInfoDetail() {
|
||||
launchActivity<ManageAccountsActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val user = sut.accountManager.user
|
||||
|
||||
val userInfo = UserInfo(
|
||||
"test",
|
||||
true,
|
||||
"Test User",
|
||||
"[email protected]",
|
||||
"+49 123 456",
|
||||
"Address 123, Berlin",
|
||||
"https://www.nextcloud.com",
|
||||
"https://twitter.com/Nextclouders",
|
||||
Quota(),
|
||||
ArrayList()
|
||||
)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
sut.showUser(user, userInfo)
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(getCurrentActivity(), screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
@@ -8,59 +9,103 @@
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class PassCodeActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(PassCodeActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.activity.PassCodeActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun check() {
|
||||
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK))
|
||||
val intent = Intent(targetContext, PassCodeActivity::class.java).apply {
|
||||
action = PassCodeActivity.ACTION_CHECK
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
launchActivity<PassCodeActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.binding.txt0.clearFocus()
|
||||
Espresso.closeSoftKeyboard()
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
val screenShotName = createName(testClassName + "_" + "check", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun request() {
|
||||
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_REQUEST_WITH_RESULT))
|
||||
val intent = Intent(targetContext, PassCodeActivity::class.java).apply {
|
||||
action = PassCodeActivity.ACTION_REQUEST_WITH_RESULT
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
launchActivity<PassCodeActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.binding.txt0.clearFocus()
|
||||
Espresso.closeSoftKeyboard()
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
val screenShotName = createName(testClassName + "_" + "request", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun delete() {
|
||||
val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK_WITH_RESULT))
|
||||
val intent = Intent(targetContext, PassCodeActivity::class.java).apply {
|
||||
action = PassCodeActivity.ACTION_CHECK_WITH_RESULT
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
launchActivity<PassCodeActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.binding.txt0.clearFocus()
|
||||
Espresso.closeSoftKeyboard()
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
val screenShotName = createName(testClassName + "_" + "delete", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
-7
@@ -1,28 +1,53 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class ReceiveExternalFilesActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(ReceiveExternalFilesActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
screenshot(sut)
|
||||
launchActivity<ReceiveExternalFilesActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "open", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+88
-68
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
@@ -9,13 +10,13 @@ package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.GrantStoragePermissionRule
|
||||
import com.nextcloud.test.GrantStoragePermissionRule.Companion.grant
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.FileStorageUtils
|
||||
@@ -24,16 +25,14 @@ import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestRule
|
||||
import java.io.File
|
||||
|
||||
class UploadFilesActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.activity.UploadFilesActivityIT"
|
||||
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(UploadFilesActivity::class.java, true, false)
|
||||
|
||||
@get:Rule
|
||||
var permissionRule = GrantStoragePermissionRule.grant()
|
||||
var storagePermissionRule: TestRule = grant()
|
||||
|
||||
private val directories = listOf("A", "B", "C", "D")
|
||||
.map { File("${FileStorageUtils.getTemporalPath(account.name)}${File.separator}$it") }
|
||||
@@ -59,101 +58,122 @@ class UploadFilesActivityIT : AbstractIT() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun noneSelected() {
|
||||
val sut: UploadFilesActivity = activityRule.launchActivity(null)
|
||||
launchActivity<UploadFilesActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.fileListFragment.setFiles(
|
||||
directories +
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
sut.fileListFragment.setFiles(
|
||||
directories +
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "noneSelected", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.fileListFragment.binding?.listRoot, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
longSleep()
|
||||
|
||||
screenshot(sut.fileListFragment.binding?.listRoot)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun localFolderPickerMode() {
|
||||
val sut: UploadFilesActivity = activityRule.launchActivity(
|
||||
Intent().apply {
|
||||
putExtra(
|
||||
UploadFilesActivity.KEY_LOCAL_FOLDER_PICKER_MODE,
|
||||
true
|
||||
)
|
||||
putExtra(
|
||||
UploadFilesActivity.REQUEST_CODE_KEY,
|
||||
FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.fileListFragment.setFiles(
|
||||
directories
|
||||
val intent = Intent(targetContext, UploadFilesActivity::class.java).apply {
|
||||
putExtra(
|
||||
UploadFilesActivity.KEY_LOCAL_FOLDER_PICKER_MODE,
|
||||
true
|
||||
)
|
||||
putExtra(
|
||||
UploadFilesActivity.REQUEST_CODE_KEY,
|
||||
FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM
|
||||
)
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
launchActivity<UploadFilesActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
screenshot(sut)
|
||||
sut.fileListFragment.setFiles(
|
||||
directories
|
||||
)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "localFolderPickerMode", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun search() {
|
||||
val sut: UploadFilesActivity = activityRule.launchActivity(null)
|
||||
launchActivity<UploadFilesActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.fileListFragment.setFiles(
|
||||
directories +
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
sut.fileListFragment.performSearch("1.txt", arrayListOf(), false)
|
||||
sut.fileListFragment.setFiles(
|
||||
directories +
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.fileListFragment.performSearch("1.txt", arrayListOf(), false)
|
||||
EspressoIdlingResource.decrement()
|
||||
val screenShotName = createName(testClassName + "_" + "search", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "search", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun selectAll() {
|
||||
val sut: UploadFilesActivity = activityRule.launchActivity(null)
|
||||
launchActivity<UploadFilesActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.fileListFragment.setFiles(
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
)
|
||||
)
|
||||
sut.fileListFragment.setFiles(
|
||||
listOf(
|
||||
File("1.txt"),
|
||||
File("2.pdf"),
|
||||
File("3.mp3")
|
||||
)
|
||||
)
|
||||
|
||||
sut.fileListFragment.selectAllFiles(true)
|
||||
}
|
||||
sut.fileListFragment.selectAllFiles(true)
|
||||
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "selectAll", "")
|
||||
screenshotViaName(sut.fileListFragment.binding?.listRoot, screenShotName)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "selectAll", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.fileListFragment.binding?.listRoot, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Andy Scherzinger <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.lib.common.UserInfo;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
public class UserInfoActivityIT extends AbstractIT {
|
||||
@Rule
|
||||
public IntentsTestRule<UserInfoActivity> activityRule = new IntentsTestRule<>(UserInfoActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void fullUserInfoDetail() {
|
||||
final Intent intent = new Intent(targetContext, UserInfoActivity.class);
|
||||
intent.putExtra(UserInfoActivity.KEY_ACCOUNT, user);
|
||||
UserInfo userInfo = new UserInfo("test",
|
||||
true,
|
||||
"Firstname Familyname",
|
||||
"[email protected]",
|
||||
"+49 7613 672 255",
|
||||
"Awesome Place Av.",
|
||||
"https://www.nextcloud.com",
|
||||
"nextclouders",
|
||||
null,
|
||||
null
|
||||
);
|
||||
intent.putExtra(UserInfoActivity.KEY_USER_DATA, userInfo);
|
||||
UserInfoActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Andy Scherzinger <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.common.UserInfo
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class UserInfoActivityIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.activity.UserInfoActivityIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun fullUserInfoDetail() {
|
||||
val intent = Intent(targetContext, UserInfoActivity::class.java).apply {
|
||||
putExtra(UserInfoActivity.KEY_ACCOUNT, user)
|
||||
|
||||
val userInfo = UserInfo(
|
||||
"test",
|
||||
true,
|
||||
"Firstname Familyname",
|
||||
"[email protected]",
|
||||
"+49 7613 672 255",
|
||||
"Awesome Place Av.",
|
||||
"https://www.nextcloud.com",
|
||||
"nextclouders",
|
||||
null,
|
||||
null
|
||||
)
|
||||
putExtra(UserInfoActivity.KEY_USER_DATA, userInfo)
|
||||
}
|
||||
|
||||
launchActivity<UserInfoActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "fullUserInfoDetail", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,650 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.Intent;
|
||||
import android.net.http.SslCertificate;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nextcloud.android.common.ui.color.ColorUtil;
|
||||
import com.nextcloud.android.common.ui.theme.MaterialSchemes;
|
||||
import com.nextcloud.android.common.ui.theme.MaterialSchemesImpl;
|
||||
import com.nextcloud.android.lib.resources.profile.Action;
|
||||
import com.nextcloud.android.lib.resources.profile.HoverCard;
|
||||
import com.nextcloud.client.account.RegisteredUser;
|
||||
import com.nextcloud.client.account.Server;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.device.DeviceInfo;
|
||||
import com.nextcloud.client.documentscan.AppScanOptionalFeature;
|
||||
import com.nextcloud.ui.ChooseAccountDialogFragment;
|
||||
import com.nextcloud.ui.fileactions.FileActionsBottomSheet;
|
||||
import com.nextcloud.utils.EditorUtils;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.EnforcedServer;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.Creator;
|
||||
import com.owncloud.android.lib.common.DirectEditing;
|
||||
import com.owncloud.android.lib.common.Editor;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
import com.owncloud.android.lib.resources.users.Status;
|
||||
import com.owncloud.android.lib.resources.users.StatusType;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.fragment.OCFileListBottomSheetActions;
|
||||
import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialog;
|
||||
import com.owncloud.android.ui.fragment.ProfileBottomSheetDialog;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
import com.owncloud.android.utils.theme.CapabilityUtils;
|
||||
import com.owncloud.android.utils.theme.MaterialSchemesProvider;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.activity.result.contract.ActivityResultContract;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import kotlin.Unit;
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
public class DialogFragmentIT extends AbstractIT {
|
||||
|
||||
private final String SERVER_URL = "https://nextcloud.localhost";
|
||||
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
||||
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
||||
|
||||
private FileDisplayActivity getFileDisplayActivity() {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
return activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void quitLooperIfNeeded() {
|
||||
if (Looper.myLooper() != null) {
|
||||
Looper.myLooper().quitSafely();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRenameFileDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(new OCFile("/Test/"),
|
||||
new OCFile("/"));
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testLoadingDialog() {
|
||||
LoadingDialog dialog = LoadingDialog.newInstance("Wait…");
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithOneAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, -1, -1);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithTwoAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, -1);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithThreeAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithThreeActionRTL() {
|
||||
enableRTL();
|
||||
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[] { }, -1, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
|
||||
showDialog(dialog);
|
||||
|
||||
resetLocale();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRemoveFileDialog() {
|
||||
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(new OCFile("/Test.md"));
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRemoveFilesDialog() {
|
||||
ArrayList<OCFile> toDelete = new ArrayList<>();
|
||||
toDelete.add(new OCFile("/Test.md"));
|
||||
toDelete.add(new OCFile("/Document.odt"));
|
||||
|
||||
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(toDelete);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRemoveFolderDialog() {
|
||||
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(new OCFile("/Folder/"));
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRemoveFoldersDialog() {
|
||||
ArrayList<OCFile> toDelete = new ArrayList<>();
|
||||
toDelete.add(new OCFile("/Folder/"));
|
||||
toDelete.add(new OCFile("/Documents/"));
|
||||
|
||||
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(toDelete);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testNewFolderDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
CreateFolderDialogFragment sut = CreateFolderDialogFragment.newInstance(new OCFile("/"));
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testEnforcedPasswordDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
SharePasswordDialogFragment sut = SharePasswordDialogFragment.newInstance(new OCFile("/"), true, false);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testOptionalPasswordDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
SharePasswordDialogFragment sut = SharePasswordDialogFragment.newInstance(new OCFile("/"), true, true);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testAccountChooserDialog() throws AccountUtils.AccountNotFoundException {
|
||||
FileDisplayActivity activity = getFileDisplayActivity();
|
||||
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
||||
AccountManager accountManager = AccountManager.get(targetContext);
|
||||
for (Account account : accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
User newUser = userAccountManager.getUser(newAccount.name).orElseThrow(RuntimeException::new);
|
||||
userAccountManager.setCurrentOwnCloudAccount(newAccount.name);
|
||||
|
||||
Account newAccount2 = new Account("[email protected]", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount2, "password", null);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_USER_ID, "user1");
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_VERSION, "20.0.0");
|
||||
accountManager.setAuthToken(newAccount2, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
||||
targetContext.getContentResolver());
|
||||
|
||||
OCCapability capability = new OCCapability();
|
||||
capability.setUserStatus(CapabilityBooleanType.TRUE);
|
||||
capability.setUserStatusSupportsEmoji(CapabilityBooleanType.TRUE);
|
||||
fileDataStorageManager.saveCapabilities(capability);
|
||||
|
||||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
showDialog(activity, sut);
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.DND,
|
||||
"Busy fixing 🐛…",
|
||||
"",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "dnd");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.ONLINE,
|
||||
"",
|
||||
"",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "online");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.ONLINE,
|
||||
"Let's have some fun",
|
||||
"🎉",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "fun");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.OFFLINE, "", "", -1), targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "offline");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.AWAY, "Vacation", "🌴", -1), targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "away");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testAccountChooserDialogWithStatusDisabled() throws AccountUtils.AccountNotFoundException {
|
||||
AccountManager accountManager = AccountManager.get(targetContext);
|
||||
for (Account account : accountManager.getAccounts()) {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
FileDisplayActivity fda = getFileDisplayActivity();
|
||||
UserAccountManager userAccountManager = fda.getUserAccountManager();
|
||||
User newUser = userAccountManager.getUser(newAccount.name).get();
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
||||
targetContext.getContentResolver());
|
||||
|
||||
OCCapability capability = new OCCapability();
|
||||
capability.setUserStatus(CapabilityBooleanType.FALSE);
|
||||
|
||||
fileDataStorageManager.saveCapabilities(capability);
|
||||
|
||||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
showDialog(fda, sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
OCFileListBottomSheetActions action = new OCFileListBottomSheetActions() {
|
||||
|
||||
@Override
|
||||
public void createFolder() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFromApp() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFiles() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newDocument() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newSpreadsheet() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newPresentation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void directCameraUpload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scanDocUpload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showTemplate(Creator creator, String headline) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRichWorkspace() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
DeviceInfo info = new DeviceInfo();
|
||||
OCFile ocFile = new OCFile("/test.md");
|
||||
ocFile.setRemoteId("00000001");
|
||||
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
FileDisplayActivity fda = activityRule.launchActivity(intent);
|
||||
|
||||
// add direct editing info
|
||||
DirectEditing directEditing = new DirectEditing();
|
||||
directEditing.getCreators().put("1", new Creator("1",
|
||||
"text",
|
||||
"text file",
|
||||
".md",
|
||||
"application/octet-stream",
|
||||
false));
|
||||
|
||||
directEditing.getCreators().put("2", new Creator("2",
|
||||
"md",
|
||||
"markdown file",
|
||||
".md",
|
||||
"application/octet-stream",
|
||||
false));
|
||||
|
||||
directEditing.getEditors().put("text",
|
||||
new Editor("1",
|
||||
"Text",
|
||||
new ArrayList<>(Collections.singletonList(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN)),
|
||||
new ArrayList<>(),
|
||||
false));
|
||||
|
||||
String json = new Gson().toJson(directEditing);
|
||||
|
||||
new ArbitraryDataProviderImpl(targetContext).storeOrUpdateKeyValue(user.getAccountName(),
|
||||
ArbitraryDataProvider.DIRECT_EDITING,
|
||||
json);
|
||||
|
||||
// activate templates
|
||||
OCCapability capability = fda.getCapabilities();
|
||||
capability.setRichDocuments(CapabilityBooleanType.TRUE);
|
||||
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
|
||||
capability.setRichDocumentsTemplatesAvailable(CapabilityBooleanType.TRUE);
|
||||
capability.setAccountName(user.getAccountName());
|
||||
|
||||
CapabilityUtils.updateCapability(capability);
|
||||
|
||||
AppScanOptionalFeature appScanOptionalFeature = new AppScanOptionalFeature() {
|
||||
@NonNull
|
||||
@Override
|
||||
public ActivityResultContract<Unit, String> getScanContract() {
|
||||
throw new UnsupportedOperationException("Document scan is not available");
|
||||
}
|
||||
};
|
||||
|
||||
MaterialSchemesProvider materialSchemesProvider = new MaterialSchemesProvider() {
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForUser(@NonNull User user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForCapability(@NonNull OCCapability capability) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForCurrentUser() {
|
||||
return new MaterialSchemesImpl(R.color.primary, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getDefaultMaterialSchemes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MaterialSchemes getMaterialSchemesForPrimaryBackground() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
ViewThemeUtils viewThemeUtils = new ViewThemeUtils(materialSchemesProvider.getMaterialSchemesForCurrentUser(),
|
||||
new ColorUtil(targetContext));
|
||||
|
||||
EditorUtils editorUtils = new EditorUtils(new ArbitraryDataProviderImpl(targetContext));
|
||||
|
||||
|
||||
OCFileListBottomSheetDialog sut = new OCFileListBottomSheetDialog(fda,
|
||||
action,
|
||||
info,
|
||||
user,
|
||||
ocFile,
|
||||
fda.themeUtils,
|
||||
viewThemeUtils,
|
||||
editorUtils,
|
||||
appScanOptionalFeature);
|
||||
|
||||
fda.runOnUiThread(sut::show);
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
sut.getBehavior().setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
ViewGroup viewGroup = sut.getWindow().findViewById(android.R.id.content);
|
||||
hideCursors(viewGroup);
|
||||
|
||||
screenshot(Objects.requireNonNull(sut.getWindow()).getDecorView());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testProfileBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
// Fixed values for HoverCard
|
||||
List<Action> actions = new ArrayList<>();
|
||||
actions.add(new Action("profile",
|
||||
"View profile",
|
||||
"https://dev.nextcloud.com/core/img/actions/profile.svg",
|
||||
"https://dev.nextcloud.com/index.php/u/christine"));
|
||||
actions.add(new Action("core",
|
||||
"[email protected]",
|
||||
"https://dev.nextcloud.com/core/img/actions/mail.svg",
|
||||
"mailto:[email protected]"));
|
||||
|
||||
actions.add(new Action("spreed",
|
||||
"Talk to Christine",
|
||||
"https://dev.nextcloud.com/apps/spreed/img/app-dark.svg",
|
||||
"https://dev.nextcloud.com/apps/spreed/?callUser=christine"
|
||||
));
|
||||
|
||||
HoverCard hoverCard = new HoverCard("christine", "Christine Scott", actions);
|
||||
|
||||
// show dialog
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
FileDisplayActivity fda = activityRule.launchActivity(intent);
|
||||
|
||||
ProfileBottomSheetDialog sut = new ProfileBottomSheetDialog(fda,
|
||||
user,
|
||||
hoverCard,
|
||||
fda.viewThemeUtils);
|
||||
|
||||
fda.runOnUiThread(sut::show);
|
||||
|
||||
waitForIdleSync();
|
||||
|
||||
screenshot(sut.getWindow().getDecorView());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testSslUntrustedCertDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
final SslCertificate certificate = new SslCertificate("foo", "bar", "2022/01/10", "2022/01/30");
|
||||
final SslError sslError = new SslError(SslError.SSL_UNTRUSTED, certificate);
|
||||
|
||||
final SslErrorHandler handler = Mockito.mock(SslErrorHandler.class);
|
||||
|
||||
SslUntrustedCertDialog sut = SslUntrustedCertDialog.newInstanceForEmptySslError(sslError, handler);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testStoragePermissionDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
StoragePermissionDialogFragment sut = StoragePermissionDialogFragment.Companion.newInstance(false);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testFileActionsBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
OCFile ocFile = new OCFile("/test.md");
|
||||
ocFile.setRemoteId("0001");
|
||||
final FileActionsBottomSheet sut = FileActionsBottomSheet.newInstance(ocFile, false);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
private void showDialog(DialogFragment dialog) {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
|
||||
FileDisplayActivity sut = activityRule.getActivity();
|
||||
|
||||
if (sut == null) {
|
||||
sut = activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
showDialog(sut, dialog);
|
||||
}
|
||||
|
||||
private void showDialog(FileDisplayActivity sut, DialogFragment dialog) {
|
||||
dialog.show(sut.getSupportFragmentManager(), "");
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
shortSleep();
|
||||
|
||||
ViewGroup viewGroup = dialog.requireDialog().getWindow().findViewById(android.R.id.content);
|
||||
hideCursors(viewGroup);
|
||||
|
||||
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
|
||||
|
||||
}
|
||||
|
||||
private void hideCursors(ViewGroup viewGroup) {
|
||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
View child = viewGroup.getChildAt(i);
|
||||
|
||||
if (child instanceof ViewGroup) {
|
||||
hideCursors((ViewGroup) child);
|
||||
}
|
||||
|
||||
if (child instanceof TextView) {
|
||||
((TextView) child).setCursorVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGson() {
|
||||
ArrayList<EnforcedServer> t = new ArrayList<>();
|
||||
t.add(new EnforcedServer("name", "url"));
|
||||
t.add(new EnforcedServer("name2", "url1"));
|
||||
|
||||
String s = new Gson().toJson(t);
|
||||
|
||||
ArrayList<EnforcedServer> t2 = new Gson().fromJson(s, new TypeToken<ArrayList<EnforcedServer>>() {
|
||||
}.getType());
|
||||
|
||||
ArrayList<String> temp = new ArrayList<>();
|
||||
for (EnforcedServer p : t2) {
|
||||
temp.add(p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,777 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import android.accounts.Account
|
||||
import android.accounts.AccountManager
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.net.http.SslCertificate
|
||||
import android.net.http.SslError
|
||||
import android.os.Looper
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.SslErrorHandler
|
||||
import android.widget.TextView
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.nextcloud.android.common.ui.color.ColorUtil
|
||||
import com.nextcloud.android.lib.resources.profile.Action
|
||||
import com.nextcloud.android.lib.resources.profile.HoverCard
|
||||
import com.nextcloud.client.account.RegisteredUser
|
||||
import com.nextcloud.client.account.Server
|
||||
import com.nextcloud.client.device.DeviceInfo
|
||||
import com.nextcloud.client.documentscan.AppScanOptionalFeature
|
||||
import com.nextcloud.ui.ChooseAccountDialogFragment.Companion.newInstance
|
||||
import com.nextcloud.ui.SetOnlineStatusBottomSheet
|
||||
import com.nextcloud.ui.fileactions.FileActionsBottomSheet.Companion.newInstance
|
||||
import com.nextcloud.utils.EditorUtils
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.authentication.EnforcedServer
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.common.Creator
|
||||
import com.owncloud.android.lib.common.DirectEditing
|
||||
import com.owncloud.android.lib.common.Editor
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount
|
||||
import com.owncloud.android.lib.common.accounts.AccountTypeUtils
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
|
||||
import com.owncloud.android.lib.resources.status.OCCapability
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion
|
||||
import com.owncloud.android.lib.resources.users.Status
|
||||
import com.owncloud.android.lib.resources.users.StatusType
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.ui.dialog.LoadingDialog.Companion.newInstance
|
||||
import com.owncloud.android.ui.dialog.RenameFileDialogFragment.Companion.newInstance
|
||||
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment.Companion.newInstance
|
||||
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.Companion.newInstanceForEmptySslError
|
||||
import com.owncloud.android.ui.dialog.StoragePermissionDialogFragment.Companion.newInstance
|
||||
import com.owncloud.android.ui.fragment.OCFileListBottomSheetActions
|
||||
import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialog
|
||||
import com.owncloud.android.ui.fragment.ProfileBottomSheetDialog
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.MimeTypeUtil
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import com.owncloud.android.utils.theme.CapabilityUtils
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import io.mockk.mockk
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.net.URI
|
||||
import java.util.function.Supplier
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
class DialogFragmentIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.dialog.DialogFragmentIT"
|
||||
private val serverUrl = "https://nextcloud.localhost"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun quitLooperIfNeeded() {
|
||||
Looper.myLooper()?.quitSafely()
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testRenameFileDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
newInstance(
|
||||
OCFile("/Test/"),
|
||||
OCFile("/")
|
||||
).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testLoadingDialog() {
|
||||
newInstance("Wait…").run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testConfirmationDialogWithOneAction() {
|
||||
ConfirmationDialogFragment.newInstance(
|
||||
R.string.upload_list_empty_text_auto_upload,
|
||||
arrayOf(),
|
||||
R.string.filedetails_sync_file,
|
||||
R.string.common_ok,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testConfirmationDialogWithTwoAction() {
|
||||
ConfirmationDialogFragment.newInstance(
|
||||
R.string.upload_list_empty_text_auto_upload,
|
||||
arrayOf(),
|
||||
R.string.filedetails_sync_file,
|
||||
R.string.common_ok,
|
||||
R.string.common_cancel,
|
||||
-1,
|
||||
-1
|
||||
).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testConfirmationDialogWithThreeAction() {
|
||||
ConfirmationDialogFragment.newInstance(
|
||||
R.string.upload_list_empty_text_auto_upload,
|
||||
arrayOf(),
|
||||
R.string.filedetails_sync_file,
|
||||
R.string.common_ok,
|
||||
R.string.common_cancel,
|
||||
R.string.common_confirm,
|
||||
-1
|
||||
).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testConfirmationDialogWithThreeActionRTL() {
|
||||
enableRTL()
|
||||
ConfirmationDialogFragment.newInstance(
|
||||
R.string.upload_list_empty_text_auto_upload,
|
||||
arrayOf(),
|
||||
-1,
|
||||
R.string.common_ok,
|
||||
R.string.common_cancel,
|
||||
R.string.common_confirm,
|
||||
-1
|
||||
).run {
|
||||
showDialog(this)
|
||||
resetLocale()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testRemoveFileDialog() {
|
||||
RemoveFilesDialogFragment.newInstance(OCFile("/Test.md")).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testRemoveFilesDialog() {
|
||||
val toDelete = ArrayList<OCFile>().apply {
|
||||
add(OCFile("/Test.md"))
|
||||
add(OCFile("/Document.odt"))
|
||||
}
|
||||
|
||||
val dialog: RemoveFilesDialogFragment = RemoveFilesDialogFragment.newInstance(toDelete)
|
||||
showDialog(dialog)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testRemoveFolderDialog() {
|
||||
val dialog = RemoveFilesDialogFragment.newInstance(OCFile("/Folder/"))
|
||||
showDialog(dialog)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testRemoveFoldersDialog() {
|
||||
val toDelete = ArrayList<OCFile>()
|
||||
toDelete.add(OCFile("/Folder/"))
|
||||
toDelete.add(OCFile("/Documents/"))
|
||||
|
||||
val dialog: RemoveFilesDialogFragment = RemoveFilesDialogFragment.newInstance(toDelete)
|
||||
showDialog(dialog)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testNewFolderDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
val sut = CreateFolderDialogFragment.newInstance(OCFile("/"))
|
||||
showDialog(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testEnforcedPasswordDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
val sut = newInstance(OCFile("/"), true, false)
|
||||
showDialog(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testOptionalPasswordDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
val sut = newInstance(OCFile("/"), true, true)
|
||||
showDialog(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testAccountChooserDialog() {
|
||||
val intent = Intent(targetContext, FileDisplayActivity::class.java)
|
||||
ActivityScenario.launch<FileDisplayActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { activity: FileDisplayActivity ->
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val userAccountManager = activity.userAccountManager
|
||||
val accountManager = AccountManager.get(targetContext)
|
||||
for (account in accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
||||
accountManager.removeAccountExplicitly(account)
|
||||
}
|
||||
|
||||
val newAccount = Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null)
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, serverUrl)
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test")
|
||||
accountManager.setAuthToken(
|
||||
newAccount,
|
||||
AccountTypeUtils.getAuthTokenTypePass(newAccount.type),
|
||||
"password"
|
||||
)
|
||||
val newUser = userAccountManager.getUser(newAccount.name)
|
||||
.orElseThrow(Supplier { RuntimeException() })
|
||||
userAccountManager.setCurrentOwnCloudAccount(newAccount.name)
|
||||
|
||||
val newAccount2 = Account("[email protected]", MainApp.getAccountType(targetContext))
|
||||
accountManager.addAccountExplicitly(newAccount2, "password", null)
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, serverUrl)
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_USER_ID, "user1")
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_VERSION, "20.0.0")
|
||||
accountManager.setAuthToken(
|
||||
newAccount2,
|
||||
AccountTypeUtils.getAuthTokenTypePass(newAccount.type),
|
||||
"password"
|
||||
)
|
||||
|
||||
val fileDataStorageManager = FileDataStorageManager(
|
||||
newUser,
|
||||
targetContext.contentResolver
|
||||
)
|
||||
|
||||
val capability = OCCapability().apply {
|
||||
userStatus = CapabilityBooleanType.TRUE
|
||||
userStatusSupportsEmoji = CapabilityBooleanType.TRUE
|
||||
}
|
||||
fileDataStorageManager.saveCapabilities(capability)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
try {
|
||||
onIdleSync {
|
||||
val sut = newInstance(
|
||||
RegisteredUser(
|
||||
newAccount,
|
||||
OwnCloudAccount(newAccount, targetContext),
|
||||
Server(URI.create(serverUrl), OwnCloudVersion.nextcloud_20)
|
||||
)
|
||||
)
|
||||
showDialog(activity, sut)
|
||||
|
||||
sut.setStatus(
|
||||
Status(
|
||||
StatusType.DND,
|
||||
"Busy fixing 🐛…",
|
||||
"",
|
||||
-1
|
||||
),
|
||||
targetContext
|
||||
)
|
||||
screenshot(sut, "dnd")
|
||||
|
||||
sut.setStatus(
|
||||
Status(
|
||||
StatusType.ONLINE,
|
||||
"",
|
||||
"",
|
||||
-1
|
||||
),
|
||||
targetContext
|
||||
)
|
||||
screenshot(sut, "online")
|
||||
|
||||
sut.setStatus(
|
||||
Status(
|
||||
StatusType.ONLINE,
|
||||
"Let's have some fun",
|
||||
"🎉",
|
||||
-1
|
||||
),
|
||||
targetContext
|
||||
)
|
||||
screenshot(sut, "fun")
|
||||
|
||||
sut.setStatus(
|
||||
Status(StatusType.OFFLINE, "", "", -1),
|
||||
targetContext
|
||||
)
|
||||
screenshot(sut, "offline")
|
||||
|
||||
sut.setStatus(
|
||||
Status(StatusType.AWAY, "Vacation", "🌴", -1),
|
||||
targetContext
|
||||
)
|
||||
screenshot(sut, "away")
|
||||
}
|
||||
} catch (e: AccountUtils.AccountNotFoundException) {
|
||||
throw java.lang.RuntimeException(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
@Throws(AccountUtils.AccountNotFoundException::class)
|
||||
fun testAccountChooserDialogWithStatusDisabled() {
|
||||
val accountManager = AccountManager.get(targetContext)
|
||||
for (account in accountManager.accounts) {
|
||||
accountManager.removeAccountExplicitly(account)
|
||||
}
|
||||
|
||||
val newAccount = Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null)
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, serverUrl)
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test")
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password")
|
||||
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { fda ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val userAccountManager = fda.userAccountManager
|
||||
val newUser = userAccountManager.getUser(newAccount.name).get()
|
||||
val fileDataStorageManager = FileDataStorageManager(
|
||||
newUser,
|
||||
targetContext.contentResolver
|
||||
)
|
||||
|
||||
val capability = OCCapability().apply {
|
||||
userStatus = CapabilityBooleanType.FALSE
|
||||
}
|
||||
|
||||
fileDataStorageManager.saveCapabilities(capability)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val sut =
|
||||
newInstance(
|
||||
RegisteredUser(
|
||||
newAccount,
|
||||
OwnCloudAccount(newAccount, targetContext),
|
||||
Server(
|
||||
URI.create(serverUrl),
|
||||
OwnCloudVersion.nextcloud_20
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
showDialog(fda, sut)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
val action: OCFileListBottomSheetActions = object : OCFileListBottomSheetActions {
|
||||
override fun createFolder() = Unit
|
||||
override fun uploadFromApp() = Unit
|
||||
override fun uploadFiles() = Unit
|
||||
override fun newDocument() = Unit
|
||||
override fun newSpreadsheet() = Unit
|
||||
override fun newPresentation() = Unit
|
||||
override fun directCameraUpload() = Unit
|
||||
override fun scanDocUpload() = Unit
|
||||
override fun showTemplate(creator: Creator?, headline: String?) = Unit
|
||||
override fun createRichWorkspace() = Unit
|
||||
}
|
||||
|
||||
val info = DeviceInfo()
|
||||
val ocFile = OCFile("/test.md").apply {
|
||||
remoteId = "00000001"
|
||||
}
|
||||
|
||||
val intent = Intent(targetContext, FileDisplayActivity::class.java)
|
||||
|
||||
launchActivity<FileDisplayActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { fda ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
// add direct editing info
|
||||
var directEditing = DirectEditing()
|
||||
val creators = directEditing.creators.toMutableMap()
|
||||
val editors = directEditing.editors.toMutableMap()
|
||||
|
||||
creators.put(
|
||||
"1",
|
||||
Creator(
|
||||
"1",
|
||||
"text",
|
||||
"text file",
|
||||
".md",
|
||||
"application/octet-stream",
|
||||
false
|
||||
)
|
||||
)
|
||||
creators.put(
|
||||
"2",
|
||||
Creator(
|
||||
"2",
|
||||
"md",
|
||||
"markdown file",
|
||||
".md",
|
||||
"application/octet-stream",
|
||||
false
|
||||
)
|
||||
)
|
||||
editors.put(
|
||||
"text",
|
||||
Editor(
|
||||
"1",
|
||||
"Text",
|
||||
ArrayList(mutableListOf(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN)),
|
||||
ArrayList(),
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
directEditing = DirectEditing(editors, creators)
|
||||
val json = Gson().toJson(directEditing)
|
||||
|
||||
ArbitraryDataProviderImpl(targetContext).storeOrUpdateKeyValue(
|
||||
user.accountName,
|
||||
ArbitraryDataProvider.DIRECT_EDITING,
|
||||
json
|
||||
)
|
||||
|
||||
// activate templates
|
||||
val capability = fda.capabilities.apply {
|
||||
richDocuments = CapabilityBooleanType.TRUE
|
||||
richDocumentsDirectEditing = CapabilityBooleanType.TRUE
|
||||
richDocumentsTemplatesAvailable = CapabilityBooleanType.TRUE
|
||||
accountName = user.accountName
|
||||
}
|
||||
CapabilityUtils.updateCapability(capability)
|
||||
|
||||
val appScanOptionalFeature: AppScanOptionalFeature = object : AppScanOptionalFeature() {
|
||||
override fun getScanContract(): ActivityResultContract<Unit, String?> =
|
||||
throw UnsupportedOperationException("Document scan is not available")
|
||||
}
|
||||
|
||||
val materialSchemesProvider = getMaterialSchemesProvider()
|
||||
val viewThemeUtils = ViewThemeUtils(
|
||||
materialSchemesProvider.getMaterialSchemesForCurrentUser(),
|
||||
ColorUtil(targetContext)
|
||||
)
|
||||
|
||||
val editorUtils = EditorUtils(ArbitraryDataProviderImpl(targetContext))
|
||||
|
||||
val sut = OCFileListBottomSheetDialog(
|
||||
fda,
|
||||
action,
|
||||
info,
|
||||
user,
|
||||
ocFile,
|
||||
fda.themeUtils,
|
||||
viewThemeUtils,
|
||||
editorUtils,
|
||||
appScanOptionalFeature
|
||||
)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
sut.show()
|
||||
sut.behavior.setState(BottomSheetBehavior.STATE_EXPANDED)
|
||||
val viewGroup = sut.window?.findViewById<ViewGroup>(android.R.id.content) ?: return@onIdleSync
|
||||
hideCursors(viewGroup)
|
||||
val screenShotName = createName(testClassName + "_" + "testBottomSheet", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testOnlineStatusBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
// show dialog
|
||||
val intent = Intent(targetContext, FileDisplayActivity::class.java)
|
||||
|
||||
launchActivity<FileDisplayActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { fda ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = SetOnlineStatusBottomSheet(
|
||||
Status(StatusType.DND, "Focus time", "\uD83E\uDD13", -1)
|
||||
)
|
||||
EspressoIdlingResource.decrement()
|
||||
sut.show(fda.supportFragmentManager, "set_online_status")
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "testOnlineStatusBottomSheet", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.view, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testProfileBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
// Fixed values for HoverCard
|
||||
val actions: MutableList<Action> = ArrayList()
|
||||
actions.add(
|
||||
Action(
|
||||
"profile",
|
||||
"View profile",
|
||||
"https://dev.nextcloud.com/core/img/actions/profile.svg",
|
||||
"https://dev.nextcloud.com/index.php/u/christine"
|
||||
)
|
||||
)
|
||||
actions.add(
|
||||
Action(
|
||||
"core",
|
||||
"[email protected]",
|
||||
"https://dev.nextcloud.com/core/img/actions/mail.svg",
|
||||
"mailto:[email protected]"
|
||||
)
|
||||
)
|
||||
|
||||
actions.add(
|
||||
Action(
|
||||
"spreed",
|
||||
"Talk to Christine",
|
||||
"https://dev.nextcloud.com/apps/spreed/img/app-dark.svg",
|
||||
"https://dev.nextcloud.com/apps/spreed/?callUser=christine"
|
||||
)
|
||||
)
|
||||
|
||||
val hoverCard = HoverCard("christine", "Christine Scott", actions)
|
||||
|
||||
// show dialog
|
||||
val intent = Intent(targetContext, FileDisplayActivity::class.java)
|
||||
|
||||
launchActivity<FileDisplayActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { fda ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = ProfileBottomSheetDialog(
|
||||
fda,
|
||||
user,
|
||||
hoverCard,
|
||||
fda.viewThemeUtils
|
||||
)
|
||||
EspressoIdlingResource.decrement()
|
||||
sut.show()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "testProfileBottomSheet", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testSslUntrustedCertDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
val certificate = SslCertificate("foo", "bar", "2022/01/10", "2022/01/30")
|
||||
val sslError = SslError(SslError.SSL_UNTRUSTED, certificate)
|
||||
|
||||
val handler = mockk<SslErrorHandler>(relaxed = true)
|
||||
|
||||
newInstanceForEmptySslError(sslError, handler).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testStoragePermissionDialog() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
newInstance(false).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun testFileActionsBottomSheet() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
|
||||
val ocFile = OCFile("/test.md").apply {
|
||||
remoteId = "0001"
|
||||
}
|
||||
|
||||
newInstance(ocFile, false).run {
|
||||
showDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialog(dialog: DialogFragment) {
|
||||
launchActivity<FileDisplayActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
showDialog(sut, dialog)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialog(sut: FileDisplayActivity, dialog: DialogFragment) {
|
||||
dialog.show(sut.supportFragmentManager, null)
|
||||
onIdleSync {
|
||||
val dialogInstance = waitForDialog(dialog)
|
||||
?: throw IllegalStateException("Dialog was not created")
|
||||
|
||||
val viewGroup = dialogInstance.window?.findViewById<ViewGroup>(android.R.id.content) ?: return@onIdleSync
|
||||
hideCursors(viewGroup)
|
||||
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshot(dialogInstance.window?.decorView)
|
||||
}
|
||||
}
|
||||
|
||||
private fun waitForDialog(dialogFragment: DialogFragment, timeoutMs: Long = 5000): Dialog? {
|
||||
val start = System.currentTimeMillis()
|
||||
while (System.currentTimeMillis() - start < timeoutMs) {
|
||||
val dialog = dialogFragment.dialog
|
||||
if (dialog != null) return dialog
|
||||
Thread.sleep(100)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun hideCursors(viewGroup: ViewGroup) {
|
||||
for (i in 0..<viewGroup.childCount) {
|
||||
val child = viewGroup.getChildAt(i)
|
||||
|
||||
if (child is ViewGroup) {
|
||||
hideCursors(child)
|
||||
}
|
||||
|
||||
if (child is TextView) {
|
||||
child.isCursorVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGson() {
|
||||
val t = ArrayList<EnforcedServer?>().apply {
|
||||
add(EnforcedServer("name", "url"))
|
||||
add(EnforcedServer("name2", "url1"))
|
||||
}
|
||||
|
||||
val s = Gson().toJson(t)
|
||||
val t2 = Gson().fromJson<ArrayList<EnforcedServer>>(
|
||||
s,
|
||||
object : TypeToken<ArrayList<EnforcedServer?>?>() {
|
||||
}.type
|
||||
)
|
||||
|
||||
val temp = ArrayList<String?>()
|
||||
for (p in t2) {
|
||||
temp.add(p.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,36 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class SendFilesDialogTest : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.dialog.SendFilesDialogTest"
|
||||
|
||||
companion object {
|
||||
private val FILES_SAME_TYPE = setOf(
|
||||
OCFile("/1.jpg").apply {
|
||||
@@ -43,52 +53,77 @@ class SendFilesDialogTest : AbstractIT() {
|
||||
)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
private fun showDialog(files: Set<OCFile>): SendFilesDialog {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
val fm: FragmentManager = activity.supportFragmentManager
|
||||
val ft = fm.beginTransaction()
|
||||
ft.addToBackStack(null)
|
||||
private fun showDialog(files: Set<OCFile>, onComplete: (SendFilesDialog) -> Unit) {
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val sut = SendFilesDialog.newInstance(files)
|
||||
sut.show(ft, "TAG_SEND_SHARE_DIALOG")
|
||||
val fm: FragmentManager = sut.supportFragmentManager
|
||||
val ft = fm.beginTransaction()
|
||||
ft.addToBackStack(null)
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
shortSleep()
|
||||
val dialog = SendFilesDialog.newInstance(files)
|
||||
dialog.show(ft, "TAG_SEND_SHARE_DIALOG")
|
||||
onComplete(dialog)
|
||||
|
||||
return sut
|
||||
EspressoIdlingResource.decrement()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showDialog() {
|
||||
val sut = showDialog(FILES_SAME_TYPE)
|
||||
val recyclerview: RecyclerView = sut.requireDialog().findViewById(R.id.send_button_recycler_view)
|
||||
Assert.assertNotNull("Adapter is null", recyclerview.adapter)
|
||||
Assert.assertNotEquals("Send button list is empty", 0, recyclerview.adapter!!.itemCount)
|
||||
showDialog(FILES_SAME_TYPE) { sut ->
|
||||
val recyclerview: RecyclerView = sut.requireDialog().findViewById(R.id.send_button_recycler_view)
|
||||
Assert.assertNotNull("Adapter is null", recyclerview.adapter)
|
||||
Assert.assertNotEquals("Send button list is empty", 0, recyclerview.adapter!!.itemCount)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showDialog_Screenshot() {
|
||||
val sut = showDialog(FILES_SAME_TYPE)
|
||||
sut.requireDialog().window?.decorView.let { screenshot(it) }
|
||||
showDialog(FILES_SAME_TYPE) { sut ->
|
||||
val screenShotName = createName(testClassName + "_" + "showDialog_Screenshot", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showDialogDifferentTypes() {
|
||||
val sut = showDialog(FILES_MIXED_TYPE)
|
||||
val recyclerview: RecyclerView = sut.requireDialog().findViewById(R.id.send_button_recycler_view)
|
||||
Assert.assertNotNull("Adapter is null", recyclerview.adapter)
|
||||
Assert.assertNotEquals("Send button list is empty", 0, recyclerview.adapter!!.itemCount)
|
||||
showDialog(FILES_MIXED_TYPE) { sut ->
|
||||
val recyclerview: RecyclerView = sut.requireDialog().findViewById(R.id.send_button_recycler_view)
|
||||
Assert.assertNotNull("Adapter is null", recyclerview.adapter)
|
||||
Assert.assertNotEquals("Send button list is empty", 0, recyclerview.adapter!!.itemCount)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showDialogDifferentTypes_Screenshot() {
|
||||
val sut = showDialog(FILES_MIXED_TYPE)
|
||||
sut.requireDialog().window?.decorView.let { screenshot(it) }
|
||||
showDialog(FILES_MIXED_TYPE) { sut ->
|
||||
val screenShotName = createName(testClassName + "_" + "showDialogDifferentTypes_Screenshot", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,55 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.resources.status.OCCapability
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SendShareDialogTest : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.dialog.SendShareDialogTest"
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showDialog() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val fm: FragmentManager = activity.supportFragmentManager
|
||||
val ft = fm.beginTransaction()
|
||||
ft.addToBackStack(null)
|
||||
|
||||
val fm: FragmentManager = activity.supportFragmentManager
|
||||
val ft = fm.beginTransaction()
|
||||
ft.addToBackStack(null)
|
||||
val file = OCFile("/1.jpg").apply {
|
||||
mimeType = "image/jpg"
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val file = OCFile("/1.jpg").apply {
|
||||
mimeType = "image/jpg"
|
||||
val sut = SendShareDialog.newInstance(file, false, OCCapability())
|
||||
sut.show(ft, "TAG_SEND_SHARE_DIALOG")
|
||||
val screenShotName = createName(testClassName + "_" + "showDialog", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val sut = SendShareDialog.newInstance(file, false, OCCapability())
|
||||
sut.show(ft, "TAG_SEND_SHARE_DIALOG")
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
sut.requireDialog().window?.decorView.let { screenshot(it) }
|
||||
}
|
||||
}
|
||||
+66
-45
@@ -1,80 +1,101 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.ui.dialog.setupEncryption.SetupEncryptionDialogFragment
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class SetupEncryptionDialogFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.dialog.SetupEncryptionDialogFragmentIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showMnemonic() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = SetupEncryptionDialogFragment.newInstance(user, 0)
|
||||
|
||||
val sut = SetupEncryptionDialogFragment.newInstance(user, 0)
|
||||
sut.show(activity.supportFragmentManager, "1")
|
||||
|
||||
sut.show(activity.supportFragmentManager, "1")
|
||||
val keyWords = arrayListOf(
|
||||
"ability",
|
||||
"able",
|
||||
"about",
|
||||
"above",
|
||||
"absent",
|
||||
"absorb",
|
||||
"abstract",
|
||||
"absurd",
|
||||
"abuse",
|
||||
"access",
|
||||
"accident",
|
||||
"account",
|
||||
"accuse"
|
||||
)
|
||||
sut.setMnemonic(keyWords)
|
||||
sut.showMnemonicInfo()
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val keyWords = arrayListOf(
|
||||
"ability",
|
||||
"able",
|
||||
"about",
|
||||
"above",
|
||||
"absent",
|
||||
"absorb",
|
||||
"abstract",
|
||||
"absurd",
|
||||
"abuse",
|
||||
"access",
|
||||
"accident",
|
||||
"account",
|
||||
"accuse"
|
||||
)
|
||||
|
||||
shortSleep()
|
||||
|
||||
runOnUiThread {
|
||||
sut.setMnemonic(keyWords)
|
||||
sut.showMnemonicInfo()
|
||||
val screenShotName = createName(testClassName + "_" + "showMnemonic", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut.requireDialog().window!!.decorView)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun error() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val sut = SetupEncryptionDialogFragment.newInstance(user, 0)
|
||||
val sut = SetupEncryptionDialogFragment.newInstance(user, 0)
|
||||
sut.show(activity.supportFragmentManager, "1")
|
||||
sut.errorSavingKeys()
|
||||
|
||||
sut.show(activity.supportFragmentManager, "1")
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
shortSleep()
|
||||
|
||||
runOnUiThread {
|
||||
sut.errorSavingKeys()
|
||||
val screenShotName = createName(testClassName + "_" + "error", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut.requireDialog().window?.decorView, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut.requireDialog().window!!.decorView)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
@@ -8,8 +9,13 @@
|
||||
package com.owncloud.android.ui.fragment
|
||||
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
@@ -17,155 +23,171 @@ import com.owncloud.android.lib.resources.users.StatusType
|
||||
import com.owncloud.android.ui.TextDrawable
|
||||
import com.owncloud.android.utils.BitmapUtils
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class AvatarIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.fragment.AvatarIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showAvatars() {
|
||||
val avatarRadius = targetContext.resources.getDimension(R.dimen.list_item_avatar_icon_radius)
|
||||
val width = DisplayUtils.convertDpToPixel(2 * avatarRadius, targetContext)
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
val fragment = AvatarTestFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
sut.addFragment(fragment)
|
||||
val avatarRadius = targetContext.resources.getDimension(R.dimen.list_item_avatar_icon_radius)
|
||||
val width = DisplayUtils.convertDpToPixel(2 * avatarRadius, targetContext)
|
||||
val fragment = AvatarTestFragment()
|
||||
|
||||
runOnUiThread {
|
||||
fragment.addAvatar("Admin", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Test Server Admin", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Cormier Paulette", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("winston brent", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("[email protected]", avatarRadius, width, targetContext)
|
||||
sut.addFragment(fragment)
|
||||
fragment.run {
|
||||
addAvatar("Admin", avatarRadius, width, targetContext)
|
||||
addAvatar("Test Server Admin", avatarRadius, width, targetContext)
|
||||
addAvatar("Cormier Paulette", avatarRadius, width, targetContext)
|
||||
addAvatar("winston brent", avatarRadius, width, targetContext)
|
||||
addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
addAvatar("[email protected]", avatarRadius, width, targetContext)
|
||||
}
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showAvatars", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showAvatarsWithStatus() {
|
||||
val avatarRadius = targetContext.resources.getDimension(R.dimen.list_item_avatar_icon_radius)
|
||||
val width = DisplayUtils.convertDpToPixel(2 * avatarRadius, targetContext)
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
val fragment = AvatarTestFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val paulette = BitmapFactory.decodeFile(getFile("paulette.jpg").absolutePath)
|
||||
val christine = BitmapFactory.decodeFile(getFile("christine.jpg").absolutePath)
|
||||
val textBitmap = BitmapUtils.drawableToBitmap(TextDrawable.createNamedAvatar("Admin", avatarRadius))
|
||||
val avatarRadius = targetContext.resources.getDimension(R.dimen.list_item_avatar_icon_radius)
|
||||
val width = DisplayUtils.convertDpToPixel(2 * avatarRadius, targetContext)
|
||||
val fragment = AvatarTestFragment()
|
||||
|
||||
sut.addFragment(fragment)
|
||||
val paulette = BitmapFactory.decodeFile(getFile("paulette.jpg").absolutePath)
|
||||
val christine = BitmapFactory.decodeFile(getFile("christine.jpg").absolutePath)
|
||||
val textBitmap = BitmapUtils.drawableToBitmap(TextDrawable.createNamedAvatar("Admin", avatarRadius))
|
||||
|
||||
runOnUiThread {
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.ONLINE, "😘", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
sut.addFragment(fragment)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "☁️", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
fragment.run {
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.ONLINE, "😘", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "☁️", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "🌴️", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.DND, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.AWAY, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.OFFLINE, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "😘", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "☁️", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "🌴️", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.DND, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.AWAY, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.OFFLINE, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
}
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "🌴️", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.ONLINE, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.DND, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(christine, StatusType.AWAY, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(paulette, StatusType.OFFLINE, "", targetContext),
|
||||
width * 2,
|
||||
1,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "😘", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "☁️", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "🌴️", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.ONLINE, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.DND, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.AWAY, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
|
||||
fragment.addBitmap(
|
||||
BitmapUtils.createAvatarWithStatus(textBitmap, StatusType.OFFLINE, "", targetContext),
|
||||
width,
|
||||
2,
|
||||
targetContext
|
||||
)
|
||||
val screenShotName = createName(testClassName + "_" + "showAvatarsWithStatus", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -471,7 +471,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
||||
permissions = 17
|
||||
}
|
||||
activity.handler.post { sut.showSharingMenuActionSheet(publicShare) }
|
||||
waitForIdleSync()
|
||||
|
||||
// check if items are visible
|
||||
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).check(matches(isDisplayed()))
|
||||
@@ -611,8 +610,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
||||
|
||||
// click event
|
||||
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).perform(ViewActions.click())
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
// validate view shown on screen
|
||||
onView(ViewMatchers.withId(R.id.view_only_radio_button)).check(matches(isDisplayed()))
|
||||
@@ -825,7 +822,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
||||
val processFragment =
|
||||
activity.supportFragmentManager.findFragmentByTag(FileDetailsSharingProcessFragment.TAG) as
|
||||
FileDetailsSharingProcessFragment
|
||||
processFragment.onBackPressed()
|
||||
processFragment.activity?.onBackPressedDispatcher?.onBackPressed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+61
-37
@@ -1,74 +1,98 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2023 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.fragment
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.android.lib.resources.groupfolders.Groupfolder
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class GroupfolderListFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
lateinit var activity: TestActivity
|
||||
private val testClassName = "com.owncloud.android.ui.fragment.GroupfolderListFragmentIT"
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
activity = testActivityRule.launchActivity(null)
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showGroupfolder() {
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
shortSleep() // to let async task finish
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.setAdapter(null)
|
||||
sut.setData(
|
||||
mapOf(
|
||||
Pair("2", Groupfolder(2, "/subfolder/group"))
|
||||
)
|
||||
)
|
||||
sut.setAdapter(null)
|
||||
sut.setData(
|
||||
mapOf(
|
||||
Pair("2", Groupfolder(2, "/subfolder/group"))
|
||||
)
|
||||
)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showGroupfolder", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(activity, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
screenshot(activity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showGroupfolders() {
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
shortSleep() // to let async task finish
|
||||
val sut = GroupfolderListFragment()
|
||||
activity.addFragment(sut)
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.setAdapter(null)
|
||||
sut.setData(
|
||||
mapOf(
|
||||
Pair("1", Groupfolder(1, "/test/")),
|
||||
Pair("2", Groupfolder(2, "/subfolder/group"))
|
||||
)
|
||||
)
|
||||
sut.setAdapter(null)
|
||||
sut.setData(
|
||||
mapOf(
|
||||
Pair("1", Groupfolder(1, "/test/")),
|
||||
Pair("2", Groupfolder(2, "/subfolder/group"))
|
||||
)
|
||||
)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showGroupfolders", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(activity, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
screenshot(activity)
|
||||
}
|
||||
}
|
||||
+363
-325
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Chris Narkiewicz <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
@@ -8,392 +9,429 @@
|
||||
*/
|
||||
package com.owncloud.android.ui.fragment
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.GrantStoragePermissionRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.GrantStoragePermissionRule.Companion.grant
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.resources.shares.ShareType
|
||||
import com.owncloud.android.lib.resources.shares.ShareeUser
|
||||
import com.owncloud.android.lib.resources.tags.Tag
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.MimeType
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestRule
|
||||
|
||||
class OCFileListFragmentStaticServerIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
private val testClassName = "com.owncloud.android.ui.fragment.OCFileListFragmentStaticServerIT"
|
||||
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val permissionRule = GrantStoragePermissionRule.grant()
|
||||
var storagePermissionRule: TestRule = grant()
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
@Suppress("MagicNumber")
|
||||
fun showFiles() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
OCFile("/1.png").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
OCFile("/1.png").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/image.png").apply {
|
||||
remoteId = "00000002"
|
||||
mimeType = "image/png"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 3072000
|
||||
modificationTimestamp = 746443755000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
tags = listOf(Tag("", "Top secret", null))
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/live photo.png").apply {
|
||||
remoteId = "00000003"
|
||||
mimeType = "image/png"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 3072000
|
||||
modificationTimestamp = 746443755000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
setLivePhoto("/video.mov")
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/video.mp4").apply {
|
||||
remoteId = "00000004"
|
||||
mimeType = "video/mp4"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 12092000
|
||||
modificationTimestamp = 746143952000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
tags = listOf(Tag("", "Confidential", null), Tag("", "+5", null))
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(OCFileListFragment())
|
||||
|
||||
val fragment = (sut.fragment as OCFileListFragment)
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
fragment.listDirectory(root, false, false)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showFiles", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCFile("/image.png").apply {
|
||||
remoteId = "00000002"
|
||||
mimeType = "image/png"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 3072000
|
||||
modificationTimestamp = 746443755000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
tags = listOf(Tag("", "Top secret", null))
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/live photo.png").apply {
|
||||
remoteId = "00000003"
|
||||
mimeType = "image/png"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 3072000
|
||||
modificationTimestamp = 746443755000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
setLivePhoto("/video.mov")
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/video.mp4").apply {
|
||||
remoteId = "00000004"
|
||||
mimeType = "video/mp4"
|
||||
isPreviewAvailable = false
|
||||
fileLength = 12092000
|
||||
modificationTimestamp = 746143952000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
tags = listOf(Tag("", "Confidential", null), Tag("", "+5", null))
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(OCFileListFragment())
|
||||
|
||||
val fragment = (sut.fragment as OCFileListFragment)
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
|
||||
shortSleep()
|
||||
|
||||
sut.runOnUiThread { fragment.listDirectory(root, false, false) }
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use same values as {@link FileDetailSharingFragmentIT listSharesFileAllShareTypes }
|
||||
*/
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showSharedFiles() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
val fragment = OCFileListFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
OCFile("/sharedToUser.jpg").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Admin", "Server Admin", ShareType.USER))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
val fragment = OCFileListFragment()
|
||||
|
||||
OCFile("/sharedToUser.jpg").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Admin", "Server Admin", ShareType.USER))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToGroup.jpg").apply {
|
||||
remoteId = "00000002"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("group", "Group", ShareType.GROUP))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToEmail.jpg").apply {
|
||||
remoteId = "00000003"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees =
|
||||
listOf(
|
||||
ShareeUser("[email protected]", "[email protected]", ShareType.EMAIL)
|
||||
)
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/publicLink.jpg").apply {
|
||||
remoteId = "00000004"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedViaLink = true
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToFederatedUser.jpg").apply {
|
||||
remoteId = "00000005"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(
|
||||
ShareeUser(
|
||||
"[email protected]",
|
||||
"[email protected] (remote)",
|
||||
ShareType.FEDERATED
|
||||
)
|
||||
)
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToPersonalCircle.jpg").apply {
|
||||
remoteId = "00000006"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("circle", "Circle (Personal circle)", ShareType.CIRCLE))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToUserRoom.jpg").apply {
|
||||
remoteId = "00000007"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Conversation", "Admin", ShareType.ROOM))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToGroupRoom.jpg").apply {
|
||||
remoteId = "00000008"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Conversation", "Meeting", ShareType.ROOM))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToUsers.jpg").apply {
|
||||
remoteId = "00000009"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(
|
||||
ShareeUser("Admin", "Server Admin", ShareType.USER),
|
||||
ShareeUser("User", "User", ShareType.USER),
|
||||
ShareeUser("Christine", "Christine Scott", ShareType.USER)
|
||||
)
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/notShared.jpg").apply {
|
||||
remoteId = "000000010"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/Foo%e2%80%aedm.exe").apply {
|
||||
remoteId = "000000011"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(fragment)
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
fragment.listDirectory(root, false, false)
|
||||
fragment.adapter.setShowShareAvatar(true)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showSharedFiles", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCFile("/sharedToGroup.jpg").apply {
|
||||
remoteId = "00000002"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("group", "Group", ShareType.GROUP))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToEmail.jpg").apply {
|
||||
remoteId = "00000003"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("[email protected]", "[email protected]", ShareType.EMAIL))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/publicLink.jpg").apply {
|
||||
remoteId = "00000004"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedViaLink = true
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToFederatedUser.jpg").apply {
|
||||
remoteId = "00000005"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(
|
||||
ShareeUser("[email protected]", "[email protected] (remote)", ShareType.FEDERATED)
|
||||
)
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToPersonalCircle.jpg").apply {
|
||||
remoteId = "00000006"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("circle", "Circle (Personal circle)", ShareType.CIRCLE))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
// as we cannot distinguish circle types, we do not need them right now
|
||||
// OCFile("/sharedToPublicCircle.jpg").apply {
|
||||
// parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
// isSharedWithSharee = true
|
||||
// sharees = listOf(ShareeUser("circle", "Circle (Public circle)", ShareType.CIRCLE))
|
||||
// modificationTimestamp = 1000
|
||||
// sut.storageManager.saveFile(this)
|
||||
// }
|
||||
//
|
||||
// OCFile("/sharedToClosedCircle.jpg").apply {
|
||||
// parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
// isSharedWithSharee = true
|
||||
// sharees = listOf(ShareeUser("circle", "Circle (Closed circle)", ShareType.CIRCLE))
|
||||
// modificationTimestamp = 1000
|
||||
// sut.storageManager.saveFile(this)
|
||||
// }
|
||||
//
|
||||
// OCFile("/sharedToSecretCircle.jpg").apply {
|
||||
// parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
// isSharedWithSharee = true
|
||||
// sharees = listOf(ShareeUser("circle", "Circle (Secret circle)", ShareType.CIRCLE))
|
||||
// modificationTimestamp = 1000
|
||||
// sut.storageManager.saveFile(this)
|
||||
// }
|
||||
|
||||
OCFile("/sharedToUserRoom.jpg").apply {
|
||||
remoteId = "00000007"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Conversation", "Admin", ShareType.ROOM))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToGroupRoom.jpg").apply {
|
||||
remoteId = "00000008"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("Conversation", "Meeting", ShareType.ROOM))
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedToUsers.jpg").apply {
|
||||
remoteId = "00000009"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(
|
||||
ShareeUser("Admin", "Server Admin", ShareType.USER),
|
||||
ShareeUser("User", "User", ShareType.USER),
|
||||
ShareeUser("Christine", "Christine Scott", ShareType.USER)
|
||||
)
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/notShared.jpg").apply {
|
||||
remoteId = "000000010"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
modificationTimestamp = 1000
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
shortSleep()
|
||||
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
|
||||
sut.runOnUiThread {
|
||||
fragment.listDirectory(root, false, false)
|
||||
fragment.adapter.setShowShareAvatar(true)
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use same values as {@link FileDetailSharingFragmentIT listSharesFileAllShareTypes }
|
||||
*/
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showFolderTypes() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
val fragment = OCFileListFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
OCFile("/normal/").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
modificationTimestamp = 1624003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
val fragment = OCFileListFragment()
|
||||
|
||||
OCFile("/normal/").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
modificationTimestamp = 1624003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedViaLink/").apply {
|
||||
remoteId = "00000002"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedViaLink = true
|
||||
modificationTimestamp = 1619003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/share/").apply {
|
||||
remoteId = "00000003"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedWithSharee = true
|
||||
modificationTimestamp = 1619303571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/groupFolder/").apply {
|
||||
remoteId = "00000004"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
modificationTimestamp = 1615003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
permissions += "M"
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/encrypted/").apply {
|
||||
remoteId = "00000005"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isEncrypted = true
|
||||
decryptedRemotePath = "/encrypted/"
|
||||
modificationTimestamp = 1614003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/locked/").apply {
|
||||
remoteId = "00000006"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isLocked = true
|
||||
decryptedRemotePath = "/locked/"
|
||||
modificationTimestamp = 1613003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/offlineOperation/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
decryptedRemotePath = "/offlineOperation/"
|
||||
modificationTimestamp = System.currentTimeMillis()
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
fragment.listDirectory(root, false, false)
|
||||
fragment.adapter.setShowShareAvatar(true)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showFolderTypes", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OCFile("/sharedViaLink/").apply {
|
||||
remoteId = "00000002"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedViaLink = true
|
||||
modificationTimestamp = 1619003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/share/").apply {
|
||||
remoteId = "00000003"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedWithSharee = true
|
||||
modificationTimestamp = 1619303571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/groupFolder/").apply {
|
||||
remoteId = "00000004"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
modificationTimestamp = 1615003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
permissions += "M"
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/encrypted/").apply {
|
||||
remoteId = "00000005"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isEncrypted = true
|
||||
decryptedRemotePath = "/encrypted/"
|
||||
modificationTimestamp = 1614003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/locked/").apply {
|
||||
remoteId = "00000006"
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isLocked = true
|
||||
decryptedRemotePath = "/locked/"
|
||||
modificationTimestamp = 1613003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/offlineOperation/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
decryptedRemotePath = "/offlineOperation/"
|
||||
modificationTimestamp = System.currentTimeMillis()
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
shortSleep()
|
||||
|
||||
val root = sut.storageManager.getFileByEncryptedRemotePath("/")
|
||||
|
||||
sut.runOnUiThread {
|
||||
fragment.listDirectory(root, false, false)
|
||||
fragment.adapter.setShowShareAvatar(true)
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
@Suppress("MagicNumber")
|
||||
fun showRichWorkspace() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
val fragment = OCFileListFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val folder = OCFile("/test/")
|
||||
folder.setFolder()
|
||||
sut.storageManager.saveFile(folder)
|
||||
val fragment = OCFileListFragment()
|
||||
|
||||
val imageFile = OCFile("/test/image.png").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/test/").fileId
|
||||
storagePath = getFile("java.md").absolutePath
|
||||
val folder = OCFile("/test/")
|
||||
folder.setFolder()
|
||||
sut.storageManager.saveFile(folder)
|
||||
|
||||
val imageFile = OCFile("/test/image.png").apply {
|
||||
remoteId = "00000001"
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/test/").fileId
|
||||
storagePath = getFile("java.md").absolutePath
|
||||
}
|
||||
|
||||
sut.storageManager.saveFile(imageFile)
|
||||
|
||||
sut.addFragment(fragment)
|
||||
val testFolder: OCFile = sut.storageManager.getFileByEncryptedRemotePath("/test/")
|
||||
testFolder.richWorkspace = getFile("java.md").readText()
|
||||
fragment.listDirectory(testFolder, false, false)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showRichWorkspace", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sut.storageManager.saveFile(imageFile)
|
||||
|
||||
sut.addFragment(fragment)
|
||||
val testFolder: OCFile = sut.storageManager.getFileByEncryptedRemotePath("/test/")
|
||||
testFolder.richWorkspace = getFile("java.md").readText()
|
||||
|
||||
sut.runOnUiThread { fragment.listDirectory(testFolder, false, false) }
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun shouldShowHeader() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = OCFileListFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = OCFileListFragment()
|
||||
val folder = OCFile("/test/").apply {
|
||||
remoteId = "000001"
|
||||
setFolder()
|
||||
}
|
||||
activity.storageManager.saveFile(folder)
|
||||
activity.addFragment(sut)
|
||||
val testFolder: OCFile = activity.storageManager.getFileByEncryptedRemotePath("/test/")
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val folder = OCFile("/test/").apply {
|
||||
remoteId = "000001"
|
||||
setFolder()
|
||||
}
|
||||
// richWorkspace is not set
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
|
||||
activity.storageManager.saveFile(folder)
|
||||
EspressoIdlingResource.increment()
|
||||
testFolder.richWorkspace = " "
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "")
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
activity.addFragment(sut)
|
||||
val testFolder: OCFile = activity.storageManager.getFileByEncryptedRemotePath("/test/")
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
|
||||
activity.runOnUiThread {
|
||||
// richWorkspace is not set
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
EspressoIdlingResource.increment()
|
||||
testFolder.richWorkspace = null
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "")
|
||||
EspressoIdlingResource.decrement()
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
|
||||
testFolder.richWorkspace = " "
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "")
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
EspressoIdlingResource.increment()
|
||||
testFolder.richWorkspace = "1"
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.setCurrentDirectory(testFolder)
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
testFolder.richWorkspace = null
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.swapDirectory(user, testFolder, activity.storageManager, false, "")
|
||||
Assert.assertFalse(sut.adapter.shouldShowHeader())
|
||||
|
||||
testFolder.richWorkspace = "1"
|
||||
activity.storageManager.saveFile(testFolder)
|
||||
sut.adapter.setCurrentDirectory(testFolder)
|
||||
Assert.assertTrue(sut.adapter.shouldShowHeader())
|
||||
Assert.assertTrue(sut.adapter.shouldShowHeader())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+143
-128
@@ -8,163 +8,178 @@
|
||||
package com.owncloud.android.ui.fragment
|
||||
|
||||
import android.view.View
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.GrantStoragePermissionRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.GrantStoragePermissionRule.Companion.grant
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.resources.shares.OCShare
|
||||
import com.owncloud.android.lib.resources.shares.ShareType
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TestRule
|
||||
|
||||
internal class SharedListFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
@get:Rule
|
||||
val permissionRule = GrantStoragePermissionRule.grant()
|
||||
|
||||
lateinit var sut: TestActivity
|
||||
private val testClassName = "com.owncloud.android.ui.fragment.SharedListFragmentIT"
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
sut = testActivityRule.launchActivity(null)
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
var storagePermissionRule: TestRule = grant()
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showSharedFiles() {
|
||||
val fragment = SharedListFragment()
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val file = OCFile("/shared to admin.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
val fragment = SharedListFragment()
|
||||
|
||||
val file1 = OCFile("/shared to group.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
val file = OCFile("/shared to admin.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
val file2 = OCFile("/shared via public link.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
val file1 = OCFile("/shared to group.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
val file3 = OCFile("/shared to personal circle.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
val file2 = OCFile("/shared via public link.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
val file4 = OCFile("/shared to talk.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
val file3 = OCFile("/shared to personal circle.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
val shares = listOf(
|
||||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 1
|
||||
shareType = ShareType.USER
|
||||
sharedWithDisplayName = "Admin"
|
||||
permissions = OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
val file4 = OCFile("/shared to talk.png").apply {
|
||||
remoteId = "00000001"
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
mimeType = "image/png"
|
||||
fileLength = 1024000
|
||||
modificationTimestamp = 1188206955
|
||||
permissions = OCFile.PERMISSION_CAN_RESHARE
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCShare(file1.decryptedRemotePath).apply {
|
||||
remoteId = 2
|
||||
shareType = ShareType.GROUP
|
||||
sharedWithDisplayName = "Group"
|
||||
permissions = OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
val shares = listOf(
|
||||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 1
|
||||
shareType = ShareType.USER
|
||||
sharedWithDisplayName = "Admin"
|
||||
permissions = OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
|
||||
OCShare(file2.decryptedRemotePath).apply {
|
||||
remoteId = 3
|
||||
shareType = ShareType.PUBLIC_LINK
|
||||
label = "Customer"
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
OCShare(file1.decryptedRemotePath).apply {
|
||||
remoteId = 2
|
||||
shareType = ShareType.GROUP
|
||||
sharedWithDisplayName = "Group"
|
||||
permissions = OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
|
||||
OCShare(file3.decryptedRemotePath).apply {
|
||||
remoteId = 4
|
||||
shareType = ShareType.CIRCLE
|
||||
sharedWithDisplayName = "Personal circle"
|
||||
permissions = OCShare.SHARE_PERMISSION_FLAG
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
OCShare(file2.decryptedRemotePath).apply {
|
||||
remoteId = 3
|
||||
shareType = ShareType.PUBLIC_LINK
|
||||
label = "Customer"
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
|
||||
OCShare(file4.decryptedRemotePath).apply {
|
||||
remoteId = 11
|
||||
shareType = ShareType.ROOM
|
||||
sharedWithDisplayName = "Admin"
|
||||
permissions = OCShare.SHARE_PERMISSION_FLAG
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
OCShare(file3.decryptedRemotePath).apply {
|
||||
remoteId = 4
|
||||
shareType = ShareType.CIRCLE
|
||||
sharedWithDisplayName = "Personal circle"
|
||||
permissions = OCShare.SHARE_PERMISSION_FLAG
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
},
|
||||
|
||||
OCShare(file4.decryptedRemotePath).apply {
|
||||
remoteId = 11
|
||||
shareType = ShareType.ROOM
|
||||
sharedWithDisplayName = "Admin"
|
||||
permissions = OCShare.SHARE_PERMISSION_FLAG
|
||||
userId = getUserId(user)
|
||||
sharedDate = 1188206955
|
||||
mimetype = "image/png"
|
||||
sut.storageManager.saveShare(this)
|
||||
}
|
||||
)
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
fragment.isLoading = false
|
||||
fragment.mEmptyListContainer?.visibility = View.GONE
|
||||
fragment.adapter.setData(
|
||||
shares,
|
||||
SearchType.SHARED_FILTER,
|
||||
storageManager,
|
||||
null,
|
||||
true
|
||||
)
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showSharedFiles", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
shortSleep()
|
||||
|
||||
sut.runOnUiThread {
|
||||
fragment.isLoading = false
|
||||
fragment.mEmptyListContainer?.visibility = View.GONE
|
||||
fragment.adapter.setData(
|
||||
shares,
|
||||
SearchType.SHARED_FILTER,
|
||||
storageManager,
|
||||
null,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
||||
+80
-57
@@ -1,86 +1,109 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.fragment
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.common.SearchResultEntry
|
||||
import com.owncloud.android.ui.unifiedsearch.UnifiedSearchSection
|
||||
import com.owncloud.android.ui.unifiedsearch.UnifiedSearchViewModel
|
||||
import org.junit.Rule
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class UnifiedSearchFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
fun showSearchResult() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = UnifiedSearchFragment.newInstance(null, null)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
activity.addFragment(sut)
|
||||
|
||||
shortSleep()
|
||||
|
||||
UiThreadStatement.runOnUiThread {
|
||||
sut.onSearchResultChanged(
|
||||
listOf(
|
||||
UnifiedSearchSection(
|
||||
providerID = "files",
|
||||
name = "Files",
|
||||
entries = listOf(
|
||||
SearchResultEntry(
|
||||
"thumbnailUrl",
|
||||
"Test",
|
||||
"in Files",
|
||||
"http://localhost/nc/index.php/apps/files/?dir=/Files&scrollto=Test",
|
||||
"icon",
|
||||
false
|
||||
)
|
||||
),
|
||||
hasMoreResults = false
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
shortSleep()
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun showSearchResult() {
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val sut = UnifiedSearchFragment.newInstance(null, null, "/")
|
||||
activity.addFragment(sut)
|
||||
|
||||
sut.onSearchResultChanged(
|
||||
listOf(
|
||||
UnifiedSearchSection(
|
||||
providerID = "files",
|
||||
name = "Files",
|
||||
entries = listOf(
|
||||
SearchResultEntry(
|
||||
"thumbnailUrl",
|
||||
"Test",
|
||||
"in Files",
|
||||
"http://localhost/nc/index.php/apps/files/?dir=/Files&scrollto=Test",
|
||||
"icon",
|
||||
false
|
||||
)
|
||||
),
|
||||
hasMoreResults = false
|
||||
)
|
||||
)
|
||||
)
|
||||
EspressoIdlingResource.decrement()
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
fun search() {
|
||||
val activity = testActivityRule.launchActivity(null) as TestActivity
|
||||
val sut = UnifiedSearchFragment.newInstance(null, null)
|
||||
val testViewModel = UnifiedSearchViewModel(activity.application)
|
||||
testViewModel.setConnectivityService(activity.connectivityServiceMock)
|
||||
val localRepository = UnifiedSearchFakeRepository()
|
||||
testViewModel.setRepository(localRepository)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
val ocFile = OCFile("/folder/test1.txt").apply {
|
||||
storagePath = "/sdcard/1.txt"
|
||||
storageManager.saveFile(this)
|
||||
val sut = UnifiedSearchFragment.newInstance(null, null, "/")
|
||||
val testViewModel = UnifiedSearchViewModel(activity.application)
|
||||
testViewModel.setConnectivityService(activity.connectivityServiceMock)
|
||||
val localRepository = UnifiedSearchFakeRepository()
|
||||
testViewModel.setRepository(localRepository)
|
||||
val ocFile = OCFile("/folder/test1.txt").apply {
|
||||
storagePath = "/sdcard/1.txt"
|
||||
storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
File(ocFile.storagePath).createNewFile()
|
||||
activity.addFragment(sut)
|
||||
|
||||
sut.setViewModel(testViewModel)
|
||||
sut.vm.setQuery("test")
|
||||
sut.vm.initialQuery()
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File(ocFile.storagePath).createNewFile()
|
||||
|
||||
activity.addFragment(sut)
|
||||
|
||||
shortSleep()
|
||||
|
||||
UiThreadStatement.runOnUiThread {
|
||||
sut.setViewModel(testViewModel)
|
||||
sut.vm.setQuery("test")
|
||||
sut.vm.initialQuery()
|
||||
}
|
||||
shortSleep()
|
||||
}
|
||||
}
|
||||
+34
-14
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
@@ -8,36 +9,55 @@
|
||||
package com.owncloud.android.ui.preview
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class PreviewBitmapScreenshotIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.preview.PreviewBitmapScreenshotIT"
|
||||
|
||||
companion object {
|
||||
private const val PNG_FILE_ASSET = "imageFile.png"
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(PreviewBitmapActivity::class.java, true, false)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showBitmap() {
|
||||
val pngFile = getFile(PNG_FILE_ASSET)
|
||||
|
||||
val activity = testActivityRule.launchActivity(
|
||||
Intent().putExtra(
|
||||
PreviewBitmapActivity.EXTRA_BITMAP_PATH,
|
||||
pngFile.absolutePath
|
||||
)
|
||||
val intent = Intent(targetContext, PreviewBitmapActivity::class.java).putExtra(
|
||||
PreviewBitmapActivity.EXTRA_BITMAP_PATH,
|
||||
pngFile.absolutePath
|
||||
)
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(activity)
|
||||
launchActivity<PreviewBitmapActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
onIdleSync {
|
||||
val screenShotName = createName(testClassName + "_" + "showBitmap", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.preview
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import org.junit.Rule
|
||||
|
||||
class PreviewImageFragmentIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
// Disabled for now due to strange failing when using entire test suite
|
||||
// Findings so far:
|
||||
// PreviewImageFragmentIT runs fine when only running this
|
||||
// running it in whole test suite fails
|
||||
// manually tried to execute LoadBitmapTask, but this does not start "doInBackground", but only creates class
|
||||
|
||||
// @Test
|
||||
// @ScreenshotTest
|
||||
// fun corruptImage() {
|
||||
// val activity = testActivityRule.launchActivity(null)
|
||||
//
|
||||
// val ocFile = OCFile("/test.png")
|
||||
// val sut = PreviewImageFragment.newInstance(ocFile, true, false)
|
||||
//
|
||||
// activity.addFragment(sut)
|
||||
//
|
||||
// while (!sut.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
// shortSleep()
|
||||
// }
|
||||
//
|
||||
// screenshot(activity)
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @ScreenshotTest
|
||||
// fun validImage() {
|
||||
// val activity = testActivityRule.launchActivity(null)
|
||||
//
|
||||
// val ocFile = OCFile("/test.png")
|
||||
// ocFile.storagePath = getFile("imageFile.png").absolutePath
|
||||
//
|
||||
// val sut = PreviewImageFragment.newInstance(ocFile, true, false)
|
||||
//
|
||||
// activity.addFragment(sut)
|
||||
//
|
||||
// while (!sut.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
// shortSleep()
|
||||
// }
|
||||
//
|
||||
// screenshot(activity)
|
||||
// }
|
||||
}
|
||||
+41
-25
@@ -1,54 +1,70 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||
*/
|
||||
package com.owncloud.android.ui.preview.pdf
|
||||
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.test.core.app.launchActivity
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class PreviewPdfFragmentScreenshotIT : AbstractIT() {
|
||||
private val testClassName = "com.owncloud.android.ui.preview.pdf.PreviewPdfFragmentScreenshotIT"
|
||||
|
||||
companion object {
|
||||
private const val PDF_FILE_ASSET = "test.pdf"
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
@Before
|
||||
fun registerIdlingResource() {
|
||||
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@After
|
||||
fun unregisterIdlingResource() {
|
||||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun showPdf() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
launchActivity<TestActivity>().use { scenario ->
|
||||
scenario.onActivity { activity ->
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
val pdfFile = getFile(PDF_FILE_ASSET)
|
||||
val ocFile = OCFile("/test.pdf").apply {
|
||||
storagePath = pdfFile.absolutePath
|
||||
}
|
||||
|
||||
val pdfFile = getFile(PDF_FILE_ASSET)
|
||||
val ocFile = OCFile("/test.pdf").apply {
|
||||
storagePath = pdfFile.absolutePath
|
||||
val sut = PreviewPdfFragment.newInstance(ocFile)
|
||||
activity.addFragment(sut)
|
||||
sut.dismissSnack()
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
|
||||
val screenShotName = createName(testClassName + "_" + "showPdf", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(activity, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val sut = PreviewPdfFragment.newInstance(ocFile)
|
||||
activity.addFragment(sut)
|
||||
|
||||
while (!sut.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
shortSleep()
|
||||
}
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.dismissSnack()
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(activity)
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.owncloud.android.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.extensions.launchAndCapture
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
@@ -71,84 +72,50 @@ class TrashbinActivityIT : AbstractIT() {
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun files() {
|
||||
launchActivity<TrashbinActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.FILES)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.loadFolder(
|
||||
onComplete = { EspressoIdlingResource.decrement() },
|
||||
onError = { EspressoIdlingResource.decrement() }
|
||||
)
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
val screenShotName = createName(testClassName + "_" + "files", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
launchAndCapture<TrashbinActivity>(testClassName, "files", before = { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.FILES)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
sut.loadFolder(
|
||||
onComplete = { EspressoIdlingResource.decrement() },
|
||||
onError = { EspressoIdlingResource.decrement() }
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun empty() {
|
||||
launchActivity<TrashbinActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.loadFolder(
|
||||
onComplete = { EspressoIdlingResource.decrement() },
|
||||
onError = { EspressoIdlingResource.decrement() }
|
||||
)
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
val screenShotName = createName(testClassName + "_" + "empty", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
launchAndCapture<TrashbinActivity>(testClassName, "empty", before = { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
sut.loadFolder(
|
||||
onComplete = { EspressoIdlingResource.decrement() },
|
||||
onError = { EspressoIdlingResource.decrement() }
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun loading() {
|
||||
launchActivity<TrashbinActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.showInitialLoading()
|
||||
EspressoIdlingResource.decrement()
|
||||
val screenShotName = createName(testClassName + "_" + "loading", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
launchAndCapture<TrashbinActivity>(testClassName, "loading", before = { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
sut.showInitialLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThread
|
||||
@ScreenshotTest
|
||||
fun normalUser() {
|
||||
launchActivity<TrashbinActivity>().use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.showUser()
|
||||
EspressoIdlingResource.decrement()
|
||||
val screenShotName = createName(testClassName + "_" + "normalUser", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
launchAndCapture<TrashbinActivity>(testClassName, "normalUser", before = { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
sut.showUser()
|
||||
})
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -167,19 +134,10 @@ class TrashbinActivityIT : AbstractIT() {
|
||||
putExtra(Intent.EXTRA_USER, "differentUser@https://nextcloud.localhost")
|
||||
}
|
||||
|
||||
launchActivity<TrashbinActivity>(intent).use { scenario ->
|
||||
scenario.onActivity { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
onIdleSync {
|
||||
EspressoIdlingResource.increment()
|
||||
sut.showUser()
|
||||
EspressoIdlingResource.decrement()
|
||||
val screenShotName = createName(testClassName + "_" + "differentUser", "")
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
launchAndCapture<TrashbinActivity>(testClassName, "differentUser", intent = intent, before = { sut ->
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut)
|
||||
sut.showUser()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import com.owncloud.android.datamodel.e2e.v1.decrypted.Encrypted;
|
||||
import com.owncloud.android.datamodel.e2e.v1.encrypted.EncryptedFolderMetadataFileV1;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.e2ee.CsrHelper;
|
||||
import com.owncloud.android.utils.crypto.CryptoHelper;
|
||||
import com.owncloud.android.utils.EncryptionUtils;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -44,7 +45,6 @@ import java.security.PrivateKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.interfaces.RSAPrivateCrtKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -57,7 +57,6 @@ import javax.crypto.Cipher;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decodeStringToBase64Bytes;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptFile;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptFolderMetaData;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptPrivateKey;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptStringAsymmetric;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptStringSymmetric;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.deserializeJSON;
|
||||
@@ -262,13 +261,8 @@ public class EncryptionTestIT extends AbstractIT {
|
||||
byte[] privateKeyBytes = privateKey.getEncoded();
|
||||
String privateKeyString = encodeBytesToBase64String(privateKeyBytes);
|
||||
|
||||
String encryptedString;
|
||||
if (new Random().nextBoolean()) {
|
||||
encryptedString = EncryptionUtils.encryptPrivateKey(privateKeyString, keyPhrase);
|
||||
} else {
|
||||
encryptedString = EncryptionUtils.encryptPrivateKeyOld(privateKeyString, keyPhrase);
|
||||
}
|
||||
String decryptedString = decryptPrivateKey(encryptedString, keyPhrase);
|
||||
String encryptedString = CryptoHelper.INSTANCE.encryptPrivateKey(privateKeyString, keyPhrase);
|
||||
String decryptedString = CryptoHelper.INSTANCE.decryptPrivateKey(encryptedString, keyPhrase);
|
||||
|
||||
assertEquals(privateKeyString, decryptedString);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ class CapabilityUtilsIT : AbstractIT() {
|
||||
assertTrue(test(NextcloudVersion.nextcloud_22))
|
||||
assertTrue(test(NextcloudVersion.nextcloud_21))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_20))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_19))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_18))
|
||||
}
|
||||
|
||||
private fun test(version: OwnCloudVersion): Boolean =
|
||||
|
||||
@@ -44,6 +44,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
@@ -96,7 +97,11 @@ public final class PushUtils {
|
||||
if (!new File(privateKeyPath).exists() && !new File(publicKeyPath).exists()) {
|
||||
try {
|
||||
if (!keyPathFile.exists()) {
|
||||
keyPathFile.mkdir();
|
||||
try {
|
||||
Files.createDirectory(keyPathFile.toPath());
|
||||
} catch (IOException e) {
|
||||
Log_OC.e(TAG, "Could not create directory: " + keyPathFile.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
|
||||
keyGen.initialize(2048);
|
||||
@@ -304,8 +309,12 @@ public final class PushUtils {
|
||||
try {
|
||||
if (!new File(path).exists()) {
|
||||
File newFile = new File(path);
|
||||
newFile.getParentFile().mkdirs();
|
||||
newFile.createNewFile();
|
||||
try {
|
||||
Files.createDirectories(newFile.getParentFile().toPath());
|
||||
} catch (IOException e) {
|
||||
Log_OC.e(TAG, "Could not create directory: " + newFile.getParentFile(), e);
|
||||
}
|
||||
Files.createFile(newFile.toPath());
|
||||
}
|
||||
keyFileOutputStream = new FileOutputStream(path);
|
||||
keyFileOutputStream.write(encoded);
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:supportsRtl="true"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:theme="@style/Theme.ownCloud.Toolbar"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="UnusedAttribute"
|
||||
@@ -269,9 +269,18 @@
|
||||
android:exported="false"
|
||||
tools:replace="android:exported" />
|
||||
|
||||
<receiver
|
||||
android:name="com.nextcloud.client.jobs.offlineOperations.receiver.OfflineOperationReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name=".operations.upload.UploadFileBroadcastReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="com.nextcloud.client.jobs.MediaFoldersDetectionWork$NotificationReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="com.nextcloud.client.jobs.upload.FileUploadBroadcastReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="com.nextcloud.client.jobs.NotificationWork$NotificationReceiver"
|
||||
android:exported="false" />
|
||||
@@ -344,6 +353,7 @@
|
||||
<activity
|
||||
android:name=".ui.activity.SettingsActivity"
|
||||
android:exported="false"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:theme="@style/PreferenceTheme" />
|
||||
<activity
|
||||
android:name=".ui.preview.PreviewImageActivity"
|
||||
@@ -575,6 +585,8 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name="com.nextcloud.client.jobs.folderDownload.FolderDownloadWorkerReceiver" android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.activity.CopyToClipboardActivity"
|
||||
android:exported="false"
|
||||
@@ -607,8 +619,7 @@
|
||||
<activity
|
||||
android:name=".ui.activity.ManageSpaceActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/manage_space_title"
|
||||
android:theme="@style/Theme.ownCloud" />
|
||||
android:label="@string/manage_space_title" />
|
||||
|
||||
<service
|
||||
android:name=".services.AccountManagerService"
|
||||
|
||||
@@ -17,7 +17,10 @@ import com.nextcloud.client.core.Clock
|
||||
import com.nextcloud.client.core.ClockImpl
|
||||
import com.nextcloud.client.database.dao.ArbitraryDataDao
|
||||
import com.nextcloud.client.database.dao.FileDao
|
||||
import com.nextcloud.client.database.dao.FileSystemDao
|
||||
import com.nextcloud.client.database.dao.OfflineOperationDao
|
||||
import com.nextcloud.client.database.dao.RecommendedFileDao
|
||||
import com.nextcloud.client.database.dao.SyncedFolderDao
|
||||
import com.nextcloud.client.database.dao.UploadDao
|
||||
import com.nextcloud.client.database.entity.ArbitraryDataEntity
|
||||
import com.nextcloud.client.database.entity.CapabilityEntity
|
||||
@@ -25,6 +28,7 @@ import com.nextcloud.client.database.entity.ExternalLinkEntity
|
||||
import com.nextcloud.client.database.entity.FileEntity
|
||||
import com.nextcloud.client.database.entity.FilesystemEntity
|
||||
import com.nextcloud.client.database.entity.OfflineOperationEntity
|
||||
import com.nextcloud.client.database.entity.RecommendedFileEntity
|
||||
import com.nextcloud.client.database.entity.ShareEntity
|
||||
import com.nextcloud.client.database.entity.SyncedFolderEntity
|
||||
import com.nextcloud.client.database.entity.UploadEntity
|
||||
@@ -48,7 +52,8 @@ import com.owncloud.android.db.ProviderMeta
|
||||
SyncedFolderEntity::class,
|
||||
UploadEntity::class,
|
||||
VirtualEntity::class,
|
||||
OfflineOperationEntity::class
|
||||
OfflineOperationEntity::class,
|
||||
RecommendedFileEntity::class
|
||||
],
|
||||
version = ProviderMeta.DB_VERSION,
|
||||
autoMigrations = [
|
||||
@@ -75,7 +80,10 @@ import com.owncloud.android.db.ProviderMeta
|
||||
AutoMigration(from = 86, to = 87, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
|
||||
AutoMigration(from = 87, to = 88, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
|
||||
// manual migration used for 88 to 89
|
||||
AutoMigration(from = 89, to = 90)
|
||||
AutoMigration(from = 89, to = 90),
|
||||
AutoMigration(from = 90, to = 91),
|
||||
AutoMigration(from = 91, to = 92),
|
||||
AutoMigration(from = 92, to = 93, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
|
||||
],
|
||||
exportSchema = true
|
||||
)
|
||||
@@ -87,6 +95,9 @@ abstract class NextcloudDatabase : RoomDatabase() {
|
||||
abstract fun fileDao(): FileDao
|
||||
abstract fun offlineOperationDao(): OfflineOperationDao
|
||||
abstract fun uploadDao(): UploadDao
|
||||
abstract fun recommendedFileDao(): RecommendedFileDao
|
||||
abstract fun fileSystemDao(): FileSystemDao
|
||||
abstract fun syncedFolderDao(): SyncedFolderDao
|
||||
|
||||
companion object {
|
||||
const val FIRST_ROOM_DB_VERSION = 65
|
||||
|
||||
@@ -9,11 +9,17 @@ package com.nextcloud.client.database.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.nextcloud.client.database.entity.FileEntity
|
||||
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta
|
||||
import com.owncloud.android.utils.MimeType
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
@Dao
|
||||
interface FileDao {
|
||||
@Update
|
||||
fun update(entity: FileEntity)
|
||||
|
||||
@Query("SELECT * FROM filelist WHERE _id = :id LIMIT 1")
|
||||
fun getFileById(id: Long): FileEntity?
|
||||
|
||||
@@ -58,4 +64,51 @@ interface FileDao {
|
||||
"ORDER BY internal_two_way_sync_timestamp DESC"
|
||||
)
|
||||
fun getInternalTwoWaySyncFolders(fileOwner: String): List<FileEntity>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT *
|
||||
FROM filelist
|
||||
WHERE parent = :parentId
|
||||
AND file_owner = :accountName
|
||||
AND is_encrypted = 0
|
||||
AND (content_type = :dirType OR content_type = :webdavType)
|
||||
ORDER BY ${ProviderTableMeta.FILE_DEFAULT_SORT_ORDER}
|
||||
"""
|
||||
)
|
||||
fun getNonEncryptedSubfolders(
|
||||
parentId: Long,
|
||||
accountName: String,
|
||||
dirType: String = MimeType.DIRECTORY,
|
||||
webdavType: String = MimeType.WEBDAV_FOLDER
|
||||
): List<FileEntity>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT *
|
||||
FROM filelist
|
||||
WHERE parent = :parentId
|
||||
AND file_owner = :accountName
|
||||
AND (content_type != :dirType AND content_type != :webdavType)
|
||||
ORDER BY ${ProviderTableMeta.FILE_DEFAULT_SORT_ORDER}
|
||||
"""
|
||||
)
|
||||
fun getSubfiles(
|
||||
parentId: Long,
|
||||
accountName: String,
|
||||
dirType: String = MimeType.DIRECTORY,
|
||||
webdavType: String = MimeType.WEBDAV_FOLDER
|
||||
): List<FileEntity>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT *
|
||||
FROM filelist
|
||||
WHERE file_owner = :fileOwner
|
||||
AND parent = :parentId
|
||||
AND ${ProviderTableMeta.FILE_NAME} LIKE '%' || :query || '%'
|
||||
ORDER BY ${ProviderTableMeta.FILE_DEFAULT_SORT_ORDER}
|
||||
"""
|
||||
)
|
||||
fun searchFilesInFolder(parentId: Long, fileOwner: String, query: String): List<FileEntity>
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.nextcloud.client.database.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import com.nextcloud.client.database.entity.FilesystemEntity
|
||||
import com.owncloud.android.db.ProviderMeta
|
||||
|
||||
@Dao
|
||||
interface FileSystemDao {
|
||||
@Query(
|
||||
"""
|
||||
SELECT *
|
||||
FROM ${ProviderMeta.ProviderTableMeta.FILESYSTEM_TABLE_NAME}
|
||||
WHERE ${ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID} = :syncedFolderId
|
||||
AND ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD} = 0
|
||||
AND ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_IS_FOLDER} = 0
|
||||
AND ${ProviderMeta.ProviderTableMeta._ID} > :lastId
|
||||
ORDER BY ${ProviderMeta.ProviderTableMeta._ID}
|
||||
LIMIT :limit
|
||||
"""
|
||||
)
|
||||
suspend fun getAutoUploadFilesEntities(syncedFolderId: String, limit: Int, lastId: Int): List<FilesystemEntity>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
UPDATE ${ProviderMeta.ProviderTableMeta.FILESYSTEM_TABLE_NAME}
|
||||
SET ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD} = 1
|
||||
WHERE ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH} = :localPath
|
||||
AND ${ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID} = :syncedFolderId
|
||||
"""
|
||||
)
|
||||
suspend fun markFileAsUploaded(localPath: String, syncedFolderId: String)
|
||||
}
|
||||
@@ -40,4 +40,7 @@ interface OfflineOperationDao {
|
||||
|
||||
@Query("DELETE FROM offline_operations")
|
||||
fun clearTable()
|
||||
|
||||
@Query("DELETE FROM offline_operations WHERE _id = :id")
|
||||
fun deleteById(id: Int)
|
||||
}
|
||||
Loaded 100 of 524 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user