diff options
Diffstat (limited to 'ui-ci')
174 files changed, 19208 insertions, 9590 deletions
diff --git a/ui-ci/.gitignore b/ui-ci/.gitignore index a3b2274a53..6405eb7c05 100644 --- a/ui-ci/.gitignore +++ b/ui-ci/.gitignore @@ -1,3 +1,2 @@ /bin/ -test-output/ -/target/ +test-output/
\ No newline at end of file diff --git a/ui-ci/hs_err_pid10052.log b/ui-ci/hs_err_pid10052.log new file mode 100644 index 0000000000..3475f9250a --- /dev/null +++ b/ui-ci/hs_err_pid10052.log @@ -0,0 +1,389 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006f70a0a5, pid=10052, tid=0x0000000000001f50 +# +# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13) +# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode windows-amd64 compressed oops) +# Problematic frame: +# V [jvm.dll+0x12a0a5] +# +# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows +# +# If you would like to submit a bug report, please visit: +# http://bugreport.java.com/bugreport/crash.jsp +# + +--------------- T H R E A D --------------- + +Current thread (0x000000001d458800): JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=8016, stack(0x000000001e150000,0x000000001e250000)] + +siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff + +Registers: +RAX=0x000000001e24f201, RBX=0x000000001d458800, RCX=0x293b676e69727453, RDX=0x0000000000000000 +RSP=0x000000001e24f290, RBP=0x293b676e69727453, RSI=0x000000001e24f3a8, RDI=0x000000000237c720 +R8 =0x000000001d458800, R9 =0x000000000000ff00, R10=0x0000000000000000, R11=0x004e596502bc0041 +R12=0x0000000000000000, R13=0x000000001d451788, R14=0x0000000000000000, R15=0x0000000000000000 +RIP=0x000000006f70a0a5, EFLAGS=0x0000000000010206 + +Top of Stack: (sp=0x000000001e24f290) +0x000000001e24f290: 000000001d458800 000000001fbdbe40 +0x000000001e24f2a0: 000000001e24f358 000000006f912f0b +0x000000001e24f2b0: 000000001d458800 000000006f92f76d +0x000000001e24f2c0: 0000000000000000 0000000055559155 +0x000000001e24f2d0: 000000001f30efd8 000000005556291e +0x000000001e24f2e0: 000000001d458800 0000000000000000 +0x000000001e24f2f0: 0000000000000000 0000000000000000 +0x000000001e24f300: 293b676e69727453 0000000055561a15 +0x000000001e24f310: 000000001e24f3a8 000000001e24f380 +0x000000001e24f320: 0000000000000001 000000001f30efd8 +0x000000001e24f330: 293b676e69727453 00000000555453b3 +0x000000001e24f340: 000000001e24f470 0000000000000001 +0x000000001e24f350: 0000000000000001 000000001f30efd8 +0x000000001e24f360: 00000000f000100a 0000000000000000 +0x000000001e24f370: 0000000000000000 0000000000000000 +0x000000001e24f380: 0000000000000001 0000000055545571 + +Instructions: (pc=0x000000006f70a0a5) +0x000000006f70a085: cc cc cc cc cc cc cc cc cc cc cc 48 83 ec 28 48 +0x000000006f70a095: 85 c9 75 07 33 c0 48 83 c4 28 c3 48 89 5c 24 20 +0x000000006f70a0a5: 48 8b 19 48 85 db 74 20 48 83 fb 37 74 1a 48 8b +0x000000006f70a0b5: 13 48 8b cb ff 52 10 84 c0 74 0d 48 8b c3 48 8b + + +Register to memory mapping: + +RAX=0x000000001e24f201 is pointing into the stack for thread: 0x000000001d458800 +RBX=0x000000001d458800 is a thread +RCX=0x293b676e69727453 is an unknown value +RDX=0x0000000000000000 is an unknown value +RSP=0x000000001e24f290 is pointing into the stack for thread: 0x000000001d458800 +RBP=0x293b676e69727453 is an unknown value +RSI=0x000000001e24f3a8 is pointing into the stack for thread: 0x000000001d458800 +RDI=0x000000000237c720 is an unknown value +R8 =0x000000001d458800 is a thread +R9 =0x000000000000ff00 is an unknown value +R10=0x0000000000000000 is an unknown value +R11=0x004e596502bc0041 is an unknown value +R12=0x0000000000000000 is an unknown value +R13=0x000000001d451788 is an unknown value +R14=0x0000000000000000 is an unknown value +R15=0x0000000000000000 is an unknown value + + +Stack: [0x000000001e150000,0x000000001e250000], sp=0x000000001e24f290, free space=1020k +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +V [jvm.dll+0x12a0a5] +V [jvm.dll+0x34f76d] +C [jdwp.dll+0x21a15] +C [jdwp.dll+0x53b3] +C [jdwp.dll+0x5571] +C [jdwp.dll+0xf0a8] +C [jdwp.dll+0x1f2d5] +C [jdwp.dll+0x1f4aa] +V [jvm.dll+0x1bd258] +V [jvm.dll+0x2451a4] +V [jvm.dll+0x29c18a] +C [msvcr100.dll+0x21d9f] +C [msvcr100.dll+0x21e3b] +C [kernel32.dll+0x159cd] +C [ntdll.dll+0x2a2e1] + + +--------------- P R O C E S S --------------- + +Java Threads: ( => current thread ) + 0x000000001f2a0000 JavaThread "Thread-25" daemon [_thread_in_native, id=11400, stack(0x0000000024be0000,0x0000000024ce0000)] + 0x000000001f29f000 JavaThread "Thread-24" daemon [_thread_in_native, id=1112, stack(0x00000000243d0000,0x00000000244d0000)] + 0x000000001f29e800 JavaThread "Thread-23" [_thread_in_native, id=2452, stack(0x0000000022cc0000,0x0000000022dc0000)] + 0x000000001f93d000 JavaThread "ReaderThread" [_thread_in_native, id=11720, stack(0x0000000021250000,0x0000000021350000)] + 0x000000001d4e8800 JavaThread "Service Thread" daemon [_thread_blocked, id=10596, stack(0x000000001e6f0000,0x000000001e7f0000)] + 0x000000001d474800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=8028, stack(0x000000001e3d0000,0x000000001e4d0000)] + 0x000000001d471000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5140, stack(0x000000001e4f0000,0x000000001e5f0000)] + 0x000000001d46d000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=12216, stack(0x000000001dd90000,0x000000001de90000)] + 0x000000001d45f800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=7520, stack(0x000000001e2d0000,0x000000001e3d0000)] + 0x000000001d45e000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2652, stack(0x000000001df60000,0x000000001e060000)] +=>0x000000001d458800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=8016, stack(0x000000001e150000,0x000000001e250000)] + 0x000000001d444800 JavaThread "Attach Listener" daemon [_thread_blocked, id=7364, stack(0x000000001d200000,0x000000001d300000)] + 0x000000001bfff000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9460, stack(0x000000001d850000,0x000000001d950000)] + 0x000000001bfe6800 JavaThread "Finalizer" daemon [_thread_blocked, id=7944, stack(0x000000001d340000,0x000000001d440000)] + 0x000000001bf9d000 JavaThread "Reference Handler" daemon [_thread_blocked, id=6028, stack(0x000000001d080000,0x000000001d180000)] + 0x0000000002381000 JavaThread "main" [_thread_blocked, id=12148, stack(0x0000000002480000,0x0000000002580000)] + +Other Threads: + 0x000000001bf95800 VMThread [stack: 0x000000001cf80000,0x000000001d080000] [id=8456] + 0x000000001d537000 WatcherThread [stack: 0x000000001e840000,0x000000001e940000] [id=5808] + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap: + PSYoungGen total 144896K, used 11229K [0x000000076c700000, 0x0000000776d80000, 0x00000007c0000000) + eden space 143360K, 6% used [0x000000076c700000,0x000000076d087050,0x0000000775300000) + from space 1536K, 95% used [0x0000000775d00000,0x0000000775e70540,0x0000000775e80000) + to space 9216K, 0% used [0x0000000776480000,0x0000000776480000,0x0000000776d80000) + ParOldGen total 93184K, used 6916K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5ac1178,0x00000006caf00000) + Metaspace used 26524K, capacity 27092K, committed 27264K, reserved 1073152K + class space used 3209K, capacity 3367K, committed 3456K, reserved 1048576K + +Card table byte_map: [0x0000000011cf0000,0x00000000124d0000] byte_map_base: 0x000000000e6c6000 + +Marking Bits: (ParMarkBitMap*) 0x000000006fdfa6d0 + Begin Bits: [0x00000000130c0000, 0x0000000016f70000) + End Bits: [0x0000000016f70000, 0x000000001ae20000) + +Polling page: 0x0000000000370000 + +CodeCache: size=245760Kb used=14912Kb max_used=14912Kb free=230848Kb + bounds [0x0000000002930000, 0x00000000037d0000, 0x0000000011930000] + total_blobs=4013 nmethods=3595 adapters=338 + compilation: enabled + +Compilation events (10 events): +Event: 131.300 Thread 0x000000001d474800 4189 ! 3 com.google.gson.JsonParser::parse (100 bytes) +Event: 131.302 Thread 0x000000001d474800 nmethod 4189 0x00000000037cce10 code [0x00000000037cd120, 0x00000000037ceb08] +Event: 131.303 Thread 0x000000001d474800 4190 ! 3 com.google.gson.internal.Streams::parse (68 bytes) +Event: 131.304 Thread 0x000000001d474800 nmethod 4190 0x00000000037a77d0 code [0x00000000037a79e0, 0x00000000037a81d8] +Event: 131.304 Thread 0x000000001d474800 4191 3 com.google.gson.internal.bind.TypeAdapters$25::read (6 bytes) +Event: 131.304 Thread 0x000000001d474800 nmethod 4191 0x00000000037a7390 code [0x00000000037a7500, 0x00000000037a7728] +Event: 131.313 Thread 0x000000001d474800 4192 1 java.lang.StackTraceElement::getClassName (5 bytes) +Event: 131.313 Thread 0x000000001d474800 nmethod 4192 0x00000000037a4c90 code [0x00000000037a4de0, 0x00000000037a4ef0] +Event: 131.313 Thread 0x000000001d474800 4193 ! 3 sun.nio.cs.StreamEncoder::flushBuffer (42 bytes) +Event: 131.313 Thread 0x000000001d474800 nmethod 4193 0x00000000037a6910 code [0x00000000037a6ac0, 0x00000000037a7098] + +GC Heap History (10 events): +Event: 98.293 GC heap before +{Heap before GC invocations=12 (full 1): + PSYoungGen total 169472K, used 169111K [0x000000076c700000, 0x0000000778200000, 0x00000007c0000000) + eden space 167424K, 100% used [0x000000076c700000,0x0000000776a80000,0x0000000776a80000) + from space 2048K, 82% used [0x0000000778000000,0x00000007781a5ff0,0x0000000778200000) + to space 10752K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777780000) + ParOldGen total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000) + Metaspace used 26364K, capacity 26900K, committed 27008K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +Event: 98.299 GC heap after +Heap after GC invocations=12 (full 1): + PSYoungGen total 164352K, used 1859K [0x000000076c700000, 0x0000000778080000, 0x00000007c0000000) + eden space 162304K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000776580000) + from space 2048K, 90% used [0x0000000776d00000,0x0000000776ed0fe0,0x0000000776f00000) + to space 10752K, 0% used [0x0000000777600000,0x0000000777600000,0x0000000778080000) + ParOldGen total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000) + Metaspace used 26364K, capacity 26900K, committed 27008K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +} +Event: 112.449 GC heap before +{Heap before GC invocations=13 (full 1): + PSYoungGen total 164352K, used 164163K [0x000000076c700000, 0x0000000778080000, 0x00000007c0000000) + eden space 162304K, 100% used [0x000000076c700000,0x0000000776580000,0x0000000776580000) + from space 2048K, 90% used [0x0000000776d00000,0x0000000776ed0fe0,0x0000000776f00000) + to space 10752K, 0% used [0x0000000777600000,0x0000000777600000,0x0000000778080000) + ParOldGen total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000) + Metaspace used 26410K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +Event: 112.470 GC heap after +Heap after GC invocations=13 (full 1): + PSYoungGen total 158720K, used 1461K [0x000000076c700000, 0x0000000777780000, 0x00000007c0000000) + eden space 157184K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000776080000) + from space 1536K, 95% used [0x0000000777600000,0x000000077776d550,0x0000000777780000) + to space 10240K, 0% used [0x0000000776380000,0x0000000776380000,0x0000000776d80000) + ParOldGen total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000) + Metaspace used 26410K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +} +Event: 114.140 GC heap before +{Heap before GC invocations=14 (full 1): + PSYoungGen total 158720K, used 158645K [0x000000076c700000, 0x0000000777780000, 0x00000007c0000000) + eden space 157184K, 100% used [0x000000076c700000,0x0000000776080000,0x0000000776080000) + from space 1536K, 95% used [0x0000000777600000,0x000000077776d550,0x0000000777780000) + to space 10240K, 0% used [0x0000000776380000,0x0000000776380000,0x0000000776d80000) + ParOldGen total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000) + Metaspace used 26418K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +Event: 114.143 GC heap after +Heap after GC invocations=14 (full 1): + PSYoungGen total 154624K, used 1655K [0x000000076c700000, 0x0000000777680000, 0x00000007c0000000) + eden space 152576K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775c00000) + from space 2048K, 80% used [0x0000000776380000,0x000000077651dff0,0x0000000776580000) + to space 9728K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777680000) + ParOldGen total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000) + Metaspace used 26418K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +} +Event: 115.355 GC heap before +{Heap before GC invocations=15 (full 1): + PSYoungGen total 154624K, used 154231K [0x000000076c700000, 0x0000000777680000, 0x00000007c0000000) + eden space 152576K, 100% used [0x000000076c700000,0x0000000775c00000,0x0000000775c00000) + from space 2048K, 80% used [0x0000000776380000,0x000000077651dff0,0x0000000776580000) + to space 9728K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777680000) + ParOldGen total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000) + Metaspace used 26418K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +Event: 115.360 GC heap after +Heap after GC invocations=15 (full 1): + PSYoungGen total 150016K, used 1591K [0x000000076c700000, 0x0000000776f00000, 0x00000007c0000000) + eden space 147968K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775780000) + from space 2048K, 77% used [0x0000000776d00000,0x0000000776e8dff0,0x0000000776f00000) + to space 9216K, 0% used [0x0000000775d00000,0x0000000775d00000,0x0000000776600000) + ParOldGen total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000) + Metaspace used 26418K, capacity 26964K, committed 27264K, reserved 1073152K + class space used 3204K, capacity 3367K, committed 3456K, reserved 1048576K +} +Event: 127.014 GC heap before +{Heap before GC invocations=16 (full 1): + PSYoungGen total 150016K, used 149559K [0x000000076c700000, 0x0000000776f00000, 0x00000007c0000000) + eden space 147968K, 100% used [0x000000076c700000,0x0000000775780000,0x0000000775780000) + from space 2048K, 77% used [0x0000000776d00000,0x0000000776e8dff0,0x0000000776f00000) + to space 9216K, 0% used [0x0000000775d00000,0x0000000775d00000,0x0000000776600000) + ParOldGen total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000) + Metaspace used 26464K, capacity 27028K, committed 27264K, reserved 1073152K + class space used 3205K, capacity 3367K, committed 3456K, reserved 1048576K +Event: 127.033 GC heap after +Heap after GC invocations=16 (full 1): + PSYoungGen total 144896K, used 1473K [0x000000076c700000, 0x0000000776d80000, 0x00000007c0000000) + eden space 143360K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775300000) + from space 1536K, 95% used [0x0000000775d00000,0x0000000775e70540,0x0000000775e80000) + to space 9216K, 0% used [0x0000000776480000,0x0000000776480000,0x0000000776d80000) + ParOldGen total 93184K, used 6916K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000) + object space 93184K, 7% used [0x00000006c5400000,0x00000006c5ac1178,0x00000006caf00000) + Metaspace used 26464K, capacity 27028K, committed 27264K, reserved 1073152K + class space used 3205K, capacity 3367K, committed 3456K, reserved 1048576K +} + +Deoptimization events (10 events): +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x00000000032857bc method=sun.reflect.generics.parser.SignatureParser.current()C @ 34 +Event: 131.311 Thread 0x0000000002381000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000003324434 method=org.codehaus.jackson.impl.ReaderBasedParser.nextToken()Lorg/codehaus/jackson/JsonToken; @ 37 + +Internal exceptions (10 events): +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x0000000774722590) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 39> (0x0000000774723398) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x0000000774724040) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x0000000774724d40) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 29> (0x00000007747259e8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x00000007747266e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 32> (0x0000000774727458) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 32> (0x0000000774728060) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x0000000774728c58) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366] +Event: 119.647 Thread 0x0000000002381000 Exception <a 'java/net/ConnectException': Connection refused: connect> (0x0000000774aedd18) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jni.cpp, line 735] + +Events (10 events): +Event: 2632.158 Executing VM operation: EnterInterpOnlyMode +Event: 2632.158 Executing nested VM operation: Deoptimize +Event: 2632.159 Executing nested VM operation: Deoptimize done +Event: 2632.159 Executing VM operation: EnterInterpOnlyMode done +Event: 2632.159 Executing VM operation: ChangeSingleStep +Event: 2632.159 Executing VM operation: ChangeSingleStep done +Event: 2632.160 Executing VM operation: ChangeSingleStep +Event: 2632.160 Executing VM operation: ChangeSingleStep done +Event: 2632.193 Executing VM operation: RedefineClasses +Event: 2632.229 Executing VM operation: RedefineClasses done + + +Dynamic libraries: +0x000000013fd10000 - 0x000000013fd47000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\javaw.exe +0x0000000077510000 - 0x00000000776ba000 C:\WINDOWS\SYSTEM32\ntdll.dll +0x00000000773f0000 - 0x000000007750f000 C:\WINDOWS\system32\kernel32.dll +0x000007fefd2e0000 - 0x000007fefd34a000 C:\WINDOWS\system32\KERNELBASE.dll +0x000007fefd600000 - 0x000007fefd6db000 C:\WINDOWS\system32\ADVAPI32.dll +0x000007fefe3e0000 - 0x000007fefe47f000 C:\WINDOWS\system32\msvcrt.dll +0x000007fefe480000 - 0x000007fefe49f000 C:\WINDOWS\SYSTEM32\sechost.dll +0x000007fefe510000 - 0x000007fefe63d000 C:\WINDOWS\system32\RPCRT4.dll +0x00000000772f0000 - 0x00000000773ea000 C:\WINDOWS\system32\USER32.dll +0x000007fefe4a0000 - 0x000007fefe507000 C:\WINDOWS\system32\GDI32.dll +0x000007feff730000 - 0x000007feff73e000 C:\WINDOWS\system32\LPK.dll +0x000007fefe820000 - 0x000007fefe8ea000 C:\WINDOWS\system32\USP10.dll +0x000007fefb4c0000 - 0x000007fefb6b4000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll +0x000007fefd9e0000 - 0x000007fefda51000 C:\WINDOWS\system32\SHLWAPI.dll +0x000007fefd9b0000 - 0x000007fefd9de000 C:\WINDOWS\system32\IMM32.DLL +0x000007fefdff0000 - 0x000007fefe0f9000 C:\WINDOWS\system32\MSCTF.dll +0x000007fef9c10000 - 0x000007fef9c9a000 C:\WINDOWS\system32\VSMAPIMon.dll +0x000007fef27e0000 - 0x000007fef2887000 C:\Program Files\McAfee\Host Intrusion Prevention\HcApi.dll +0x00000000705b0000 - 0x00000000705bb000 C:\Program Files\McAfee\Host Intrusion Prevention\HcThe.dll +0x0000000055580000 - 0x0000000055652000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\msvcr100.dll +0x000000006f5e0000 - 0x000000006fe7a000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\server\jvm.dll +0x000007fefbda0000 - 0x000007fefbda9000 C:\WINDOWS\system32\WSOCK32.dll +0x000007feff6e0000 - 0x000007feff72d000 C:\WINDOWS\system32\WS2_32.dll +0x000007fefdfc0000 - 0x000007fefdfc8000 C:\WINDOWS\system32\NSI.dll +0x000007fefaee0000 - 0x000007fefaf1b000 C:\WINDOWS\system32\WINMM.dll +0x000007fefc5f0000 - 0x000007fefc5fc000 C:\WINDOWS\system32\VERSION.dll +0x00000000776e0000 - 0x00000000776e7000 C:\WINDOWS\system32\PSAPI.DLL +0x00000000711e0000 - 0x00000000711ef000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\verify.dll +0x0000000065240000 - 0x0000000065269000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\java.dll +0x0000000055540000 - 0x0000000055575000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\jdwp.dll +0x00000000711d0000 - 0x00000000711d8000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\npt.dll +0x00000000003b0000 - 0x00000000003c6000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\zip.dll +0x000007fefe8f0000 - 0x000007feff67a000 C:\WINDOWS\system32\SHELL32.dll +0x000007fefdae0000 - 0x000007fefdce3000 C:\WINDOWS\system32\ole32.dll +0x000007fefd240000 - 0x000007fefd24f000 C:\WINDOWS\system32\profapi.dll +0x00000000711c0000 - 0x00000000711c9000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\dt_socket.dll +0x000007fefaa20000 - 0x000007fefaa35000 C:\WINDOWS\system32\NLAapi.dll +0x000007fef7bc0000 - 0x000007fef7bd5000 C:\WINDOWS\system32\napinsp.dll +0x000007fef7ba0000 - 0x000007fef7bb9000 C:\WINDOWS\system32\pnrpnsp.dll +0x000007fefca20000 - 0x000007fefca75000 C:\WINDOWS\System32\mswsock.dll +0x000007fefc8a0000 - 0x000007fefc8fb000 C:\WINDOWS\system32\DNSAPI.dll +0x000007fef7b90000 - 0x000007fef7b9b000 C:\WINDOWS\System32\winrnr.dll +0x000007fef7b80000 - 0x000007fef7b90000 C:\WINDOWS\system32\wshbth.dll +0x000007fefa330000 - 0x000007fefa357000 C:\WINDOWS\system32\IPHLPAPI.DLL +0x000007fefa320000 - 0x000007fefa32b000 C:\WINDOWS\system32\WINNSI.DLL +0x000007fef95a0000 - 0x000007fef95f3000 C:\WINDOWS\System32\fwpuclnt.dll +0x000007fef7010000 - 0x000007fef7018000 C:\WINDOWS\system32\rasadhlp.dll +0x000007fefc2d0000 - 0x000007fefc2d7000 C:\WINDOWS\System32\wshtcpip.dll +0x000000006f380000 - 0x000000006f39a000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\net.dll +0x000007fefca10000 - 0x000007fefca17000 C:\WINDOWS\System32\wship6.dll +0x000007fefca80000 - 0x000007fefca98000 C:\WINDOWS\system32\CRYPTSP.dll +0x000007fefc780000 - 0x000007fefc7c7000 C:\WINDOWS\system32\rsaenh.dll +0x000007fefd400000 - 0x000007fefd41e000 C:\WINDOWS\system32\USERENV.dll +0x000007fefd180000 - 0x000007fefd18f000 C:\WINDOWS\system32\CRYPTBASE.dll +0x000007fef9550000 - 0x000007fef9561000 C:\WINDOWS\system32\dhcpcsvc6.DLL +0x000007fef98c0000 - 0x000007fef98d8000 C:\WINDOWS\system32\dhcpcsvc.DLL +0x000000006f300000 - 0x000000006f311000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\nio.dll +0x000007fefd120000 - 0x000007fefd177000 C:\WINDOWS\system32\apphelp.dll +0x0000000051ba0000 - 0x0000000051bc4000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\sunec.dll +0x000007fef68d0000 - 0x000007fef69f5000 C:\WINDOWS\system32\dbghelp.dll + +VM Arguments: +jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:65399 -ea -Dlogback.configurationFile=src/test/resources/logback-test.xml -Dfile.encoding=Cp1252 +java_command: org.testng.remote.RemoteTestNG -serport 65394 -protocol json -d C:\Users\md9897\Projects\d2-sdnc\ui-ci\test-output C:\Users\md9897\AppData\Local\Temp\testng-eclipse-914658768\testng-customsuite.xml +java_class_path (initial): C:\Users\md9897\Desktop\eclipse\plugins\org.testng.eclipse_6.9.13.201609291640\lib\testng-remote.jar;C:\Users\md9897\Projects\d2-sdnc\ui-ci\target\test-classes;C:\Users\md9897\Projects\d2-sdnc\ui-ci\target\classes;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-java\2.45.0\selenium-java-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.45.0\selenium-chrome-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.45.0\selenium-remote-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-api\2.45.0\selenium-api-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-htmlunit-driver\2.45.0\selenium-htmlunit-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\net\sourceforge\htmlunit\htmlunit\2.15\htmlunit-2.15.jar;C:\Users\md9897\.m2\repository\xalan\xalan\2.7.1\xalan-2.7.1.jar;C:\Users\md9897\.m2\repository\xalan\serializer\2.7.1\serializer-2.7.1.jar;C:\Users\md9897\.m2\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.15\htmlunit-core-js-2.15.jar;C:\Users\md9897\.m2\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar;C:\Users\md9897\.m2\repository\net\sourceforge\nekohtml\nekohtml\1.9.21\nekohtml-1.9.21.jar;C:\Users\md9897\.m2\repository\net\sourceforge\cssparser\cssparser\0.9.14\cssparser-0.9.14.jar;C:\Users\md9897\.m2\repository\org\w3c\css\sac\1.3\sac-1.3.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-websocket\8.1.15.v20140411\jetty-websocket-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-util\8.1.15.v20140411\jetty-util-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-io\8.1.15.v20140411\jetty-io-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-http\8.1.15.v20140411\jetty-http-8.1.15.v20140411.jar;C:\Users\md9897\. +Launcher Type: SUN_STANDARD + +Environment Variables: +PATH=C:\Program Files\Java\jdk1.8.0_101\jre\bin;C:/Program Files/Java/jre1.8.0_101/bin/server;C:/Program Files/Java/jre1.8.0_101/bin;C:/Program Files/Java/jre1.8.0_101/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\GitExtensions\;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\WinSCP\;C:\Program Files (x86)\PuTTY\;C:\Program Files\nodejs\;C:\Users\md9897\AppData\Roaming\npm;C:\Users\md9897\Desktop\eclipse; +USERNAME=md9897 +OS=Windows_NT +PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 78 Stepping 3, GenuineIntel + + + +--------------- S Y S T E M --------------- + +OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23543) + +CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 78 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx + +Memory: 4k page, physical 16432244k(7214352k free), swap 32862628k(23040548k free) + +vm_info: Java HotSpot(TM) 64-Bit Server VM (25.101-b13) for windows-amd64 JRE (1.8.0_101-b13), built on Jun 22 2016 01:21:29 by "java_re" with MS VC++ 10.0 (VS2010) + +time: Wed Nov 09 17:56:52 2016 +elapsed time: 2632 seconds (0d 0h 43m 52s) + diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml index b221f8fab3..072a610360 100644 --- a/ui-ci/pom.xml +++ b/ui-ci/pom.xml @@ -10,69 +10,68 @@ <groupId>org.openecomp.sdc</groupId> <artifactId>sdc-main</artifactId> <version>1.1.0-SNAPSHOT</version> - </parent> <dependencies> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.7.10</version> - <scope>compile</scope> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> <scope>compile</scope> </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${lang3.version}</version> - <scope>compile</scope> - </dependency> - + <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> - <version>2.48.0</version> + <version>2.53.1</version> </dependency> - + <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>2.53.1</version> <scope>runtime</scope> </dependency> - -<!-- <dependency> - <groupId>org.seleniumhq.selenium</groupId> - <artifactId>selenium-firefox-driver</artifactId> - <version>3.0.1</version> - </dependency> --> - - + + <dependency> + <groupId>commons-net</groupId> + <artifactId>commons-net</artifactId> + <version>3.3</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + <scope>compile</scope> + </dependency> + <dependency> <groupId>org.openecomp.sdc</groupId> - <artifactId>asdc-tests</artifactId> - <version>${asdc-tests.version}</version> + <artifactId>test-apis-ci</artifactId> + <version>${project.version}</version> + <!-- <classifier>jar-with-dependencies</classifier> --> + <scope>compile</scope> </dependency> <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.14</version> + <version>${snakeyaml.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.functionaljava</groupId> + <artifactId>functionaljava</artifactId> + <version>${functionaljava.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> - <version>2.3.1</version> + <version>${gson.version}</version> <scope>compile</scope> </dependency> @@ -80,28 +79,42 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> + <version>${httpclient.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> - <version>${httpclient.version}</version> + <version>${httpclient.version}</version> <scope>compile</scope> </dependency> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.5</version> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging}</version> <scope>compile</scope> </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.2.1-SNAPSHOT</version> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j-api.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback.version}</version> <scope>compile</scope> </dependency> @@ -134,41 +147,46 @@ <version>1.9.2</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <!--<version>2.3.1</version>--> - <version>${jackson.version}</version> + <version>2.3.1</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <!--<version>2.3.1</version>--> - <version>${jackson.version}</version> + <version>2.3.1</version> <scope>compile</scope> </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson.annotations.version}</version> + <scope>compile</scope> + </dependency> <dependency> - <groupId>org.openecomp.sdc</groupId> + <groupId>org.openecomp.sdc.sdc-distribution-client</groupId> <artifactId>sdc-distribution-client</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.1.9-SNAPSHOT</version> <scope>compile</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.12</version> + <version>${junit.version}</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>6.9.10</version> + <version>${testng.version}</version> <scope>compile</scope> </dependency> @@ -178,41 +196,99 @@ <version>1.4.01</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> - <version>1.1</version> + <version>${json-simple.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-jci-core</artifactId> + <version>${commons-jci-core.version}</version> <scope>compile</scope> </dependency> <dependency> + <groupId>org.sikuli</groupId> + <artifactId>sikuli-api</artifactId> + <version>1.2.0</version> + </dependency> + + <dependency> + <groupId>org.sikuli</groupId> + <artifactId>sikuli-core</artifactId> + <version>1.2.2</version> + </dependency> + + <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> - <version>2.0-SNAPSHOT</version> + <version>${commons-codec}</version> <scope>compile</scope> </dependency> - + <dependency> - <groupId>com.relevantcodes</groupId> - <artifactId>extentreports</artifactId> - <version>2.41.1</version> + <groupId>com.aventstack</groupId> + <artifactId>extentreports</artifactId> + <version>3.0.6</version> + <scope>compile</scope> </dependency> - - + + <dependency> + <groupId>net.lightbody.bmp</groupId> + <!-- To use the legacy, Jetty-based implementation, + change the artifactId to browsermob-core --> + <artifactId>browsermob-core</artifactId> + <version>2.1.4</version> + </dependency> + + <dependency> + <groupId>com.github.markusbernhardt</groupId> + <artifactId>proxy-vole</artifactId> + <version>1.0.2</version> + </dependency> + + <dependency> + <groupId>com.paulhammant</groupId> + <artifactId>ngwebdriver</artifactId> + <version>0.9.7</version> + <scope>compile</scope> + </dependency> + </dependencies> - - - + <build> <plugins> + <!-- ================================================== --> + <!-- Get the next versions from the properties file. --> + <!-- ================================================== --> + <!--<plugin>--> + <!--<groupId>org.codehaus.mojo</groupId>--> + <!--<artifactId>properties-maven-plugin</artifactId>--> + <!--<version>1.0-alpha-1</version>--> + <!--<inherited>false</inherited>--> + + <!--<executions>--> + <!--<execution>--> + <!--<id>ui-ci</id>--> + <!--<phase>initialize</phase>--> + <!--<goals>--> + <!--<goal>read-project-properties</goal>--> + <!--</goals>--> + + <!--<configuration>--> + <!--<files>--> + <!--<file>../target/FullReleaseVersion.properties</file>--> + <!--</files>--> + <!--</configuration>--> + <!--</execution>--> + <!--</executions>--> + <!--</plugin>--> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> @@ -252,36 +328,27 @@ </plugins> </build> - - <profiles> <profile> - <id>CI</id> + <id>Fortify</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <plugins> + + <!-- =========================== --> + <!-- HP Fortify scanner --> + <!-- =========================== --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.5.5</version> - <executions> - <execution> - <id>tarball</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <finalName>${project.artifactId}-${full.release.version}${build.type}</finalName> - <appendAssemblyId>false</appendAssemblyId> - <descriptor>${project.basedir}/tarball.xml</descriptor> - <attach>false</attach> - </configuration> - </execution> - </executions> + <groupId>com.fortify.ps.maven.plugin</groupId> + <artifactId>sca-maven-plugin</artifactId> + <version>4.30</version> + <configuration> + <scanEnabled>false</scanEnabled> + <skip>true</skip> + </configuration> </plugin> </plugins> </build> diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java new file mode 100644 index 0000000000..a8e6501dff --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java @@ -0,0 +1,415 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + + +public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { + + private String filePath; + @BeforeClass + public void beforeClass(){ + filePath = System.getProperty("filepath"); + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar"+ File.separator; + } + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "AddComponentInstancesArtifactsInCsar"+ File.separator; + } + } + + // US847439 - Story [BE] - Add Component Instance's artifacts in CSAR + // TC1521795 - VF CSAR - The Flow + @Test + public void vfAndServicerCsarTheFlow() throws Exception{ + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String vnfFile = "FDNT.zip"; + String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + String vspName = createVSP.left; + resourceMetaData.setName(vspName); + Map<String, String> resourceMeta = createVSP.right; + String vspid = resourceMeta.get("vspId"); + OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); + OnboardingUtils.prepareVspForUse(getUser(), vspid); + + HomePage.showVspRepository(); + OnboardingUtils.importVSP(createVSP); + resourceMetaData.setVersion("0.1"); + Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion()); + + + Map<String, Object> artifacts = getArtifactsOfComponentAndComponentsInstance(vfResource); + + List<ImmutablePair<ComponentInstance, ArtifactDefinition>> artifactsUploadedToComponentInstance = new LinkedList<>(); + Random random = new Random(); + for(int i=0; i<random.nextInt(10) + 10; i++) { + ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomVfc = uploadArtifactOnRandomRI(vfResource); + + if(uploadArtifactOnRandomVfc.getRight().getArtifactName() != null) { + artifactsUploadedToComponentInstance.add(uploadArtifactOnRandomVfc); + } + } + + if(artifactsUploadedToComponentInstance.size() > 0) { + Map<String, Object> artifactsOfResourceInstance = getArtifactsOfResourceInstance(artifactsUploadedToComponentInstance); + artifacts.put("Resources", artifactsOfResourceInstance); + } + + + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + ToscaArtifactsPage.downloadCsar(); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + Map<String, Object> combineHeatArtifacstWithFolderArtifacsToMap = ArtifactFromCsar.getVFCArtifacts(latestFilefromDir.getAbsolutePath()); + + compareArtifactFromFileStructureToArtifactsFromJavaObject(artifacts, combineHeatArtifacstWithFolderArtifacsToMap); + + +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// // Submit for testing + certify +// DeploymentArtifactPage.clickSubmitForTestingButton(vspName); +// +// reloginWithNewRole(UserRoleEnum.TESTER); +// GeneralUIUtils.findComponentAndClick(vspName); +// TesterOperationPage.certifyComponent(vspName); +// +// reloginWithNewRole(UserRoleEnum.DESIGNER); +// // create service +// ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); +// ServiceUIUtils.createService(serviceMetadata, getUser()); +// serviceMetadata.setVersion("0.1"); +// +// +// // Upload informationl artifact to service +// ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); +// +// String HEAT_FILE_YAML_NAME = "Heat-File.yaml"; +// String DESCRIPTION = "kuku"; +// String ARTIFACT_LABEL = "artifact3"; +// +// ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER"); +// CompositionPage.showDeploymentArtifactTab(); +// CompositionPage.clickAddArtifactButton(); +// ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); +// +// ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE"); +// CompositionPage.showInformationArtifactTab(); +// CompositionPage.clickAddArtifactButton(); +// ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact, CompositionPage.artifactPopup()); +// +// +// +// // Add component instance to canvas of the service +// CompositionPage.searchForElement(vspName); +// CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); +// CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); +// +// Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion()); +// +//// ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", "OTHER", true, false); +//// RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(service, getUser(), artifactReqDetails); +//// Integer responseCode = restResponse.getErrorCode(); +//// Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct."); +//// +//// service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion()); +// +// Map<String, Object> artifactsService = getArtifactsOfComponentAndComponentsInstance(service); +// +// System.out.println("12354"); +// +// artifactsService.put(vfResource.getToscaResourceName(), artifacts); +// +// System.out.println("1234"); + + } + + public void compareArtifactFromFileStructureToArtifactsFromJavaObject(Map<String, Object> artifactFromJavaObject, Map<String, Object> artifactsFromFileStructure) { + for(String key: artifactFromJavaObject.keySet()) { + if((!key.equals("Deployment")) && (!key.equals("Informational"))) { + Map<String, Object> newArtifactFromJavaObject = (Map<String, Object>) artifactFromJavaObject.get(key); + Map<String, Object> newArtifactsFromFileStructure = (Map<String, Object>) artifactsFromFileStructure.get(key); + compareArtifactFromFileStructureToArtifactsFromJavaObject(newArtifactFromJavaObject, newArtifactsFromFileStructure); + } else { + compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key)); + } + + + + + } + } + + + private void compareArtifacts(Object artifactFromJavaObject, Object artifactsFromFileStructure) { + Map<String, List<String>> artifactsMap = (Map<String, List<String>>) artifactFromJavaObject; + List<HeatMetaFirstLevelDefinition> artifactsList = (List<HeatMetaFirstLevelDefinition>) artifactsFromFileStructure; + + for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) { + Assert.assertTrue(artifactsMap.get(heatMetaFirstLevelDefinition.getType()).contains(heatMetaFirstLevelDefinition.getFileName()), + "Expected that artifacts will be the same. Not exists: " + heatMetaFirstLevelDefinition.getFileName() + " of type: " + heatMetaFirstLevelDefinition.getType()); + } + + for(String key: artifactsMap.keySet()) { + List<String> artifacts = artifactsMap.get(key); + + for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) { + if(heatMetaFirstLevelDefinition.getType().equals(key)) { + if(artifacts.contains(heatMetaFirstLevelDefinition.getFileName())) { + artifacts.remove(heatMetaFirstLevelDefinition.getFileName()); + } + } + } + + Assert.assertEquals(artifacts.size(), 0, "Expected that all artifacts equal. There is artifacts which not equal: " + artifacts.toString()); + } + } + + + public Map<String, Object> getArtifactsOfResourceInstance(List<ImmutablePair<ComponentInstance, ArtifactDefinition>> riList) { + Map<String, Object> artifacts = new HashMap<>(); + + for(ImmutablePair<ComponentInstance, ArtifactDefinition> ri: riList) { + ArtifactDefinition artifactDefinition = ri.getRight(); + ComponentInstance componentInstance = ri.getLeft(); + if(artifacts.containsKey(componentInstance.getNormalizedName())) { + if( ((Map<String, ArrayList<String>>)((Map<String, Object>)artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).containsKey(artifactDefinition.getArtifactType()) ) { + + ((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).get(artifactDefinition.getArtifactType()).add(artifactDefinition.getArtifactName()); + + } else { + ArrayList<String> list = new ArrayList<String>(); + list.add(artifactDefinition.getArtifactName()); + ((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).put(artifactDefinition.getArtifactType(), list); + } + + } else { + try { + + + ArrayList<String> list = new ArrayList<String>(); + list.add(artifactDefinition.getArtifactName()); + + Map<String, ArrayList<String>> map = new HashMap<>(); + map.put(artifactDefinition.getArtifactType(), list); + + Map<String, Map<String, ArrayList<String>>> addMap = new HashMap<>(); + addMap.put("Deployment", map); + + artifacts.put(componentInstance.getNormalizedName(), addMap); + +// if(artifacts.size() == 0) { +// artifacts.put("Deployment", addMap); +// } else { +// ((Map<String, Map<String, ArrayList<String>>>) artifacts.get("Deployment")).putAll(addMap); +// } + } catch (Exception e) { + Assert.fail("Artifact name is null for componentInstance: " + componentInstance.getNormalizedName()); + } + } + } + return artifacts; + } + + public Map<String, Object> getArtifactsOfComponentAndComponentsInstance(Component component) { + Map<String, Object> artifacts = getArtifacstOfComponent(component); + + for(ComponentInstance componentInstance: component.getComponentInstances()) { + Map<String, Object> artifacstOfComponentInstance = getArtifacstOfComponentInstance(componentInstance); + if(artifacstOfComponentInstance.size() > 0) { + artifacts.put(componentInstance.getToscaComponentName() + "." + componentInstance.getComponentVersion(), artifacstOfComponentInstance); + } + } + + return artifacts; + } + + public Map<String, Object> getArtifacstOfComponentInstance(ComponentInstance componentInstance) { + Map<String, Object> map = new HashMap<>(); + + if(componentInstance.getArtifacts() != null) { + Map<String, Object> informationalArtifacts = getArtifacts(componentInstance.getArtifacts()); + if(informationalArtifacts.size() > 0) { + map.put("Informational", informationalArtifacts); + } + } + + if(componentInstance.getDeploymentArtifacts() != null) { + Map<String, Object> deploymentArtifacts = getArtifacts(componentInstance.getDeploymentArtifacts()); + if(deploymentArtifacts.size() > 0) { + map.put("Deployment", deploymentArtifacts); + } + } + + return map; + } + + public Map<String, Object> getArtifacstOfComponent(Component component) { + Map<String, Object> map = new HashMap<>(); + + if(component.getArtifacts() != null) { + Map<String, Object> informationalArtifacts = getArtifacts(component.getArtifacts()); + if(informationalArtifacts.size() > 0) { + map.put("Informational", informationalArtifacts); + } + } + + if(component.getDeploymentArtifacts() != null) { + Map<String, Object> deploymentArtifacts = getArtifacts(component.getDeploymentArtifacts()); + if(deploymentArtifacts.size() > 0) { + map.put("Deployment", deploymentArtifacts); + } + } + + return map; + } + + public Map<String, Object> getArtifacts(Map<String, ArtifactDefinition> artifacts) { + Map<String, Object> map = new HashMap<>(); + + for(String artifact: artifacts.keySet()) { + ArtifactDefinition artifactDefinition = artifacts.get(artifact); + if((artifactDefinition.getEsId() != null) && (!artifactDefinition.getEsId().equals("")) && (!artifactDefinition.getArtifactType().equals("HEAT_ENV"))) { + if(map.containsKey(artifactDefinition.getArtifactType())) { + ((List<String>) map.get(artifactDefinition.getArtifactType())).add(artifactDefinition.getArtifactName()); + } else { + ArrayList<String> list = new ArrayList<String>(); + list.add(artifactDefinition.getArtifactName()); + map.put(artifactDefinition.getArtifactType(), list); + } + } + } + + return map; + } + + public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Component component) throws IOException, Exception { + ArtifactReqDetails artifactReqDetails = getRandomArtifact(); + Random random = new Random(); + int randInt = random.nextInt(component.getComponentInstances().size()); + User defaultUser = ElementFactory.getDefaultUser(getRole()); + ComponentInstance componentInstance = component.getComponentInstances().get(randInt); + + RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, defaultUser, artifactReqDetails, componentInstance); + + // Check response of external API + Integer responseCode = uploadArtifactRestResponse.getErrorCode(); + Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct."); + + ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse())); + + return pair; + } + + public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Resource resource) throws IOException, Exception { + ArtifactReqDetails artifactReqDetails = getRandomVfcArtifact(); + Random random = new Random(); + int randInt = random.nextInt(resource.getComponentInstances().size()); + User defaultUser = ElementFactory.getDefaultUser(getRole()); + ComponentInstance componentInstance = resource.getComponentInstances().get(randInt); + + RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resource, defaultUser, artifactReqDetails, componentInstance); + + + + // Check response of external API + Integer responseCode = uploadArtifactRestResponse.getErrorCode(); + + if(responseCode.equals(404)) { + getExtendTest().log(Status.SKIP, String.format("DE271521")); + throw new SkipException("DE271521"); + } + + Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct."); + + ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse())); + + return pair; + } + + public ArtifactReqDetails getRandomArtifact() throws IOException, Exception { + List<String> artifactsTypeList = Arrays.asList("Other"); + return getRandomArtifact(artifactsTypeList); + } + + public ArtifactReqDetails getRandomVfcArtifact() throws IOException, Exception { + List<String> vfcArtifactsTypeList = Arrays.asList("DCAE_INVENTORY_TOSCA", "DCAE_INVENTORY_JSON", "DCAE_INVENTORY_POLICY", "DCAE_INVENTORY_DOC", + "DCAE_INVENTORY_BLUEPRINT", "DCAE_INVENTORY_EVENT", "SNMP_POLL", "SNMP_TRAP"); + return getRandomArtifact(vfcArtifactsTypeList); + } + + public ArtifactReqDetails getRandomArtifact(List<String> artifactType) throws IOException, Exception { + Random random = new Random(); + + ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType.get(random.nextInt(artifactType.size())), true, false); + return artifactReqDetails; + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java new file mode 100644 index 0000000000..913064b7fd --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java @@ -0,0 +1,343 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.testng.SkipException; +import org.testng.annotations.Test; + +public class ImportUpdateInformationalDeploymentArtifacts extends SetupCDTest { + + private String folder ="US747946"; + + // US747946 - Import artifacts to component instances + // TC1407822 - Import VFC Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types + @Test + public void importVfvArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception { + + if(true){ + throw new SkipException("Open bug 197126"); + } + + String filePath = FileHandling.getFilePath(folder); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String fileName = "TC1407822.csar"; + + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + + List<String> snmpPollArtifactList = Stream + .of("base_cgi_frwl.mib", "base_vIECCF_volume.yml", "node_userdata_script.sh", "vendor-license-model.xml") + .collect(Collectors.toList()); + List<String> snmpTrapArtifactList = Stream + .of("module_1_ixlt.mib", "module_1_ixlt.yaml") + .collect(Collectors.toList()); + + + List<ArtifactDefinition> filteredArtifactNames = + //Stream of component Instances + resource.getComponentInstances().stream() + //Stream of all the artifacts on all the component instances + .flatMap( e -> e.getDeploymentArtifacts().values().stream()) + //filter relevant artifact types + .filter( e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()) || e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType())) + //collect to list + .collect(Collectors.toList()); + + + assertTrue("Not contain all SNMP TRAP artifacts.", filteredArtifactNames.stream() + .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType())) + .map(e -> e.getArtifactName()) + .collect(Collectors.toList()) + .containsAll(snmpTrapArtifactList)); + + assertTrue("Not contain all SNMP POLL artifacts.", filteredArtifactNames.stream() + .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType())) + .map(e -> e.getArtifactName()) + .collect(Collectors.toList()) + .containsAll(snmpPollArtifactList)); + + filteredArtifactNames.stream() + .map(e->e.getArtifactDisplayName()) + .collect(Collectors.toList()) + .forEach(e -> { + assertTrue("Wrong artifact appear on deployment artifact UI page.", + !GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + e)); + }); + + } + + + + // US747946 - Import artifacts to component instances + // TC1408044 - Import VFC Artifacts - Informational Artifacts on Single VFC + @Test + public void importVfcArtifactsInformationalArtifactsOnSingleVfc() throws Exception { + + if(true){ + throw new SkipException("Open bug 197126"); + } + + String filePath = FileHandling.getFilePath(folder); + String fileName = "TC1408044.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + + resource.getComponentInstances().forEach(e -> { + + if(e.getToscaComponentName().endsWith("heat.ltm")) { + Map<String, List<String>> artifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("module_1_ldsa.yaml", "vendor-license-model.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("module_2_ldsa.yaml", "vf-license-model.xml")); + } + }; + + validateInformationalArtifactOnComponetInstance(e, artifactsMap, "heat.ltm"); + } + }); + } + + // TODO: Note there is performance issue with this CSAR + // US747946 - Import artifacts to component instances + // TC1407998 - Import VFC Artifacts - Deployment & Informational Artifacts - Multiple VFCs + @Test + public void importVfcArtifactsDeploymentAndInformationalArtifactsMultipleVfcs() throws Exception { + + if(true){ + throw new SkipException("Open bug 197126"); + } + + String filePath = FileHandling.getFilePath(folder); + String fileName = "TC1407998.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + +// resourceMetaData.setName("TC1407998"); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + + resource.getComponentInstances().forEach(e -> { + + if(e.getToscaComponentName().endsWith("heat.ps")) { + Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("PS_DEPL_Poll1.mib", "PS_DEPL_Poll2.xml", "PS_DEPL_Poll3.yaml")); + put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("PS_DEPL_Trap1.mib", "PS_DEPL_Trap2.xml", "PS_DEPL_Trap3.sh", "PS_DEPL_Trap4.yml")); + } + }; + validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ps"); + + Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("PS_INFO_GUIDE1.yaml", "PS_INFO_GUIDE2.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("PS_INFO_OTHER1.yaml", "PS_INFO_OTHER2.xml")); + } + }; + validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ps"); + + + } else if (e.getToscaComponentName().endsWith("heat.sm")) { + Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("SM_DEPL_Poll1.mib", "SM_DEPL_Poll2.mib", "SM_DEPL_Poll3.xml")); + put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("SM_DEPL_Trap1.mib", "SM_DEPL_Trap2.xml")); + } + }; + validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.sm"); + + Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("SM_INFO_GUIDE1.yaml", "SM_INFO_GUIDE2.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("SM_INFO_OTHER1.yaml", "SM_INFO_OTHER2.xml")); + } + }; + validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.sm"); + } + }); + + } + + // US747946 - Import artifacts to component instances + // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Extra folder Under VFC-Identification + @Test + public void importVfcArtifactsDeploymentArtifactsExtraFolderUnderVfcIdentification() throws Exception { + + if(true){ + throw new SkipException("Open bug 197126"); + } + + String filePath = FileHandling.getFilePath(folder); + String fileName = "TC1410352.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + +// resourceMetaData.setName("TC1410352"); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + + resource.getComponentInstances().forEach(e -> { + + if(e.getToscaComponentName().endsWith("heat.ltm")) { + Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("Poll1.mib", "Poll2.xml", "Poll3.sh", "Poll4.yml")); + put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("Trap1.mib", "Trap2.yaml")); + } + }; + validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm"); + + Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("GUIDE1.yaml", "GUIDE2.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("OTHER1.yaml", "OTHER2.xml")); + } + }; + validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm"); + } + }); + } + + + // US747946 - Import artifacts to component instances + // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Invalid Artifact Type + @Test + public void importVfcArtifactsDeploymentArtifactsInvalidArtifactType() throws Exception { + + if(true){ + throw new SkipException("Open bug 197126"); + } + + String filePath = FileHandling.getFilePath(folder); + String fileName = "TC1425032.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + +// resourceMetaData.setName("TC1425032"); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + + resource.getComponentInstances().forEach(e -> { + + if(e.getToscaComponentName().endsWith("heat.ltm")) { + Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("DeploySNMPPoll1.mib", "DeploySNMPPoll2.yml", "DeploySNMPPoll3.sh", "DeploySNMPPoll4.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("DeploySNMPTrapB1.mib", "DeploySNMPTrapB2.yaml")); + } + }; + validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm"); + + Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() { + { + put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("InfoGuide1.yaml", "InfoGuide2.xml")); + put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("InfoOther1.yaml", "InfoOther2.xml", "InfoInvalid1.yaml")); + } + }; + validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm"); + } + }); + } + + + private void validateInformationalArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){ + if(instacne.getToscaComponentName().endsWith(endswith) ){ + Set<String> types = artifactsMap.keySet(); + + Map<String, List<ArtifactDefinition>> collect = instacne.getArtifacts().values().stream() + .filter( a -> types.contains(a.getArtifactType())) + .collect(Collectors.groupingBy( e -> e.getArtifactType())); + + types.forEach(m -> { + if(collect.containsKey(m)){ + List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList()); + boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found); + assertTrue("Not contain all artifact of type: " + m, isValid); + } else{ + assertTrue("Contains informational artifact which not in provided list", false); + } + }); + } + } + + private void validateDeploymentArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){ + if(instacne.getToscaComponentName().endsWith(endswith) ){ + Set<String> types = artifactsMap.keySet(); + + Map<String, List<ArtifactDefinition>> collect = instacne.getDeploymentArtifacts().values().stream() + .filter( a -> types.contains(a.getArtifactType())) + .collect(Collectors.groupingBy( e -> e.getArtifactType())); + + types.forEach(m -> { + if(collect.containsKey(m)){ + List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList()); + boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found); + assertTrue("Not contain all artifact of type: " + m, isValid); + } else{ + assertTrue("Contains deployment artifact which not in provided list", false); + } + }); + } + } + + + + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java new file mode 100644 index 0000000000..dff10dba49 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java @@ -0,0 +1,226 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.InputsPage; +import org.openecomp.sdc.ci.tests.pages.PropertyPopup; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.TestException; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +public class Inputs extends SetupCDTest { + + private static final String DESCRIPTION = "kuku"; + private static final String ARTIFACT_LABEL = "artifact3"; + private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate"; + private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact"; + private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml"; + private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml"; + private String filePath; + + @BeforeMethod + public void beforeTest(){ + filePath = FileHandling.getFilePath(""); + } + + // TODO: There is defect that imported VFC checkin not appear in service until refresh + // TODO: add support for CP (there is no normative CP's with complex properties which can be selected - import one) - importVFCWithComplexProperty.yml + // TC1508249 + // Delete Input declared from VLi/CPi in service level - Deleting an Input that was declared from Complex property. + @Test + public void deletingAnInputThatWasDeclaredFromComplexProperty() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + Map<String, List<String>> resourceInstanceToProperty = new HashMap<>(); + CompositionPage.searchForElement("ExtVL"); + CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL"); + canvasManager.clickOnCanvaElement(computeElement); + resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), Arrays.asList("network_homing", "instance_node_target")); + +// CompositionPage.searchForElement("ExtCP"); +// computeElement = canvasManager.createElementOnCanvas("ExtCP"); +// canvasManager.clickOnCanvaElement(computeElement); +// resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order"); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + DeploymentArtifactPage.getLeftMenu().moveToInputsScreen(); + + + for(String element: resourceInstanceToProperty.keySet()) { + String propertyName = resourceInstanceToProperty.get(element).get(0); + String innerPropertyName = resourceInstanceToProperty.get(element).get(1); + String dataTestIdPropertyCheckbox = DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + propertyName; + + GeneralUIUtils.clickOnElementByText(element); + GeneralUIUtils.ultimateWait(); + + InputsPage.clickOnProperty(propertyName); + + PropertyPopup propertyPopup = new PropertyPopup(); + propertyPopup.selectPropertyRadioButton(innerPropertyName); + propertyPopup.clickSave(); + + InputsPage.clickOnAddInputButton(); + + // Verify that input checkbox selected + verifyPropertyCheckBoxSelected(dataTestIdPropertyCheckbox); + + InputsPage.deleteServiceInput(element, propertyName + "_" + innerPropertyName); + + // Trying to find deleted service input + try{ + InputsPage.getServiceInput(element, propertyName + "_" + innerPropertyName); + assert(false); + } catch(TestException e){ + System.out.println("Verfied that service input deleted"); + } + + // Verify that input checkbox not selected + verifyPropertyCheckBoxNotSelected(dataTestIdPropertyCheckbox); + + GeneralUIUtils.clickOnElementByText(element); + GeneralUIUtils.ultimateWait(); + } + + } + + + // TC1508248 + // Delete inputs who come from CP/VL properties + @Test + public void deleteInputsWhoComeFromCpVlProperties() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + Map<String, String> resourceInstanceToProperty = new HashMap<>(); + CompositionPage.searchForElement("ExtVL"); + CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL"); + canvasManager.clickOnCanvaElement(computeElement); + resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "network_role"); + + CompositionPage.searchForElement("ExtCP"); + computeElement = canvasManager.createElementOnCanvas("ExtCP"); + canvasManager.clickOnCanvaElement(computeElement); + resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order"); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + DeploymentArtifactPage.getLeftMenu().moveToInputsScreen(); + + + for(String element: resourceInstanceToProperty.keySet()) { + GeneralUIUtils.clickOnElementByText(element); + GeneralUIUtils.ultimateWait(); + + WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element)); + InputsPage.clickOnVFInputCheckbox(webElementByTestID); + + InputsPage.clickOnAddInputButton(); + + // Verify that input checkbox selected + verifyPropertyCheckBoxSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element)); + + InputsPage.deleteServiceInput(element, resourceInstanceToProperty.get(element)); + + // Trying to find deleted service input + try{ + InputsPage.getServiceInput(element, resourceInstanceToProperty.get(element)); + assert(false); + } catch(TestException e){ + System.out.println("Verfied that service input deleted"); + } + + // Verify that input checkbox not selected + verifyPropertyCheckBoxNotSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element)); + + GeneralUIUtils.clickOnElementByText(element); + GeneralUIUtils.ultimateWait(); + } + + } + + + + + + + + public String verifyPropertyCheckBox(String dataTestId) { + WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(dataTestId); + webElementByTestID = webElementByTestID.findElement(By.className("tlv-checkbox-i")); + if(webElementByTestID.getAttribute("checked") == null) { + return "false"; + } + return "true"; + } + + public void verifyPropertyCheckBoxSelected(String dataTestId) { + if(!verifyPropertyCheckBox(dataTestId).equals("true")) { + Assert.assertEquals(true, false, "Expected that checkbox will be selected."); + } + } + + public void verifyPropertyCheckBoxNotSelected(String dataTestId) { + if(!verifyPropertyCheckBox(dataTestId).equals("false")) { + Assert.assertEquals(false, true, "Expected that checkbox will not be selected."); + } + } + + public String getNormalizedName(String notNormalizedName) { + String normalizedName = notNormalizedName.toLowerCase(); + normalizedName = normalizedName.replaceAll(" ", ""); + + return normalizedName; + } + + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java new file mode 100644 index 0000000000..fb1798d0c9 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.json.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; + +import com.clearspring.analytics.util.Pair; + +public class LocalGeneralUtilities { + + public LocalGeneralUtilities() { + // TODO Auto-generated constructor stub + } + public static final String FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\VNFs\\"; + public static final String Env_FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\Env_files\\"; + public static String downloadPath = "C:\\Users\\th0695\\Downloads"; + +public static String getValueFromJsonResponse(String response, String fieldName) { + try { + JSONObject jsonResp = (JSONObject) JSONValue.parse(response); + Object fieldValue = jsonResp.get(fieldName); + return fieldValue.toString(); + + } catch (Exception e) { + return null; + } + +} + +public static List<String> getValuesFromJsonArray(RestResponse message) throws Exception { + List<String> artifactTypesArrayFromApi = new ArrayList<String>(); + + org.json.JSONObject responseObject = new org.json.JSONObject(message.getResponse()); + JSONArray jArr = responseObject.getJSONArray("componentInstances"); + + for (int i = 0; i < jArr.length(); i++) { + org.json.JSONObject jObj = jArr.getJSONObject(i); + String value = jObj.get("uniqueId").toString(); + + artifactTypesArrayFromApi.add(value); + } + return artifactTypesArrayFromApi; +} + +public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception { + OnboardingUtils.createVendorLicense(user); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils + .createVendorSoftwareProduct(fileName, filePath, user); + String vspName = createVendorSoftwareProduct.left; + HomePage.showVspRepository(); + OnboardingUtils.importVSP(createVendorSoftwareProduct); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click(); + GeneralUIUtils.waitForLoader(); + return vspName; +} + +//check if file downloaded successfully. +public static boolean isFileDownloaded(String downloadPath, String fileName) { + boolean flag = false; + File dir = new File(downloadPath); + File[] dir_contents = dir.listFiles(); + for (int i = 0; i < dir_contents.length; i++) { + if (dir_contents[i].getName().equals(fileName)) + return flag = true; + } + return flag; +} +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java new file mode 100644 index 0000000000..949a20b4a9 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java @@ -0,0 +1,269 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + + +public class MIBsArtifactsOnResourceInstance extends SetupCDTest { + + private String folder =""; + + @DataProvider(name="mibsArtifactCRUDUi") + public static Object[][] dataProviderMibsArtifactCRUDUi() { + return new Object[][] { + {"mibsvFW_VFC.yml", ResourceTypeEnum.VFC}, + {"mibsVL.yml", ResourceTypeEnum.VL}, + {"mibsCP.yml", ResourceTypeEnum.CP} + }; + } + + // US820414 + // Artifact UI CRUD on VFC/VL/CP + // TODO: Change download validation from download artifact via external API to UI + @Test(dataProvider="mibsArtifactCRUDUi") + public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception { + setLog("mibsArtifactCRUDUi"); + String filePath = FileHandling.getFilePath(folder); + + if(true){ + throw new SkipException("Open bug 197101"); + } + + // import Resource + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser()); + ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser()); + + // get resourceUUID from BE + String resourceUUID = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1").getUUID(); + + // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL. + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true)); + + assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + + String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "1", deploymentArtifact.getArtifactType(), true, true, true, false); + + // Verify that uploaded correct file by download artifact via external api + RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString()); + File file = new File(deploymentArtifact.getFilepath() + deploymentArtifact.getFilename()); + String readFileToString = FileUtils.readFileToString(file); + Assert.assertEquals(restResponse.getResponse(), readFileToString); + + DeploymentArtifactPage.clickEditArtifact(deploymentArtifact.getArtifactLabel()); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true); + artifactPopup.loadFile(filePath, "CP.yml"); + artifactPopup.clickDoneButton(); + + assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(), artifactUUID); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "2", deploymentArtifact.getArtifactType(), true, true, true, false); + + // Verify that updated correct file by download artifact via external api + artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(); + restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString()); + file = new File(deploymentArtifact.getFilepath() + "CP.yml"); + readFileToString = FileUtils.readFileToString(file); + Assert.assertEquals(restResponse.getResponse(), readFileToString); + + DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifact.getArtifactLabel()); + DeploymentArtifactPage.clickOK(); + + assertTrue("No artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(0)); + } + + } + + @DataProvider(name="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption") + public static Object[][] dataProviderMibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption() { + return new Object[][] { + {"mibs1vFW_VFC.yml", ResourceTypeEnum.VFC}, + // TODO: delete comment below when we will have support for VL on canvas +// {"mibs1VL.yml", ResourceTypeEnum.VL}, + {"mibs1CP.yml", ResourceTypeEnum.CP} + }; + } + + // US820414 + // Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option + @Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption") + public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception { + + setLog("mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption"); + + String filePath = FileHandling.getFilePath(folder); + + // import Resource + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser()); + ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser()); + + // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL. + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true)); + } + assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + // 3. Check-in DataProvider resource. + ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); + + // 4. Create VF. + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + // 5. Click on composition. + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + // 6. Drag created DataProvider resource to canvas. + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(resourceMetaData.getName()); + CanvasElement resourceInstance = vfCanvasManager.createElementOnCanvas(resourceMetaData.getName()); + + // 7. Click on DataProvider resource. + vfCanvasManager.clickOnCanvaElement(resourceInstance); + + // 8. Click on deployment artifacts in right menu. + CompositionPage.showDeploymentArtifactTab(); + + // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts. + // 10. Verify that only have download option. + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + // Hover over webelement -> check that only dowload button displayed + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel()); + Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel()); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false); + } + + + } + + // US820414 + // Create VF, upload MIBs artifacts then drag it on service & verify that deployment artifact have only download option + @Test + public void mibsArtifacsOnVFInstanceShouldOnlyHaveDownloadOption() throws Exception { + String filePath = FileHandling.getFilePath(folder); + + // 1. Create VF. + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + + // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL. + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true)); + } + assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + // 3. Check-in VF. + ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); + + // 4. Create service. + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + // 5. Click on composition. + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + // 6. Drag created DataProvider s to canvas. + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(resourceMetaData.getName()); + CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName()); + + // 7. Click on DataProvider resource. + canvasManager.clickOnCanvaElement(resourceInstance); + + // 8. Click on deployment artifacts in right menu. + CompositionPage.showDeploymentArtifactTab(); + + // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts. + // 10. Verify that only have download option. + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + // Hover over webelement -> check that only dowload button displayed + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel()); + Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel()); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false); + } + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java new file mode 100644 index 0000000000..179c300a18 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; +import java.util.List; + +import java.net.Proxy; + +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.remote.CapabilityType; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.testng.AssertJUnit; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.github.markusbernhardt.proxy.ProxySearch; +import com.github.markusbernhardt.proxy.ProxySearch.Strategy; + +import net.lightbody.bmp.BrowserMobProxyServer; +import net.lightbody.bmp.client.ClientUtil; +import net.lightbody.bmp.core.har.Har; +import net.lightbody.bmp.proxy.CaptureType; + +public class MobProxy { + public static WebDriver driver; + public static BrowserMobProxyServer server; + + @BeforeClass + public void setup() throws Exception { + + ProxySearch proxySearch = new ProxySearch(); + proxySearch.addStrategy(Strategy.OS_DEFAULT); + proxySearch.addStrategy(Strategy.JAVA); + proxySearch.addStrategy(Strategy.BROWSER); + ProxySelector proxySelector = proxySearch.getProxySelector(); + + ProxySelector.setDefault(proxySelector); + URI home = URI.create("http://www.google.com"); + System.out.println("ProxySelector: " + proxySelector); + System.out.println("URI: " + home); + List<Proxy> proxyList = proxySelector.select(home); + String host = null; + String port = null; + if (proxyList != null && !proxyList.isEmpty()) { + for (Proxy proxy : proxyList) { + System.out.println(proxy); + SocketAddress address = proxy.address(); + if (address instanceof InetSocketAddress) { + host = ((InetSocketAddress) address).getHostName(); + port = Integer.toString(((InetSocketAddress) address).getPort()); + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", port); + } + } + } + + server = new BrowserMobProxyServer(); + InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port)); + server.setChainedProxy(address); + server.start(); + int port1 = server.getPort(); + DesiredCapabilities seleniumCapabilities = new DesiredCapabilities(); + seleniumCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); + seleniumCapabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(server)); + driver = new FirefoxDriver(seleniumCapabilities); + server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT); + System.out.println("Port started:" + port1); + } + + @Test + public void first_test1() throws InterruptedException { + + server.newHar("asdc.har"); + + driver.get("https://www.e-access.att.com/QA-SCRUM1/sdc1/portal#/dashboard"); + driver.manage().window().maximize(); + + WebElement userNameTextbox = driver.findElement(By.name("userid")); + userNameTextbox.sendKeys("m99121"); + WebElement passwordTextbox = driver.findElement(By.name("password")); + passwordTextbox.sendKeys("66-Percent"); + + WebElement submitButton = driver.findElement(By.name("btnSubmit")); + submitButton.click(); + Thread.sleep(300); + WebElement buttonOK = driver.findElement(By.name("successOK")); + AssertJUnit.assertTrue(buttonOK.isDisplayed()); + buttonOK.click(); + Thread.sleep(2000); + driver.findElement(By.xpath(getXpath("main-menu-button-catalog"))).click(); + Thread.sleep(2000); + driver.findElement(By.xpath(getXpath("checkbox-service"))).click(); + Thread.sleep(2000); + } + + public static String getXpath(String dataTestId){ + return String.format("//*[@data-tests-id='%s']", dataTestId); + } + + @AfterClass + public void shutdown() { + try { + + // Get the HAR data + Har har = server.getHar(); + File harFile = new File("C:\\temp\\asdc.har"); + har.writeTo(harFile); + + } catch (IOException ioe) { + ioe.printStackTrace(); + } + driver.quit(); + server.stop(); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java new file mode 100644 index 0000000000..9d460b0b0c --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import static org.testng.AssertJUnit.assertTrue; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.testng.Assert; +import org.testng.annotations.Test; + + +public class NewArtifactTypeGuide extends SetupCDTest { + + private String folder =""; + + // US820276 + // Upload information artifact of type GUIDE to VF + @Test + public void crudGuideInformationArtifactForVf() throws Exception { + String filePath = FileHandling.getFilePath(folder); + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE"); + + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact); + + assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + + String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false); + + InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel()); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(); + artifactPopup.loadFile(filePath, "CP.yml"); + artifactPopup.clickDoneButton(); + + assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false); + + InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel()); + InformationalArtifactPage.clickOK(); + } + + // US820276 + // Upload information artifact of type GUIDE to VFC + @Test + public void crudGuideInformationArtifactForVfc() throws Exception { + String filePath = FileHandling.getFilePath(folder); + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser()); + ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser()); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE"); + + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact); + + assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false); + + InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel()); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(); + artifactPopup.loadFile(filePath, "CP.yml"); + artifactPopup.clickDoneButton(); + + assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1)); + Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID); + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false); + + InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel()); + InformationalArtifactPage.clickOK(); + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java new file mode 100644 index 0000000000..1f85ec21fb --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.testng.annotations.Test; + + +public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest { + + private String folder =""; + + // US833330 - Story [BE] - remove restriction of deployment artifacts + // Create service without resource instance and without deployment artifacts and verify it can submit for testing + @Test + public void createServiceWithoutRIAndArtifacts() throws Exception { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + } + + + // US833330 - Story [BE] - remove restriction of deployment artifacts + // Create service with VL resource instance and without deployment artifacts and verify it can submit for testing + @Test + public void createServiceWithVlAndWithoutArtfiacts() throws Exception { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK); + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK); + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK); + + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + } + + // US833330 - Story [BE] - remove restriction of deployment artifacts + // Create service with VF with informational artifacts and verify it can submit for testing + @Test + public void createServiceWithInformationalArtifacts() throws Exception { + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + String filePath = FileHandling.getFilePath(folder); + List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>(); + informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); + informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE")); + for (ArtifactInfo informationalArtifact : informationalArtifactList) { + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true)); + } + ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(resourceMetaData.getName()); + TesterOperationPage.certifyComponent(resourceMetaData.getName()); + reloginWithNewRole(UserRoleEnum.DESIGNER); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName()); + + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java new file mode 100644 index 0000000000..80801afafb --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.sanity.Onboard; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.testng.annotations.Test; + +import com.clearspring.analytics.util.Pair; + +public class Service_Tests_UI extends SetupCDTest{ + + public Service_Tests_UI() { + // TODO Auto-generated constructor stub + } + + // US839610 - E2E Declare VL / CP properties as inputs in service level + @Test + public void declareVL_CP_InputsInServiceLevel() throws Exception { + String vnfFile = "FDNT.zip"; + Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); + ServiceUIUtils.createService(servicemetadata, getUser()); + GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); + CanvasManager service_CanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(VspName.left); + GeneralUIUtils.waitForLoader(); + CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()) + .click(); + GeneralUIUtils.findComponentAndClick(servicemetadata.getName()); + GeneralUIUtils.moveToStep(StepsEnum.INPUTS); + GeneralUIUtils.getWebElementByTestID("inputs-vf-instance-1").click(); +// GeneralUIUtils.onNameClicked(input); + } + @Test + public void CreateServiceWithCpInstance() throws Exception { + String vnfFile = "FDNT.zip"; + Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); + ServiceUIUtils.createService(servicemetadata, getUser()); + GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); + CanvasManager service_CanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(VspName.left); + GeneralUIUtils.waitForLoader(); + CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()) + .click(); + GeneralUIUtils.findComponentAndClick(servicemetadata.getName()); + GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW); + String version = GeneralUIUtils.getWebElementByTestID("versionHeader").getText(); + RestResponse service = ServiceRestUtils.getServiceByNameAndVersion(getUser(), servicemetadata.getName(), + version.substring(1)); + List<String> serviceResponseArray = new ArrayList<String>(); + serviceResponseArray =LocalGeneralUtilities.getValuesFromJsonArray(service); + servicemetadata.setUniqueId(serviceResponseArray.get(0)); + RestResponse serviceResponse = ServiceRestUtils.getService(servicemetadata, getUser()); + if (serviceResponseArray.get(0).contains("VL")) { + System.out.println("OK"); + } + + } + + @Override + protected UserRoleEnum getRole() { + // TODO Auto-generated method stub + return UserRoleEnum.DESIGNER; + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java new file mode 100644 index 0000000000..089ad9580f --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.testng.Assert; + + + + + + +public class Testing { + + public static void main(String[] args) throws Exception { + // TODO Auto-generated method stub + + File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml"); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); + + Map<String, Object> vl_us831517_1 = new HashMap<String, Object>(); + vl_us831517_1.put("property_1", true); + vl_us831517_1.put("property_2", "init_value_2"); + vl_us831517_1.put("property_3", "init_value_3"); + + + Map<String, Object> vl_us831517_2 = new HashMap<String, Object>(); + vl_us831517_2.put("property_1", false); + vl_us831517_2.put("property_2", "init_value_2"); + vl_us831517_2.put("property_3", "new_value_3"); + + Map<String, Object> vl_us831517_3 = new HashMap<String, Object>(); + vl_us831517_3.put("property_1", true); + vl_us831517_3.put("property_2", "init_value_2"); + vl_us831517_3.put("property_3", "init_value_3"); + vl_us831517_3.put("property_4", false); + vl_us831517_3.put("property_5", "init_value_5"); + + Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>(); + predefinedProperties.put("VL_US831517_1", vl_us831517_1); + predefinedProperties.put("VL_US831517_2", vl_us831517_2); + predefinedProperties.put("VL_US831517_3", vl_us831517_3); + + validateNodeTemplatesProperties(predefinedProperties, toscaDefinition); + + + + } + + + + private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) { + + for(String key: predefinedMap.keySet()) { + Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition); + + predefinedMap.get(key).forEach((i,j) -> { + Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal"); + }); + } + + } + + // Get properties by type + private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) { + Map<String, Object> propertiesMap = null; + + Set<String> nodeTemplates = getNodeTemplates(toscaDefinition); + + for(String nodeTemplate: nodeTemplates) { + String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate); + currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1); + if(currentNodeTemplateType.equals(nodeTemplateType)) { + propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate); + break; + } + } + + return propertiesMap; + } + + // Get node templates + private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) { + Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet(); + return resourceInstanceArray; + } + + // Get type of node template + private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) { + return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType(); + } + + // Get properties of node template + private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) { + Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties(); + return propertiesMap; + } + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java new file mode 100644 index 0000000000..a038c284e1 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import static org.testng.AssertJUnit.assertNotNull; + +import java.awt.AWTException; +import java.io.File; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.DownloadManager; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.CsarParserUtils; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; +import org.testng.annotations.Test; + +import com.clearspring.analytics.util.Pair; +import com.aventstack.extentreports.Status; + +/** + * @author al714h + * + */ + +public class VfModule extends SetupCDTest { + + + @Test + public void checkVfModulesCountAndStructure() throws Exception, AWTException { + +// String filepath = "src\\main\\resources\\Files\\VNFs"; + String filepath = FileHandling.getVnfRepositoryPath(); +// String vnfFile = "LDSA.zip"; + String vnfFile = "FDNT.zip"; + getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); + System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); + String vspName = createVendorSoftwareProduct.left; + // + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir); + // + getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); + HomePage.showVspRepository(); + getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); + + OnboardingUtils.importVSP(createVendorSoftwareProduct); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + // Verify deployment artifacts + Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath()); + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); + for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { + if(deploymentArtifact.getType().equals("HEAT_ENV")) { + continue; + } + System.out.println("--------------"); + System.out.println(deploymentArtifact.getFileName()); + System.out.println(deploymentArtifact.getType()); +// System.out.println(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."))); + if(deploymentArtifact.getFileName().contains(".")) { + ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType()); + } else { + ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType()); + } + + } + + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + + DeploymentArtifactPage.clickSubmitForTestingButton(vspName); + + // create service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CompositionPage.searchForElement(vspName); + CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); + assertNotNull(vfElement); + ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue()); + latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + +// verification + Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion()); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(latestFilefromDir); + +// compare number of vf modules defined in HEAT.meta file vs Service TOSCA yaml + VfModuleVerificator.compareNumberOfVfModules(listTypeHeatMetaDefinition, toscaDefinition); + VfModuleVerificator.verifyGroupMetadata(toscaDefinition, service); + + getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile)); + + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java new file mode 100644 index 0000000000..71c2612a82 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.awt.AWTException; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ArtifactPageEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.sanity.Onboard; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class Vf_Tests_UI extends SetupCDTest{ + + public Vf_Tests_UI() { + // TODO Auto-generated constructor stub + } + public void uploadHeatEnvVFLevel() throws Exception { + + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + } + +// @Test +// // Download ENV file from VF level. +// public void downloadEnvVFLevel() throws AWTException, Exception { +// String firstEnvArtifact = "base_stsi_dnt_frwl.env"; +// String secondEnvArtifact = "mod_vmsi_dnt_fw_parent.env"; +// String filePath=Config.instance().getWindowsDownloadDirectory(); +// String vnfFile = "FDNT.zip"; +// OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); +// Map<String,File> mD5OfFilesToValidate = new HashMap<String,File>(); +// mD5OfFilesToValidate.put(firstEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + firstEnvArtifact)); +// mD5OfFilesToValidate.put(secondEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + secondEnvArtifact)); +// List<File>filesToBeDeleted=new ArrayList<>(mD5OfFilesToValidate.values()); +// FileHandling.deleteLastDowloadedFiles(filesToBeDeleted); +// ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); +// List<WebElement> allDisplayedArtifcats = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace(); +// for (int i=0;i<allDisplayedArtifcats.size();i++) { +// if (DeploymentArtifactPage.geteArtifactType(allDisplayedArtifcats.get(i).getText()).equalsIgnoreCase("heat")) { +// DeploymentArtifactPage.clickDownloadEnvArtifact(allDisplayedArtifcats.get(i)); +// GeneralUIUtils.waitForLoader(); +// File latestFilefromDir = FileHandling.getRequiredFromDir(filePath,allDisplayedArtifcats.get(i).getText()+".env"); +// VfVerificator.verifyFilesChecksum(latestFilefromDir,mD5OfFilesToValidate.get(latestFilefromDir.getName())); +// +// } +// } +// } + @Override + protected UserRoleEnum getRole() { + // TODO Auto-generated method stub + return UserRoleEnum.DESIGNER; + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java new file mode 100644 index 0000000000..291a1dbb2e --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java @@ -0,0 +1,299 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.US; + +import java.io.File; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; + +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + + +public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest { + + @DataProvider(name="customizeServiceVfUsedVlsCps") + public static Object[][] dataProviderCustomizeServiceVfUsedVlsCps() { + return new Object[][] { +// {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE}, + {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE}, + {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE}, + {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE}, + }; + } + + // US831517 - Story [BE] - Extend node_template properties with default values + @Test(dataProvider="customizeServiceVfUsedVlsCps") + public void customizeServiceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception { + setLog("Extend node_template properties with default values"); + + // import Resource + LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum); + + if(ComponentTypeEnum.SERVICE == componentTypeEnum) { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + } else { + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + } + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement resourceInstance1 = canvasManager.createElementOnCanvas(assetsName.get(0)); + CanvasElement resourceInstance2 = canvasManager.createElementOnCanvas(assetsName.get(1)); + CanvasElement resourceInstance3 = canvasManager.createElementOnCanvas(assetsName.get(2)); + + canvasManager.clickOnCanvaElement(resourceInstance1); + CompositionPage.showPropertiesAndAttributesTab(); + PropertiesUIUtils.changePropertyDefaultValueInComposition("property_1", "false"); + + canvasManager.clickOnCanvaElement(resourceInstance2); + CompositionPage.showPropertiesAndAttributesTab(); + PropertiesUIUtils.changePropertyDefaultValueInComposition("property_3", "customize"); + + canvasManager.clickOnCanvaElement(resourceInstance3); + CompositionPage.showPropertiesAndAttributesTab(); + PropertiesUIUtils.changePropertyDefaultValueInComposition("property_2", "customize derived"); + PropertiesUIUtils.changePropertyDefaultValueInComposition("property_5", "customize new"); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue()); + + // TODO: Replace it by automatic download to path + // TODO: After it remove + File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml"); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); + + Map<String, Object> vl_us831517_1 = new HashMap<String, Object>(); + vl_us831517_1.put("property_1", false); + vl_us831517_1.put("property_2", "init_value_2"); + vl_us831517_1.put("property_3", "init_value_3"); + + + Map<String, Object> vl_us831517_2 = new HashMap<String, Object>(); + vl_us831517_2.put("property_1", false); + vl_us831517_2.put("property_2", "init_value_2"); + vl_us831517_2.put("property_3", "customize"); + + Map<String, Object> vl_us831517_3 = new HashMap<String, Object>(); + vl_us831517_3.put("property_1", true); + vl_us831517_3.put("property_2", "customize derived"); + vl_us831517_3.put("property_3", "init_value_3"); + vl_us831517_3.put("property_4", false); + vl_us831517_3.put("property_5", "customize new"); + + Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>(); + predefinedProperties.put("VL_US831517_1", vl_us831517_1); + predefinedProperties.put("VL_US831517_2", vl_us831517_2); + predefinedProperties.put("VL_US831517_3", vl_us831517_3); + + validateNodeTemplatesProperties(predefinedProperties, toscaDefinition); + + RestCDUtils.deleteOnDemand(); + } + + @DataProvider(name="serviceVfUsedVlsCps") + public static Object[][] dataProviderServiceVfUsedVlsCps() { + return new Object[][] { + {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE}, + {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE}, + {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE}, + {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE}, + }; + } + + + // US831517 - Story [BE] - Extend node_template properties with default values + @Test(dataProvider="serviceVfUsedVlsCps") + public void serviceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception { + setLog("Extend node_template properties with default values"); + + // import Resource + LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum); + + if(ComponentTypeEnum.SERVICE == componentTypeEnum) { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + } else { + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + } + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + canvasManager.createElementOnCanvas(assetsName.get(0)); + canvasManager.createElementOnCanvas(assetsName.get(1)); + canvasManager.createElementOnCanvas(assetsName.get(2)); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue()); + + // TODO: Replace it by automatic download to path + // TODO: After it remove + File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml"); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); + + Map<String, Object> vl_us831517_1 = new HashMap<String, Object>(); + vl_us831517_1.put("property_1", true); + vl_us831517_1.put("property_2", "init_value_2"); + vl_us831517_1.put("property_3", "init_value_3"); + + + Map<String, Object> vl_us831517_2 = new HashMap<String, Object>(); + vl_us831517_2.put("property_1", false); + vl_us831517_2.put("property_2", "init_value_2"); + vl_us831517_2.put("property_3", "new_value_3"); + + Map<String, Object> vl_us831517_3 = new HashMap<String, Object>(); + vl_us831517_3.put("property_1", true); + vl_us831517_3.put("property_2", "init_value_2"); + vl_us831517_3.put("property_3", "init_value_3"); + vl_us831517_3.put("property_4", false); + vl_us831517_3.put("property_5", "init_value_5"); + + Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>(); + predefinedProperties.put("VL_US831517_1", vl_us831517_1); + predefinedProperties.put("VL_US831517_2", vl_us831517_2); + predefinedProperties.put("VL_US831517_3", vl_us831517_3); + + validateNodeTemplatesProperties(predefinedProperties, toscaDefinition); + + RestCDUtils.deleteOnDemand(); + } + + private LinkedList<String> importThreeAsset(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum) throws Exception { + LinkedList<String> assetsNames = new LinkedList<String>(); + + String filePath = System.getProperty("filepath"); + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath() + File.separator + "US831517" + File.separator; + } + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "US831517" + File.separator; + } + + // import Resource + ResourceReqDetails resourceMetaDataVl1 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser()); + assetsNames.add(resourceMetaDataVl1.getName()); + ResourceUIUtils.importVfc(resourceMetaDataVl1, filePath, fileName_vl1, getUser()); + GeneralPageElements.clickSubmitForTestingButton(resourceMetaDataVl1.getName()); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(resourceMetaDataVl1.getName()); + TesterOperationPage.certifyComponent(resourceMetaDataVl1.getName()); + reloginWithNewRole(UserRoleEnum.DESIGNER); + + ResourceReqDetails resourceMetaDataVl2 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser()); + assetsNames.add(resourceMetaDataVl2.getName()); + ResourceUIUtils.importVfc(resourceMetaDataVl2, filePath, fileName_vl2, getUser()); + GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName()); + + ResourceReqDetails resourceMetaDataVl3 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser()); + assetsNames.add(resourceMetaDataVl3.getName()); + ResourceUIUtils.importVfc(resourceMetaDataVl3, filePath, fileName_vl3, getUser()); + GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName()); + + return assetsNames; + } + + + private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) { + + for(String key: predefinedMap.keySet()) { + Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition); + + predefinedMap.get(key).forEach((i,j) -> { + Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal"); + }); + } + + } + + // Get properties by type + private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) { + Map<String, Object> propertiesMap = null; + + Set<String> nodeTemplates = getNodeTemplates(toscaDefinition); + + for(String nodeTemplate: nodeTemplates) { + String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate); + currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1); + if(currentNodeTemplateType.equals(nodeTemplateType)) { + propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate); + break; + } + } + + return propertiesMap; + } + + // Get node templates + private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) { + Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet(); + return resourceInstanceArray; + } + + // Get type of node template + private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) { + return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType(); + } + + // Get properties of node template + private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) { + Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties(); + return propertiesMap; + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java new file mode 100644 index 0000000000..6dce83fd40 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java @@ -0,0 +1,208 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.businesslogic; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.ci.tests.datatypes.HeatAndHeatEnvNamesPair; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; + +import com.clearspring.analytics.util.Pair; + +public class ArtifactBusinessLogic { + + private final static String[] okFileExtensions = new String[] {"yaml", "yml", "env"}; + private static final String PARAMETERS = "parameters"; + private static final String DEPLOYMENT = "Deployment"; + + public static synchronized Map<String, File> createEnvFilesListFromCsar(String vspName, String filePath) throws Exception{ + Map<String, File> generatedEnvFiles = new HashMap<>(); + File csarFile= HomePage.downloadVspCsarToDefaultDirectory(vspName); + FileHandling.unzip(csarFile.toString(), filePath); + List<File> yamlList = getHeatFilesCreatedFromCsar(csarFile, filePath); + Map<String, HeatAndHeatEnvNamesPair> filesPairMap = getFilesPairMap(yamlList); + generatedEnvFiles = generateDefaultEnvFiles(filesPairMap, filePath); + return generatedEnvFiles; + } + + public static synchronized List<File> getHeatFilesCreatedFromCsar(File pathToDirectory, String filePath) throws Exception { + List<File> fileList = new ArrayList<>(); + String artifactsFilePath = filePath + "Artifacts" + File.separator; + List<File> fileListFromArtifactsDirectory = FileHandling.getHeatAndHeatEnvArtifactsFromZip(new File(artifactsFilePath), okFileExtensions); + Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToDirectory.toString()); + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get(DEPLOYMENT)); + for(HeatMetaFirstLevelDefinition deploymentArtifact : deploymentArtifacts){ + String type = deploymentArtifact.getType(); + if(type.equals(ArtifactTypeEnum.HEAT.getType()) || + type.equals(ArtifactTypeEnum.HEAT_ENV.getType()) || + type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || + type.equals(ArtifactTypeEnum.HEAT_NET.getType())){ + File file = (new File(artifactsFilePath + deploymentArtifact.getFileName())); + if(fileListFromArtifactsDirectory.contains(file)){ + fileList.add(file); + }else{ + assertTrue("File " + file + " does not exist", false); + } + } + } + return fileList; + } + public static synchronized Map<String, HeatAndHeatEnvNamesPair> getFilesPairMap(List<File> generatedEnvFiles) { + + Map<String, HeatAndHeatEnvNamesPair> heatAndHeatEnvPairs= new HashMap<>(); + for(File file : generatedEnvFiles){ + String[] fileName = file.getName().split("\\."); + String currentKey = fileName[0]; + String currentExtension = fileName[1]; + HeatAndHeatEnvNamesPair pair; + if(!heatAndHeatEnvPairs.containsKey(currentKey)){ + pair = new HeatAndHeatEnvNamesPair(); + heatAndHeatEnvPairs.put(currentKey, pair); + }else{ + pair = heatAndHeatEnvPairs.get(currentKey); + } + setFileToPair(file, currentExtension, pair); + } + return heatAndHeatEnvPairs; + } + + /** + * The method fill list of HeatWithParametersDefinition parameters + * @param deploymentArtifacts + * @return + */ + public static synchronized List<HeatWithParametersDefinition> extractHeatWithParametersDefinition(Map<String, ArtifactDefinition> deploymentArtifacts) { + + List<HeatWithParametersDefinition> heatAndEnvLabelList = new ArrayList<>(); + + for (Entry<String, ArtifactDefinition> artifactDefinitionChild : deploymentArtifacts.entrySet()){ + if(artifactDefinitionChild.getValue().getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){ + for(Entry<String, ArtifactDefinition> artifactDefinitionParent : deploymentArtifacts.entrySet()){ + if(artifactDefinitionChild.getValue().getGeneratedFromId().equals(artifactDefinitionParent.getValue().getUniqueId())){ + String heatLabel = artifactDefinitionParent.getValue().getArtifactLabel(); + String heatArtifactType = artifactDefinitionParent.getValue().getArtifactType(); + String heatArtifactDisplayName = artifactDefinitionParent.getValue().getArtifactDisplayName(); + List<HeatParameterDataDefinition> heatParameterDefinition = artifactDefinitionParent.getValue().getHeatParameters(); + String heatEnvLabel = artifactDefinitionChild.getValue().getArtifactLabel(); + String heatEnvArtifactType = artifactDefinitionChild.getValue().getArtifactType(); + heatAndEnvLabelList.add(new HeatWithParametersDefinition(heatLabel, heatEnvLabel, heatArtifactType, heatEnvArtifactType, heatArtifactDisplayName, heatParameterDefinition)); + break; + } + } + } + } + return heatAndEnvLabelList; + } + + + public static synchronized void setFileToPair(File file, String currentExtension, HeatAndHeatEnvNamesPair pair) { + if(!currentExtension.equals("env")){ + pair.setHeatFileName(file); + }else{ + pair.setHeatEnvFileName(file); + } + } + + public static synchronized Map<String, File> generateDefaultEnvFiles(Map<String, HeatAndHeatEnvNamesPair> filesPairMap, String filePath) throws Exception { + + Map<String, File> generatedEnvFilesMap = new HashMap<>(); + for(Entry<String, HeatAndHeatEnvNamesPair> pair : filesPairMap.entrySet()){ + Map<String, Pair<String, Object>> envParametersMap = getEnvParametersMap(pair); + File generatedEnvFile = createEnvFile(envParametersMap, new File(filePath + pair.getKey() + ".env")); + generatedEnvFilesMap.put(pair.getKey(), generatedEnvFile); + } + return generatedEnvFilesMap; + } + + public static synchronized File createEnvFile(Map<String, Pair<String, Object>> envParametersMap, File fileToWrite) throws IOException { + + FileHandling.writeToFile(fileToWrite, PARAMETERS+":", 0); + FileHandling.writeToFile(fileToWrite, envParametersMap, 2); + return fileToWrite; + } + + public static synchronized Map<String, Pair<String, Object>> getEnvParametersMap(Entry<String, HeatAndHeatEnvNamesPair> pair) throws Exception { + File heatFileName = pair.getValue().getHeatFileName(); + File heatEnvFileName = pair.getValue().getHeatEnvFileName(); + Map<String, Pair<String, Object>> envParametersMap = new HashMap<>(); + fillParametersMapFromHeatFile(heatFileName, envParametersMap); + fillParametersMapFromHeatEnvFile(heatEnvFileName, envParametersMap); + return envParametersMap; + } + + public static synchronized void fillParametersMapFromHeatEnvFile(File heatEnvFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception { + if(heatEnvFileName != null){ + Map<String, Object> mapHeatEnvFileParameters = FileHandling.parseYamlFileToMapByPattern(heatEnvFileName, PARAMETERS); + for (Map.Entry<String, Object> parameter : mapHeatEnvFileParameters.entrySet()){ + String key = parameter.getKey(); + Pair<String, Object> pair; + if(envParametersMap.containsKey(key)){ + if(envParametersMap.get(key).left.equals("string") && parameter.getValue() != null){ + pair = Pair.create(envParametersMap.get(key).left, "\"" + parameter.getValue() + "\""); + }else if(envParametersMap.get(key).left.equals("string") && parameter.getValue() == null){ + pair = Pair.create(envParametersMap.get(key).left, ""); + }else if(parameter.getValue() == null){ + pair = Pair.create(envParametersMap.get(key).left, ""); + }else{ + pair = Pair.create(envParametersMap.get(key).left, parameter.getValue()); + } + envParametersMap.put(key, pair); + } + } + } + } + + @SuppressWarnings("unchecked") + public static synchronized void fillParametersMapFromHeatFile(File heatFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception { + Map<String, Object> mapHeatFileParameters = FileHandling.parseYamlFileToMapByPattern(heatFileName, PARAMETERS); + for (Map.Entry<String, Object> parameter : mapHeatFileParameters.entrySet()){ + Map<String, Object> value = (Map<String, Object>) parameter.getValue(); + Pair<String, Object> pair; + if(value.get("type").toString().equals("string") && value.get("default") != null ){ + pair = Pair.create(value.get("type").toString(), "\"" + value.get("default") + "\""); + }else if(value.get("type").toString().equals("string") && value.get("default") == null){ + pair = Pair.create(value.get("type").toString(), ""); + }else if(value.get("default") == null){ + pair = Pair.create(value.get("type").toString(), ""); + }else{ + pair = Pair.create(value.get("type").toString(), value.get("default")); + } + envParametersMap.put(parameter.getKey(), pair); + } + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java index 4de9ae8436..1302cb52af 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java @@ -27,6 +27,7 @@ public class ArtifactInfo { private String description; private String artifactType; private String artifactLabel; + private String artifactVersion; public ArtifactInfo(String filepath, String filename, String description, String artifactLabel, String artifactType) { @@ -37,10 +38,29 @@ public class ArtifactInfo { this.artifactType = artifactType; this.artifactLabel = artifactLabel; } + + public ArtifactInfo(String filepath, String filename, String description, String artifactLabel, + String artifactType, String artifactVersion) { + super(); + this.filepath = filepath; + this.filename = filename; + this.description = description; + this.artifactType = artifactType; + this.artifactLabel = artifactLabel; + this.artifactVersion = artifactVersion; + } public ArtifactInfo() { super(); } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } public String getFilepath() { return filepath; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java index d5c76d1ef1..25ed4c2d91 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.datatypes; -import static org.testng.AssertJUnit.assertNotNull; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,42 +29,40 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.verificator.VfVerificator; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openqa.selenium.By; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.testng.Assert; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public final class CanvasManager { - private static final String LEFT_PANEL_ELEMENT_NAME_PREFIX = "leftbar-section-content-item-"; private Map<String, CanvasElement> canvasElements; private Actions actions; private WebElement canvas; private int reduceCanvasWidthFactor; + private CanvasElement canvasElement; // Offsets Are used to find upper right corner of canvas element in order to // connect links - private static final int CANVAS_ELEMENT_Y_OFFSET = 40; - private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27 + private static final int CANVAS_ELEMENT_Y_OFFSET = 30; + private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27 private CanvasManager() { canvasElements = new HashMap<>(); actions = new Actions(GeneralUIUtils.getDriver()); -// canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); - canvas = GeneralUIUtils.waitForClassNameVisibility("w-sdc-designer-canvas"); + canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); try { - WebElement webElement = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); + WebElement webElement = GeneralUIUtils + .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); reduceCanvasWidthFactor = webElement.getSize().width; } catch (Exception e) { reduceCanvasWidthFactor = 0; } } - public static CanvasManager getCanvasManager() { return new CanvasManager(); @@ -82,7 +79,6 @@ public final class CanvasManager { private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation) throws Exception { GeneralUIUtils.waitForLoader(); - GeneralUIUtils.sleep(500); actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); actions.clickAndHold(); actions.moveToElement(canvas, newLocation.left, newLocation.right); @@ -104,8 +100,7 @@ public final class CanvasManager { actions.clickAndHold(); actions.release(); actions.perform(); - GeneralUIUtils.sleep(napPeriod); - isKeepWaiting = GeneralUIUtils.getWebElementWaitForVisible("selectedCompTitle").getText() + isKeepWaiting = GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText() .equals(containerName); sumOfWaiting += napPeriod; if (sumOfWaiting > maxWait) { @@ -119,6 +114,9 @@ public final class CanvasManager { actions.clickAndHold(); actions.release(); actions.perform(); + actions.click().perform(); + GeneralUIUtils.ultimateWait(); + ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType())); } public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception { @@ -130,43 +128,63 @@ public final class CanvasManager { actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); actions.click(); actions.perform(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); canvasElements.remove(canvasElement.getUniqueId()); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.ultimateWait(); + if (canvasElement.getElementType().contains("-")){ + ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType().split("-")[4])); + } + else{ + ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType())); + } } private WebElement findClickElement(String dataTestId) { int attempts = 0; while (attempts < 2) { try { - return GeneralUIUtils.getWebElementWaitForVisible(dataTestId); + return GeneralUIUtils.getWebElementByTestID(dataTestId); } catch (StaleElementReferenceException e) { } attempts++; } return null; } - + public CanvasElement createElementOnCanvas(String elementName) throws Exception { - final String elementDataTestId = LEFT_PANEL_ELEMENT_NAME_PREFIX + elementName; + String actionDuration = GeneralUIUtils.getActionDuration(() -> { + try { + canvasElement = createElementOnCanvasWithoutDuration(elementName); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + if (canvasElement != null){ + ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration); + } + return canvasElement; + } + + private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception { try { WebElement element = findClickElement(elementDataTestId); ImmutablePair<Integer, Integer> freePosition = getFreePosition(); - actions.moveToElement(element, 0, 0); + actions.moveToElement(element, 20, 20); actions.clickAndHold(); actions.moveToElement(canvas, freePosition.left, freePosition.right); actions.release(); actions.perform(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.ultimateWait(); String uniqueId = elementDataTestId + "_" + UUID.randomUUID().toString(); CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, elementDataTestId); addCanvasElement(canvasElement); - SetupCDTest.getExtendTest().log(LogStatus.PASS, - String.format("element %s is in canvas now..", elementName)); + GeneralUIUtils.ultimateWait(); return canvasElement; - } catch (Exception e) { + } + catch (Exception e) { System.out.println("Can't create element on canvas"); e.printStackTrace(); } @@ -201,19 +219,19 @@ public final class CanvasManager { } public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception { + ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType())); drawSimpleLink(firstElement, secondElement); selectReqAndCapAndConnect(); + ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType())); } private void selectReqAndCapAndConnect() throws Exception { // Select First Cap - GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0) - .click(); + GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); // Select First Req - GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0) - .click(); + GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); // Connect - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); GeneralUIUtils.waitForLoader(); } @@ -222,29 +240,29 @@ public final class CanvasManager { int yOffset = CANVAS_ELEMENT_Y_OFFSET; int xOffset = CANVAS_ELEMENT_X_OFFSET; - actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, firstElement.getLocation().right - yOffset); + actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, + firstElement.getLocation().right - yOffset); + actions.clickAndHold(); actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset); actions.release(); actions.perform(); GeneralUIUtils.ultimateWait(); - SetupCDTest.getExtendTest().log(LogStatus.INFO, String.format("Elements %s and %s now connected", firstElement.getElementType().split("-")[4], secondElement.getElementType().split("-")[4])); } public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception { - GeneralUIUtils.waitForLoader(); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.click(); - actions.perform(); - WebElement updateInstanceName = GeneralUIUtils.getDriver().findElement(By.id("editPencil")); + GeneralUIUtils.ultimateWait();; + clickOnCanvaElement(canvasElement); + WebElement updateInstanceName = GeneralUIUtils.getWebElementBy(By.id("editPencil")); updateInstanceName.click(); - WebElement instanceNameField = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue()); - String oldInstanceName = instanceNameField.getText(); + WebElement instanceNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue()); + String oldInstanceName = instanceNameField.getAttribute("value"); instanceNameField.clear(); instanceNameField.sendKeys(newInstanceName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("w-sdc-modal-resource-instance-name")); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName)); return oldInstanceName; } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java index 16593fc62f..ef510b8a12 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java @@ -20,18 +20,23 @@ package org.openecomp.sdc.ci.tests.datatypes; +import java.util.Arrays; +import java.util.List; + public final class DataTestIdEnum { private DataTestIdEnum() { - }; + } public enum Dashboard { - IMPORT_AREA("importButtonsArea"), + IMPORT_AREA("importButtonsArea"), + ADD_AREA("AddButtonsArea"), BUTTON_ADD_VF("createResourceButton"), BUTTON_ADD_SERVICE("createServiceButton"), IMPORT_VFC("importVFCbutton"), IMPORT_VF("importVFbutton"), IMPORT_VFC_FILE("file-importVFCbutton"), - IMPORT_VF_FILE("file-importVFbutton"); + IMPORT_VF_FILE("file-importVFbutton"), + BUTTON_ADD_PRODUCT("createProductButton"); private String value; @@ -45,10 +50,12 @@ public final class DataTestIdEnum { } public enum LifeCyleChangeButtons { - CREATE("create/save"), CHECK_IN("check_in"), + CREATE("create/save"), + CHECK_IN("check_in"), SUBMIT_FOR_TESTING("submit_for_testing"), START_TESTING("start_testing"), - ACCEPT("accept"); + ACCEPT("accept"), + CHECKOUT("check_out"); private String value; @@ -62,7 +69,8 @@ public final class DataTestIdEnum { } public enum DistributionChangeButtons { - APPROVE("approve"), REJECT("reject"), + APPROVE("approve"), + REJECT("reject"), DISTRIBUTE("distribute"), MONITOR("monitor"), APPROVE_MESSAGE("checkindialog"), @@ -79,13 +87,13 @@ public final class DataTestIdEnum { } } - public enum InformationalArtifacts { + public enum InformationalArtifactsPlaceholders { CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"), FEATURES("Features"), VENDOR_TEST_RESULT("Vendor Test Result"), TEST_SCRIPTS("Test Scripts"), RESOURCE_SECURITY_TEMPLATE("Resource Security Template"), - HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"), + HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"), CAPACITY("Capacity"); private String value; @@ -94,11 +102,10 @@ public final class DataTestIdEnum { return value; } - private InformationalArtifacts(String value) { + private InformationalArtifactsPlaceholders(String value) { this.value = value; } - - } + } public enum ModalItems { BROWSE_BUTTON("browseButton"), @@ -128,8 +135,8 @@ public final class DataTestIdEnum { NOVA_SERVER("NovaServer"), OBJECT_STORAGE("ObjectStorage"), NEUTRON_PORT("NeutronPort"), - PORT("Port"), - DATABASE("Database"); + PORT("Port"), DATABASE("Database"), + NETWORK("Network"); private String value; @@ -176,19 +183,18 @@ public final class DataTestIdEnum { private GeneralCanvasItems(String value) { this.value = value; } - } public enum ResourceMetadataEnum { RESOURCE_NAME("name"), DESCRIPTION("description"), CATEGORY("selectGeneralCategory"), - VENDOR_NAME("vendorName"), + VENDOR_NAME("vendorName"), VENDOR_RELEASE("vendorRelease"), TAGS("i-sdc-tag-input"), CONTACT_ID("contactId"), - ICON(" iconBox"); - + ICON(" iconBox"), + TAGS_TABLE("i-sdc-tag-text"); private String value; public String getValue() { @@ -198,17 +204,19 @@ public final class DataTestIdEnum { private ResourceMetadataEnum(String value) { this.value = value; } - } public enum GeneralElementsEnum { CREATE_BUTTON("create/save"), CHECKIN_BUTTON("check_in"), + CHECKOUT_BUTTON("check_out"), SUBMIT_FOR_TESTING_BUTTON("submit_for_testing"), DELETE_VERSION_BUTTON("delete_version"), REVERT_BUTTON("revert"), - LIFECYCLE_STATE("lifecyclestate"), - VERSION_HEADER("versionHeader"); + LIFECYCLE_STATE("formlifecyclestate"), + VERSION_HEADER("versionHeader"), + OK("OK"), + UPLOAD_FILE_INPUT("browseButton"); private String value; @@ -219,21 +227,27 @@ public final class DataTestIdEnum { private GeneralElementsEnum(String value) { this.value = value; } - } public enum ArtifactPageEnum { - + ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"), ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"), - ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"), + DOWNLOAD_ARTIFACT_ENV("download_env_"), ADD_ANOTHER_ARTIFACT("add-another-artifact-button"), - EDIT_ARTIFACT("edit_"), - DELETE_ARTIFACT("delete_"), + EDIT_ARTIFACT("edit_"), //upload env file by its label(via deployment artifact view)/displayName(via Canvas) + DELETE_ARTIFACT("delete_"), DOWNLOAD_ARTIFACT("download_"), GET_DEPLOYMENT_ARTIFACT_DESCRIPTION("description"), - GET_INFORMATIONAL_ARTIFACT_DESCRIPTION("Description") - - ; + GET_INFORMATIONAL_ARTIFACT_DESCRIPTION("Description"), + OK("OK"), + TYPE("artifactType_"), + DEPLOYMENT_TIMEOUT("timeout_"), + VERSION("artifactVersion_"), + UUID("artifactUUID_"), + EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"), + ARTIFACT_NAME("artifactDisplayName_"), + UPLOAD_HEAT_ENV_PARAMETERS("uplaodEnv_"), + VERSION_ENV("artifactEnvVersion_"); private String value; public String getValue() { @@ -250,15 +264,55 @@ public final class DataTestIdEnum { ADD_NEW_PROPERTY("addGrey"), EDIT_PROPERTY("edit_"), DELETE_PROPERTY("delete_"), + PROPERTY_NAME("propertyName_"), + PROPERTY_DESCRIPTION("propertyDescription_"), + PROPERTY_TYPE("propertyType_"), + ENTRY_SCHEMA("propertySchema_"), + ADD("Add"), CANCEL("Cancel"), + DONE("Done"), + PROPERTY_ROW("propertyRow"), + SAVE("Save"), + POPUP_FORM("sdc-edit-property-container"); + private String value; + + public String getValue() { + return value; + } + + private PropertiesPageEnum(String value) { + this.value = value; + } + } + + public enum PropertiesPopupEnum { + PROPERTY_NAME("propertyName"), PROPERTY_VALUE("defaultvalue"), - PROPERTY_DESCRIPTION("description"), + PROPERTY_BOOLEAN_VALUE("booleantype"), + PROPERTY_DESCRIPTION("description"), PROPERTY_TYPE("propertyType"), + ENTRY_SCHEMA("schema-type"), + CANCEL("Cancel"), + SAVE("Save"), + POPUP_FORM("sdc-edit-property-container"), ADD("Add"), - CANCEL("Cancel"), - DONE("Done"), - PROPERTY_ROW("propertyRow"), - SAVE("Save"); + DONE("Done"), + PROPERTY_RADIO_BUTTON_CONTAINER("propertyRadioButton_"), + RADIO_BUTTON_CLASS("tlv-radio-label"); + private String value; + + public String getValue() { + return value; + } + + private PropertiesPopupEnum(String value) { + this.value = value; + } + } + + public enum AdminPageTabs { + USER_MANAGEMENT("usermanagmenttab"), + CATEGORY_MANAGEMENT("categorymanagmenttab"); private String value; @@ -266,16 +320,72 @@ public final class DataTestIdEnum { return value; } - private PropertiesPageEnum(String value) { + private AdminPageTabs(String value) { + this.value = value; + } + } + + public enum UserManagementEnum { + + SEARCH_BOX("searchbox"), + NEW_USER_FIELD("newuserId"), + ROLE_SELECT("selectrole"), + CREATE_BUTTON("creategreen"), + CLASS__USER_MANAGEMENT_TABLE("sdc-user-management-table"), + ROW_TABLE("row_"), + FIRST_NAME("firstName_"), + LAST_NAME("lastName__"), + USER_ID("userId_"), + EMAIL("email_"), + ROLE("role_"), + LAST_ACTIVE("lastActive_"), + UPDATE_ROLE("selectRole_"), + UPDATE_USER_BUTTON("updateUser_"), + SAVE_USER("save_"), + DELETE_USER("delete_"), + ; + + + private String value; + + public String getValue() { + return value; + } + + private UserManagementEnum(String value) { this.value = value; } } + + public enum CategoryManagement { + + SERVICE_CATEGORY_HEADER("servicecategoryheader"), + RESOURCE_CATEGORY_HEADER("resourcecategoryheader"), + SERVICE_CATEGORY_LIST("servicecategory"), + RESOURCE_CATEGORY_LIST("resourcecategory"), + NEW_CATEGORY_BUTTON("newcategory"), + NEW_SUB_CATEGORY_BUTTON("newsubcategory"), + NEW_CATEGORY_NAME("i-sdc-form-input"); + + private String value; + + public String getValue() { + return value; + } + + private CategoryManagement(String value) { + this.value = value; + } + } + + public enum MainMenuButtons { HOME_BUTTON("main-menu-button-home"), CATALOG_BUTTON("main-menu-button-catalog"), - ONBOARD_BUTTON("main-menu-button-onboard"); - + ONBOARD_BUTTON("main-menu-button-onboard"), + SEARCH_BOX("main-menu-input-search"), + REPOSITORY_ICON("repository-icon"); private String value; public String getValue() { @@ -285,7 +395,19 @@ public final class DataTestIdEnum { private MainMenuButtons(String value) { this.value = value; } + } + + public enum MainMenuButtonsFromInsideFrame { + HOME_BUTTON("breadcrumbs-button-0"); + private String value; + public String getValue() { + return value; + } + + private MainMenuButtonsFromInsideFrame(String value) { + this.value = value; + } } public enum MenuOptionsEnum { @@ -320,7 +442,10 @@ public final class DataTestIdEnum { ACTIVITY_LOG("Activity Logstep"), DEPLOYMENT_VIEW("Deploymentstep"), TOSCA_ARTIFACTS("TOSCA Artifactsstep"), - MONITOR("Monitor step"); + MONITOR("Monitor step"), + MANAGEMENT_WORKFLOW("Management Workflowstep"), + INPUTS("Inputsstep"), + HIERARCHY("Hierarchystep"); private String value; @@ -331,18 +456,20 @@ public final class DataTestIdEnum { private StepsEnum(String value) { this.value = value; } - } public enum ArtifactPopup { BROWSE("browseButton"), ARTIFACT_DESCRIPTION("description"), - ARTIFACT_LABEL("selectArtifact"), - ARTIFACT_TYPE("artifacttype"), - ADD_BUTTON("Add"), - CANCEL_BUTTON("Cancel"), - UPDATE_BUTTON("Update"); + ARTIFACT_LABEL("artifactLabel"), + ARTIFACT_TYPE("artifacttype"), + OK("OK"), + SAVE("Save"), + DONE_BUTTON("Done"), + CANCEL_BUTTON("Cancel"), + URL("input[class^='i-sdc-form-input']"), + MODAL_WINDOW("sdc-add-artifact"); private String value; @@ -353,16 +480,29 @@ public final class DataTestIdEnum { private ArtifactPopup(String value) { this.value = value; } - } public enum ServiceMetadataEnum { - SERVICE_NAME("name"), - DESCRIPTION("description"), - CATEGORY("selectGeneralCategory"), + SERVICE_NAME("name"), DESCRIPTION("description"), CATEGORY("selectGeneralCategory"), PROJECT_CODE("projectCode"), TAGS("i-sdc-tag-input"), CONTACT_ID("contactId"), ICON(" iconBox"); + + private String value; + + public String getValue() { + return value; + } + + private ServiceMetadataEnum(String value) { + this.value = value; + } + } + + public enum ProductMetadataEnum { + PRODUCT_NAME("name"), + FULL_NAME("fullName"), + DESCRIPTION("description"), PROJECT_CODE("projectCode"), TAGS("i-sdc-tag-input"), - CONTACT_ID("contactId"), + ATT_CONTACT("attContact"), ICON(" iconBox"); private String value; @@ -371,10 +511,325 @@ public final class DataTestIdEnum { return value; } - private ServiceMetadataEnum(String value) { + private ProductMetadataEnum(String value) { this.value = value; } + } + + public enum DashboardCardEnum { + ASSET_TYPE("asset-type"), LIFECYCLE_STATE("span[class^='w-sdc-dashboard-card-info-lifecycleState']"), + INFO_NAME("div.sdc-tile-content-info-item-name"), + VERSION("div[class^='w-sdc-dashboard-card-info-user']"), + DASHBOARD_CARD("div[class^='w-sdc-dashboard-card ']"), + ASSET_TYPE_CSS("span[data-tests-id='asset-type']"); + + private String value; + + public String getValue() { + return value; + } + private DashboardCardEnum(String value) { + this.value = value; + } } + + public enum CatalogPageLeftPanelCategoryCheckbox { + GENERIC_CHECKBOX("span[data-tests-id='checkbox-resourcenewcategory.generic']"), + NETWORK_L2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3']"), + NETWORK_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.networkl4+']"), + NETWORK_CONNECTIVITY("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity']"), + APPLICATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+']"), + DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent']"); + + private String value; + public String getValue() { + return value; + } + + private CatalogPageLeftPanelCategoryCheckbox(String value) { + this.value = value; + } + } + + public enum CatalogPageLeftPanelFilterTitle { + TYPE("span[data-tests-id='typeFilterTitle']"), + CATEGORIES("span[data-tests-id='categoriesFilterTitle']"), + STATUS("span[data-tests-id='statusFilterTitle']"); + + private String value; + + public String getValue() { + return value; + } + + private CatalogPageLeftPanelFilterTitle(String value) { + this.value = value; + } + } + + public enum CatalogPageLeftPanelSubCategoryCheckbox { + COMMON_NETWORK_RESOURCES("span[data-tests-id='checkbox-resourcenewcategory.networkl4+.commonnetworkresources']"), + ROUTER("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.router']"), + WAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.wanconnectors']"), + LAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.lanconnectors']"), + INFRASTRUCTERE_NETWORKl2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.infrastructure']"), + GATEWAY("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.gateway']"), + NETWORK_ELEMENTS("span[data-tests-id='checkbox-resourcenewcategory.generic.networkelements']"), + ABSTRACT("span[data-tests-id='checkbox-resourcenewcategory.generic.abstract']"), + RULES("span[data-tests-id='checkbox-resourcenewcategory.generic.rules']"), + DATABASE("span[data-tests-id='checkbox-resourcenewcategory.generic.database']"), + INFRASTRUCTERE_GENERIC("span[data-tests-id='checkbox-resourcenewcategory.generic.infrastructure']"), + VIRTUAL_LINKS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.virtuallinks']"), + CONNECTION_POINTS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.connectionpoints']"), + APPLICATION_SERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.applicationserver']"), + CALL_CONTROL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.callcontrol']"), + MEDIASERVERS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.mediaservers']"), + WEBSERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.webserver']"), + LOAD_BALANCER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.loadbalancer']"), + BORDER_ELEMENT("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.borderelement']"), + DATABASE_APPLIVATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.database']"), + FIREWALL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.firewall']"), + DATABASE_DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.database']"), + POLICY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.policy']"), + MICROSERVICE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.microservice']"), + SOURCE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.source']"), + COLLECTOR("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.collector']"), + UTILITY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.utility']"), + ANALYTICS("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.analytics']"); + + private String value; + + public String getValue() { + return value; + } + + private CatalogPageLeftPanelSubCategoryCheckbox(String value) { + this.value = value; + } + } + + public enum CompositionScreenEnum { + + CHANGE_VERSION("changeVersion", Arrays.asList()), + DEPLOYMENT_ARTIFACT_TAB("deployment-artifact-tab", Arrays.asList("Deployment Artifacts")), + ADD_ARTIFACT("add_Artifact_Button", Arrays.asList()), + SEARCH_ASSET("searchAsset", Arrays.asList()), + PROPERTIES_AND_ATTRIBUTES_TAB("properties-and-attributes-tab",Arrays.asList()), + MENU_INPUTS("sub-menu-button-inputs",Arrays.asList()), + MENU_TRIANGLE_DROPDOWN("triangle-dropdown", Arrays.asList()), + ARTIFACTS_LIST("artifactName", Arrays.asList()), + INFORMATION_ARTIFACTS("button[tooltip-content='Information Artifacts']", Arrays.asList("Informational Artifacts")), + API("button[tooltip-content='API']", Arrays.asList("API Artifacts")), + INFORMATION("button[tooltip-content='Information']", Arrays.asList("General Info", "Additional Information", "Tags")), + COMPOSITION("button[tooltip-content='Composition']", Arrays.asList("Composition")), + INPUTS("button[tooltip-content='Inputs']", Arrays.asList("")), + REQUIREMENTS_AND_CAPABILITIES("button[tooltip-content='Requirements and Capabilities']", Arrays.asList()), + INFORMATION_TAB("information-tab", Arrays.asList()), + CUSTOMIZATION_UUID("rightTab_customizationModuleUUID", Arrays.asList()); + + private String value; + private List<String> title; + + public String getValue() { + return value; + } + + public List<String> getTitle() { + return title; + } + + private CompositionScreenEnum(String value, List<String> title) { + this.value = value; + this.title = title; + } + } + + public enum ToscaArtifactsScreenEnum { + + TOSCA_MODEL("download-Tosca Model"), + TOSCA_TEMPLATE("download-Tosca Template"), + ARTIFACT_VERSION("version-"), + ARTIFACT_NAME("name-"), + ARTIFACT_TYPE("type-"), + ARTIFACT_DETAILS("details-"), + DOWNLOAD_ARTIFACT("download-"), + DOWNLOAD_CSAR("download-Tosca Model"); + + private String value; + + public String getValue() { + return value; + } + + private ToscaArtifactsScreenEnum(String value) { + this.value = value; + } + } + + public enum InformationalArtifactsService { + AFFINITY_RULES("artifact_Display_Name-Affinity Rules"), + CONTROL_LOOP_FUNCTIONS("artifact_Display_Name-Control Loop Functions"), + DEPLOYMENT_VOTING_RECORD("artifact_Display_Name-Deployment Voting Record"), + DIMENSIONING_INFO("artifact_Display_Name-Dimensioning Info"), + DISTRIBUTION_INSTRUCTION("artifact_Display_Name-Distribution Instructions"), + ENGINEERING_RULES("artifact_Display_Name-Engineering Rules (ERD)"), + OPERATIONAL_POLICES("artifact_Display_Name-Operational Policies"), + SERVICE_ARTIFACT_PLAN("artifact_Display_Name-Service Artifact Plan"), + SERVICE_QUESTIONNAIRE("artifact_Display_Name-Service Questionnaire"), + SERVICE_SECURITY_TEMPLATE("artifact_Display_Name-Service Security Template"), + SERVICE_SPECIFIC_POLICIES("artifact_Display_Name-Service-specific Policies"), + SUMMARY_OF_IMPACTS_TO_ECOMP("artifact_Display_Name-Summary of impacts to ECOMP elements,OSSs, BSSs"), + TD_CERTIFICATION_TEST_RESULTS("artifact_Display_Name-TD Certification Test Results"); + + private String value; + + public String getValue() { + return value; + } + + private InformationalArtifactsService(String value) { + this.value = value; + } + } + + public enum APIArtifactsService { + + CONFIGURATION("artifact_Display_Name-Configuration"), + INSTANTIATION("artifact_Display_Name-Instantiation"), + LOGGING("artifact_Display_Name-Logging"), + MONITORING("artifact_Display_Name-Monitoring"), + REPORTING("artifact_Display_Name-Reporting"), + TESTING("artifact_Display_Name-Testing"); + + private String value; + + public String getValue() { + return value; + } + + private APIArtifactsService(String value) { + this.value = value; + } + } + + public enum DeploymentArtifactCompositionRightMenu { + ARTIFACT_NAME("artifactName-"), + ARTIFACT_DISPLAY_NAME("artifact_Display_Name-"), + DOWNLOAD("download_"), + DELETE("delete_"), + ADD_ARTIFACT_BUTTON("add_Artifact_Button"), + EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"), + ARTIFACT_ITEM("artifact-item-"), + ARTIFACT_ENV("heat_env_"); + + private String value; + + public String getValue() { + return value; + } + + private DeploymentArtifactCompositionRightMenu(String value) { + this.value = value; + } + + } + + public enum InputsScreenService { + ADD_SELECTED_INPUTS_BTN("add-inputs-to-service-button"), + VF_INSTANCE_ROWS("expand-collapse[expanded-selector^='.vf-instance-list.']"), + VF_INSTANCE_ROW_NAME("span[class^='title-text']"), + VF_INSTANCE_INPUTS("div[class^='vf-instance-list ']"), + VF_INSTANCE_INPUT("div[class^='input-row ng-scope']"), + VF_INSTNCE_PROPERTY_NAME("div[class^='title-text']"), + INPUT_CHECKBOX("span[class^='tlv-checkbox-label']"), + SERVICE_INPUT_ROW("div[class^='service-input-row input-row']"), + DELETE_INPUT_BTN("span[class$='remove-input-icon']"), + RESOURCE_INSTANCE_PROPERTY_NAME("propertyName_"), + RESOURCE_INSTANCE_PROPERTY_TYPE("propertyType_"), + RESOURCE_INSTANCE_PROPERTY_CHECKBOX("propertyCheckbox_"), + SERVICE_INPUTS_DELETE_BUTTON("deleteInput_") + ; + + private String value; + + public String getValue() { + return value; + } + + private InputsScreenService(String value) { + this.value = value; + } + + } + + public enum DeploymentScreen { + MODULES("span[class^='expand-collapse-title-text']"), + MEMBERS("div[class^='expand-collapse-sub-title']"), + PROPERTIES("list-of-Properties"), + ARTIFACTS("list-of-Artifacts"), + BUTTON_PROPERTIES("div[data-tests-id='list-of-Properties'] span[class^='hand']"), + BUTTON_ARTIFACTS("div[data-tests-id='list-of-Artifacts'] span[class^='hand']"), + PROPERTY_NAMES("div[data-tests-id='selected-module-property-name'] span"), + PROPERTY_TYPES("selected-module-property-type"), + PROPERTY_SCHEMA_TYPE("selected-module-property-schema-type"), + ARTIFACT_NAME("selected-module-artifact-name"), + ARTIFACT_UUID("selected-module-artifact-uuid"), + ARTIFACT_VERSION("selected-module-artifact-version"), + PENCIL_ICON("edit-name-popover-icon"), + MODULE_NAME("selected-module-name"), + MODULE_ID("selected-module-group-uuid"), + RESOURCE_NAME_ON_POPOVER("popover-vfinstance-name"), + MODULE_NAME_ON_POPOVER("popover-module-name"), + NAME_INPUT("popover-heat-name"), + SAVE("popover-save-button"), + CANCEL("popover-close-button"), + X_BUTTON("popover-x-button"); + + private String value; + + public String getValue() { + return value; + } + + private DeploymentScreen(String value) { + this.value = value; + } + } + + public enum ImportVfRepository { + SEARCH("onboarding-search"), + IMPORT_VSP("import-csar"), + DOWNLOAD_CSAR("download-csar"), + UPDATE_VSP("update-csar"); + + private String value; + + public String getValue() { + return value; + } + + private ImportVfRepository(String value) { + this.value = value; + } + } + + public enum EnvParameterView { + SEARCH_ENV_PARAM_NAME("search-env-param-name"), + ENV_CURRENT_VALUE("value-field-of-"),//value-field-of-oam_volume_name_0 - parameter name + ENV_DEFAULT_VALUE("default-value-of-");// default-value-of-vnf_name + + private String value; + + public String getValue() { + return value; + } + + private EnvParameterView(String value) { + this.value = value; + } + } + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java index 199fa6990a..a7d2551683 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java @@ -20,6 +20,34 @@ package org.openecomp.sdc.ci.tests.datatypes; -public enum WorkMode { - DEV, CD; +public class ErrorMessageProperties { + + private String messageId ; + private String code; + + public ErrorMessageProperties() { + + } + + public ErrorMessageProperties(String messageId, String code) { + this.messageId = messageId; + this.code = code; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java index 0e8f9cbea1..e708fb8ee4 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java @@ -21,10 +21,9 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum GeneralCanvasItemsEnum { - CANVAS("canvas"), CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), DELETE_INSTANCE_BUTTON( - "e-sdc-small-icon-delete") - - ; + CANVAS("canvas"), + CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), + DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete"); private String value; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java index ffa7400338..1df61b734c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java @@ -20,26 +20,43 @@ package org.openecomp.sdc.ci.tests.datatypes; -// public enum CreateAndUpdateStepsEnum { -// GENERAL("Generalstep"), -// ICON("Iconstep"), -// DEPLOYMENT_ARTIFACT("Deployment Artifactstep"), -// INFORMATION_ARTIFACT("Information Artifactstep"), -// PROPERTIES("Propertiesstep"), -// COMPOSITION("Compositionstep"), -// ACTIVITY_LOG("Activity Logstep"), -// DEPLOYMENT_VIEW("Deploymentstep"); -// -// -// private String value; -// -// public String getValue(){ -// return value; -// } -// -// private CreateAndUpdateStepsEnum(String value) { -// this.value = value; -// } -// -// -// } +import java.io.File; + +public class HeatAndHeatEnvNamesPair { + + private File heatFileName; + private File heatEnvFileName; + + public HeatAndHeatEnvNamesPair() { + super(); + } + + public HeatAndHeatEnvNamesPair(File heatFileName, File heatEnvFileName) { + super(); + this.heatFileName = heatFileName; + this.heatEnvFileName = heatEnvFileName; + } + + public File getHeatFileName() { + return heatFileName; + } + + public void setHeatFileName(File heatFileName) { + this.heatFileName = heatFileName; + } + + public File getHeatEnvFileName() { + return heatEnvFileName; + } + + public void setHeatEnvFileName(File heatEnvFileName) { + this.heatEnvFileName = heatEnvFileName; + } + + @Override + public String toString() { + return "HeatHeatEnvNamesPair [heatFileName=" + heatFileName + ", heatEnvFileName=" + heatEnvFileName + "]"; + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java new file mode 100644 index 0000000000..5ff173ee87 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.datatypes; + +import java.util.List; + +import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; + +public class HeatWithParametersDefinition { + + private String heatLabel; + private String heatEnvLabel; + private String heatArtifactType; + private String heatEnvArtifactType; + private String heatArtifactDisplayName; + private List<HeatParameterDataDefinition> heatParameterDefinition; + + public HeatWithParametersDefinition(String heatLabel, String heatEnvLabel, String heatArtifactType, String heatEnvArtifactType, String heatArtifactDisplayName, List<HeatParameterDataDefinition> heatParameterDefinition) { + super(); + this.heatLabel = heatLabel; + this.heatEnvLabel = heatEnvLabel; + this.heatArtifactType = heatArtifactType; + this.heatEnvArtifactType = heatEnvArtifactType; + this.heatArtifactDisplayName = heatArtifactDisplayName; + this.heatParameterDefinition = heatParameterDefinition; + } + + public String getHeatArtifactDisplayName() { + return heatArtifactDisplayName; + } + + public void setHeatArtifactDisplayName(String heatArtifactDisplayName) { + this.heatArtifactDisplayName = heatArtifactDisplayName; + } + + public String getHeatLabel() { + return heatLabel; + } + + public void setHeatLabel(String heatLabel) { + this.heatLabel = heatLabel; + } + + public String getHeatEnvLabel() { + return heatEnvLabel; + } + + public void setHeatEnvLabel(String heatEnvLabel) { + this.heatEnvLabel = heatEnvLabel; + } + + public String getHeatArtifactType() { + return heatArtifactType; + } + + public void setHeatArtifactType(String heatArtifactType) { + this.heatArtifactType = heatArtifactType; + } + + public String getHeatEnvArtifactType() { + return heatEnvArtifactType; + } + + public void setHeatEnvArtifactType(String heatEnvArtifactType) { + this.heatEnvArtifactType = heatEnvArtifactType; + } + + public List<HeatParameterDataDefinition> getHeatParameterDefinition() { + return heatParameterDefinition; + } + + public void setHeatParameterDefinition(List<HeatParameterDataDefinition> heatParameterDefinition) { + this.heatParameterDefinition = heatParameterDefinition; + } + + @Override + public String toString() { + return "HeatWithParametersDefinition [heatLabel=" + heatLabel + ", heatEnvLabel=" + heatEnvLabel + ", heatArtifactType=" + heatArtifactType + ", heatEnvArtifactType=" + heatEnvArtifactType + ", heatArtifactDisplayName=" + + heatArtifactDisplayName + ", heatParameterDefinition=" + heatParameterDefinition + "]"; + } + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java index 29274179d1..773cb57b2e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java @@ -30,7 +30,8 @@ public enum LifeCycleStateEnum { DISTRIBUTION_REJECTED("DISTRIBUTION REJECTED"), DISTRIBUTION_APPROVED("DISTRIBUTION APPROVED"), CERTIFIED("CERTIFIED"), - DISTRIBUTED("DISTRIBUTED"); + DISTRIBUTED("DISTRIBUTED"), + IN_DESIGN("IN DESIGN"); private String value; private String value2; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java index d23ab18f10..63171a6c78 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java @@ -22,15 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum MenuOptionsEnum { - EDIT("Edit"), - CHECK_IN("Check in"), - CHECK_OUT("Check out"), - VIEW("View"), - SUBMIT_FOR_TEST("Submit For Test"), - ACCEPT("Accept"), - REJECT("Reject"), - START_TEST("Start test"), - DISTREBUTE("Distribute"); + EDIT("Edit"), CHECK_IN("Check in"), CHECK_OUT("Check out"), VIEW("View"), SUBMIT_FOR_TEST("Submit For Test"), ACCEPT("Accept"), REJECT("Reject"), START_TEST("Start test"), DISTREBUTE("Distribute"); private String value; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java index 385093e5ad..785a355e13 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java @@ -28,17 +28,17 @@ public class PropertyInfo { super(); } - public PropertyInfo(String name, String value, String desc, PropertyTypeEnum type) { + public PropertyInfo(PropertyTypeEnum prop) { super(); - this.name = name; - this.value = value; - this.type = type; - this.description = desc; + this.name = prop.getName(); + this.value = prop.getValue(); + this.type = prop.getType(); + this.description = prop.getDescription(); } private String name; private String value; - private PropertyTypeEnum type; + private String type; private String description; public String getName() { @@ -57,11 +57,11 @@ public class PropertyInfo { this.value = value; } - public PropertyTypeEnum getType() { + public String getType() { return type; } - public void setType(PropertyTypeEnum type) { + public void setType(String type) { this.type = type; } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java index 921493f932..2c49c8718b 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java @@ -21,43 +21,25 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum ResourceCategoriesNameEnum { - - GENERIC("checkbox-resourcenewcategory.generic"), - NETWORK_CONNECTIVITY("checkbox-resourcenewcategory.networkconnectivity"), - NETWORK_ELEMENTS("checkbox-resourcenewcategory.generic.networkelements"), - ABSTRACT("checkbox-resourcenewcategory.generic.abstract"), - DATABASE_GENERIC("checkbox-resourcenewcategory.generic.database"), - INFRASTRUCTURE("checkbox-resourcenewcategory.generic.infrastructure"), - VIRTUAL_LINKS("checkbox-resourcenewcategory.networkconnectivity.virtuallinks"), - CONNECTION_POINTS("checkbox-resourcenewcategory.networkconnectivity.connectionpoints"), - NETWORKL4("checkbox-resourcenewcategory.networkl4+"), - COMMON_NETWORK_RESOURCES("checkbox-resourcenewcategory.networkl4+.commonnetworkresources"), - APPLICATIONL4("checkbox-resourcenewcategory.applicationl4+"), - WEB_SERVER("checkbox-resourcenewcategory.applicationl4+.webserver"), - APPLICATION_SERVER("checkbox-resourcenewcategory.applicationl4+.applicationserver"), - CALL_CONTROL("checkbox-resourcenewcategory.applicationl4+.callcontrol"), - BORDER_ELEMENT("checkbox-resourcenewcategory.applicationl4+.borderelement"), - MEDIA_SERVERS("checkbox-resourcenewcategory.applicationl4+.mediaservers"), - DATABASE("checkbox-resourcenewcategory.applicationl4+.database"), - FIREWALL("checkbox-resourcenewcategory.applicationl4+.firewall"), - LOAD_BALANCER("checkbox-resourcenewcategory.applicationl4+.loadbalancer"), - NETWORK_L23("checkbox-resourcenewcategory.networkl2-3"), - Router("checkbox-resourcenewcategory.networkl2-3.router"), - WAN_Connectors("checkbox-resourcenewcategory.networkl2-3.wanconnectors"), - LAN_CONNECTORS("checkbox-resourcenewcategory.networkl2-3.lanconnectors"), - GATEWAY("checkbox-resourcenewcategory.networkl2-3.gateway"), + + GENERIC("checkbox-resourcenewcategory.generic"), NETWORK_CONNECTIVITY("checkbox-resourcenewcategory.networkconnectivity"), NETWORK_ELEMENTS("checkbox-resourcenewcategory.generic.networkelements"), + ABSTRACT("checkbox-resourcenewcategory.generic.abstract"), DATABASE_GENERIC("checkbox-resourcenewcategory.generic.database"), INFRASTRUCTURE("checkbox-resourcenewcategory.generic.infrastructure"), + VIRTUAL_LINKS("checkbox-resourcenewcategory.networkconnectivity.virtuallinks"), CONNECTION_POINTS("checkbox-resourcenewcategory.networkconnectivity.connectionpoints"), NETWORKL4("checkbox-resourcenewcategory.networkl4+"), + COMMON_NETWORK_RESOURCES("checkbox-resourcenewcategory.networkl4+.commonnetworkresources"), APPLICATIONL4("checkbox-resourcenewcategory.applicationl4+"), WEB_SERVER("checkbox-resourcenewcategory.applicationl4+.webserver"), + APPLICATION_SERVER("checkbox-resourcenewcategory.applicationl4+.applicationserver"), CALL_CONTROL("checkbox-resourcenewcategory.applicationl4+.callcontrol"), BORDER_ELEMENT("checkbox-resourcenewcategory.applicationl4+.borderelement"), + MEDIA_SERVERS("checkbox-resourcenewcategory.applicationl4+.mediaservers"), DATABASE("checkbox-resourcenewcategory.applicationl4+.database"), FIREWALL("checkbox-resourcenewcategory.applicationl4+.firewall"), + LOAD_BALANCER("checkbox-resourcenewcategory.applicationl4+.loadbalancer"), NETWORK_L23("checkbox-resourcenewcategory.networkl2-3"), Router("checkbox-resourcenewcategory.networkl2-3.router"), + WAN_Connectors("checkbox-resourcenewcategory.networkl2-3.wanconnectors"), LAN_CONNECTORS("checkbox-resourcenewcategory.networkl2-3.lanconnectors"), GATEWAY("checkbox-resourcenewcategory.networkl2-3.gateway"), INFRASTRUCTUREL23("checkbox-resourcenewcategory.networkl2-3.infrastructure"); - - + private String value; - - public String getValue(){ + + public String getValue() { return value; } - + private ResourceCategoriesNameEnum(String value) { this.value = value; } - } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java index d39bba5594..b90e311f72 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java @@ -22,10 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum ServiceCategoriesNameEnum { - NETWORK_L13("checkbox-servicenewcategory.networkl1-3"), - VOIPCALL_CONTROL("checkbox-servicenewcategory.voipcallcontrol"), - NETWORKL4("checkbox-servicenewcategory.networkl4+"), - MOBILITY("checkbox-servicenewcategory.mobility"); + NETWORK_L13("checkbox-servicenewcategory.networkl1-3"), VOIPCALL_CONTROL("checkbox-servicenewcategory.voipcallcontrol"), NETWORKL4("checkbox-servicenewcategory.networkl4+"), MOBILITY("checkbox-servicenewcategory.mobility"); private String value; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java index 21d5f25013..9e81505111 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.ci.tests.datatypes; -public enum BreadCrumbsButtonsEnum { +public enum TopMenuButtonsEnum { HOME("main-menu-button-home"), CATALOG("main-menu-button-catalog"), ON_BOARDING("main-menu-button-onboard"); @@ -31,7 +31,7 @@ public enum BreadCrumbsButtonsEnum { return value; } - private BreadCrumbsButtonsEnum(String value) { + private TopMenuButtonsEnum(String value) { this.value = value; } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java index 1bff4d51e6..d27eb0c150 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java @@ -22,14 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum TypesEnum { - RESOURCE("checkbox-resource"), - VF("checkbox-vf"), - VFC("checkbox-vfc"), - CP("checkbox-cp"), - VL("checkbox-vl"), - SERVICE("checkbox-service"), - PRODUCT("checkbox-product"); - + RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product"); private String value; public String getValue() { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java index 870d2879bb..2de872504f 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java @@ -27,13 +27,14 @@ public class UserCredentials extends User { // private String userName; private String password; - public UserCredentials(String userId, String password, String firstname, String lastname) { + public UserCredentials(String userId, String password, String firstname, String lastname, String role) { super(); setUserId(userId); // this.userName = userName; this.password = password; setFirstName(firstname); setLastName(lastname); + setRole(role); } public UserCredentials() { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java new file mode 100644 index 0000000000..0101b430d8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.datatypes; + +import java.util.List; + +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +public class UserManagementTab { + + public void searchUser(String searchCriterion){ + ExtentTestActions.log(Status.INFO, "Searching a user by the value : " + searchCriterion); + WebElement searchBoxWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.SEARCH_BOX.getValue()); + searchBoxWebElement.clear(); + searchBoxWebElement.sendKeys(searchCriterion); + GeneralUIUtils.ultimateWait(); + } + + public void setNewUserBox(String user){ + ExtentTestActions.log(Status.INFO, "Inserting userid " + user); + WebElement createNewUserWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.NEW_USER_FIELD.getValue()); + createNewUserWebElement.clear(); + createNewUserWebElement.sendKeys(user); + GeneralUIUtils.ultimateWait(); + } + + public void selectUserRole(UserRoleEnum userRole){ + String role = userRole.name().toLowerCase(); + ExtentTestActions.log(Status.INFO, "Selecting role " + userRole.name()); + GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.ROLE_SELECT.getValue()); + } + + public void updateUserRole(UserRoleEnum userRole, int rowIndx){ + String role = userRole.name().toLowerCase(); + ExtentTestActions.log(Status.INFO, "Updating the user role to " + userRole.name()); + GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.UPDATE_ROLE.getValue() + rowIndx); + } + + public void clickCreateButton(){ + ExtentTestActions.log(Status.INFO, "Clicking on 'Create' button."); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.CREATE_BUTTON.getValue()); + } + + public WebElement getRow(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue() + index); + } + + public WebElement getFirstName(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.FIRST_NAME.getValue() + index); + } + + public WebElement getLastName(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_NAME.getValue() + index); + } + + public WebElement getUserId(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue() + index); + } + + public WebElement getEmail(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.EMAIL.getValue() + index); + } + + public WebElement getRole(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROLE.getValue() + index); + } + + public WebElement getLastActive(int index){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_ACTIVE.getValue() + index); + } + + public void updateUser(int index){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.UPDATE_USER_BUTTON.getValue() + index); + } + + public void deleteUser(int index){ + ExtentTestActions.log(Status.INFO, "Deleting the user in row " + (index + 1)); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.DELETE_USER.getValue() + index); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + } + + public void saveAfterUpdateUser(int index){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.SAVE_USER.getValue() + index); + } + + public List<WebElement> getAllRowsDisplayed(){ + return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue()); + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java new file mode 100644 index 0000000000..540a36ad18 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.datatypes; + +public class VFCArtifact { + + String artifactUUID; + String artifactVersion; + String artifactname; + String artifacttype; + + + public VFCArtifact(String artifactName, String artifactType, String uuid, String version){ + artifactname = artifactName; + artifactUUID = uuid; + artifactVersion = version; + artifacttype = artifactType; + } + + public String getArtifactUUID() { + return artifactUUID; + } + + public void setArtifactUUID(String artifactUUID) { + this.artifactUUID = artifactUUID; + } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public String getArtifactname() { + return artifactname; + } + + public void setArtifactname(String artifactname) { + this.artifactname = artifactname; + } + + public String getArtifacttype() { + return artifacttype; + } + + public void setArtifacttype(String artifacttype) { + this.artifacttype = artifacttype; + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java deleted file mode 100644 index 19a0d6414f..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.adminworkspace; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.validation.constraints.AssertTrue; - -import org.junit.rules.TestName; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.google.common.collect.Ordering; - -public class AdminUserManagment extends SetupCDTest { - // - // public AdminUserManagment() { - // super(new TestName(), AdminUserManagment.class.getName()); - // } - - private WebDriver driver = GeneralUIUtils.getDriver(); - - // Create new USER_ID user - @Test - public void creatUserIdNewUserTest() throws Exception { - String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(userId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.typeToSearchBox(userId); - String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText(); - userId.equals(createdUserUserId); - GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting"); - GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role); - AdminWorkspaceUIUtilies.deleteuser(userId); - - } - - // Create new MacId user - @Test - public void creatMacIdNewUserTest() throws Exception { - - String macId = AdminWorkspaceUIUtilies.defineNewUserId("m12345"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(macId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.typeToSearchBox(macId); - String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText(); - macId.equals(createdUserUserId); - GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting"); - GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role); - AdminWorkspaceUIUtilies.deleteuser(macId); - } - - // Create exist user and get error already exist . - @Test - public void createxistUserTest() throws Exception { - String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(userId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.defineNewUserId(userId); - AdminWorkspaceUIUtilies.selectUserRole("admin"); - GeneralUIUtils.getWebButton("creategreen").click(); - ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") - .equals("User with '" + userId + "' ID already exists."); - GeneralUIUtils.clickOkButton(); - AdminWorkspaceUIUtilies.deleteuser(userId); - - } - - // enter Special chars and the create button disabled. - @Test - public void insertSpacialcharsTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("!@DER%"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // enter invalid macid and create button shall be disabled. - @Test - public void insertInvalidUserMacidTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("k12345"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // enter invalid userId and create button shall be disabled. - @Test - public void insertInvalidUserUserIdTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("ac1c23"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // display users list and sort by column name. - @Test - public void displayuserslistandsorting() throws Exception { - GeneralUIUtils.getWebElementWaitForVisible("thFirst Name").click(); - Collection<WebElement> usersFname = GeneralUIUtils.getWebElements("tdFirst Name"); - for (WebElement webElement : usersFname) { - System.out.println(webElement.getText()); - } - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.ADMIN; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java deleted file mode 100644 index 39755a9db8..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum; -import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; -import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class CatalogLeftFilterPanelCheckBoxTest extends SetupCDTest { - - public CatalogLeftFilterPanelCheckBoxTest() { - // TODO Auto-generated constructor stub - } - - private ResourceReqDetails resourceDetails; - FileWriter filwriter = GeneralUIUtils.InitializeprintToTxt("CatalogLeftFilterPanelCheckBoxTest"); - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - // filter by Type Resource in catalog - @Test - public void filterByAssetTypeResource() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VF", "VL", "CP", "VFC"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.RESOURCE); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVF() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VF"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VF); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVFC() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VFC"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VFC); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeCP() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("CP"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.CP); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVL() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VL"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VL); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - // @Test - // public void filterByProducTType() throws Exception{ - // List<WebElement> elements = null; - // List<String> validValues = Arrays.asList("PRODUCT"); - // GeneralUIUtils.checkIn(); - // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - // GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.PRODUCT); - // GeneralUIUtils.getWorkspaceElements(); - // try { - // elements = - // GeneralUIUtils.getEelementsByClassName1("w-sdc-dashboard-card-avatar"); - // for (WebElement webElement : elements) { - // assertTrue(validValues.contains(webElement.findElement(By.xpath(".//*")).getAttribute("class"))); - // } - // } catch (Exception e) { - // System.out.println("No Elements founds!"); - // } - // } - - @Test - public void filterByResourceCategories() throws Exception { - List<WebElement> elements = null; - List<String> validValues = null; - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - Thread.sleep(2000); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE); - List<String> categories = CatalogUIUtilitis.abcd(); - for (String category : categories) { - validValues = CatalogUIUtilitis.getAllSubcategoriesByUniqueId(category); - boolean bool = false; - try { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - bool = true; - } catch (Exception e) { - while (!bool) { - GeneralUIUtils.scrollDown(); - try { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - bool = true; - } catch (Exception e2) { - - } - } - } - String checkBox = GeneralUIUtils.getWebElementWaitForVisible(category).findElement(By.xpath(".//input")) - .getAttribute("class"); - if (checkBox.contains("ng-not-empty") && validValues != null) { - try { - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.getEelementsBycontainsClassName("sprite-resource-icons"); - for (WebElement webElement : elements) { - String elementUniqueId = webElement.getAttribute("data-tests-id"); - if (!validValues.contains(elementUniqueId)) { - System.out.println("assert error!"); - } - } - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - } catch (Exception e) { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - System.out.println("No Elements founds!"); - } - } - } - } - - @SuppressWarnings("null") - @Test - public void filterByStatus() throws Exception { - - List<WebElement> elements = null; - List<String> validValues = null; - List<ResourceReqDetails> createdComponents = new ArrayList<ResourceReqDetails>(); - List<String> catalogStatuses = Arrays.asList("IN_DESIGN", "READY_FOR_TESTING", "IN_TESTING", "CERTIFIED", - "DISTRIBUTED"); - GeneralUIUtils.checkIn(); - for (int i = 1; i < catalogStatuses.size() - 1; i++) { - GeneralUIUtils.sleep(3000); - GeneralUIUtils.createAndImportButtons(CreateAndImportButtonsEnum.CREATE_VF, GeneralUIUtils.getDriver()); - resourceDetails.setName(getRandomComponentName("ResourceCDTest-")); - ResourceUIUtils.createResourceInUI(resourceDetails, getUser()); - GeneralUIUtils.clickSubmitForTest(); - if (catalogStatuses.get(i) == "IN_TESTING") { - GeneralUIUtils.testerUser(true, false, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - - } - if (catalogStatuses.get(i) == "CERTIFIED") { - GeneralUIUtils.testerUser(true, true, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - } - if (catalogStatuses.get(i) == "DISTRIBUTED") { - GeneralUIUtils.testerUser(true, true, resourceDetails); - GeneralUIUtils.governorUser(false, true, resourceDetails); - GeneralUIUtils.opsUser(true, false, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - - } - createdComponents.add(resourceDetails); - } - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - // get filters title close. - Thread.sleep(2000); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.CATEGORIES); - for (CheckBoxStatusEnum statusEnum : CheckBoxStatusEnum.values()) { - if (catalogStatuses.contains(statusEnum.name().toString())) { - validValues = GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - if (GeneralUIUtils.getWorkspaceElements().size() > 0) { - String checkBox = GeneralUIUtils.getWebElementByName(statusEnum.getCatalogValue()) - .getAttribute("class"); - if (checkBox.contains("ng-not-empty") && validValues != null) { - try { - elements = GeneralUIUtils.getEelementsBycontainsClassName("w-sdc-dashboard-card-edit"); - for (WebElement webElement : elements) { - String className = webElement.getAttribute("class"); - String textCategory = className.substring(className.indexOf(" ")); - assertTrue(validValues.contains(textCategory.replace(" ", ""))); - } - GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - } catch (Exception e) { - GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - System.out.println("No Elements founds!"); - } - } - } else { - break; - } - } - } - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java deleted file mode 100644 index efdb9532a4..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.io.FileWriter; -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class CatalogSearchBoxTest extends SetupCDTest { - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - // search by ResourceName - @Test - public void searchResourceInCatalogMenuTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - Thread.sleep(500); - assertTrue(GeneralUIUtils.getWorkspaceElements().size() == 1); - } - - // search by Description - @Test - public void searchResourceInCatalogMenuByDescriptionTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription()); - Thread.sleep(2000); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - - int count = 0; - for (WebElement webElement : assets) { - if (count != 0) { - GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription()); - } - if (count == 0) { - webElement.click(); - } else { - List<WebElement> assets1 = GeneralUIUtils.getWorkspaceElements(); - assets1.get(count).click(); - } - GeneralUIUtils.getWebElementWaitForVisible("description").getText() - .equals(resourceDetails.getDescription()); - GeneralUIUtils.clickExitSign(); - Thread.sleep(500); - count++; - } - } - - // search by tags - @Test - public void searchResourceInCatalogMenuBytagsTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getTags().get(0)); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - List<WebElement> expectedTagsList = GeneralUIUtils.getWebElements("i-sdc-tag-text"); - for (int i = 0; i < expectedTagsList.size(); i++) { - expectedTagsList.get(i).equals(resourceDetails.getTags().get(i)); - } - - } - - // search by Version - @Test - public void searchResourceInCatalogMenuByVersionTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getVersion().replace("V", "")); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText() - .equals(resourceDetails.getVersion()); - } - - // search by SpecialCharacters - @Test - public void searchResourceInCatalogMenuBySpecialCharactersTest() throws Exception { - GeneralUIUtils.moveToStep(StepsEnum.GENERAL); - GeneralUIUtils.defineDescription(resourceDetails.getDescription() + "!@#$%^&*"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox("!@#$%^&*"); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - GeneralUIUtils.getWebElementWaitForVisible("description").getText().equals(resourceDetails.getDescription()); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java deleted file mode 100644 index a75240d2b2..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class ChangeLifeCycleStatFromCatalogTest extends SetupCDTest { - - public ChangeLifeCycleStatFromCatalogTest() { - // TODO Auto-generated constructor stub - } - - // This test check the status filter . - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - @Test - public void checkInFromCatalog() throws InterruptedException { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - if (assets.isEmpty()) { - System.out.println("error elements not found."); - } else { - for (WebElement webElement : assets) { - webElement.click(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - Thread.sleep(2000); - System.out.println(ResourceUIUtils.lifeCycleStateUI()); - System.out.println(LifeCycleStateEnum.CHECKIN.getValue()); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue())); - - } - } - - } - - @Test - public void checkOutFromCatalog() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - if (assets.isEmpty()) { - System.out.println("error elements not found."); - } else { - for (WebElement webElement : assets) { - webElement.click(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue())); - - } - } - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java deleted file mode 100644 index 8e9df40068..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java +++ /dev/null @@ -1,480 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.Assert.assertNotEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; -import java.util.Map; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ImportAssetUIUtils; -import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.testng.AssertJUnit; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class ImportAssetInUITest extends SetupCDTest { - - private ResourceReqDetails resourceDetails; - - @BeforeMethod(alwaysRun = true) - public void inializeBeforeImportTest() { - GeneralUIUtils.fileName = "JDM_vfc.yml"; - resourceDetails = ElementFactory.getDefaultResource(); - resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString()); - } - - @Test - public void importAssetFillGeneralInfoAndSelectIconTest() throws Exception { - ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - CreateAndImportButtonsEnum.IMPORT_CP); - ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser()); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - ResourceUIUtils.getVFCGeneralInfoAndValidate(resourceDetails, getUser()); - } - - @Test - public void changeImportedAssetFileTest() throws Exception { - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - String firstFileName = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - AssertJUnit.assertTrue(firstFileName.equals(GeneralUIUtils.fileName)); - String secondFileName = "Valid_tosca_ReplaceTest.yml"; - ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, secondFileName); - String secondFileNameFromField = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - // assertThat(fileName, not(secondFileNameFromField)); - assertNotEquals(GeneralUIUtils.fileName, secondFileNameFromField); - } - - @Test - public void duplicateFileTest() throws Exception { - ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - CreateAndImportButtonsEnum.IMPORT_CP); - ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser()); - String nameofresource = resourceDetails.getName(); - resourceDetails.setName(getRandomComponentName("SecondImportCDTest")); - GeneralUIUtils.checkIn(); - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.allReadyExistErro); - GeneralUIUtils.clickOkButton(); - resourceDetails.setName(nameofresource); - - } - - @Test - public void importInvalidFileTest() throws Exception { - GeneralUIUtils.fileName = "InValid_tosca_File .yml"; - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.toscaErrorMessage); - GeneralUIUtils.clickOkButton(); - } - - @Test - public void deleteImportAssetFileTest() throws Exception { - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - WebElement deleteFileButton = GeneralUIUtils.getDriver() - .findElement(By.className("i-sdc-form-file-upload-x-btn")); - deleteFileButton.click(); - WebElement filefield = GeneralUIUtils.getWebElementWaitForVisible("filename"); - AssertJUnit.assertEquals("", filefield.getText()); - } - - // Add artifact by Clicking the Place holders button. - @Test - public void importAssetAddInformationArtifactPlaceHoldersTest() throws Exception { - // fileName = "CP_WAN.yml"; - String artifactByname = "placeHolder"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT); - GeneralUIUtils.getWebElementWaitForVisible("Features"); - List<WebElement> Placholders = GeneralUIUtils.getDriver().findElements(By.className("add-button")); - for (WebElement element : Placholders) { - Thread.sleep(500); - element.click(); - // Placholders.get(4).click(); - System.out.println(element.getText()); - if (element.getText().equalsIgnoreCase("Add Other Artifact")) { - ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact("Create New Artifact"), false); - } else { - ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact(null), false); - } - } - } - - // Add information artifact by Clicking the Add button. - @Test - public void importAssetAddInformationArtifactAddButtonTest() throws Exception { - String type = "Create New Artifact"; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT); - GeneralUIUtils.actionBuild(GeneralUIUtils.getWebButton("add-information-artifact-button")).click(); - ; - ; - Map<String, String> expected = ArtifactUIUtils.addInformationalArtifact(type); - Thread.sleep(1000); - ResourceUIUtils.scrollDownPage(); - ArtifactUIUtils.valideArtifact(expected, false); - } - - // Add New property String Type. - @Test - public void importAssetAddStringPropertyTest() throws Exception { - WebElement prop = null; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - Thread.sleep(500); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("String-Property", "string", - "!This is strig123456@#$%$", "This is description.", null); - WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow"); - GeneralUIUtils.actionBuild(elementTohover).click(); - int counter = 0; - try { - prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")); - } catch (Exception e) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - } finally { - if (prop.isDisplayed()) { - counter++; - } - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Add New property Integer Type. - @Test - public void importAssetAddIntegerPropertyTest() throws Exception { - WebElement prop; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - Thread.sleep(500); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Integer-Property", "integer", "123456", - "This is description.", null); - WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow"); - GeneralUIUtils.actionBuild(elementTohover); - int counter = 0; - prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Add New property boolean Type. - @Test - public void importAssetAddBooleanPropertyTest() throws Exception { - // fileName = "CP_WAN.yml"; - WebElement prop; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Boolean-Property", "boolean", "true", - "This is boolean description.", null); - int counter = 0; - WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow")); - GeneralUIUtils.actionBuild(elementTohover); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - AssertJUnit.assertEquals(1, counter); - } - - // Add New property float Type. - @Test - public void importAssetAddFloatPropertyTest() throws Exception { - WebElement prop; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("floatProperty", "float", "22.5", - "This is description.", null); - int counter = 0; - WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow")); - GeneralUIUtils.actionBuild(elementTohover); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Edit property. - @Test - public void importAssetEditPropertiesTest() throws Exception { - // fileName = "CP_WAN.yml"; - Map<String, String> expected = null; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("table-col-general"); - GeneralUIUtils.getWebButton("addGrey").click(); - expected = PropertiesUIUtils.addProperties("BooleanProperty", "boolean", "true", "This is boolean description.", - null); - GeneralUIUtils.getWebElement(GeneralUIUtils.getDriver(), "table-edit-btn").click(); - ; - List<WebElement> properties = GeneralUIUtils.getDriver().findElements(By.xpath("//*[@*='table-edit-btn']")); - ; - for (WebElement webElement : properties) { - webElement.click(); - GeneralUIUtils.defineDescription("This is Property update"); - GeneralUIUtils.getWebButton("Update").click(); - break; - } - Thread.sleep(2000); - GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='BooleanProperty']")).click(); - Thread.sleep(1000); - String actual = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@class='item-opened ng-binding ng-scope']")).getText(); - assertNotEquals(expected.get("name"), actual); - // assertThat(expected.get("name"),not(actual)); - } - - // ************************************************************************************************** - // change VFC version - - // this test return error 500; - @Test(alwaysRun = false) - public void importAssetChangeVersionOfVFCTest() throws Exception { - // fileName = "VFC.yml"; - // resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - - // change VL version - // this test return error 500; - @Test - public void importAssetChangeVersionOfVLTest() throws Exception { - GeneralUIUtils.fileName = "VL.yml"; - resourceDetails.setResourceType(ResourceTypeEnum.VL.getValue()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - // change CP version - - @Test - public void importAssetChangeVersionOfCPTest() throws Exception { - GeneralUIUtils.fileName = "CP_LAN.yml"; - resourceDetails.setResourceType(ResourceTypeEnum.CP.toString()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - - // @Test - // public void viewPageActivityLogTest() throws Exception { - // resourceDetails.setResourceType(ResourceTypeEnum.VF.toString()); - // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, - // GeneralUIUtils.fileName , resourceDetails, getUser(), - // CreateAndImportButtonsEnum.IMPORT_CP); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // RestCDUtils.getResource(resourceDetails, getUser()); - // GeneralUIUtils.checkIn(); - // GeneralUIUtils.openObjectMenuAndSelectOption(resourceDetails.getUniqueId(), - // MenuOptionsEnum.VIEW); - // ResourceUIUtils.lifeCycleState(); - // Thread.sleep(1000); - // ViewPageUIUtils.validateActivityLog("Action: Checkin Performed by: Carlos - // Santana(cs0008) Status: 200"); - // } - - // @Test - // public void downloadArtifactViewPaage() throws Exception { - // importAssetAddInformationArtifactAddButton(); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // ViewPageUIUtils.openDropDownListOfObject(resourceDetails.getName(), - // ImportAssetUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver()), - // "View", - // ImportAssetUIUtils.scrollElement(GeneralUIUtils.getDriver())); - // ValidateViewPageParameters.ViewPagedownloadArtifact(); - // String myheatfile="Heat-File.yaml"; - // //Assert.assertTrue((GeneralUIUtils.FILE_PATH, "mailmerge.xls"), "Failed - // to download - // Expected document"); - // String dowloadedfile= - // "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Downloads\\"+fileName+""; - // int index=dowloadedfile.lastIndexOf("\\"); - // System.out.println(dowloadedfile.substring(index+1)); - // File getLatestFile = getLatestFilefromDir(); - // String fileName = getLatestFile.getName(); - // Assert.assertTrue(fileName.equals("mailmerge.xls"), "Downloaded file name - // is not matching with expected file name"); - // - // } - - @Test - public void importAssetcheckInVFCTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue())); - } - - @Test - public void importAssetcheckOutVFCTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue())); - } - - @Test - public void importAssetDeleteVFCVersionTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - GeneralUIUtils.deleteVersionInUI(); - Thread.sleep(1000); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - AssertJUnit.assertEquals("0.1", version.replace("V", "")); - } - - // @Test(enabled = false) - // public void importAssetVFCPrintScreenTest() throws Exception { - // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, - // GeneralUIUtils.fileName , resourceDetails, getUser()); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // ResourceUIUtils.openDropDownListOfObject(resourceDetails.getName(), - // ResourceUIUtils.getAllObjectsOnWorkspace(driver,resourceDetails), "Edit", - // ResourceUIUtils.scrollElement(driver)); - // ResourceUIUtils.waitfunctionforelements("sprite-resource-icons", 7); - // Thread.sleep(2000); - // WebElement element = - // GeneralUIUtils.getDriver().findElement(By.className("network")); - // WebElement target = - // GeneralUIUtils.getDriver().findElement(By.className("dropzone")); - // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element, - // target).perform(); - // WebElement element1 = - // GeneralUIUtils.getDriver().findElement(By.className("network")); - // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element1, - // target).perform(); - // ResourceUIUtils.clickPrintScreen(); - // - // // the firefox not support print screen. - // } - - @Test - public void importAssetVFCSubmitForTestingTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - String name = ""; - GeneralUIUtils.clickSubmitForTest(); - Thread.sleep(2000); - String url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; - navigateToUrl(url); - GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info"); - int counter = 0; - for (WebElement object : ResourceUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver(), - resourceDetails)) { - if (object.getText().equals(resourceDetails.getName())) { - name = object.getText(); - counter++; - } - } - AssertJUnit.assertEquals(1, counter); - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java deleted file mode 100644 index 51454173de..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Action; -import org.openqa.selenium.interactions.Actions; -import org.testng.annotations.Test; - -public class VFCanvasTest extends SetupCDTest { - - public List<Integer> getposition(WebElement canvas, int width, int height) { - - width = canvas.getSize().getWidth(); - height = canvas.getSize().getHeight(); - Random r = new Random(); - int Resultx = r.nextInt(width); - int Resulty = r.nextInt(height); - List<Integer> position = new ArrayList<Integer>(); - position.add(Resultx); - position.add(Resulty); - return position; - } - - @Test - public void VFCanvasTest1() throws Exception { - // GeneralUIUtils.waitForContainsdataTestIdVisibility("left-sectioin-element-QA"); - - GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); - Thread.sleep(2000); - List<Integer> position = null; - WebElement canvas = GeneralUIUtils.getWebElementWaitForVisible("canvas"); - int xPos = 0; - int yPos = 0; - position = getposition(canvas, xPos, yPos); - WebElement otherElement = GeneralUIUtils - .getWebElementWaitForVisible("left-sectioin-element-QA left-section-NeutronPort"); - for (int i = 0; i < 8; i++) { - Actions builder = new Actions(GeneralUIUtils.getDriver()); - Action dragAndDrop = builder.clickAndHold(otherElement) - .moveToElement(canvas, position.get(0), position.get(1)).release().build(); - dragAndDrop.perform(); - Thread.sleep(2000); - } - Thread.sleep(2000); - Actions builder = new Actions(GeneralUIUtils.getDriver()); - builder.moveToElement(canvas, position.get(0), position.get(1)); - builder.clickAndHold(); - position = getposition(canvas, xPos, yPos); - builder.moveToElement(canvas, position.get(0), position.get(1)); - builder.release(); - builder.build(); - builder.perform(); - builder.moveToElement(canvas, 200, 300); - builder.release(); - builder.perform(); - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java deleted file mode 100644 index 792d687a72..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.testng.AssertJUnit; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class WorkspaceCheckBoxFilterTest extends SetupCDTest { - - // This test check the status filter . - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - @Test - public void selectCheckOutMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKOUT); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectCheckInMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkIn(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKIN); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectReadyForTestingMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.READY_FOR_TESTING); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectInTestIngMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester")); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - GeneralUIUtils.clickStartTesting(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer")); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.IN_TESTING); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectCertifiedMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester")); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - GeneralUIUtils.clickStartTesting(); - GeneralUIUtils.clickAccept(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer")); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CERTIFIED); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java new file mode 100644 index 0000000000..b1cd09c6d8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java @@ -0,0 +1,292 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.io.IOException; +import java.util.List; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils; +import org.openecomp.sdc.ci.tests.verificator.ErrorMessageUIVerificator; +import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class AdminUserManagment extends SetupCDTest { + + @DataProvider(name = "searchValues") + private final Object[][] searchString(){ + User newUser = createNewUserUsingAPI(); + GeneralUIUtils.getDriver().navigate().refresh(); + return new Object[][]{{newUser.getUserId(), newUser}, {newUser.getFirstName(), newUser}, {newUser.getLastName(), newUser}, {newUser.getEmail(), newUser}}; + } + + //TC915101 + @Test(dataProvider = "searchValues") + public void searchUserByCriterionsTest(String searchCriterion, User user) throws IOException{ + setLog(searchCriterion); + AdminWorkspaceUIUtilies.searchForUser(searchCriterion); + UserManagementVerificator.validateFirstRowDisplayedCorrectly(user); + } + + //TC915100 + @Test + public void creatNewUserTest() throws Exception { + + String userId = generateValidUserId(); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(userId, userRole); + UserManagementVerificator.validateUserCreated(userId, userRole); + } + + //TC922253 + @Test + public void creatNewUser_MacIdTest() throws Exception { + + String macId = generateValidMacId(); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(macId, userRole); + UserManagementVerificator.validateUserCreated(macId, userRole); + } + + //TC922253 + @Test + public void createExistingUserTest(){ + String userId = generateValidUserId(); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(userId, userRole); + ExtentTestActions.log(Status.INFO, "Trying to create the same user once again."); + AdminWorkspaceUIUtilies.createNewUser(userId, userRole); + ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.USER_ALREADY_EXIST); + } + + //TC922253 + @Test + public void createInvalidMacIdTest(){ + String macId = generateValidMacId(); + StringBuilder invalidMacId = new StringBuilder(macId); + invalidMacId.setCharAt(0, 'a'); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + ExtentTestActions.log(Status.INFO, "Trying to create an invalid macId."); + AdminWorkspaceUIUtilies.createNewUser(invalidMacId.toString(), userRole); + ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.INVALID_USER_ID); + } + + //TC922253 + @Test + public void specialCharInUserIdTest(){ + String expectedErrorMsg = "User id not valid."; + String userId = generateValidUserId(); + StringBuilder invalidUserId = new StringBuilder(userId); + invalidUserId.setCharAt(1, '#'); + ExtentTestActions.log(Status.INFO, String.format("Trying to create an invalid user with special character (%s)", userId)); + AdminGeneralPage.getUserManagementTab().setNewUserBox(invalidUserId.toString()); + ExtentTestActions.log(Status.INFO, "Validating an error message is displayed as a result of invalid character."); + List<WebElement> inputErrors = null; + int inputErrorsSize = 0; + + try{ + WebElement inputField = GeneralUIUtils.getWebElementByClassName("input-error"); + ExtentTestActions.log(Status.INFO, String.format("Validating the message is : '%s'", expectedErrorMsg)); + inputErrors = inputField.findElements(By.className("ng-scope")); + inputErrorsSize = inputErrors.size(); + for (WebElement err : inputErrors){ + String actualErrorMessage = err.getText(); + if (actualErrorMessage.equals(expectedErrorMsg)){ + inputErrorsSize--; + } + } + } + catch(Exception e){ + ExtentTestActions.log(Status.INFO, "Did not find an error input."); + Assert.fail("Did not find an error message input."); + } + + Assert.assertEquals(inputErrors.size() - 1 , inputErrorsSize, "Did not find an error : " + expectedErrorMsg); + } + + + + //TC915101 + @Test + public void searchForUserByRoleTest(){ + String userId = generateValidUserId(); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(userId, userRole); + AdminWorkspaceUIUtilies.searchForUser(userRole.name()); + List<WebElement> allRows = GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue()); + ExtentTestActions.log(Status.INFO, String.format("Found %s rows, looking for the user %s.", allRows.size(), userId)); + int rowsCount = allRows.size(); + for (int i = 0 ; i < allRows.size() ; i++){ + String userIdFromTable = GeneralUIUtils.getTextContentAttributeValue(allRows.get(i)); + if (userIdFromTable.equals(userId)){ + rowsCount--; + break; + } + } + Assert.assertEquals(allRows.size() - 1 , rowsCount , "Did not find a row with the userId " + userId); + } + + //TC915102 + @Test + public void modifyUserRoleTest(){ + User user = new User(); + user.setUserId(generateValidUserId()); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole); + UserRoleEnum updatedUserRole = UserRoleEnum.TESTER; + AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole); + UserManagementVerificator.validateUserRoleUpdated(0, updatedUserRole); + UserManagementVerificator.validateUserRoleUpdatedViaRest(user, getUser(), updatedUserRole); + } + + //TC915103 + @Test + public void deleteUserTest(){ + User user = new User(); + user.setUserId(generateValidUserId()); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole); + AdminWorkspaceUIUtilies.deleteFirstRow(); + UserManagementVerificator.validateUserIdNotFound(user.getUserId()); + UserManagementVerificator.validateUserNotFoundViaRest(user, getUser()); + } + + //TC951428 + @Test + public void modifyUserRoleWithTaskInHand_Checkout() throws Exception{ + User newUser = new User(); + newUser.setUserId(generateValidUserId()); + UserRoleEnum userRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.createNewUser(newUser.getUserId(), userRole); + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, newUser); + ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName() + " with the user " + newUser.getUserId()); + RestResponse createResourceResp = ResourceRestUtils.createResource(resourceMetaData, newUser); + Assert.assertEquals(createResourceResp.getErrorCode().intValue(), 201, "Did not succeed to create a VF"); + + UserRoleEnum updatedUserRole = UserRoleEnum.TESTER; + AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole); + + ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS); + } + + @Test + public void modifyUserRoleWithTaskInHand_InTesting() throws Exception{ + User newTesterUser = new User(); + newTesterUser.setUserId(generateValidUserId()); + UserRoleEnum userTesterRole = UserRoleEnum.TESTER; + userTesterRole.setUserId(newTesterUser.getUserId()); + AdminWorkspaceUIUtilies.createNewUser(newTesterUser.getUserId(), userTesterRole); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName()); + ResourceUIUtils.createResource(resourceMetaData, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName()); + Resource resourceObjectByNameAndVersion = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1"); + ExtentTestActions.log(Status.INFO, "Getting the VF to 'In Testing' state."); + AtomicOperationUtils.changeComponentState(resourceObjectByNameAndVersion, userTesterRole, LifeCycleStatesEnum.STARTCERTIFICATION, true); + ExtentTestActions.log(Status.INFO, "Succeeded - The VF is in testing state."); + + reloginWithNewRole(UserRoleEnum.ADMIN); + UserRoleEnum updatedUserRole = UserRoleEnum.DESIGNER; + AdminWorkspaceUIUtilies.searchForUser(newTesterUser.getUserId()); + AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole); + + ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS); + } + + + private static String generateValidUserId() { + String charsPattern = "abcdefghijklmnopqrstuvwxyz"; + String digitPatter = "0123456789"; + String chars = ResourceUIUtils.buildStringFromPattern(charsPattern, 2); + String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 4); + return chars + digits; + } + + private String generateValidMacId() { + String digitPatter = "0123456789"; + String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 5); + return "m" + digits; + } + + private User createNewUserUsingAPI() { + UserRoleEnum role = UserRoleEnum.DESIGNER; + String userId = generateValidUserId(); + User userByEnv = new User(generateValidUserId(), generateValidUserId(), userId, generateValidUserId()+"@intl.sdc.com", role.name(), null); + User adminUser = getUserByEnv(UserRoleEnum.ADMIN); + try { + RestResponse createUserResp = UserRestUtils.createUser(userByEnv, adminUser); + Assert.assertEquals(createUserResp.getErrorCode().intValue(), 201, "Did not succeed to create a new user using API."); + } catch (IOException e) { + e.printStackTrace(); + } + return userByEnv; + } + + + private User getUserByEnv(UserRoleEnum userRole) { + try{ + if (!getConfig().getUrl().contains("localhost") && !getConfig().getUrl().contains("127.0.0.1")) { + return getUserFromFileByRole(userRole); + } + else{ + return getUser(userRole); + } + } + catch (Exception e){ + throw new RuntimeException(e); + } + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.ADMIN; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java new file mode 100644 index 0000000000..10389d9331 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java @@ -0,0 +1,236 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelSubCategoryCheckbox; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.CatalogVerificator; +import org.openqa.selenium.WebElement; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +@Test(singleThreaded = true) +public class CatalogLeftPanelTest extends SetupCDTest{ + + private String filePath; + @BeforeMethod + public void beforeTest(){ + filePath = System.getProperty("filepath"); + + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } + } + + public static String[] resourceTypes = Arrays.stream(ResourceTypeEnum.class.getEnumConstants()). + map(ResourceTypeEnum::name).toArray(String[]::new); + + public static String[] catalogTypes = {"RESOURCE", "SERVICE", "PRODUCT"}; + + public static Object[][] provideData(String[] arObj) { + Object[][] arObject = new Object[arObj.length][]; + + int index = 0; + for (Object obj : arObj) { + arObject[index++] = new Object[]{obj}; + } + return arObject; + } + + @DataProvider(name = "Resource_Type_List") + private static final Object[][] resourceTypeList(){ + // Extract names of constants from enum as array of Strings + ResourceTypeEnum[] resourceEnums = {ResourceTypeEnum.CP, ResourceTypeEnum.VF, ResourceTypeEnum.VFC, ResourceTypeEnum.VL}; + String[] resourcesForTest = Arrays.stream(resourceEnums).map(ResourceTypeEnum::name).toArray(String[]::new); + return provideData(resourcesForTest); + } + + @DataProvider(name = "Type_List") + private static final Object[][] typeList(){ + // Extract names of constants from enum as array of Strings + Object[][] arObject = new Object[catalogTypes.length][]; + int index = 0; + for (String catalogType : catalogTypes) { + if (catalogType.equals("RESOURCE")){ + arObject[index++] = new Object[]{catalogType, resourceTypes}; + } else { + arObject[index++] = new Object[]{catalogType, new String[] {catalogType}}; + } + } + return arObject; + } + + @DataProvider(name = "Status_List") + private static final Object[][] statusList(){ + CheckBoxStatusEnum[] checkboxes = {CheckBoxStatusEnum.CERTIFIED, + CheckBoxStatusEnum.IN_DESIGN, + CheckBoxStatusEnum.DISTRIBUTED, + CheckBoxStatusEnum.IN_TESTING, + CheckBoxStatusEnum.READY_FOR_TESTING}; + Object[][] arObject = new Object[checkboxes.length][]; + int index = 0; + for (CheckBoxStatusEnum checkbox: checkboxes) { + if (checkbox.equals(CheckBoxStatusEnum.CERTIFIED)){ + arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CERTIFIED, LifeCycleStateEnum.DISTRIBUTED, LifeCycleStateEnum.WAITING_FOR_DISTRIBUTION) }; + } else if (checkbox.equals(CheckBoxStatusEnum.IN_DESIGN)) { + arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CHECKIN, LifeCycleStateEnum.CHECKOUT)}; + } else if (checkbox.equals(CheckBoxStatusEnum.DISTRIBUTED)) { + arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.DISTRIBUTED)}; + } else if (checkbox.equals(CheckBoxStatusEnum.IN_TESTING)) { + arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.IN_TESTING)}; + } else if (checkbox.equals(CheckBoxStatusEnum.READY_FOR_TESTING)) { + arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.READY_FOR_TESTING)}; + } + } + return arObject; + } + + // filter by Type Resource in catalog + @Test(dataProvider = "Type_List") + public void filterByType(String catalogType, String[] classValues ) throws Exception { + setLog(catalogType); +// getExtendTest().setDescription(catalogType); + + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(catalogType)); + + CatalogVerificator.validateType(TypesEnum.valueOf(catalogType)); + } + + @Test(dataProvider = "Resource_Type_List") + public void filterByResourceType(String resourceType) throws Exception { + setLog(resourceType); +// getExtendTest().setDescription(resourceType); + + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(resourceType)); + + CatalogVerificator.validateType(TypesEnum.valueOf(resourceType)); + } + + @Test(dataProvider = "Status_List") + public void filterByStatus(CheckBoxStatusEnum statusCheckbox, List<LifeCycleStateEnum> lifecycleStates) throws Exception{ + setLog(statusCheckbox.name()); +// getExtendTest().setDescription(statusCheckbox.name()); + + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.CATEGORIES); + CatalogUIUtilitis.catalogFilterStatusChecBox(statusCheckbox); + + CatalogVerificator.validateStatus(lifecycleStates, statusCheckbox.name()); + } + + @Test + public void filterByUpperCategory() throws Exception{ + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE); + + WebElement categorieCheckbox = CatalogUIUtilitis.clickOnUpperCategoryCheckbox(); + + CatalogVerificator.validateCategory(categorieCheckbox.getAttribute("textContent").trim()); + } + + @Test + public void filterByGenericDtabaseSubCategory() throws Exception{ + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE); + + WebElement checkboxElement = GeneralUIUtils.getElementsByCSS(CatalogPageLeftPanelSubCategoryCheckbox.DATABASE.getValue()).get(0); + String checkboxElementName = checkboxElement.getAttribute("textContent").trim(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s subcategory ...", checkboxElementName)); + GeneralUIUtils.clickOnAreaJS(checkboxElement); + CatalogVerificator.validateSubCategory("Generic", checkboxElementName); + } + + @Test(priority = 1) + public void lastUpdatedService() throws Exception{ + // create service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue()); + String firstElementName = cardElements.get(0).getAttribute("textContent").trim(); + assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", serviceMetadata.getName(), firstElementName), serviceMetadata.getName().equals(firstElementName)); + } + + @Test(priority = 17) + public void lastUpdatedResource() throws Exception{ + // create resource + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue()); + String firstElementName = cardElements.get(0).getAttribute("textContent").trim(); + assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", vfMetaData.getName(), firstElementName), vfMetaData.getName().equals(firstElementName)); + } + + @Test(priority = 5) + public void fromCatalogCheckout() throws Exception{ + // create resource + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + GeneralUIUtils.findComponentAndClickInCatalog(vfMetaData.getName()); + ResourceGeneralPage.clickCheckoutButton(); + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java new file mode 100644 index 0000000000..d2c787e4e5 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java @@ -0,0 +1,213 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.util.List; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class Categories extends SetupCDTest { + + + @Test + public void createResourceCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + GeneralUIUtils.clickSomewhereOnPage(); + List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList(); + List<String> collect = resourceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList()); + collect.contains(newResourceCategory); + + + } + + @Test + public void createServiceCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + GeneralUIUtils.clickSomewhereOnPage(); + List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList(); + List<String> collect = serviceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList()); + collect.contains(newserviceCategory); + + } + + + @Test + public void createResourceSubCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + String newSubCategory = ElementFactory.getDefaultSubCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList(); + List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList(); + AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickSomewhereOnPage(); + + + } + + + @Test + public void createExistingResourceCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + + + } + + @Test + public void createExistingServiceCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + AdminGeneralPage.selectUserManagmetTab(); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + + } + + @Test + public void createExsitingResourceSubCategory() throws Exception { + + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + String newSubCategory = ElementFactory.getDefaultSubCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList(); + List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList(); + AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory); + AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory); + GeneralUIUtils.waitForLoader(); + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + + } + + + @Test + public void createServiceWithNewCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + String newSubCategory = ElementFactory.getDefaultSubCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList(); + List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList(); + AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory); + GeneralUIUtils.waitForLoader(); + AdminGeneralPage.selectUserManagmetTab(); + reloginWithNewRole(UserRoleEnum.DESIGNER); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + List<CategoryDefinition> categories = serviceMetadata.getCategories(); + categories.get(0).setName(newserviceCategory); + + ServiceUIUtils.createService(serviceMetadata, getUser()); + + } + + + @Test + public void createResourceWithNewCategory() throws Exception { + + AdminGeneralPage.selectCategoryManagmetTab(); + String newResourceCategory = ElementFactory.getDefaultCategory().getName(); + String newserviceCategory = ElementFactory.getDefaultCategory().getName(); + String newSubCategory = ElementFactory.getDefaultSubCategory().getName(); + AdminGeneralPage.createNewResourceCategory(newResourceCategory); + AdminGeneralPage.createNewServiceCategory(newserviceCategory); + List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList(); + List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList(); + AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory); + GeneralUIUtils.waitForLoader(); + AdminGeneralPage.selectUserManagmetTab(); + reloginWithNewRole(UserRoleEnum.DESIGNER); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + List<CategoryDefinition> categories = resourceMetaData.getCategories(); + CategoryDefinition categoryDefinition = categories.get(0); + categoryDefinition.setName(newResourceCategory); + SubCategoryDefinition subCategoryDefinition = categoryDefinition.getSubcategories().get(0); + subCategoryDefinition.setName(newSubCategory); + + ResourceUIUtils.createResource(resourceMetaData, getUser()); + + + } + + + + + + + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.ADMIN; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java new file mode 100644 index 0000000000..2c2b09af22 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java @@ -0,0 +1,383 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.CustomizationUUIDVerificator; +import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.AssertJUnit; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class CustomizationUUID extends SetupCDTest { + + private static final String DESCRIPTION = "kuku"; + private static final String ARTIFACT_LABEL = "artifact3"; + private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate"; + private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact"; + private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml"; + private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml"; + private String filePath; + + @BeforeMethod + public void beforeTest(){ + filePath = System.getProperty("filepath"); + + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } + } + + @Test + public void uniqueCustomizationUUIDforeachVFi() throws Exception { + + + ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting(); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + List customizationUUIDs = new ArrayList<String>(); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager); + CanvasElement VFiElement2 = addElemntToCanvas(vfMetaData, canvasManager); + CanvasElement VFiElement3 = addElemntToCanvas(vfMetaData, canvasManager); + + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement2); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement3); + + ServiceGeneralPage.clickCheckoutButton(); + canvasManager = CanvasManager.getCanvasManager(); + CanvasElement VFiElement4 = addElemntToCanvas(vfMetaData, canvasManager); + CanvasElement VFiElement5 = addElemntToCanvas(vfMetaData, canvasManager); + CanvasElement VFiElement6 = addElemntToCanvas(vfMetaData, canvasManager); + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement4); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement5); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement6); + + CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs); + + + } + + + @Test + public void uniqueCustomizationUUIDafterArtifactCRUDofVFi() throws Exception { + + + ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting(); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + List customizationUUIDs = new ArrayList<>(); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager); + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + //add artifact to VFI + + ServiceGeneralPage.clickCheckoutButton(); + canvasManager = CanvasManager.getCanvasManager(); + + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); + + canvasManager.clickOnCanvaElement(VFiElement1); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + + //delete VFI artifacts + + ServiceGeneralPage.clickCheckoutButton(); + canvasManager = CanvasManager.getCanvasManager(); + canvasManager.clickOnCanvaElement(VFiElement1); + CompositionPage.showDeploymentArtifactTab(); + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete " + HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted"); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + + CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs); + + } + + + @Test + public void uniqueCustomizationUUIDchangeVFiVersion() throws Exception { + + + ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting(); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + List customizationUUIDs = new ArrayList<>(); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager); + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + //change VF version + HomePage.navigateToHomePage(); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.clickCheckoutButton(); + ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + reloginWithNewRole(UserRoleEnum.DESIGNER); + + //update VFI version + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + ServiceGeneralPage.clickCheckoutButton(); + canvasManager = CanvasManager.getCanvasManager(); + canvasManager.clickOnCanvaElement(VFiElement1); + CompositionPage.changeComponentVersion(canvasManager, VFiElement1, "2.0"); + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs); + + } + + + @Test + public void uniqueCustomizationUUIDaddRelation() throws Exception { + + + ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting(); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + List customizationUUIDs = new ArrayList<>(); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager); + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + //change VF version + HomePage.navigateToHomePage(); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.clickCheckoutButton(); + ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + reloginWithNewRole(UserRoleEnum.DESIGNER); + + //update VFI version + + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + ServiceGeneralPage.clickCheckoutButton(); + canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(NormativeTypesEnum.PORT.getFolderName()); + CanvasElement portElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT); + canvasManager.linkElements(portElement, VFiElement1); + + canvasManager.clickOnCanvaElement(VFiElement1); + + + ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + canvasManager = findServiceAndNavigateToCanvas(serviceMetadata); + addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1); + + CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs); + + } + + + + public CanvasManager findServiceAndNavigateToCanvas(ServiceReqDetails serviceMetadata) throws Exception { + CanvasManager canvasManager; + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); + canvasManager = CanvasManager.getCanvasManager(); + return canvasManager; + } + + public ResourceReqDetails createNewResourceWithArtifactSubmitForTesting() throws Exception { + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); + } + AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + String newDescription = "new description"; + DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.artifactPopup().insertDescription(newDescription); + DeploymentArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel()); + AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.clickOK(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + +// ResourceReqDetails vfcCompute = ElementFactory.getDefaultResource(NormativeTypesEnum.COMPUTE); + CompositionPage.searchForElement(NormativeTypesEnum.COMPUTE.name()); + CanvasManager canvasManagerVF = CanvasManager.getCanvasManager(); + CanvasElement VFiElement1 = canvasManagerVF.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + + + ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + return vfMetaData; + } + + public void addCanvasElementToList(List customizationUUIDs, CanvasManager canvasManager, CanvasElement VFiElement1) + throws Exception { + canvasManager.clickOnCanvaElement(VFiElement1); + WebElement VFi1customizationUUID = CompositionPage.getCustomizationUUID(); + customizationUUIDs.add(VFi1customizationUUID.getText()); + } + + public CanvasElement addElemntToCanvas(ResourceReqDetails vfMetaData, CanvasManager canvasManager) + throws Exception { + CompositionPage.searchForElement(vfMetaData.getName()); + CanvasElement VFiElement1 = canvasManager.createElementOnCanvas(vfMetaData.getName()); + return VFiElement1; + } + + public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{ + GeneralPageElements.selectVersion("V" + previousVersion); + ServiceVerificator.verifyVersionUI(previousVersion); + GeneralUIUtils.clickJSOnElementByText("latest version"); + ServiceVerificator.verifyVersionUI(currentVersion); + GeneralPageElements.clickTrashButtonAndConfirm(); + GeneralUIUtils.findComponentAndClick(serviceName); + ServiceVerificator.verifyVersionUI(previousVersion); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java new file mode 100644 index 0000000000..87bf7b0506 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java @@ -0,0 +1,286 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator; +import org.openqa.selenium.WebElement; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class DeploymentViewTests extends SetupCDTest { + + private String filePath; + + @BeforeMethod + public void beforeTest(){ + filePath = System.getProperty("filepath"); + + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } + } + + @DataProvider(name = "CSAR_VF_Files", parallel = false) + public Object[][] createDataX() { + return new Object[][] { { "vSeGWdoubleMembers.csar" }, { "vSeGW.csar" }, {"vSeGWsingleModule.csar"}}; + } + + + @Test(dataProvider = "CSAR_VF_Files") + public void deploymentScreenDCAEAssetImportCSARTest(String baseFileName) throws Exception{ + // + setLog(baseFileName); +// getExtendTest().setDescription(baseFileName); + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen(); + List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()); + DeploymentViewVerificator verificator = new DeploymentViewVerificator(filePath + baseFileName); + verificator.verifyDeploymentPageModules(moduleRowsFromTable); + for(WebElement moduleRow :moduleRowsFromTable){ + String moduleRowText = moduleRow.getText(); + verificator.verifyDeploymentPageSubElements(moduleRowText.split("\\.\\.")[1]); + DeploymentPage.updateModuleName(moduleRowText, "updatedName"); + String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), "updatedName"); + verificator.verifyComponentNameChanged( moduleRowText, updatedModuleName); + // Close module + GeneralUIUtils.clickOnElementByText(updatedModuleName); + } + } + + @Test + public void deploymentScreenDCAEAssetUpdateWithNewGroupCSAR_TC1368223_Test() throws Exception{ + String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; + String updateFileName = "baseUpdateFlowVF.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); + put("moduleID", "primary");}}); + + // add new group, base_ldsa + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetDeleteGroupFromCSAR_TC1368281_Test() throws Exception{ + String baseFileName = "baseUpdateFlowVF.csar"; + String updateFileName = "baseUpdateMinusGroupFlowVF.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 3)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + + // remove group base_ldsa + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be removed", 2)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + // validate that group was removed + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName)); + + Map<String, HashMap<String, String>> metaDataFromUI2 = DeploymentPage.collectMetaDataFromUI(); + metaDataFromUI2.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); + put("moduleID", "primary");}}); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + // add group base_ldsa + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be added", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, baseFileName); + + // validate that group was added + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI2, new DeploymentViewVerificator(filePath + baseFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + } + + @Test + public void deploymentScreenDCAEAssetUpdateWithNewGroupWithoutMembersCSAR_TC1368280_Test() throws Exception{ + String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; + String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow.csar"; + String updateFileName2 = "baseUpdateFlowVF.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + // add new group without members, base_ldsa + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group without members", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + + // validate that group was added and no members exist + DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + updateFileName)); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + // add group base_ldsa with members + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group with members", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName2); + + // validate that member was added to base_ldsa group + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName2)); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetImportCSARWithArtifactSection_TC1368282_1_Test() throws Exception{ + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + baseFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetImportCSARRemoveArtifact_TC1368282_2_Test() throws Exception{ + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; + String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + // remove artifact from every group + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 3 artifacts in every group")); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetImportCSARAddArtifact_TC1368282_3_Test() throws Exception{ + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; + String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 3 artifacts in every group ", 3)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, updateFileName, getUser()); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + // add artifact to every group + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 4 artifacts in every group")); + ResourceUIUtils.updateVfWithCsar(filePath, baseFileName); + + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + baseFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetImportCSARMixArtifacts_TC1368282_4_Test() throws Exception{ + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; + String updateFileName = "baseUpdateMixedArtifacts.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + //mix artifacts between groups + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, mixing between artifacts and groups", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator()); + DeploymentViewVerificator.validateModuleNameUpadate(); + }; + + @Test + public void deploymentScreenDCAEAssetUpdateVFModule_TC1296437_Test() throws Exception{ + String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; + String updateFileName = "baseUpdateFlowVF.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser()); +// SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1]))); + + Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI(); + metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); + put("moduleID", "primary");}}); + + DeploymentViewVerificator.validateEditPopover(); + + ResourceGeneralPage.getLeftMenu().moveToGeneralScreen(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3)); + ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); + + assertTrue(resourceMetaData.getName().equals(ResourceGeneralPage.getNameText())); + DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName)); + DeploymentViewVerificator.validateModuleNameUpadate(); + } + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java deleted file mode 100644 index c5017a4f34..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.sanity; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; -import java.util.function.Supplier; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; -import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.ElementNotVisibleException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.Select; -import org.testng.annotations.Test; - -public class Import extends SetupCDTest { - - @Test - public void importResource() throws Exception { - - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - - // import Resource - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser()); - ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser()); - - } - - @Test - public void certifyVFC() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - String cpVersion = GeneralUIUtils.getComponentVersion(atomicResourceMetaData.getName()); - assertTrue("V 1.0".equals(cpVersion)); - } - - @Test - public void uploadAllInformationalArtifactPlaceholdersInVFC() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - - for (InformationalArtifacts infoArtifact : InformationalArtifacts.values()) { - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(infoArtifact, filePath, "Heat-File 1.yaml", - infoArtifact.name()); - } - - assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifacts.values().length, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - InformationalArtifactPage.clickAddNewArtifact(); - Select artifactLabelList = InformationalArtifactPage.artifactPopup().defineArtifactLabel(""); - assertEquals(1, artifactLabelList.getAllSelectedOptions().size()); - - } - - @Test(expectedExceptions = ElementNotVisibleException.class) - public void uploadInformationaArtifactMetdataTest() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - assertTrue(InformationalArtifactPage.checkElementsCountInTable(0, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - ArtifactInfo artifactInfo = new ArtifactInfo(filePath, "Heat-File 1.yaml", "new artifact", "artifact1", - "OTHER"); - InformationalArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo); - - assertTrue(InformationalArtifactPage.checkElementsCountInTable(1, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - String actulaArtifactDescription = InformationalArtifactPage - .getArtifactDescription(artifactInfo.getArtifactLabel()); - assertTrue(artifactInfo.getDescription().equals(actulaArtifactDescription)); - - InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel()); - InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2"); - } - - // @Test() - // public void updateInformationalArtifact(){ - // ArtifactInfo artifactInfo = new ArtifactInfo("", "", "new artifact", - // "artifact1", ""); - // InformationalArtifactPage.clickEditArtifact("artifact1"); - // String newDesc = "newDesc"; - // InformationalArtifactPage.artifactPopup().insertDescription(newDesc); - // InformationalArtifactPage.artifactPopup().clickUpdateButton(); - // String actulaArtifactDescription = - // InformationalArtifactPage.getArtifactDescription(artifactInfo.getArtifactLabel()); - // assertTrue(newDesc.equals(actulaArtifactDescription)); - // InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel()); - // InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2"); - // InformationalArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType()); - // } - - @Test - public void verifyTwoToscaArtifacts() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); - - // List<WebElement> elemenetsFromTable = - // GeneralPageElements.getElemenetsFromTable(); - // Supplier<List<WebElement>> supplier = () -> elemenetsFromTable; - // assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2, - // supplier)); - assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2)); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java new file mode 100644 index 0000000000..6a80dfe854 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java @@ -0,0 +1,678 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.InputsPage; +import org.openecomp.sdc.ci.tests.pages.PropertiesPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class ImportDCAE extends SetupCDTest { + + private String filePath; + @BeforeMethod + public void beforeTest(){ + filePath = System.getProperty("filepath"); + + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } + } + + @Test + public void updateDCAEAsset() throws Exception { + ResourceReqDetails resourceMetaData = createDCAEAsset(); + + // update Resource + ResourceReqDetails updatedResource = new ResourceReqDetails(); + updatedResource.setName("ciUpdatedNameImportDCAE"); + updatedResource.setDescription("kuku"); + updatedResource.setVendorName("updatedVendor"); + updatedResource.setVendorRelease("updatedRelease"); + updatedResource.setContactId("ab0001"); + updatedResource.setCategories(resourceMetaData.getCategories()); + updatedResource.setVersion("0.1"); + List<String> newTags = resourceMetaData.getTags(); + newTags.remove(resourceMetaData.getName()); + newTags.add(updatedResource.getName()); + updatedResource.setTags(newTags); + ResourceUIUtils.updateResource(updatedResource, getUser()); + + VfVerificator.verifyVFMetadataInUI(updatedResource); + VfVerificator.verifyVFUpdated(updatedResource, getUser()); + } + + @Test + public void vfcLinkedToComputeInDCAEAssetFlowTest() throws Exception { + String fileName = "importVFC_VFC14.yml"; + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + + try{ + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + ResourceReqDetails resourceMetaData = createDCAEAsset(); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + Assert.assertNotNull(cpElement); + ServiceVerificator.verifyNumOfComponentInstances(resourceMetaData, "0.1", 4, getUser()); + + canvasManager.linkElements(cpElement, computeElement); + + resourceMetaData.setVersion("0.1"); + VfVerificator.verifyLinkCreated(resourceMetaData, getUser(), 1); + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0"); + } + + } + + @Test + public void addUpdateDeleteDeploymentArtifactToDCAEAssetTest() throws Exception { + createDCAEAsset(); + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); + } + assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + String newDescription = "new description"; + DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.artifactPopup().insertDescription(newDescription); + DeploymentArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel()); + assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.clickOK(); + assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1)); + + assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed()); + } + + @Test + public void addUpdateDeleteInformationalArtifactDCAEAssetTest() throws Exception { + createDCAEAsset(); + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact); + + assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1)); + + String newDescription = "new description"; + InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel()); + InformationalArtifactPage.artifactPopup().insertDescription(newDescription); + InformationalArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel()); + assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel()); + InformationalArtifactPage.clickOK(); + assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0)); + } + + @Test + public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception { + String fileName = "importVFC_VFC15.yml"; + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + + try{ + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + vfCanvasManager.clickOnCanvaElement(vfcElement); + CompositionPage.showPropertiesAndAttributesTab(); + List<WebElement> properties = CompositionPage.getProperties(); + String propertyValue = "abc123"; + for (int i = 0; i < 2; i++) { + WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")); + findElement.click(); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue); + PropertiesPage.getPropertyPopup().clickSave(); + + findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value")); + assertTrue(findElement.getText().equals(propertyValue)); + } + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1"); + } + } + + @Test + public void changeInstanceVersionDCAEAssetTest() throws Exception{ + ResourceReqDetails atomicResourceMetaData = null; + ResourceReqDetails vfMetaData = null; + CanvasManager vfCanvasManager; + CanvasElement vfcElement = null; + String fileName = "importVFC_VFC16.yml"; + try{ + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + vfMetaData = createDCAEAsset(); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + CompositionPage.clickSubmitForTestingButton(vfMetaData.getName()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0"); + + //verfication + VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0"); + } + + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0"); + } + + } + + // future removed from ui + @Test(enabled = false) + public void addUpdateDeleteSimplePropertiesToDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER); + int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable())); + VfVerificator.verifyPropertiesInUI(propertyList); + PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size()); + + PropertyTypeEnum prop = propertyList.get(0); + prop.setDescription("updatedDescription"); + prop.setValue("value"); + PropertiesUIUtils.updateProperty(prop); + + PropertiesPage.clickDeletePropertyArtifact(prop.getName()); + assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable())); + } + + // future removed from ui + @Test(enabled = false) + public void DCAEAssetInstancesInputScreenTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + + Map<String, String> elementsIntancesMap = new HashMap<String, String>(); + for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE)){ + CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element); + vfCanvasManager.clickOnCanvaElement(elementOnCanvas); + String selectedInstanceName = CompositionPage.getSelectedInstanceName(); + elementsIntancesMap.put(selectedInstanceName, element.getValue()); + } + + CompositionPage.moveToInputsScreen(); + int canvasElementsSize = vfCanvasManager.getCanvasElements().size() + 2; + List<String> inputsNamesFromTable = InputsPage.getVFCInstancesNamesFromTable(); + assertTrue(String.format("Instances count is not as Expected: %s Actual: %s", canvasElementsSize, inputsNamesFromTable.size()), inputsNamesFromTable.size() == canvasElementsSize); + + for (String instanceName :inputsNamesFromTable){ + String resourceName = instanceName.split(" ")[0]; + ResourceReqDetails resource = new ResourceReqDetails(); + resource.setName(resourceName); + resource.setVersion("1.0"); + if (resourceName.equals("Port")){ + resource.setResourceType(ResourceTypeEnum.CP.toString()); + } else { + resource.setResourceType(ResourceTypeEnum.VFC.toString()); + } + RestResponse restResponse = RestCDUtils.getResource(resource, getUser()); + Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse); + + List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(resourceName); + assertTrue("Some properties are missing in table. Instance name is : " + resourceName, propertyRowsFromTable.size() == propertiesNameTypeJson.size()); + VfVerificator.verifyVfInputs(instanceName, propertiesNameTypeJson, propertyRowsFromTable); + + GeneralUIUtils.clickOnElementByText(resourceName); + } + } + + @Test + public void addAllInformationalArtifactPlaceholdersInDCAEAssetTest() throws Exception{ + createDCAEAsset(); + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){ + ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue()); + } + + assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length)); + } + + @Test + public void verifyToscaArtifactsExistDCAEAssetTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + final int numOfToscaArtifacts = 2; + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts)); + + for(int i = 0; i < numOfToscaArtifacts; i++){ + String typeFromScreen = ToscaArtifactsPage.getArtifactType(i); + assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType())); + } + + ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName()); + VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser()); + } + + @Test + public void DCAEAssetCertificationTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + String vfName = vfMetaData.getName(); + + ResourceGeneralPage.clickCheckinButton(vfName); + GeneralUIUtils.findComponentAndClick(vfName); + ResourceGeneralPage.clickSubmitForTestingButton(vfName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfName); + TesterOperationPage.certifyComponent(vfName); + + vfMetaData.setVersion("1.0"); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfName); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED); + } + + @Test + public void deleteDCAEAssetCheckedoutTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + GeneralPageElements.clickTrashButtonAndConfirm(); + + vfMetaData.setVersion("0.1"); + VfVerificator.verifyVfDeleted(vfMetaData, getUser()); + } + + @Test + public void revertDCAEAssetMetadataTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + ResourceReqDetails vfRevertDetails = new ResourceReqDetails(); + vfRevertDetails.setName("ciUpdatedName"); + vfRevertDetails.setDescription("kuku"); + vfRevertDetails.setCategories(vfMetaData.getCategories()); + vfRevertDetails.setVendorName("updatedVendor"); + vfRevertDetails.setVendorRelease("updatedRelease"); + ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false); + + GeneralPageElements.clickRevertButton(); + + VfVerificator.verifyVFMetadataInUI(vfMetaData); + } + + @Test + public void addDeploymentArtifactInCompositionScreenDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER"); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact")); + Assert.assertEquals(1, actualArtifactList.size()); + } + + // future removed from ui + @Test(enabled = false) + public void addPropertyInCompositionScreenDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + CompositionPage.showPropertiesAndAttributesTab(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER); + int propertiesCount = CompositionPage.getProperties().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties())); + } + + @Test + public void addDeploymentArtifactAndVerifyInCompositionScreenDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); + assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1)); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + CompositionPage.showDeploymentArtifactTab(); + List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts(); + assertTrue(1 == deploymentArtifactsFromScreen.size()); + + String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText(); + assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName)); + } + + @Test + public void checkoutDCAEAssetTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + GeneralPageElements.clickCheckoutButton(); + + vfMetaData.setVersion("0.2"); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + + ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + TesterOperationPage.certifyComponent(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.clickCheckoutButton(); + + vfMetaData.setVersion("1.1"); + vfMetaData.setUniqueId(null); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + } + + @Test + public void deleteInstanceFromDCAEAssetCanvas() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager); + + vfCanvasManager.clickOnCanvaElement(computeElement); + vfCanvasManager.deleteElementFromCanvas(computeElement); + + VfVerificator.verifyNumOfComponentInstances(vfMetaData, 2, getUser()); + } + + @Test + public void changeInstanceNameInDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager); + + String updatedInstanceName = "updatedName"; + vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); + + String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName(); + assertTrue(updatedInstanceName.equals(actualSelectedInstanceName)); + } + + @Test + public void submitDCAEAssetForTestingWithNonCertifiedAsset() throws Exception{ + String fileName = "importVFC_VFC17.yml"; + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + ResourceReqDetails vfMetaData = createDCAEAsset(); + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.addElementToCanvasScreen(atomicResourceMetaData.getName(), canvasManager); + + try{ + CompositionPage.clickSubmitForTestingButton(vfMetaData.getName()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1"); + } + } + + @Test + public void isDisabledAndReadOnlyInCheckinDCAEAssetTest() throws Exception{ + ResourceReqDetails vfMetaData = createDCAEAsset(); + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + + ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME, + ResourceMetadataEnum.DESCRIPTION, + ResourceMetadataEnum.VENDOR_NAME, + ResourceMetadataEnum.VENDOR_RELEASE, + ResourceMetadataEnum.CONTACT_ID, + ResourceMetadataEnum.CATEGORY, + ResourceMetadataEnum.TAGS}; + + for (ResourceMetadataEnum field: fieldsForCheck){ + VfVerificator.verifyIsElementDisabled(field.getValue(), field.name()); + } + VfVerificator.verifyIsElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue(), DataTestIdEnum.LifeCyleChangeButtons.CREATE.name()); + } + + @Test + public void removeFileFromGeneralPageDCAEAssetTest() throws Exception{ + String fileName2 = "service_input_test_VF2.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsarNoCreate(resourceMetaData, filePath, fileName2, getUser()); + GeneralPageElements.clickDeleteFile(); + + try{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30); + assert(false); + } + catch(Exception e){ + assert(true); + } + } + + @Test + public void activityLogDCAEAssetTest() throws Exception{ + createDCAEAsset(); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact); + + ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen(); + + int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size(); + assertTrue("Wrong rows number, should be 2", numberOfRows == 2); + } + + @Test + public void checkinCheckoutChangeDeleteVersionDCAEAssetTest() throws Exception{ + ResourceReqDetails atomicResourceMetaData = createDCAEAsset(); + + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + GeneralPageElements.clickCheckoutButton(); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + + GeneralPageElements.selectVersion("V0.1"); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN); + GeneralUIUtils.clickJSOnElementByText("latest version"); + + GeneralPageElements.clickTrashButtonAndConfirm(); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText(); + assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1")); + } + + @Test + public void badFileDCAEAssetTest() throws Exception { + String customFileName = "badVF.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + try{ + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, customFileName, getUser()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.CSAR_INVALID.name()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating error messdge...")); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + } + + @Test + public void validContactAfterCreateDCAEAssetTest() throws Exception{ + String fileName2 = "service_input_test_VF2.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating that userID equal to user that was logged in...")); + assertTrue("wrong userId", resourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText())); + } + + public ResourceReqDetails createDCAEAsset() throws Exception{ + String fileName2 = "service_input_test_VF2.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + resourceMetaData.setVersion("0.1"); + return resourceMetaData; + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java new file mode 100644 index 0000000000..c129636291 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java @@ -0,0 +1,359 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.PropertiesPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openecomp.sdc.ci.tests.verificator.VFCverificator; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class ImportVFCAsset extends SetupCDTest { + + private ResourceReqDetails atomicResourceMetaData; + + private String filePath; + @BeforeClass + public void beforeClass(){ + filePath = System.getProperty("filepath"); + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + ""; + } + } + + @DataProvider(name = "assetFiles", parallel = false) + public Object[][] createDataX() { + return new Object[][] { { "importVFC_VFC9.yml" }, { "CP.yml" }, {"VL.yml"} }; + } + + @Test + public void importVFCTest() throws Exception { + String fileName = "importVFC_VFC1.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + } + + @Test + public void importDuplicateVFCTest() throws Exception { + String fileName = "importVFC_VFC2.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + + ResourceReqDetails atomicResourceMetaDataDup = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_INFRASTRUCTURE, getUser()); + try{ + ResourceUIUtils.importVfc(atomicResourceMetaDataDup, filePath, fileName, getUser()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + } + + @Test + public void badFileVFCTest() throws Exception { + String fileName = "importVFC_VFC3.yml"; + String customFileName = "Heat-File 1.yaml"; + + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + try{ + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customFileName, getUser()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + } + + @Test + public void validContactAfterCreateVFCTest() throws Exception{ + String fileName = "importVFC_VFC4.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + assertTrue("wrong userId", atomicResourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText())); + } + + @Test + public void validContactAfterUpdateVFCTest() throws Exception{ + String fileName = "importVFC_VFC5.yml"; + String userIdUpdated = "up1234"; + + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceUIUtils.defineUserId(userIdUpdated); + assertTrue("userId is not updated",userIdUpdated.equals(ResourceGeneralPage.getContactIdText())); + } + + @Test + public void addUpdateDeleteDeploymentArtifactToVFCTest() throws Exception { + String fileName = "importVFC_VFC6.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); + deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); + for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true) ); + } + assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + String newDescription = "new description"; + DeploymentArtifactPage.updateDescription(newDescription, deploymentArtifactList.get(0)); + String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel()); + assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.clickOK(); + assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1)); + + assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed()); + } + + @Test + public void addUpdateDeletePlaceholdersInformationalArtefactVFCTest() throws Exception{ + String fileName = "importVFC_VFC7.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + // create artifacts + List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>(); + informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); + informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuuuuku", "artifact3", "HEAT")); + for (ArtifactInfo informationalArtifact : informationalArtifactList) { + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact); + } + assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(informationalArtifactList.size())); + + // update artifact description + String newDescription = "new description"; + InformationalArtifactPage.clickEditArtifact(informationalArtifactList.get(0).getArtifactLabel()); + InformationalArtifactPage.artifactPopup().insertDescription(newDescription); + InformationalArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifactList.get(0).getArtifactLabel()); + assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + // delete artifacts + for (ArtifactInfo informationalArtifact : informationalArtifactList) { + InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel()); + InformationalArtifactPage.clickOK(); + } + + assertTrue("not all artifacts is deleted", InformationalArtifactPage.checkElementsCountInTable(0)); + + // fill placeholders + for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){ + ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue()); + } + InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length); + } + + @Test + public void addSimplePropertiesToVFCTest() throws Exception{ + String fileName = "importVFC_VFC8.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER, PropertyTypeEnum.FLOAT); + int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable())); + + } + + + @Test(dataProvider = "assetFiles") + public void checkinCheckoutChangeDeleteVersionVFCTest(String customfileName) throws Exception{ + setLog(customfileName); +// getExtendTest().setDescription(customfileName); + + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customfileName, getUser()); + + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + GeneralPageElements.clickCheckoutButton(); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + + GeneralPageElements.selectVersion("V0.1"); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN); + GeneralUIUtils.clickJSOnElementByText("latest version"); + + GeneralPageElements.clickTrashButtonAndConfirm(); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText(); + assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1")); + } + + @Test + public void certificationVFCTest() throws Exception{ + String fileName = "importVFC_VFC10.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + String vfName = atomicResourceMetaData.getName(); + + ResourceGeneralPage.clickCheckinButton(vfName); + GeneralUIUtils.findComponentAndClick(vfName); + ResourceGeneralPage.clickSubmitForTestingButton(vfName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfName); + TesterOperationPage.certifyComponent(vfName); + + atomicResourceMetaData.setVersion("1.0"); + VfVerificator.verifyVFLifecycle(atomicResourceMetaData, getUser(), LifecycleStateEnum.CERTIFIED); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfName); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED); + } + + @Test + public void activityLogVFCTest() throws Exception{ + + if(true){ + throw new SkipException("Open bug 291623"); + } + + String fileName = "importVFC_VFC11.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact); + + ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen(); + + int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size(); + assertTrue("Wrong rows number, should be 2", numberOfRows == 2); + } + + @Test + public void removeFileFromGeneralPageVFCTest() throws Exception{ + String fileName = "importVFC_VFC12.yml"; + + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfcNoCreate(atomicResourceMetaData, filePath, fileName, getUser()); + + GeneralPageElements.clickDeleteFile(); + + try{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30); + assert(false); + } + catch(Exception e){ + assert(true); + } + } + + @Test + public void maxLengthGeneralInformationVFCTest() throws Exception{ + String fileName = "importVFC_VFC13.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceUIUtils.fillMaxValueResourceGeneralInformationPage(atomicResourceMetaData); + GeneralPageElements.clickUpdateButton(); + VFCverificator.verifyVFCUpdatedInUI(atomicResourceMetaData); + GeneralPageElements.clickDeleteVersionButton(); + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java index 713bc4df41..fddb97ace3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java @@ -21,24 +21,28 @@ package org.openecomp.sdc.ci.tests.execute.sanity; import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; import java.awt.AWTException; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; +import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; @@ -49,20 +53,28 @@ import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; -import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; import org.testng.AssertJUnit; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; import org.testng.annotations.Test; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; public class Onboard extends SetupCDTest { - + + protected String makeDistributionValue; + + @Parameters({ "makeDistribution" }) + @BeforeMethod + public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { + makeDistributionValue = makeDistributionReadValue; + } + public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { Object[][] arObject = new Object[fileNamesFromFolder.length][]; @@ -73,28 +85,51 @@ public class Onboard extends SetupCDTest { return arObject; } - @DataProvider(name = "VNF_List") + @DataProvider(name = "VNF_List" , parallel = true) private static final Object[][] VnfList() throws Exception { String filepath = getFilePath(); - Object[] fileNamesFromFolder = OnboardingUtils.getZipFileNamesFromFolder(filepath); + + Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length)); return provideData(fileNamesFromFolder, filepath); } - @Test(dataProvider = "VNF_List") - public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable { - SetupCDTest.setScreenshotFile(vnfFile); - extendTest.setDescription(vnfFile); - - String vspName = onboardVNF(filepath, vnfFile); + public static String getFilePath() { + String filepath = System.getProperty("filepath"); + if (filepath == null && System.getProperty("os.name").contains("Windows")) { + filepath = FileHandling.getResourcesFilesPath() +"VNFs"; + } + + else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs"; + } + return filepath; + } + + @Test + public void onboardVNFTestSanity() throws Exception, Throwable { + String filepath = getFilePath(); +// String vnfFile = "2016-012_vMX_AV_30_1072_e2e.zip"; +// String filepath = getFilePath(); + Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + String vnfFile = fileNamesFromFolder[0].toString(); + runOnboardToDistributionFlow(filepath, vnfFile); + } - ResourceGeneralPage.clickSubmitForTestingButton(vspName); + public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException { + Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser()); + String vspName = onboardAndValidate.left; + + DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); + ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile ,"The topology template for " + vnfFile + " is as follows : "); + + DeploymentArtifactPage.clickSubmitForTestingButton(vspName); - quitAndReLogin(UserRoleEnum.TESTER); + reloginWithNewRole(UserRoleEnum.TESTER); GeneralUIUtils.findComponentAndClick(vspName); TesterOperationPage.certifyComponent(vspName); - quitAndReLogin(UserRoleEnum.DESIGNER); + reloginWithNewRole(UserRoleEnum.DESIGNER); // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ServiceUIUtils.createService(serviceMetadata, getUser()); @@ -103,117 +138,231 @@ public class Onboard extends SetupCDTest { CompositionPage.searchForElement(vspName); CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); + ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName); + assertNotNull(vfElement); ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); + ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows : "); ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); - quitAndReLogin(UserRoleEnum.TESTER); + reloginWithNewRole(UserRoleEnum.TESTER); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); TesterOperationPage.certifyComponent(serviceMetadata.getName()); - quitAndReLogin(UserRoleEnum.GOVERNOR); + reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); GovernorOperationPage.approveSerivce(serviceMetadata.getName()); -// quitAndReLogin(UserRoleEnum.OPS); -// GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); -// OpsOperationPage.distributeService(); -// OpsOperationPage.displayMonitor(); -// -// List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); -// AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); -// -// OpsOperationPage.waitUntilArtifactsDistributed(0); -// -// extendTest.log(LogStatus.PASS, String.format("onboarding %s test is passed ! ", vnfFile)); - } + if (makeDistributionValue.equals("true")){ + + + reloginWithNewRole(UserRoleEnum.OPS); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + OpsOperationPage.distributeService(); + OpsOperationPage.displayMonitor(); - private String onboardVNF(String filepath, String vnfFile) throws Exception, Throwable { - extendTest.log(LogStatus.INFO, String.format("going to onboard the VNF %s......", vnfFile)); - System.out.println(String.format("going to onboard the VNF %s......", vnfFile)); - - OnboardingUtils.createVendorLicense(getUser()); - String vspName = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); - GeneralUIUtils.getWebButton("repository-icon").click(); - extendTest.log(LogStatus.INFO, String.format("searching for onboarded %s", vnfFile)); - GeneralUIUtils.getWebElementWaitForVisible("onboarding-search").sendKeys(vspName); - AssertJUnit.assertTrue(GeneralPageElements.checkElementsCountInTable(2)); - - List<WebElement> elemenetsFromTable = GeneralPageElements.getElemenetsFromTable(); - GeneralUIUtils.waitForLoader(); - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); - WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); - findElement.click(); - GeneralUIUtils.waitForLoader(); - extendTest.log(LogStatus.INFO, - String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - GeneralUIUtils.getWebElementWaitForVisible("import-csar").click(); - GeneralUIUtils.getWebButton("create/save").click(); - GeneralUIUtils.waitForLoaderOnboarding(); - WebDriverWait wait2 = new WebDriverWait(GeneralUIUtils.getDriver(), 2 * 60); - wait2.until(ExpectedConditions.visibilityOfElementLocated( - By.xpath("//*[@data-tests-id='" + DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue() + "']"))); - extendTest.log(LogStatus.PASS, - String.format("succeeded to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - return vspName; - } - - public static String getFilePath() { - String filepath = System.getProperty("filepath"); - if (filepath == null && System.getProperty("os.name").contains("Windows")) { - filepath = FileHandling.getResourcesFilesPath(); - } + List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); + AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); + + OpsOperationPage.waitUntilArtifactsDistributed(0); - else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ - filepath = FileHandling.getBasePath() + File.separator + "Files"; +// validateInputArtsVSouput(serviceMetadata.getName()); + } - return filepath; + + getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } + +// protected synchronized void validateInputArtsVSouput(String serviceName) { +// +// +// String filepath = System.getProperty("filepath"); +// if (filepath == null && System.getProperty("os.name").contains("Windows")) { +// filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; +// } +// +// Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> serviceArtifactCorrelationMap = ArtifactsCorrelationManager.getServiceArtifactCorrelationMap(serviceName); +// +// } + + @Test(dataProvider = "VNF_List") + public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable { + setLog(vnfFile); + System.out.println("printttttttttttttt - >" + makeDistributionValue); + runOnboardToDistributionFlow(filepath, vnfFile); + } + @Test - public void twoOnboardedVNFsInService() throws Exception, Throwable{ - + public void onboardUpdateVNFTest() throws Exception, Throwable { String filepath = getFilePath(); + Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + String vnfFile = fileNamesFromFolder[0].toString(); - final String dnsScaling = "DNSscaling12.8.16.zip"; - final String vLB = "vLB12.8.16.zip"; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser()); + String vspName = vsp.left; + ResourceGeneralPage.clickSubmitForTestingButton(vspName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vspName); + TesterOperationPage.certifyComponent(vspName); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + // create service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CompositionPage.searchForElement(vspName); + CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); + assertNotNull(vfElement); + ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); + + HomePage.navigateToHomePage(); - String[] onboardList = {dnsScaling, vLB}; + ///update flow + String updatedVnfFile = fileNamesFromFolder[1].toString(); + + getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); + // update VendorSoftwareProduct + OnboardingUtils.updateVnfAndValidate(filepath, vsp, updatedVnfFile, getUser()); - Map<String, String> vspMap = new HashMap<String,String>(); + ResourceGeneralPage.clickSubmitForTestingButton(vspName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vspName); + TesterOperationPage.certifyComponent(vspName); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + // replace exiting VFI in service with new updated + + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); + serviceCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0"); + ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); + + ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.GOVERNOR); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + + + + reloginWithNewRole(UserRoleEnum.OPS); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + OpsOperationPage.distributeService(); + OpsOperationPage.displayMonitor(); + + List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); + AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); + + OpsOperationPage.waitUntilArtifactsDistributed(0); + + + getExtendTest().log(Status.INFO, String.format("onboarding %s test is passed ! ", vnfFile)); + + + } + + @Test + public void threeVMMSCsInServiceTest() throws Exception{ + String filepath = getFilePath(); + + + List<String> vmmscList = new ArrayList<String>(); + vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList()); + assertTrue("Did not find vMMSCs", vmmscList.size() > 0); - for (String vnf : onboardList){ - GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification")); - String vspName = onboardVNF(filepath, vnf); - vspMap.put(vnf, vspName); - ResourceGeneralPage.clickSubmitForTestingButton(vspName); + Map<String, String> vspNames = new HashMap<String, String>(); + for (String vnfFile : vmmscList){ + getExtendTest().log(Status.INFO, String.format("going to onboard the VNF %s......", vnfFile)); + System.out.println(String.format("going to onboard the VNF %s......", vnfFile)); + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); + + getExtendTest().log(Status.INFO, String.format("searching for onboarded %s", vnfFile)); + HomePage.showVspRepository(); + getExtendTest().log(Status.INFO,String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); + OnboardingUtils.importVSP(createVendorSoftwareProduct); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + + String vspName = createVendorSoftwareProduct.left; + DeploymentArtifactPage.clickSubmitForTestingButton(vspName); + + vspNames.put(vnfFile, vspName); } - quitAndReLogin(UserRoleEnum.TESTER); - for (String vspName : vspMap.values()){ - GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification")); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); + reloginWithNewRole(UserRoleEnum.TESTER); + for (String vsp : vspNames.values()){ + GeneralUIUtils.findComponentAndClick(vsp); + TesterOperationPage.certifyComponent(vsp); } - quitAndReLogin(UserRoleEnum.DESIGNER); + reloginWithNewRole(UserRoleEnum.DESIGNER); + // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ServiceUIUtils.createService(serviceMetadata, getUser()); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - - Map<String, CanvasElement> canvasElements = new HashMap<String,CanvasElement>(); - for (String vspName : vspMap.values()){ - CompositionPage.searchForElement(vspName); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); + + for (String vsp : vspNames.values()){ + CompositionPage.searchForElement(vsp); + CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp); assertNotNull(vfElement); - canvasElements.put(vspName, vfElement); } - ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 2, getUser()); + ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser()); + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath)); + ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.GOVERNOR); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.OPS); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + OpsOperationPage.distributeService(); + OpsOperationPage.displayMonitor(); + + List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); + AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); + + OpsOperationPage.waitUntilArtifactsDistributed(0); + } + + + + + + + + + + + + + + @Override protected UserRoleEnum getRole() { return UserRoleEnum.DESIGNER; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java new file mode 100644 index 0000000000..cb647aec6d --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java @@ -0,0 +1,303 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertEquals; + +import java.awt.AWTException; +import java.io.File; +import java.io.FileOutputStream; +import java.nio.charset.StandardCharsets; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bouncycastle.util.encoders.Base64; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.slf4j.LoggerFactory; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import fj.data.Either; + +public class OnboardViaApis{ + + + private static final String FULL_PATH = "C://tmp//CSARs//"; + + public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { + Object[][] arObject = new Object[fileNamesFromFolder.length][]; + + int index = 0; + for (Object obj : fileNamesFromFolder) { + arObject[index++] = new Object[] { filepath, obj }; + } + return arObject; + } + + @DataProvider(name = "VNF_List" , parallel = false) + private static final Object[][] VnfList() throws Exception { + String filepath = FileHandling.getVnfRepositoryPath(); + + Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length)); + return provideData(fileNamesFromFolder, filepath); + } + + +//------------------------------------------------------------------------------------------------------- + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + private static String vendorId; + private static String vendorLicenseName; + private static String vendorLicenseAgreementId; + private static String featureGroupId; + ResourceReqDetails resourceDetails; + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + + + @BeforeMethod + public void before(){ + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + lc.getLogger("org.apache").setLevel(Level.OFF); + lc.getLogger("org.*").setLevel(Level.OFF); + lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF); + resourceDetails = ElementFactory.getDefaultResource(); + + } + + @Test(dataProvider = "VNF_List") + public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable { + Service service = null; + String fullFileName = FULL_PATH + vnfFile + ".csar"; + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Starting test with VNF: " + vnfFile); + service = runOnboardViaApisOnly(filepath, vnfFile); + timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Finished test with VNF: " + vnfFile); + timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Starting download service csar file: " + vnfFile); + File file = new File(fullFileName); + downloadToscaCsarToDirectory(service, file); + timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Finished download service csar file: " + vnfFile); + System.out.println("end"); + + } + + public static void downloadToscaCsarToDirectory(Service service, File file) { + try { + Either<String,RestResponse> serviceToscaArtifactPayload = AtomicOperationUtils.getServiceToscaArtifactPayload(service, "assettoscacsar"); + if(serviceToscaArtifactPayload.left().value() != null){ + Gson gson = new Gson(); + @SuppressWarnings("unchecked") + Map<String, String> fromJson = gson.fromJson(serviceToscaArtifactPayload.left().value(), Map.class); + String string = fromJson.get("base64Contents").toString(); + byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8)); + File downloadedFile = new File(file.getAbsolutePath()); + FileOutputStream fos = new FileOutputStream(downloadedFile); + fos.write(byteArray); + fos.flush(); + fos.close(); + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException { + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Starting onboard VNF: " + vnfFile); + Pair<String,Map<String,String>> onboardAndValidate = onboardAndValidateViaApi(filepath, vnfFile, sdncDesignerDetails1); + String vspName = onboardAndValidate.left; + timestamp = new Timestamp(System.currentTimeMillis()); + System.err.println(timestamp + " Finished onboard VNF: " + vnfFile); + Resource resource = AtomicOperationUtils.getResourceObject(resourceDetails.getUniqueId()); + + AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true); + resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId()); + // create service + + Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value(); + Either<ComponentInstance,RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + return service; + } + + + + public Pair<String, Map<String, String>> onboardAndValidateViaApi(String filepath, String vnfFile, User user) throws Exception { + + createVendorLicense(user); + Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user); + String vspName = createVendorSoftwareProduct.left; + List<String> tags = new ArrayList<>(); + tags.add(vspName); + Map<String, String> map = createVendorSoftwareProduct.right; + + resourceDetails.setCsarUUID(map.get("vspId")); + resourceDetails.setCsarVersion("1.0"); + resourceDetails.setName(vspName); + resourceDetails.setTags(tags); + resourceDetails.setResourceType(map.get("componentType")); + resourceDetails.setVendorName(map.get("vendorName")); + resourceDetails.setVendorRelease("1.0"); + resourceDetails.setResourceType("VF"); + RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1); + + return createVendorSoftwareProduct; + } + + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user) + throws Exception { + Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user); + + String vspid = pair.right.get("vspId"); + + prepareVspForUse(user, vspid); + + return pair; + } + + public static void prepareVspForUse(User user, String vspid) throws Exception { + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); + + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); + + } + public static void createVendorLicense(User user) throws Exception { + vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0]; + RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); + assertEquals("did not succeed to create vendor license model", 200, + vendorLicenseResponse.getErrorCode().intValue()); + vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); + + RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); + assertEquals("did not succeed to create vendor key groups", 200, + vendorKeyGroupsResponse.getErrorCode().intValue()); + String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); + + RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); + assertEquals("did not succeed to create vendor entitlement pool", 200, + vendorEntitlementPool.getErrorCode().intValue()); + String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), + "value"); + + RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, + entitlementPoolId, user); + assertEquals("did not succeed to create vendor license feature groups", 200, + vendorLicenseFeatureGroups.getErrorCode().intValue()); + featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); + + RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); + assertEquals("did not succeed to create vendor license agreement", 200, + vendorLicenseAgreement.getErrorCode().intValue()); + vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), + "value"); + + RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user); + assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); + + RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user); + assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); + + } + + + public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user) throws Exception { + String vspName = OnboardingUtils.handleFilename(HeatFileName); + + Pair<RestResponse, Map<String, String>> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user); + RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; + assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); + String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); + String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); + + Map<String, String> vspMeta = createNewVspPair.right; + Map<String, String> vspObject = new HashMap<String, String>(); + Iterator<String> iterator = vspMeta.keySet().iterator(); + while(iterator.hasNext()){ + Object key = iterator.next(); + Object value = vspMeta.get(key); + vspObject.put(key.toString(), value.toString()); + } + vspObject.put("vspId", vspid); + vspObject.put("componentId", componentId); + vspObject.put("vendorName", vendorLicenseName); + vspObject.put("attContact", user.getUserId()); + + RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user); + assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = OnboardingUtils.validateUpload(vspid, user); + assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); + + Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); + + return pair; + } + + + + + + + + + +// ---------------------------------------------------------------------------------------------------------------------------------------- + + + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java new file mode 100644 index 0000000000..e0e13b7036 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.io.File; + +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ProductUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +/** + * @author al714h + * + */ + +public class Product extends SetupCDTest { + + private String filePath; + @BeforeMethod + public void beforeTest(){ + filePath = System.getProperty("filepath"); + + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath(); + } + + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } + } + + + @Test + public void createProductAndAddCertifiedServiceInstance() throws Exception { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ProductReqDetails productReqDetails = ElementFactory.getDefaultProduct(); + + ServiceUIUtils.createService(serviceMetadata, getUser()); + GeneralPageElements.clickSubmitForTestingButton(serviceMetadata.getName()); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + reloginWithNewRole(UserRoleEnum.PRODUCT_MANAGER1); + ProductUIUtils.createProduct(productReqDetails, getUser()); + ProductGeneralPage.getProductLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement canvasElement = CompositionPage.addElementToCanvasScreen(serviceMetadata.getName(), canvasManager); + canvasManager.clickOnCanvaElement(canvasElement); + } + + @Test + public void loginAsProductStrateger() throws Exception { + reloginWithNewRole(UserRoleEnum.PRODUCT_STRATEGIST1); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java new file mode 100644 index 0000000000..d5920a22ca --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java @@ -0,0 +1,698 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.awt.AWTException; +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.InputsPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator; +import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.AssertJUnit; +import org.testng.SkipException; +import org.testng.TestException; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +public class Service extends SetupCDTest { + + private static final String DESCRIPTION = "kuku"; + private static final String ARTIFACT_LABEL = "artifact3"; + private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate"; + private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact"; + private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml"; + private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml"; + private String filePath; + + @BeforeMethod + public void beforeTest(){ + filePath = FileHandling.getFilePath(""); + } + + + @Test + public void createService() throws Exception { + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + } + + @Test + public void validDefaultContactAndTagAfterCreateService() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createServiceWithDefaultTagAndUserId(serviceMetadata, getUser()); + + assertTrue("wrong userId", getUser().getUserId().equals(ResourceGeneralPage.getContactIdText())); + + List<String> actualTags = Arrays.asList(ServiceGeneralPage.getTags()); + assertTrue("wrong tags", (actualTags.size() == 1) && actualTags.get(0).equals(serviceMetadata.getName())); + } + + @Test + public void updateService() throws Exception { + // Create Service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + // Update Service + ServiceGeneralPage.deleteOldTags(serviceMetadata); + serviceMetadata.setName("ciUpdatedNameSanity"); + serviceMetadata.setDescription("updatedDescriptionSanity"); + serviceMetadata.setProjectCode("654321"); + serviceMetadata.setContactId("cs6543"); + serviceMetadata.getTags().addAll(Arrays.asList("updatedTag", "oneMoreUpdatedTag", "lastOne UpdatedTag")); + ServiceUIUtils.setServiceCategory(serviceMetadata, ServiceCategoriesEnum.VOIP); + ServiceUIUtils.fillServiceGeneralPage(serviceMetadata, getUser()); + GeneralPageElements.clickCreateButton(); + + ServiceVerificator.verifyServiceUpdatedInUI(serviceMetadata); + } + + @Test + public void deleteService() throws Exception { + + // create service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + // Delete service + //GeneralUIUtils.HighlightMyElement(GeneralUIUtils.getWebButton("delete_version")); + GeneralPageElements.clickTrashButtonAndConfirm(); + + // Verification + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.catalogSearchBox(serviceMetadata.getName()); + ServiceVerificator.verifyServiceDeletedInUI(serviceMetadata); + } + + @Test + public void checkoutServiceTest() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER"); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + GeneralPageElements.clickCheckoutButton(); + + serviceMetadata.setVersion("0.2"); + ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion()); + + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + ResourceGeneralPage.clickCheckoutButton(); + + serviceMetadata.setVersion("1.1"); + serviceMetadata.setUniqueId(null); + ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion()); + } + + @Test + public void submitServiceForTestingWithNonCertifiedAsset() throws Exception{ + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.createResource(atomicResourceMetaData, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + try{ + CompositionPage.clickSubmitForTestingButton(serviceMetadata.getName()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name()); + assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1"); + } + + } + + @Test + public void addDeploymentArtifactInCompositionScreenTest() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER"); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + AssertJUnit.assertEquals(1, actualArtifactList.size()); + + for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){ + assertTrue(HEAT_FILE_YAML_NAME.equals(actualArtifactFileName.getText())); + } + + } + + @Test + public void addInformationArtifactInCompositionScreenTest() throws Exception{ + String fileName = HEAT_FILE_YAML_NAME; + String descriptionText = DESCRIPTION; + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER"); + CompositionPage.showInformationArtifactTab(); + List<WebElement> beforeArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo, CompositionPage.artifactPopup()); + + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", beforeArtifactList.size() + 1, actualArtifactList.size()), + (beforeArtifactList.size() + 1) == actualArtifactList.size()); + for(DataTestIdEnum.InformationalArtifactsService artifact: DataTestIdEnum.InformationalArtifactsService.values()){ + ArtifactUIUtils.fillPlaceHolderInformationalArtifact(artifact, filePath, fileName, descriptionText); + } + int numberOfFiles = CompositionPage.getAllAddedArtifacts().size(); + assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", (beforeArtifactList.size() + 1), numberOfFiles), (beforeArtifactList.size() + 1) == numberOfFiles); + + for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){ + assertTrue(fileName.equals(actualArtifactFileName.getText())); + } + + } + + @Test + public void addAPIArtifactInCompositionScreenTest() throws Exception{ + + if(true){ + throw new SkipException("Open bug 292017"); + } + + String fileName = HEAT_FILE_YAML_NAME, + descriptionText = DESCRIPTION, + url = "http://kuku.com"; + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER"); + CompositionPage.showAPIArtifactTab(); + + for(DataTestIdEnum.APIArtifactsService artifact: DataTestIdEnum.APIArtifactsService.values()){ + ArtifactUIUtils.fillPlaceHolderAPIArtifact(artifact, filePath, fileName, descriptionText, url); + } + int numberOfFiles = CompositionPage.getAllAddedArtifacts().size(), + numberOfPlacehoders = DataTestIdEnum.APIArtifactsService.values().length; + assertTrue(String.format("Wrong file count, should be %s files", numberOfPlacehoders), numberOfPlacehoders == numberOfFiles); + + for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){ + assertTrue(fileName.equals(actualArtifactFileName.getText())); + } + } + + @Test + public void ManagmentWorkflowTest() throws Exception{ + String descriptionText = DESCRIPTION, + descriptionTextEdit = "kuku2"; + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ServiceGeneralPage.getServiceLeftMenu().moveToManagmentWorkflow(); + ServiceGeneralPage.fillAndAddNewWorkflow(descriptionText, descriptionText); + ServiceVerificator.verifyManagmentWorkflow(descriptionText, descriptionText); + + ServiceGeneralPage.clickAddWorkflow(); + ServiceGeneralPage.fillAndAddNewWorkflow(descriptionTextEdit, descriptionTextEdit); + } + + @Test + public void deleteChangeVersionTest() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER"); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + GeneralPageElements.clickCheckoutButton(); + + changeDeleteAndValidateVersionOnGeneralPage("0.1", "0.2", serviceMetadata.getName()); + + GeneralPageElements.clickCheckoutButton(); + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + ResourceGeneralPage.clickCheckoutButton(); + + changeDeleteAndValidateVersionOnGeneralPage("1.0", "1.1", serviceMetadata.getName()); + } + + @Test + public void compositionScreenRightSideButtonsTest() throws Exception{ + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + CompositionPage.showInformationTab(); + ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION); + + //feature removed from UI +// CompositionPage.showCompositionTab(); +// ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.COMPOSITION); + + CompositionPage.showDeploymentArtifactTab(); + ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB); + + CompositionPage.showInputsTab(); + assertTrue(CompositionPage.getOpenTabTitle().size() == 0); + + CompositionPage.showAPIArtifactTab(); + ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.API); + + CompositionPage.showInformationArtifactTab(); + ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION_ARTIFACTS); + + } + + @Test + public void addDeploymentArtifactToVFInstanceTest() throws Exception{ + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); + + CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + checkInService(serviceMetadata); + clickOncanvasElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + } + + @Test + public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{ + + if(true){ + throw new SkipException("Open bug 300513"); + } + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); + + CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + deleteAndVerifyArtifact(actualArtifactList); + + } + + @Test + public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{ + + if(true){ + throw new SkipException("Open bug 300513"); + } + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); + + CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + checkInService(serviceMetadata); + ResourceGeneralPage.clickCheckoutButton(); + clickOncanvasElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + deleteAndVerifyArtifact(actualArtifactList); +// change container version + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()); + GeneralPageElements.selectVersion("V0.1"); + clickOncanvasElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + + } + +// service version V0.1 default artifact, service version V0.2 updated artifact + @Test + public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{ + + if(true){ + throw new SkipException("Open bug 300513"); + } + + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); + ArtifactInfo artifactUpdate = new ArtifactInfo(filePath, HEAT_FILE_YAML_UPDATE_NAME, DESCRIPTION, ARTIFACT_LABEL_UPDATE,ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType()); + + CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + checkInService(serviceMetadata); + ResourceGeneralPage.clickCheckoutButton(); + clickOncanvasElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + deleteAndVerifyArtifact(actualArtifactList); +// upload new artifact + addDeploymentArtifact(artifactUpdate, CanvasManager.getCanvasManager(), computeElement); + checkArtifactIfAdded(1, HEAT_FILE_YAML_UPDATE_NAME); +// change container version + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()); + GeneralPageElements.selectVersion("V0.1"); + clickOncanvasElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); + + } + + public void clickOncanvasElement(CanvasElement computeElement) { + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + canvasManager.clickOnCanvaElement(computeElement); + } + + public void checkInService(ServiceReqDetails serviceMetadata) throws Exception { + ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + } + + public static void deleteAndVerifyArtifact(List<WebElement> actualArtifactList) { + if (actualArtifactList.size()>0){ + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete " + HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted"); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + assertTrue("Artifact does not deleted", !GeneralUIUtils.waitForElementInVisibilityByTestId(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME))); + } + } + + + public void checkArtifactIfAdded(Integer expectedNumOfARtifacts, String expectedArtifactName) { + + List<WebElement> actualArtifactList; + actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); + assertTrue("Expected artifact count is: " + expectedNumOfARtifacts + ", but was " + actualArtifactList.size(),expectedNumOfARtifacts==actualArtifactList.size()); + + if(expectedNumOfARtifacts != 0){ + for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){ + assertTrue("Artifact name does not match, expected " + expectedArtifactName + ", but was " + actualArtifactFileName.getText(), expectedArtifactName.equals(actualArtifactFileName.getText())); + } + } + + } + + + public CanvasElement createServiceWithRiArtifact(ResourceReqDetails atomicResourceMetaData, ServiceReqDetails serviceMetadata, ArtifactInfo artifact) throws Exception, AWTException { + ResourceUIUtils.createResource(atomicResourceMetaData, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + ServiceUIUtils.createService(serviceMetadata, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + CanvasElement computeElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + addDeploymentArtifact(artifact, canvasManager, computeElement); + + return computeElement; + } + + + public void addDeploymentArtifact(ArtifactInfo artifact, CanvasManager canvasManager, CanvasElement computeElement) throws Exception { + canvasManager.clickOnCanvaElement(computeElement); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + } + + @Test + public void isDisabledAndReadOnlyInCheckin() throws Exception{ + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + GeneralPageElements.clickCheckinButton(serviceMetadata.getName()); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + + ServiceMetadataEnum[] fieldsForCheck = {ServiceMetadataEnum.SERVICE_NAME, + ServiceMetadataEnum.CONTACT_ID, + ServiceMetadataEnum.DESCRIPTION, + ServiceMetadataEnum.PROJECT_CODE, + ServiceMetadataEnum.TAGS}; + for (ServiceMetadataEnum field: fieldsForCheck){ + assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue())); + } + + assertTrue(GeneralUIUtils.isElementDisabled(ServiceMetadataEnum.CATEGORY.getValue())); + assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue())); + } + + // future removed from ui + @Test(enabled = false) + public void inputsTest() throws Exception{ + String fileName = "service_input_test_VF2.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + GeneralPageElements.clickCheckinButton(resourceMetaData.getName()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + String selectedInstanceName = addResourceToServiceInCanvas(resourceMetaData); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + DeploymentArtifactPage.getLeftMenu().moveToInputsScreen(); + + InputsPage.addInputToService(selectedInstanceName, "volume_id"); + InputsPage.deleteServiceInput(selectedInstanceName, "volume_id"); + + // Trying to find deleted service input + try{ + InputsPage.getServiceInput(selectedInstanceName, "volume_id"); + assert(false); + } + catch(TestException e){ + } + } + + @Test + public void deploymentViewServiceTest() throws Exception{ + String fileName2 = "vSeGW.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + addResourceToServiceInCanvas(resourceMetaData); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + DeploymentArtifactPage.getLeftMenu().moveToDeploymentViewScreen(); + + serviceMetadata.setVersion("0.1"); + List<WebElement> instanceRowsFromTable = GeneralUIUtils.getElementsByCSS("div[data-tests-id^='hierarchy-instance'] span[class^='expand-collapse-title-text']"); + for(WebElement instanceRow: instanceRowsFromTable){ + String instanceRowText = instanceRow.getText(); + List<WebElement> instanceModulesList = DeploymentPage.getInstanceModulesList(instanceRowText); + for (WebElement instanceModule: instanceModulesList){ + String instanceModuleText = instanceModule.getText(); + ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance"); + + ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[2], new DeploymentViewVerificator(filePath + fileName2)); + + ServiceVerificator.verifyDisabledServiceProperties(); + String isBaseValue = ServiceVerificator.getVFModulePropertieValue(serviceMetadata, "isBase", instanceModuleText); + if (isBaseValue.equals("false")) + ServiceVerificator.verifyEnabledServiceProperties(); + + ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance"); + } + } + } + + @Test + public void vfModuleCustomizationUUIDServiceTest() throws Exception{ + String fileName2 = "vSeGW.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + addResourceToServiceInCanvas(resourceMetaData); + + serviceMetadata.setVersion("0.1"); + ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata); + } + + @Test + public void checkoutCertifyRemainSameCustomizationUUIDServiceTest() throws Exception{ + String fileName2 = "vSeGW.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(resourceMetaData.getName()); + TesterOperationPage.certifyComponent(resourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + addResourceToServiceInCanvas(resourceMetaData); + + serviceMetadata.setVersion("0.1"); + ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata); + List<String> allVFModuleCustomizationUUIDs = ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata); + + ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + GeneralPageElements.clickCheckoutButton(); + + serviceMetadata.setVersion("0.2"); + assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata))); + + ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + TesterOperationPage.certifyComponent(serviceMetadata.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); + ResourceGeneralPage.clickCheckoutButton(); + + serviceMetadata.setVersion("1.1"); + serviceMetadata.setUniqueId(null); + assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata))); + } + + + public synchronized String addResourceToServiceInCanvas(ResourceReqDetails resourceMetaData) throws Exception { + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(resourceMetaData.getName()); + CanvasElement computeElement = canvasManager.createElementOnCanvas(resourceMetaData.getName()); + canvasManager.clickOnCanvaElement(computeElement); + String selectedInstanceName = CompositionPage.getSelectedInstanceName(); + return selectedInstanceName; + } + + public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{ + GeneralPageElements.selectVersion("V" + previousVersion); + ServiceVerificator.verifyVersionUI(previousVersion); + GeneralUIUtils.clickJSOnElementByText("latest version"); + ServiceVerificator.verifyVersionUI(currentVersion); + GeneralPageElements.clickTrashButtonAndConfirm(); + GeneralUIUtils.findComponentAndClick(serviceName); + ServiceVerificator.verifyVersionUI(previousVersion); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java new file mode 100644 index 0000000000..c043a65e71 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java @@ -0,0 +1,436 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.utilities.DownloadManager; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator; +import org.testng.SkipException; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +public class VFCArtifacts extends SetupCDTest { + + private static final String DEPLOYMENT = "Deployment"; + private static final String INFORMATIONAL = "Informational"; + private static final String ARTIFACTS = "artifacts"; + private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts"; + private String filePath; + private Object object; + @BeforeClass + public void beforeClass(){ + filePath = System.getProperty("filepath"); + if (filePath == null && System.getProperty("os.name").contains("Windows")) { + filePath = FileHandling.getResourcesFilesPath() + "VFCArtifacts"+ File.separator; + } + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "VFCArtifacts"+ File.separator; + } + } + + @Test + public void ImportMultiVFCTest_TC1407998() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + String csarFile = "Import_Multi_VFC.csar"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + RestResponse getResponse = RestCDUtils.getResource(resourceMetaData, getUser()); + assertTrue(getResponse.getErrorCode().intValue() == 200); + + Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = verifyVfcArtifacts(filePath, csarFile, resourceMetaData, getResponse); + + VFCArtifactVerificator.verifyVFCArtifactsNotInVFArtifactList(resourceMetaData, getUser(), getResponse, expectedArtifactMap); + + + } + + @Test + public void updateCsarWithVFCArtifacts_ModifyArtifacts_TC1449482() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + String csarFile = "LDSA-ORIG.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile); + List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : vfcKeys){ + VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser()); + } + + String updatedCsarFile = "LDSA-MODIFY.csar"; + ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile); + + Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile); + List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : updatedVfcKeys){ + verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key); + VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser()); + } + } + + @Test + public void updateCsarWithVFCArtifacts_DeleteAndAddArtifacts_TC1449473() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + String csarFile = "LDSA-ORIG.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + String updatedCsarFile = "LDSA-DELETE-ADD.csar"; + ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile); + + verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null); + } + + @Test + public void updateCsarWithVFCArtifacts_AddFirstVFCIdentifier_TC1425896() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + String csarFile = "LDSA-ORIG-OLD_STRUCTURE.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile); + String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile); + DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen(); + + String updatedCsarFile = "LDSA-ADD.csar"; + ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile); + + verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate); + } + + + @Test + public void updateCsarWithVFCArtifacts_AddAdditionalVFCIdentifier_TC1425898() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + String csarFile = "LDSA-SINGLE.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile); + List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : vfcKeys){ + VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser()); + } + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile); + String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile); + DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen(); + + String updatedCsarFile = "LDSA-MULTI.csar"; + ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile); + + Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile); + List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : updatedVfcKeys){ + verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key); + if (vfcKeys.contains(key)){ + VFCArtifactVerificator.verifyVFCArtifactNotChanged(key, resourceMetaData, getUser()); + } + } + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate); + } + + @Test + public void updateCsarWithVFCArtifacts_DeleteAll_TC1425581() throws Exception{ + String csarFile = "LDSA-ORIG.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile); + String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile); + DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen(); + + String updatedCsarFile = "LDSA-DELETE-ALL.csar"; + ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile); + + VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate); + } + + @Test + public void importComplexVFCArtifacts_Onboarding_TC1484153() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String vnfFile = "vProbes_FE.zip"; + String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + String vspName = createVSP.left; + resourceMetaData.setName(vspName); + Map<String, String> resourceMeta = createVSP.right; + String vspid = resourceMeta.get("vspId"); + OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); + OnboardingUtils.prepareVspForUse(getUser(), vspid); + + String downloadDirectory = getWindowTest().getDownloadDirectory(); + String csarFile = vspid + ".csar"; + + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); + HomePage.showVspRepository(); + OnboardingUtils.importVSP(createVSP); + resourceMetaData.setVersion("0.1"); + + verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile); + + } + + @Test + public void updateComplexVFCArtifacts_AddRemove_Onboarding_TC1484185() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + //check of version is 1 + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String vnfFile = "vProbes_FE.zip"; + String snmpPollFile = "vprobes-vLB.zip"; + String updatedSnmpPollFile = "vprobes-vLBAgent.zip"; + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + String vspName = createVSP.left; + resourceMetaData.setName(vspName); + Map<String, String> resourceMeta = createVSP.right; + String vspid = resourceMeta.get("vspId"); + String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser()); + OnboardingUtils.prepareVspForUse(getUser(), vspid); + + String downloadDirectory = getWindowTest().getDownloadDirectory(); + String csarFile = vspid + ".csar"; + + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); + HomePage.showVspRepository(); + OnboardingUtils.importVSP(createVSP); + + ResourceGeneralPage.clickSubmitForTestingButton(vspName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vspName); + TesterOperationPage.certifyComponent(vspName); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser()); + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); + HomePage.showVspRepository(); + OnboardingUtils.updateVSP(createVSP); + resourceMetaData.setVersion("1.1"); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile); + + verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null); + + } + + @Test + public void updateComplexVFCArtifacts_Modify_Onboarding_TC1484195() throws Exception{ + + if(true){ + throw new SkipException("Open bug 294400"); + } + + //check of version is 2 + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String vnfFile = "vProbes_FE.zip"; + String snmpFile = "vprobes-vLB.zip"; + String updatedSnmpFile = "vprobes-vLB-Modified.zip"; + + OnboardingUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + String vspName = createVSP.left; + resourceMetaData.setName(vspName); + Map<String, String> resourceMeta = createVSP.right; + String vspid = resourceMeta.get("vspId"); + String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); + OnboardingUtils.prepareVspForUse(getUser(), vspid); + + String downloadDirectory = getWindowTest().getDownloadDirectory(); + String csarFile = vspid + ".csar"; + + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); + HomePage.showVspRepository(); + OnboardingUtils.importVSP(createVSP); + + Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile); + List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : vfcKeys){ + resourceMetaData.setVersion("0.1"); + VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser()); + } + + ResourceGeneralPage.clickSubmitForTestingButton(vspName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vspName); + TesterOperationPage.certifyComponent(vspName); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser()); + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); + HomePage.showVspRepository(); + OnboardingUtils.updateVSP(createVSP); + resourceMetaData.setVersion("1.1"); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile); + + Map<String, Object> artifactsFromCsarAfterUpdate = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile); + List<String> vfcKeysAfterUpdate = artifactsFromCsarAfterUpdate.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : vfcKeysAfterUpdate){ + verifyVfcInstanceArtifacts(resourceMetaData, null, artifactsFromCsarAfterUpdate, key); + VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser()); + } + + } + + + + + + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + + private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcArtifacts(String filepath, String csarFile, + ResourceReqDetails resourceMetaData, RestResponse getResponse) throws Exception { + ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts"); + Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = null; + ExtentTestActions.log(Status.INFO, "Reading artifacts in CSAR file"); + Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filepath + csarFile); + List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); + for (String key : vfcKeys){ + expectedArtifactMap = verifyVfcInstanceArtifacts(resourceMetaData, getResponse, artifactsFromCsar, key); + } + return expectedArtifactMap; + } + + private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcInstanceArtifacts( + ResourceReqDetails resourceMetaData, RestResponse getResponse, Map<String, Object> artifactsFromCsar, String key) { + + Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap; + Map<String,LinkedList<HeatMetaFirstLevelDefinition>> vfcDeploymentArtifacts = (Map<String,LinkedList<HeatMetaFirstLevelDefinition>>)artifactsFromCsar.get(key); + LinkedList<HeatMetaFirstLevelDefinition> deploymentList = vfcDeploymentArtifacts.get(DEPLOYMENT); + LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) artifactsFromCsar.get(INFORMATIONAL); + + expectedArtifactMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>(); + if(deploymentList == null){ + expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>()); + }else{ + expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, deploymentList); + } + if(informationalList == null){ + expectedArtifactMap.put(ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>()); + }else{ + expectedArtifactMap.put(ARTIFACTS, informationalList); + } + + + VFCArtifactVerificator.verifyVfcArtifacts(resourceMetaData, getUser(), key, expectedArtifactMap, getResponse); + return expectedArtifactMap; + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java index 96a22ef2fe..a94a63500d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java @@ -20,69 +20,93 @@ package org.openecomp.sdc.ci.tests.execute.sanity; +import java.awt.AWTException; +import java.io.File; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.ci.tests.datatypes.PropertyInfo; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; -import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; +import org.openecomp.sdc.ci.tests.pages.InputsPage; import org.openecomp.sdc.ci.tests.pages.PropertiesPage; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; +import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.Select; import org.testng.AssertJUnit; +import org.testng.SkipException; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + + public class Vf extends SetupCDTest { private String filePath; - - @BeforeMethod - public void beforeTest() { + @BeforeClass + public void beforeClass(){ filePath = System.getProperty("filepath"); - if (filePath == null) { + if (filePath == null && System.getProperty("os.name").contains("Windows")) { filePath = FileHandling.getResourcesFilesPath(); } + else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + } } - - @Test - public void createVF() throws Exception { - - // create Resource - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(resourceMetaData, getUser()); - + + @BeforeMethod + public void beforeTest(){ + System.out.println("File repository is : " + filePath); + getExtendTest().log(Status.INFO, "File repository is : " + filePath); } + @Test public void updateVF() throws Exception { @@ -92,69 +116,63 @@ public class Vf extends SetupCDTest { ResourceUIUtils.createResource(resourceMetaData, getUser()); // update Resource - String expectedDesc = "kuku"; - resourceMetaData.setDescription(expectedDesc); - ResourceGeneralPage.defineDescription(expectedDesc); - GeneralUIUtils.clickUpdateButton(); - - VfVerificator.verifyVFUpdatedInUI(resourceMetaData); + ResourceReqDetails updatedResource = new ResourceReqDetails(); + updatedResource.setName("ciUpdatedName"); + updatedResource.setDescription("kuku"); + updatedResource.setVendorName("updatedVendor"); + updatedResource.setVendorRelease("updatedRelease"); + updatedResource.setContactId("ab0001"); + updatedResource.setCategories(resourceMetaData.getCategories()); + updatedResource.setVersion("0.1"); + updatedResource.setResourceType(ResourceTypeEnum.VF.getValue()); + List<String> newTags = resourceMetaData.getTags(); + newTags.remove(resourceMetaData.getName()); + newTags.add(updatedResource.getName()); + updatedResource.setTags(newTags); + ResourceUIUtils.updateResource(updatedResource, getUser()); + + VfVerificator.verifyVFMetadataInUI(updatedResource); + VfVerificator.verifyVFUpdated(updatedResource, getUser()); } @Test - public void vfcLinkedToComputeInVfWithArtifactsFlow() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; - - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath, - "asc_heat 0 2.yaml", "features"); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - - // create Resource - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(vfMetaData, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - ArtifactInfo artifact1 = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact1); - ArtifactInfo artifact2 = new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2", - "YANG_XML"); - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact2); - - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - - CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - AssertJUnit.assertNotNull(cpElement); - ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser()); - canvasManager.linkElements(cpElement, computeElement); - - vfMetaData.setVersion("0.1"); - VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1); + public void vfcLinkedToComputeInVfFlow() throws Exception { + String fileName = "vFW_VFC2.yml"; + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + + try{ + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue() , "1.0")); + CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + AssertJUnit.assertNotNull(cpElement); + ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser()); + canvasManager.linkElements(cpElement, computeElement); + + vfMetaData.setVersion("0.1"); + VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1); + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0"); + } } @Test - public void addingDeploymentArtifactToVFInstanceInService() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - // create Resource + public void addUpdateDeleteDeploymentArtifactToVfTest() throws Exception { ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createResource(vfMetaData, getUser()); @@ -162,211 +180,499 @@ public class Vf extends SetupCDTest { List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); - deploymentArtifactList - .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); + deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { DeploymentArtifactPage.clickAddNewArtifact(); ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); } - - ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); - GeneralUIUtils.clickASDCLogo(); - - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vfMetaData.getName()); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName()); - - serviceCanvasManager.clickOnCanvaElement(vfElement); - GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click(); - GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click(); - GeneralUIUtils.waitForLoader(); - ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", - "DCAE_INVENTORY_TOSCA"); - deploymentArtifactList.add(artifact3); - GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel()); - DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType()); - DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription()); - DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename()); - GeneralUIUtils.getWebElementWaitForVisible("Done").click(); - GeneralUIUtils.waitForLoader(); - - List<WebElement> actualArtifactList = GeneralUIUtils - .waitForElementsListVisibility(By.className("i-sdc-designer-sidebar-section-content-item-artifact")); - AssertJUnit.assertEquals(deploymentArtifactList.size(), actualArtifactList.size()); - + AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size())); + + String newDescription = "new description"; + DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.artifactPopup().insertDescription(newDescription); + DeploymentArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel()); + AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel()); + DeploymentArtifactPage.clickOK(); + AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1)); + + AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed()); } + @Test - public void distibuteVFCInVFInServiceTest() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; + public void addUpdateDeleteInformationalArtifact() throws Exception { + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath, - "asc_heat 0 2.yaml", "features"); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + InformationalArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact); + + AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1)); + + String newDescription = "new description"; + InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel()); + InformationalArtifactPage.artifactPopup().insertDescription(newDescription); + InformationalArtifactPage.artifactPopup().clickDoneButton(); + String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel()); + AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription)); + + InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel()); + InformationalArtifactPage.clickOK(); + AssertJUnit.assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0)); + } - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - quitAndReLogin(UserRoleEnum.DESIGNER); + @Test + public void addPropertiesToVfcInstanceInVfTest() throws Exception { + + if(true){ + throw new SkipException("Open bug 292047"); + } + + String fileName = "vFW_VFC.yml"; + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + + try{ + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + vfCanvasManager.clickOnCanvaElement(vfcElement); + CompositionPage.showPropertiesAndAttributesTab(); + List<WebElement> properties = CompositionPage.getProperties(); + String propertyValue = "abc123"; + for (int i = 0; i < 2; i++) { + WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")); + findElement.click(); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue); + PropertiesPage.getPropertyPopup().clickSave(); + + + findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value")); + AssertJUnit.assertTrue(findElement.getText().equals(propertyValue)); + } + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1"); + } + } + + @Test + public void changeInstanceVersionTest() throws Exception{ + + ResourceReqDetails atomicResourceMetaData = null; + ResourceReqDetails vfMetaData = null; + CanvasManager vfCanvasManager; + CanvasElement vfcElement = null; + String fileName = "vFW_VFC3.yml"; + try{ + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); + + vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(atomicResourceMetaData.getName()); + vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + + CompositionPage.clickSubmitForTestingButton(vfMetaData.getName()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name()); + AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError)); + + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0"); + + //verfication + VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0"); + } + + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0"); + } + + } - // create Resource + // future removed from ui + @Test(enabled = false) + public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception{ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER); + int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable())); + VfVerificator.verifyPropertiesInUI(propertyList); + PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size()); + + + PropertyTypeEnum prop = propertyList.get(0); + prop.setDescription("updatedDescription"); + prop.setValue("value"); + PropertiesUIUtils.updateProperty(prop); + + PropertiesPage.clickDeletePropertyArtifact(prop.getName()); + AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable())); + } + + // future removed from ui + @Test(enabled = false) + public void vfcInstancesInputScreenTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + + Map<String, String> elementsIntancesMap = new HashMap<String, String>(); + for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)){ + CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element); + vfCanvasManager.clickOnCanvaElement(elementOnCanvas); + String selectedInstanceName = CompositionPage.getSelectedInstanceName(); + elementsIntancesMap.put(selectedInstanceName, element.getValue()); + } - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); - deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); - deploymentArtifactList - .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2", "YANG_XML")); - for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); + CompositionPage.moveToInputsScreen(); + int canvasElementsSize = vfCanvasManager.getCanvasElements().size(); + AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize)); + + for (String element : elementsIntancesMap.keySet()){ + String resourceName = elementsIntancesMap.get(element); + ResourceReqDetails resource = new ResourceReqDetails(); + resource.setName(resourceName); + resource.setVersion("1.0"); + resource.setResourceType(ResourceTypeEnum.VFC.toString()); + RestResponse restResponse = RestCDUtils.getResource(resource, getUser()); + Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse); + + List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element); + AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size()); + VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable); + + GeneralUIUtils.clickOnElementByText(element); } + + } - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement cpElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - vfCanvasManager.linkElements(cpElement, computeElement); + @Test + public void addAllInformationalArtifactPlaceholdersInVfTest() throws Exception{ + + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); - ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + + for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){ + ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue()); + } + + AssertJUnit.assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length)); + } + + @Test + public void verifyToscaArtifactsExist() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + final int numOfToscaArtifacts = 2; + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts)); + + for(int i = 0; i < numOfToscaArtifacts; i++){ + String typeFromScreen = ToscaArtifactsPage.getArtifactType(i); + AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType())); + } + + ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName()); + VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser()); + } + + @Test(enabled=false) + public void testDownload() throws Exception{ +// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); +// ResourceUIUtils.createResource(vfMetaData, getUser()); +// +// final int numOfToscaArtifacts = 2; +// ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); +// assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts)); +// GeneralUIUtils.clickOnElementByTestId("download-Tosca Model"); +// System.out.println("download me"); + + AttFtpClient attFtpClient = AttFtpClient.getInstance(); + + File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP(); + attFtpClient.deleteFilesFromFTPserver(); + } + + @Test + public void vfCertificationTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + String vfName = vfMetaData.getName(); + + ResourceGeneralPage.clickCheckinButton(vfName); + GeneralUIUtils.findComponentAndClick(vfName); + ResourceGeneralPage.clickSubmitForTestingButton(vfName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(vfName); + TesterOperationPage.certifyComponent(vfName); + + vfMetaData.setVersion("1.0"); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfName); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED); + } + + @Test + public void deleteVfCheckedoutTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + GeneralPageElements.clickTrashButtonAndConfirm(); + + vfMetaData.setVersion("0.1"); + VfVerificator.verifyVfDeleted(vfMetaData, getUser()); + } + + @Test + public void revertVfMetadataTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceReqDetails vfRevertDetails = new ResourceReqDetails(); + vfRevertDetails.setName("ciUpdatedName"); + vfRevertDetails.setDescription("kuku"); + vfRevertDetails.setCategories(vfMetaData.getCategories()); + vfRevertDetails.setVendorName("updatedVendor"); + vfRevertDetails.setVendorRelease("updatedRelease"); + ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false); + + GeneralPageElements.clickRevertButton(); + + VfVerificator.verifyVFMetadataInUI(vfMetaData); + + } + + @Test + public void addDeploymentArtifactInCompositionScreenTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER"); + CompositionPage.showDeploymentArtifactTab(); + CompositionPage.clickAddArtifactButton(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup()); + + List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact")); + AssertJUnit.assertEquals(1, actualArtifactList.size()); + } + + // future removed from ui + @Test(enabled = false) + public void addPropertyInCompositionScreenTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + CompositionPage.showPropertiesAndAttributesTab(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER); + int propertiesCount = CompositionPage.getProperties().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties())); + } + + @Test + public void addDeploymentArtifactAndVerifyInCompositionScreen() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - quitAndReLogin(UserRoleEnum.TESTER); + ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); + DeploymentArtifactPage.clickAddNewArtifact(); + ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); + AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1)); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + CompositionPage.showDeploymentArtifactTab(); + List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts(); + AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size()); + + String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText(); + AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName)); + } + + @Test + public void checkoutVfTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + GeneralPageElements.clickCheckoutButton(); + + vfMetaData.setVersion("0.2"); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); + + ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); + + reloginWithNewRole(UserRoleEnum.TESTER); GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); TesterOperationPage.certifyComponent(vfMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - - // create service - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vfMetaData.getName()); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName()); - - ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - TesterOperationPage.certifyComponent(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.OPS); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - OpsOperationPage.distributeService(); - OpsOperationPage.displayMonitor(); - - List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); - AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); - - String deploymentArtifactsSize = String.valueOf(deploymentArtifactList.size() + 1); - - OpsOperationPage.waitUntilArtifactsDistributed(deploymentArtifactsSize, 0); - + + reloginWithNewRole(UserRoleEnum.DESIGNER); + GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); + ResourceGeneralPage.clickCheckoutButton(); + + vfMetaData.setVersion("1.1"); + vfMetaData.setUniqueId(null); + VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT); } - + @Test - public void changesInVFCInstanceInVF() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; + public void deleteInstanceFromVfCanvas() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + CanvasElement portElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT); + + vfCanvasManager.clickOnCanvaElement(computeElement); + vfCanvasManager.deleteElementFromCanvas(computeElement); + + VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser()); + } + + @Test + public void changeInstanceNameInVfTest() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + + String updatedInstanceName = "updatedName"; + vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); + + String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName(); + AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName)); + } + + + @Test + public void submitVfForTestingWithNonCertifiedAsset() throws Exception{ + String fileName = "vFW_VFC4.yml"; - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - - InformationalArtifactPage.getLeftMenu().moveToPropertiesScreen(); - int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); - - PropertyInfo prop1 = new PropertyInfo("p1", "v1", "prop1", PropertyTypeEnum.STRING); - - PropertiesPage.clickAddPropertyArtifact(); - PropertiesUIUtils.addNewProperty(prop1); - AssertJUnit.assertTrue(PropertiesPage.checkElementsCountInTable(propertiesCount + 1, - () -> PropertiesPage.getElemenetsFromTable())); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createResource(vfMetaData, getUser()); - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - - vfCanvasManager.clickOnCanvaElement(vfcElement); - CompositionPage.showPropertiesAndAttributesTab(); - List<WebElement> properties = CompositionPage.getProperties(); - for (int i = 0; i < 2; i++) { - // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver() - // , 30); - // WebElement findElement = - // wait.until(ExpectedConditions.visibilityOf(properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")))); - WebElement findElement = properties.get(i).findElement( - By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")); - findElement.click(); - PropertiesPage.getPropertyPopup().insertPropertyDefaultValue("abc123"); - PropertiesPage.getPropertyPopup().clickSave(); - GeneralUIUtils.waitForInvisibileElement(DataTestIdEnum.PropertiesPageEnum.SAVE.getValue()); + canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); + + try{ + CompositionPage.clickSubmitForTestingButton(vfMetaData.getName()); + assert(false); + } + catch(Exception e){ + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name()); + AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + finally{ + ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1"); } - vfCanvasManager.moveToFreeLocation(vfMetaData.getName()); - GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click(); - GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click(); - GeneralUIUtils.waitForLoader(); - ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", "OTHER"); - GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel()); - DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType()); - DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription()); - DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename()); - GeneralUIUtils.getWebElementWaitForVisible("Done").click(); - GeneralUIUtils.waitForLoader(); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); + } + + @Test + public void isDisabledAndReadOnlyInCheckin() throws Exception{ + ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createResource(vfMetaData, getUser()); + ResourceGeneralPage.clickCheckinButton(vfMetaData.getName()); GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); - ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - vfCanvasManager = CanvasManager.getCanvasManager(); - vfCanvasManager.clickOnCanvaElement(vfcElement); - // change version - GeneralUIUtils.getWebElementByName("changeVersion"); - Select selectlist = new Select(GeneralUIUtils.getWebElementByName("changeVersion")); - selectlist.selectByVisibleText("1.0"); - GeneralUIUtils.waitForLoader(); - - // GeneralUIUtils.waitUntilClickableButton(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue()).click(); - // ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); - // - // vfMetaData.setVersion("0.1"); - // VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), - // LifecycleStateEnum.READY_FOR_CERTIFICATION); + + ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME, + ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE, + ResourceMetadataEnum.CONTACT_ID}; + + for (ResourceMetadataEnum field: fieldsForCheck){ + AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue())); + } + + AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue())); + AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue())); + } + + @Test + public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception { + String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; + Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + String vspName = vsp.left; + ResourceGeneralPage.clickSubmitForTestingButton(vsp.left); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); + VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource); + } + + @Test + public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception { + String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; + OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); + GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue()); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath()); + VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition); } @Override diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java new file mode 100644 index 0000000000..2957379ff8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java @@ -0,0 +1,380 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.awt.AWTException; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.ci.tests.businesslogic.ArtifactBusinessLogic; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.HomeUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openqa.selenium.WebElement; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +public class VfArtifacts extends SetupCDTest{ + + private String filePath; + private String vnfsRepositoryPath; + private String updatedVnfsRepositoryPath; + private String createdEnvFilePath; + private static final String PARAMETERS = "parameters"; + + @BeforeMethod + public void beforeTest() throws FileNotFoundException{ + filePath = getWindowTest().getDownloadDirectory(); + vnfsRepositoryPath = FileHandling.getVnfRepositoryPath(); +// vnfsRepositoryPath = FileHandling.getFilePath("Old_VNFs"); + updatedVnfsRepositoryPath = vnfsRepositoryPath + "UpdatedVNFs"; + Config config = Utils.getConfig(); + createdEnvFilePath = config.getWindowsDownloadDirectory(); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + + + @DataProvider(name = "heatEnvAndVersion", parallel = false) +// parameters: VSP, updatedVsp, expectedHeatVersion, expectedHeatEnvVersion + public Object[][] provideData() { + + return new Object[][] { + { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_UpdateHeatParams.zip", "2", "1" }, // expected heat version 2 and heatEnv 1 + { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_WithoutEnvFiles.zip", "1", "1" }, // expected heat version 1 and heatEnv 1 + { "2016-014_vlandslide_ldsa_30_1607_e2e.zip", "2016-209_vjsa_vjsa_30_1610_e2e.zip", "1", "0" }, // expected heat version 1 and heatEnv 0 + { "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-045_vlb_lmsp_30_1607_e2e.zip", "1", "1" }, // expected heat version 1 and heatEnv 1(DE270634) + { "2016-109_mobt_mobt_30_1607_e2e.zip", "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip", "2", "1" } // expected heat version 2 and heatEnv 1 + }; + } + +// update first env file and verify parameters value + @Test + public void uploadUpdatedHeatEnv() throws Exception{ + + String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; + File updateEnvFile = null; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); + Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); + List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts); +// create env file and update it + if(envFilesList.size()>0){ +// select index of env file to be updated + HeatWithParametersDefinition selectedEnvFileToUpdate = envFilesList.get(0); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel()); + updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath); + ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile); + } + else{ + SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files"); + } + } + +// update all env files and verify parameters value in Deployment Artifact View + @Test + public void uploadUpdatedAllHeatEnv() throws Exception{ + + String vnfFile = "2016-044_vfw_fnat_30_1607_e2e.zip"; + File updateEnvFile = null; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); + Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); + List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts); + if(envFilesList.size()>0){ + for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){ + // create env file and update it + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel()); + updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath); + ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile); + } + }else{ + SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files"); + } + } + +// update all env files and verify parameters value in Composition + @Test + public void uploadUpdatedAllHeatEnvComposition() throws Exception{ + + String vnfFile = "2016-014_vlandslide_ldst_30_1607_e2e.zip"; + File updateEnvFile = null; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); + Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); + List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.StepsEnum.COMPOSITION.getValue()); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB.getValue()); + if(envFilesList.size()>0){ + for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){ + // create env file and update it + String dataTestId = DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName(); + GeneralUIUtils.hoverOnAreaByTestId(dataTestId); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName()); + updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath); + ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile, dataTestId); + } + }else{ + SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files"); + } + } + +// expected heat version 1 and heatEnv 0 + @Test + // Download ENV file from VF level Update VSP. + public void downloadEnvFromVFLevelUpdateVSP() throws Throwable { + String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; + String updatedVnfFile="2016-014_vlandslide_ldsa_30_1607_e2e.zip"; + String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); + Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = CreatedVsp.left; + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); + OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser()); + //get updated vsp env files + Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath); + GeneralUIUtils.findComponentAndClick(vspName); + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace(); + + for (int i = 0; i < deploymentArtifcatsList.size(); i++) { + if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) { + DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i)); + GeneralUIUtils.ultimateWait(); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath); + ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir, currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS); + } + } + } + + @Test + // Download ENV file from VF level Work-Space. + public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception { + String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; + String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); + + Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + + Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); + GeneralUIUtils.findComponentAndClick(vsp.left); + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace(); + + for (int i = 0; i < deploymentArtifcatsList.size(); i++) { + + if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) { + DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i)); + GeneralUIUtils.ultimateWait(); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath); + ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS); + } + } + } + + @Test + // Download ENV file from VF level Composition. + public void downloadEnvVFLevelComposition() throws AWTException, Exception { + + String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); + String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; + + Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); + GeneralUIUtils.findComponentAndClick(vsp.left); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CompositionPage.clickOnTabTestID(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB); + List<WebElement> deploymentArtifcatsList = CompositionPage.getCompositionEnvArtifacts(); + + for (int i = 0; i < deploymentArtifcatsList.size(); i++) { + String fileName = GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)).replace(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue(), ""); + if (GeneralUIUtils.isElementVisibleByTestId(GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)))) { + CompositionPage.clickDownloadEnvArtifactComposition(fileName).click(); + GeneralUIUtils.ultimateWait(); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath); + ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(fileName), PARAMETERS); + } + } + } + + @Test + // Download ENV file from VF level Update parameters in UI. + public void downloadEnvVFLevelUpdateParameters() throws AWTException, Exception { + + String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; + String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); + Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1"); + Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); + List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts); + + for (int i = 0; i < envFilesList.size(); i++) { + String artifactName = envFilesList.get(i).getHeatArtifactDisplayName(); + if (envFilesList.get(i).getHeatArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) { + ExtentTestActions.log(Status.INFO, String.format("Opening the edit/view artifact parameters form of %s resource...", vnfFile)); + DeploymentArtifactPage.clickEditEnvArtifact(envFilesList.get(i).getHeatArtifactDisplayName()); + + ExtentTestActions.log(Status.INFO, String.format("Going To locating all artifact parameters from UI of %s artifact...", artifactName)); + Map<?, ?> dataToWriteInUI = ArtifactUIUtils.getDataToWriteInUI(envFilesList.get(i).getHeatParameterDefinition()); + Map<?, ?> data = dataToWriteInUI; + ExtentTestActions.log(Status.INFO, String.format("Success to locate all artifact parameters from UI of %s artifact...", artifactName)); + + List<HeatParameterDataDefinition> listToSearchEnvParametersInUI = envFilesList.get(i).getHeatParameterDefinition(); + fillHeatEnvParametersInUi(data, listToSearchEnvParametersInUI); + + DeploymentArtifactPage.clickSaveEnvParameters(); + GeneralUIUtils.waitForLoader(); + ExtentTestActions.log(Status.INFO, String.format("Going to get the %s updated resource ...", CreatedVsp.left)); + resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1"); + deploymentArtifacts = resource.getDeploymentArtifacts(); + Map<String,List<HeatWithParametersDefinition>> envFilesListupdated = new HashMap<>(); + ExtentTestActions.log(Status.INFO, String.format("Mapping the %s artifact parameters ...", artifactName)); + envFilesListupdated.put(artifactName,ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts)); + List<HeatWithParametersDefinition> heatEnvUpdatedParameters=envFilesListupdated.get(artifactName); + DeploymentArtifactPage. clickDownloadEnvArtifact(artifactName); + + Map<String,Object> mapExpectedProperties = new HashMap<>(); + for (HeatParameterDataDefinition param : heatEnvUpdatedParameters.get(i).getHeatParameterDefinition()) { + mapExpectedProperties.put(param.getName(), ArtifactUIUtils.getValue(param)); + } + ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileFromDir(downloadDirPath), PARAMETERS); + } + } + } + + + @Test + public void checkDefaultCreatedEnvArtifacts() throws Exception{ + String vnfFile = "2016-017_vixia_ixla_30_1607_e2e.zip"; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); + HomeUtils.findComponentAndClick(vspName); + GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT); + for(Entry<String, File> envFileEntry : generatedEnvFileList.entrySet()){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey()); + ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "0", ArtifactTypeEnum.HEAT_ENV); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT); + } + } + +// ------------------------------------------------------------------------------- + @Test(dataProvider = "heatEnvAndVersion") + public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{ + String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion); + setLog(stringForLog); + + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); + OnboardingUtils.updateVnfAndValidate(updatedVnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); + HomeUtils.findComponentAndClick(vspName); + GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT); + for(Entry<String, File> envFileEntry : generatedUpdatedEnvFileList.entrySet()){ +// TODO test will pass on case all objects on deployment view are visible + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey()); + ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT); + } + } + +// expected heat version 1 and heatEnv 2 + @Test + public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{ + String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; + String updatedVnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; + Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vspName = vsp.left; + + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); + OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); + OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); + HomeUtils.findComponentAndClick(vspName); + GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT); + for(Entry<String, File> envFileEntry : generatedUpdatedSecondTimeEnvFileList.entrySet()){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey()); + ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "2", ArtifactTypeEnum.HEAT_ENV); + ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT); + } + } + + + public void downloadFile(Entry<String, File> envFileEntry) { + int fileCountBefore = FileHandling.getFileCountFromDefaulDownloadDirectory(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey()); + int fileCountAfter = FileHandling.getFileCountFromDefaulDownloadDirectory(); + assertTrue("Downloaded file is missing", (fileCountAfter - fileCountBefore) == 1 ); + } + + public static void fillHeatEnvParametersInUi(Map<?, ?> data,List<HeatParameterDataDefinition> listToSearchEnvParametersInUI) { + ExtentTestActions.log(Status.INFO, String.format("Going to search parameters in UI and insert new current value to each parameter in UI...")); + + for (HeatParameterDataDefinition paramDefinition : listToSearchEnvParametersInUI){ + DeploymentArtifactPage.searchBoxEnv(paramDefinition.getName()); + WebElement currenValueField=GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.EnvParameterView.ENV_CURRENT_VALUE.getValue()+paramDefinition.getName()); + currenValueField.clear(); + currenValueField.sendKeys(data.get(paramDefinition.getName()).toString()); + GeneralUIUtils.ultimateWait(); + DeploymentArtifactPage.clearSearchBoxEnv(); + } + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java new file mode 100644 index 0000000000..22396ec9c7 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java @@ -0,0 +1,927 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.Test; + + +public class VfDeploymentInformationalArtifacts extends SetupCDTest { + + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // START US824719 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + // US824719 - Import VSP - VF informational artifacts + // TC1434241 - Import VF Artifacts - Deployment Artifacts - One Artifact, One Type + @Test + public void importVfArtifactsDeploymentArtifactsOneArtifactOneType() throws Exception { + String fileName = "TC1434241.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1434245 - Import VF Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types + @Test + public void importVfArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception { + String fileName = "TC1434245.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1")); + + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName,folder, deploymentArtifacts, null); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type + @Test + public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "TC1434247.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1434248 - Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types + @Test + public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "TC1434248.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1434249 - Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types + @Test + public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "TC1434249.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + } + + // TODO: there is defect in flow: "Updated button enabled for artifact in invalid type folder" + // TODO: re-check it after defect fix + // US824719 - Import VSP - VF informational artifacts + // TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid + @Test + public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "DeploymentArtifactWithInvalidType.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid + @Test + public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "InformationArtifactWithInvalidType.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1438231 - Import VF Artifacts - Deployment Artifacts - Artifact Name To Long + @Test + public void importVfArtifactsDeploymentArtifactsArtifactNameToLong() throws Exception { + String folder = "US825779"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String fileName = "DeploymentArtifactWithLongName.csar"; + + importVfFromCsar(resourceMetaData, folder, fileName, getUser()); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + // US824719 - Import VSP - VF informational artifacts + // TC1438232 - Import VF Artifacts - Informational Artifacts - Artifact Name To Long + // TODO: make informational artifact name longer then 255 + // TODO: windows/linux not allowed it + @Test(enabled=false) + public void importVfArtifactsInformationalArtifactsArtifactNameToLong() throws Exception { + String folder ="US825779"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + + String fileName = "InformationArtifactWithLongName.csar"; + + importVfFromCsar(resourceMetaData, folder, fileName, getUser()); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // END US824719 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // START US825779 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443736 - Update With One New Deployment Artifact + @Test + public void updateWithOneNewDeploymentArtifact() throws Exception { + String fileName = "ImportTC1443736.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443736.csar"; + deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null); + } + + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443737 - Update With One Removed Deployment Artifact + @Test + public void updateWithOneRemovedDeploymentArtifact() throws Exception { + String fileName = "ImportTC1443737.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); + ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"); + deploymentArtifacts.add(artifactInfo); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443737.csar"; + deploymentArtifacts.remove(artifactInfo); + + List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>(); + deploymentArtifactsNotExist.add(artifactInfo); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, deploymentArtifactsNotExist, null); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443738 - Update With One New Version Deployment Artifact + @Test + public void updateWithOneNewVersionDeploymentArtifact() throws Exception { + String fileName = "ImportTC1443738.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); + ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"); + deploymentArtifacts.add(artifactInfo); + + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443738.csar"; + artifactInfo.setArtifactVersion("2"); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443887 - Update With One New Informational Artifact + @Test + public void updateWithOneNewInformationalArtifact() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String fileName = "ImportTC1443887.csar"; + String folder ="US825779"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443887.csar"; + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443888 - Update With One Removed Informational Artifact + @Test + public void updateWithOneRemovedInformationalArtifact() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1443888.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"); + informationalArtifacts.add(artifactInfo); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443888.csar"; + + informationalArtifacts.remove(artifactInfo); + + List<ArtifactInfo> informationalArtifactNotExist = new ArrayList<ArtifactInfo>(); + informationalArtifactNotExist.add(artifactInfo); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, informationalArtifactNotExist); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443890 - Update With One New Artifact Version Informational Artifact + @Test + public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1443890.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"); + informationalArtifacts.add(artifactInfo); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443890.csar"; + artifactInfo.setArtifactVersion("2"); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443893 - Update CSAR With Same Artifacts As Imported + @Test + public void updateCSARWithSameArtifactsAsImported() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportUpdateTC1443893.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "ImportUpdateTC1443893.csar"; + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts + @Test + public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1443954.csar"; + + ArtifactInfo deploymentHeat1 = new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"); + ArtifactInfo deploymentHeat2 = new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"); + ArtifactInfo deploymentHeat3 = new ArtifactInfo(null, "heatartifactname3.yaml", null, "heatartifactname3", ArtifactTypeEnum.HEAT.getType(), "1"); + + ArtifactInfo deploymentHeatVol1 = new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"); + ArtifactInfo deploymentHeatVol2 = new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"); + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(deploymentHeat1); + deploymentArtifacts.add(deploymentHeat2); + deploymentArtifacts.add(deploymentHeat3); + deploymentArtifacts.add(deploymentHeatVol1); + deploymentArtifacts.add(deploymentHeatVol2); + + ArtifactInfo infoGuide1 = new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"); + ArtifactInfo infoGuide2 = new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"); + + ArtifactInfo infoOther1 = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"); + ArtifactInfo infoOther2 = new ArtifactInfo(null, "artifactname2.txt", null, "artifactname2", ArtifactTypeEnum.OTHER.getType(), "1"); + ArtifactInfo infoOther3 = new ArtifactInfo(null, "artifactname3.txt", null, "artifactname3", ArtifactTypeEnum.OTHER.getType(), "1"); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(infoGuide1); + informationalArtifacts.add(infoGuide2); + informationalArtifacts.add(infoOther1); + informationalArtifacts.add(infoOther2); + informationalArtifacts.add(infoOther3); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1443954.csar"; + + List<ArtifactInfo> informationalArtifactsNotExist = new ArrayList<ArtifactInfo>(); + List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>(); + + // Changes in deployment artifacts + deploymentArtifactsNotExist.add(deploymentHeat1); + deploymentArtifactsNotExist.add(deploymentHeat2); + deploymentArtifacts.remove(deploymentHeat1); + deploymentArtifacts.remove(deploymentHeat2); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname4.yaml", null, "heatartifactname4", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname5.yaml", null, "heatartifactname5", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentHeatVol1.setArtifactVersion("2"); + deploymentHeatVol2.setArtifactVersion("2"); + + // Changes in informational artifacts + infoGuide1.setArtifactVersion("2"); + infoOther1.setArtifactVersion("2"); + informationalArtifactsNotExist.add(infoGuide2); + informationalArtifactsNotExist.add(infoOther2); + informationalArtifacts.remove(infoGuide2); + informationalArtifacts.remove(infoOther2); + informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact3.yml", null, "GuideInfoArtifact3", ArtifactTypeEnum.GUIDE.getType(), "1")); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname4.txt", null, "artifactname4", ArtifactTypeEnum.OTHER.getType(), "1")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, deploymentArtifactsNotExist, informationalArtifactsNotExist); + } + + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444206 - Update With Existed Deployment Artifact By Artifact With Different Type + @Test + public void updateWithExistedDeploymentArtifactByArtifactWithDifferentType() throws Exception { + String folder ="US825779"; + String fileName = "ImportTC1444206.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444206.csar"; + String filePath = FileHandling.getFilePath(folder); ; + + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type + @Test + public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1444207.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444207.csar"; + String filePath = FileHandling.getFilePath(folder); ; + + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444208 - Update With Existed Informational Artifact By Deployment Artifact With Different Type + @Test + public void updateWithExistedInformationalArtifactByDeploymentArtifactWithDifferentType() throws Exception { + String folder ="US825779"; + String fileName = "ImportTC1444208.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444208.csar"; + String filePath = FileHandling.getFilePath(folder); ; + + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444520 - Update Deployment Artifact With Name To Long + @Test + public void updateDeploymentArtifactWithNameToLong() throws Exception { + String folder ="US825779"; + + String fileName = "ImportTC1444520.csar"; + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444520.csar"; + String filePath = FileHandling.getFilePath(folder); ; + + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444521 - Update Informational Artifact With Name To Long + @Test + public void updateInformationalArtifactWithNameToLong() throws Exception { + + String folder = "US825779"; + String fileName = "ImportTC1444521.csar"; + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444521.csar"; + String filePath = FileHandling.getFilePath(folder); ; + + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name()); + Assert.assertTrue(errorMessage.contains(checkUIResponseOnError)); + } + + // TODO: only after below TODO's it complete test + // TODO: verify that if delete/edit button need to be disabled then check that there is no such buttons + // TODO: in composition & artifact pages + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444530 - Update Deployment Artifact With Invalid Type + @Test + public void updateDeploymentArtifactWithInvalidType() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1444530.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444530.csar"; + deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null); + } + + + // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update + // TC1444531 - Update Informational Artifact With Invalid Type + @Test + public void updateInformationalArtifactWithInvalidType() throws Exception { + + if(true){ + throw new SkipException("Open bug 299719"); + } + + String folder ="US825779"; + String fileName = "ImportTC1444531.csar"; + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null); + + GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); + + fileName = "UpdateTC1444531.csar"; + + List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>(); + informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, null, informationalArtifacts, null, null); + } + + + @Test + public void importValidInformationalArtifactInInvalidFolerTest_TC1438313() throws Exception{ + String fileName = "ValidArtifactNameInInvalidFolder.csar"; + String folder = "US824719"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + + importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null); + } + + @Test + public void updateValidInformationalArtifactInInvalidFolerTest_TC1444533() throws Exception{ + String fileName = "ImportTC1444533.csar"; + String folder = "US824719"; + String filePath = FileHandling.getFilePath(folder); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + + String updatedCsarFileName = "UpdateTC1444533.csar"; + + List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>(); + deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2")); + deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4")); + + updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null); + } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // END US825779 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + public void updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String folder, String fileName, + List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts, + List<ArtifactInfo> deploymentArtifactsNotExist, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception { + String filePath = FileHandling.getFilePath(folder); + ResourceUIUtils.updateVfWithCsar(filePath, fileName); + + validateDeploymentArtifactPage(deploymentArtifacts, null); + validateInformationalArtifactPage(informationalArtifacts, null); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + validateDeploymentArtifactInComposition(deploymentArtifacts, null); + validateInformationalArtifactInComposition(informationalArtifacts, null); + + } + + + public void importVfFromCsar(ResourceReqDetails resourceMetaData, String folder, String fileName, User user) { + String filePath = FileHandling.getFilePath(folder); + GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue()); + // Insert file to the browse dialog + WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue()); + browseWebElement.sendKeys(filePath + fileName); + + // Fill the general page fields. + GeneralUIUtils.waitForLoader(); + ResourceUIUtils.fillResourceGeneralInformationPage(resourceMetaData, getUser(), true); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); + } + + + + + public void importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String fileName, String folder, List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts) throws Exception { + String filePath = FileHandling.getFilePath(folder); + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser()); + + validateDeploymentArtifactPage(deploymentArtifacts, null); + validateInformationalArtifactPage(informationalArtifacts, null); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + + validateDeploymentArtifactInComposition(deploymentArtifacts, null); + validateInformationalArtifactInComposition(informationalArtifacts, null); + } + + public void validateInformationalArtifactInComposition(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception { + CompositionPage.showInformationArtifactTab(); + // Composition informational + if(informationalArtifacts != null && informationalArtifacts.size() > 0) { + validateEachArtifactOnCompositionRightMenuInformationPage(informationalArtifacts); + } + if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) { + validateEachArtifactNotExistOnCompositionRightMenuInformationPage(informationalArtifactsNotExist); + } + } + + public void validateDeploymentArtifactInComposition(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) throws Exception { + CompositionPage.showDeploymentArtifactTab(); + // Composition deployment + if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) { + validateEachArtifactOnCompositionRightMenuDeploymentPage(deploymentArtifacts); + } + if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) { + validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(deploymentArtifactsNotExist); + } + } + + public void validateInformationalArtifactPage(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) { + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + // Informational page + if(informationalArtifacts != null && informationalArtifacts.size() > 0) { + validateEachArtifactInformationPage(informationalArtifacts); + } + if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) { + validateEachArtifactNotExistInformationPage(informationalArtifactsNotExist); + } + } + + public void validateDeploymentArtifactPage(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) { + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + // Deployment page + if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) { + validateEachArtifactOnDeploymentPage(deploymentArtifacts); + } + if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) { + validateEachArtifactNotExistOnDeploymentPage(deploymentArtifactsNotExist); + } + } + + // TODO: add validation that if not editable / deleteable then button should not appear + public void validateEachArtifactOnDeploymentPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + String type = artifact.getArtifactType(); + String label = artifact.getArtifactLabel(); + String version = artifact.getArtifactVersion(); + + if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){ + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, false, false, true); + } + else{ + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, true, true, false); + } + } + } + + public void validateEachArtifactNotExistOnDeploymentPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel()); + } + } + + public void validateEachArtifactInformationPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel(), null, artifact.getArtifactVersion(), artifact.getArtifactType(), true, true, true, false); + } + } + + public void validateEachArtifactNotExistInformationPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel()); + } + } + + public void validateEachArtifactOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + + String type = artifact.getArtifactType(); + String label = artifact.getArtifactLabel(); + String filename = artifact.getFilename(); + + if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){ + ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, false, true, true, false); + } + else{ + ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, true, false, true, true); + } + } + } + + public void validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel()); + } + } + + // TODO: there is defect in this flow + // TODO: change isEditable to false when defect fix + public void validateEachArtifactOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getFilename(), artifact.getArtifactLabel(), true, false, true, true); + } + } + + public void validateEachArtifactNotExistOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) { + for(ArtifactInfo artifact: artifactInfoList) { + ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel()); + } + } + + + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java new file mode 100644 index 0000000000..7f67978aea --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map.Entry; +import java.util.Set; + +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; + +public class ArtifactsCorrelationManager { + + private static HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>> vNFArtifactsCorrelationMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>(); + private static HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> serviceVNFCorrelationMap = new HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>(); + + public static void addVNFartifactDetails(String vspName, + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts) { + + vNFArtifactsCorrelationMap.put(vspName, deploymentArtifacts); + + + } + + public static Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> getVNFartifactDetails(String vnfName){ + + + Set<Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> entrySet = vNFArtifactsCorrelationMap.entrySet(); + for (Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> entry : entrySet) { + String key = entry.getKey(); + if (key.equals(vnfName)) { + return entry; + } + + } + return null; + + } + + + public static void addVNFtoServiceArtifactCorrelation(String service, String vnfName){ + + serviceVNFCorrelationMap.put(service, getVNFartifactDetails(vnfName)); + + } + + public static Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> getServiceArtifactCorrelationMap(String service){ + + return serviceVNFCorrelationMap.entrySet(); + + } + +} + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java new file mode 100644 index 0000000000..1d7c4ae554 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java @@ -0,0 +1,221 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.io.output.ByteArrayOutputStream; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPFile; +import org.apache.commons.net.ftp.FTPReply; + +public class AttFtpClient { + + private static final AttFtpClient instance = new AttFtpClient(); + + public static AttFtpClient getInstance() { + return instance; + } + + private FTPClient apacheFtpClient; + + private AttFtpClient() { + apacheFtpClient = new FTPClient(); + }; + + + public void init(String server, int port, String user, String pass) { + + try { + apacheFtpClient.connect(server, port); + showServerReply(apacheFtpClient); + + + int replyCode = apacheFtpClient.getReplyCode(); + if (!FTPReply.isPositiveCompletion(replyCode)) { + System.out.println("Connect failed"); + return; + } + + boolean success = apacheFtpClient.login(user, pass); + showServerReply(apacheFtpClient); + + if (!success) { + System.out.println("Could not login to the server"); + return; + } + +// else{ +// apacheFtpClient.enterLocalPassiveMode(); +// apacheFtpClient.setFileType(FTP.BINARY_FILE_TYPE); +// } + } catch (IOException ex) { + System.out.println("Oops! Something wrong happened"); + ex.printStackTrace(); + } + + } + + public File retrieveLastModifiedFileFromFTP() throws IOException { + FTPFile[] files1 = retrieveListOfFile(); + + // sort list by TimeStamp + List<FTPFile> sorted = Arrays.asList(files1).stream() + .sorted((e1, e2) -> e1.getTimestamp().compareTo(e2.getTimestamp())).collect(Collectors.toList()); + printFileDetailsList(sorted); + + // retrieve file from FTP + FTPFile ftpFile = sorted.get(sorted.size() - 1); + + return retrieveFileFromFTP(ftpFile); + + } + + public FTPFile[] retrieveListOfFile() throws IOException { + // Lists files and directories + FTPFile[] files = apacheFtpClient.listFiles(""); + + printNames(files); + return files; + } + + public File retrieveFileFromFTP(FTPFile ftpFile) throws IOException { + + File downloadFile1 = new File("tmp"); + OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1)); + boolean success = apacheFtpClient.retrieveFile(ftpFile.getName(), outputStream1); + outputStream1.close(); + + if (success) { + System.out.println("File #1 has been downloaded successfully."); + } + + + return downloadFile1; + + } + + public void deleteFilesFromFTPserver() throws IOException { + FTPFile[] files = retrieveListOfFile(); + deleteFiles(files); + } + + public void terminateClient() throws IOException { + + String status = apacheFtpClient.getStatus(); + + // logs out and disconnects from server + try { + if (apacheFtpClient.isConnected()) { + apacheFtpClient.logout(); + apacheFtpClient.disconnect(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + private void printFileDetailsList(List<FTPFile> list) { + DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + for (FTPFile ftpFile : list) { + + String details = ftpFile.getName(); + if (ftpFile.isDirectory()) { + details = "[" + details + "]"; + } + details += "\t\t" + ftpFile.getSize(); + details += "\t\t" + dateFormater.format(ftpFile.getTimestamp().getTime()); + + System.out.println(details); + } + } + + private void printNames(FTPFile[] files) { + if (files != null && files.length > 0) { + for (FTPFile aFile : files) { + System.out.println(aFile); + } + } + } + + private void showServerReply(FTPClient ftpClient) { + String[] replies = ftpClient.getReplyStrings(); + if (replies != null && replies.length > 0) { + for (String aReply : replies) { + System.out.println("SERVER: " + aReply); + } + } + } + + public class LastModifiedComparator implements Comparator<FTPFile> { + + public int compare(FTPFile f1, FTPFile f2) { + return f1.getTimestamp().compareTo(f2.getTimestamp()); + } + } + + public FTPFile getMaxLastModified(FTPFile[] ftpFiles) { + return Collections.max(Arrays.asList(ftpFiles), new LastModifiedComparator()); + } + + public static void displayFiles(File[] files) { + for (File file : files) { + System.out.printf("File: %-20s Last Modified:" + new Date(file.lastModified()) + "\n", file.getName()); + } + } + + public void deleteFiles(FTPFile[] files) { + + for (FTPFile file : files) { + + boolean deleted = false; + try { + deleted = apacheFtpClient.deleteFile(file.getName()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if (deleted) { + System.out.println("The file was deleted successfully."); + } else { + System.out.println("Could not delete the file, it may not exist."); + } + } + + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java new file mode 100644 index 0000000000..00c9ff4db4 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxProfile; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeSuite; + + +public class DriverFactory { + + private static ThreadLocal<WebDriverThread> driverThread; + private static List<WebDriverThread> webDriverThreadPool = Collections.synchronizedList(new ArrayList<WebDriverThread>()); + private static Config config; + + public DriverFactory() { + try { + config = Utils.getConfig(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + @BeforeSuite(alwaysRun = true) + public static void instantiateDriverObject() { + + + File basePath = new File(FileHandling.getBasePath()); + File[] listFiles = basePath.listFiles(new FilenameFilter() { + + @Override + public boolean accept(File basePath, String name) { + return name.startsWith(WebDriverThread.AUTOMATION_DOWNLOAD_DIR); + } + }); + Arrays.asList(listFiles).forEach(e -> FileHandling.deleteDirectory(e.getAbsolutePath())); + + + + driverThread = new ThreadLocal<WebDriverThread>() { + @Override + protected WebDriverThread initialValue() { + WebDriverThread webDriverThread = new WebDriverThread(config); + webDriverThreadPool.add(webDriverThread); + return webDriverThread; + } + }; + } + + public static WebDriver getDriver() throws Exception { + return driverThread.get().getDriver(); + } + + public static FirefoxProfile getDriverFirefoxProfile() throws Exception { + return driverThread.get().getFirefoxProfile(); + } + + @AfterSuite(alwaysRun = true) + public static void quitDriverAfterSuite() throws Exception { + for (WebDriverThread webDriverThread : webDriverThreadPool) { + if (webDriverThread.getDriver() != null) + webDriverThread.quitDriver(); + } + + MobProxy.removeAllProxyServers(); + + deleteDownloadDirs(); + } + + private static void deleteDownloadDirs() throws IOException { +// System.gc(); + HashMap<Long,WindowTest> windowMap = WindowTestManager.getWholeMap(); + for (WindowTest win : windowMap.values()){ + String downloadDirectory = win.getDownloadDirectory(); + FileUtils.deleteDirectory(new File(downloadDirectory)); + } + } + + public static void quitDriver() throws Exception{ + driverThread.get().quitDriver(); + driverThread.remove(); + WindowTestManager.removeWindowTest(); + MobProxy.removePoxyServer(); + } + + public static Config getConfig() { + return config; + } + + public static void setConfig(Config config) { + DriverFactory.config = config; + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java new file mode 100644 index 0000000000..09dcad7c36 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.File; + +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils; +import org.testng.ITestContext; + +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.reporter.ExtentHtmlReporter; +import com.aventstack.extentreports.reporter.ExtentXReporter; +import com.aventstack.extentreports.reporter.configuration.Protocol; +import com.aventstack.extentreports.reporter.configuration.Theme; + +public class ExtentManager { + + private static final String VERSIONS_INFO_FILE_NAME = "versions.info"; + private static ExtentReports extent; + private static ExtentHtmlReporter htmlReporter; + private static ExtentXReporter extentxReporter; + private static final String icon = "$(document).ready(function() {" +"\n"+ + "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+ +// "$('.logo-content' ).remove();"+"\n"+ +// "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+ +// "$('.charts div:nth-child(2)').remove();"+"\n"+ + "})"; + + public enum suiteNameXml { + + TESTNG_FAILED_XML_NAME("testng-failed.xml"); + + suiteNameXml(String value) { + this.value = value; + } + + private String value; + + public String getValue() { + return value; + } + + } + + public synchronized static ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception { + String dbIp = DriverFactory.getConfig().getReportDBhost(); + int dbPort = DriverFactory.getConfig().getReportDBport(); + + if (extent == null) { + extentxReporter = new ExtentXReporter(dbIp, dbPort); + extent = new ExtentReports(); + initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend); + + if(extentxReporter.config().getReportObjectId() != null){ + setExtentXReporter(isAppend); + }else{ + extentxReporter.stop(); + } + } + return extent; + } + + public synchronized static void setExtentXReporter(Boolean isAppend){ + extentxReporter.setAppendExisting(isAppend); + extent.attachReporter(extentxReporter); + } + + public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception{ + htmlReporter = new ExtentHtmlReporter(filePath + htmlFile); + setConfiguration(htmlReporter); + htmlReporter.setAppendExisting(isAppend); + extent.attachReporter(htmlReporter); + } + + public synchronized static ExtentReports getReporter() { + return extent; + } + + public static void initReporter(String filepath, String htmlFile, ITestContext context) throws Exception { + + String onboardVersion = AutomationUtils.getOnboardVersion(); + String osVersion = AutomationUtils.getOSVersion(); + Config config = Utils.getConfig(); + String envData = config.getUrl(); + String suiteName = getSuiteName(context); + + if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())){ + if (config.getUseBrowserMobProxy()) + setTrafficCaptue(config); + + setReporter(filepath, htmlFile, true); + String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName"); + reporterDataDefinition(onboardVersion, osVersion, envData, suiteNameFromVersionInfoFile); + }else{ + FileHandling.deleteDirectory(SetupCDTest.getReportFolder()); + FileHandling.createDirectory(filepath); + setReporter(filepath, htmlFile, false); + reporterDataDefinition(onboardVersion, osVersion, envData, suiteName); + AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName); + } + + } + + public static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile) throws Exception { + extent.setSystemInfo("Onboard Version", onboardVersion); + extent.setSystemInfo("OS Version", osVersion); + extent.setSystemInfo("Host Name Address", RestCDUtils.getExecutionHostAddress()); + extent.setSystemInfo("ExecutedOn", envData); + extent.setSystemInfo("SuiteName", suiteNameFromVersionInfoFile); + } + + public static String getSuiteName(ITestContext context) { + String suitePath = context.getSuite().getXmlSuite().getFileName(); + if(suitePath != null){ + File file = new File(suitePath); + String suiteName = file.getName(); + return suiteName; + } + return null; + } + + public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception { + + htmlReporter.config().setTheme(Theme.STANDARD); + htmlReporter.config().setEncoding("UTF-8"); + htmlReporter.config().setProtocol(Protocol.HTTPS); + htmlReporter.config().setDocumentTitle("SDC Automation Report"); + htmlReporter.config().setChartVisibilityOnOpen(true); +// htmlReporter.config().setReportName(AutomationUtils.getATTVersion()); + htmlReporter.config().setReportName("SDC Automation Report"); + htmlReporter.config().setChartVisibilityOnOpen(false); + htmlReporter.config().setJS(icon); + return htmlReporter; + } + + public static void closeReporter(){ + extent.flush(); + } + + public static void setTrafficCaptue(Config config) { + boolean mobProxyStatus = config.getUseBrowserMobProxy(); + if (mobProxyStatus){ + config.setCaptureTraffic(true);; + } + } +} + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java new file mode 100644 index 0000000000..0523647c16 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; + +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; + +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.MediaEntityBuilder; +import com.aventstack.extentreports.Status; +import com.aventstack.extentreports.markuputils.ExtentColor; +import com.aventstack.extentreports.markuputils.Markup; +import com.aventstack.extentreports.markuputils.MarkupHelper; + +public class ExtentTestActions { + + public static void log(Status logStatus, Markup mark){ + ExtentTest test = ExtentTestManager.getTest(); + test.log(logStatus, mark); + } + + public static void log(Status logStatus, String message){ + ExtentTest test = ExtentTestManager.getTest(); + test.log(logStatus, message); + } + + public static void log(Status logStatus, String message, String duration){ + log(logStatus, message + addDurationTag(duration)); + } + + public static void log(Status logStatus, Throwable throwabel){ + ExtentTest test = ExtentTestManager.getTest(); + test.log(logStatus, throwabel); + } + + public static void addTag(Status logStatus, String message){ + Markup m = null; + switch(logStatus){ + case PASS: + m = MarkupHelper.createLabel(message, ExtentColor.GREEN); + break; + case FAIL: + m = MarkupHelper.createLabel(message, ExtentColor.RED); + break; + case SKIP: + m = MarkupHelper.createLabel(message, ExtentColor.BLUE); + break; + case FATAL: + m = MarkupHelper.createLabel(message, ExtentColor.BROWN); + break; + default: + break; + } + + if (m != null){ + log(logStatus, m); + } + } + + public static String addScreenshot(Status logStatus, String screenshotName, String message) throws IOException{ + String imageFilePath = null; + String uuid = UUID.randomUUID().toString(); + String[] stringArray = uuid.split("-"); + screenshotName = screenshotName + "-" + stringArray[stringArray.length - 1]; + try { + File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder()); + imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()).getPath(); + } catch (IOException e) { + e.printStackTrace(); + } + + ExtentTest test = ExtentTestManager.getTest(); + test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build()); + return imageFilePath; + } + + private static String addDurationTag(String duration){ + return "<td width=\"80px\">" + duration + "</td>"; + } + + public static String addLinkTag(String fileName, String pathToFile){ + return String.format("<a download=\"%s\" href=\"%s\">HAR file</a>", fileName, pathToFile); + } + + public static void addFileToReportAsLink(File harFile, String pathToFileFromReportDirectory, String message) { + log(Status.INFO, message, addLinkTag(harFile.getName(), pathToFileFromReportDirectory)); + } + + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java new file mode 100644 index 0000000000..b5ed1ea498 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.util.HashMap; + +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.ExtentTest; + +public class ExtentTestManager { + + private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>(); + private static ExtentReports extent = ExtentManager.getReporter(); + + public static synchronized ExtentTest getTest() { + return extentTestMap.get(Thread.currentThread().getId()); + } + + public static synchronized void endTest() { +// extent.endTest(extentTestMap.get(Thread.currentThread().getId())); + extent.flush(); + } + + public static synchronized ExtentTest startTest(String testName) { + return startTest(testName, ""); + } + + public static synchronized ExtentTest startTest(String testName, String desc) { + ExtentTest test = extent.createTest(testName, desc); + extentTestMap.put(Thread.currentThread().getId(), test); + + return test; + } + + public static synchronized <T> void assignCategory(Class<T> clazz){ + String[] parts = clazz.getName().split("\\."); + String lastOne1 = parts[parts.length-1]; + String lastOne2 = parts[parts.length-2]; + getTest().assignCategory(lastOne2 + "-" + lastOne1); + } +} + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java new file mode 100644 index 0000000000..6251d1e8b0 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java @@ -0,0 +1,120 @@ +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +import org.slf4j.LoggerFactory; + +import com.aventstack.extentreports.ExtentTest; +import com.github.markusbernhardt.proxy.ProxySearch; +import com.github.markusbernhardt.proxy.ProxySearch.Strategy; +import com.github.markusbernhardt.proxy.util.PlatformUtil; +import com.github.markusbernhardt.proxy.util.PlatformUtil.Platform; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; +import net.lightbody.bmp.BrowserMobProxyServer; + +public class MobProxy { + + private static HashMap<Long, BrowserMobProxyServer> mobProxyServerMap = new HashMap<Long, BrowserMobProxyServer>(); + public static InetSocketAddress localProxyAddress = getProxy(); + + public static InetSocketAddress getProxy(){ + setLogger(); + + ProxySearch proxySearch = new ProxySearch(); +// proxySearch.addStrategy(Strategy.JAVA); +// proxySearch.addStrategy(Strategy.BROWSER); +// proxySearch.addStrategy(Strategy.OS_DEFAULT); +// proxySearch.addStrategy(Strategy.ENV_VAR); + if (PlatformUtil.getCurrentPlattform() == Platform.WIN) { + proxySearch.addStrategy(Strategy.IE); + proxySearch.addStrategy(Strategy.FIREFOX); + proxySearch.addStrategy(Strategy.JAVA); + } else if (PlatformUtil.getCurrentPlattform() == Platform.LINUX) { + proxySearch.addStrategy(Strategy.GNOME); + proxySearch.addStrategy(Strategy.KDE); + proxySearch.addStrategy(Strategy.FIREFOX); + proxySearch.addStrategy(Strategy.ENV_VAR); + return null; + } else { + proxySearch.addStrategy(Strategy.OS_DEFAULT); + } + ProxySelector proxySelector = proxySearch.getProxySelector(); + + ProxySelector.setDefault(proxySelector); + URI home = URI.create("http://www.google.com"); + System.out.println("ProxySelector: " + proxySelector); + System.out.println("URI: " + home); + List<Proxy> proxyList = proxySelector.select(home); + String host = null; + String port = null; + if (proxyList != null && !proxyList.isEmpty()) { + for (Proxy proxy : proxyList) { + System.out.println(proxy); + SocketAddress address = proxy.address(); + if (address instanceof InetSocketAddress) { + host = ((InetSocketAddress) address).getHostName(); + port = Integer.toString(((InetSocketAddress) address).getPort()); + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", port); + } + } + } + InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port)); + return address; + } + + // set logger for all classes connected to MobProxy + public static void setLogger() { + LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory(); +// lc.getLogger("ROOT").setLevel(Level.DEBUG); + for(Logger logger:lc.getLoggerList()){ + logger.setLevel(Level.INFO); + } + } + + public static synchronized void setProxyServer() { + BrowserMobProxyServer server = new BrowserMobProxyServer(); + server.setTrustAllServers(true); + if (localProxyAddress != null){ + server.setChainedProxy(localProxyAddress); + server.start(); + } else { + server.start(); + // filter firefox requests to mozilla when system proxy is absent + server.blacklistRequests(".*mozilla.*", 200); + } + addProxyServerToPull(Thread.currentThread().getId(), server); + } + + public static synchronized BrowserMobProxyServer getPoxyServer() { + return mobProxyServerMap.get(Thread.currentThread().getId()); + } + + public static void addProxyServerToPull(Long threadId, BrowserMobProxyServer server){ + mobProxyServerMap.put(threadId, server); + } + + public static synchronized void removePoxyServer() { + if (getPoxyServer() != null){ + getPoxyServer().stop(); + mobProxyServerMap.remove(Thread.currentThread().getId()); + } + } + + public static void removeAllProxyServers(){ + for(Long threadNumber :mobProxyServerMap.keySet()){ + mobProxyServerMap.get(threadNumber).stop(); + } + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java new file mode 100644 index 0000000000..ad923d5a1a --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.IOException; + +import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml; +import org.testng.ITestContext; +import org.testng.ITestResult; + +import com.aventstack.extentreports.Status; + +public class ReportAfterTestManager extends ExtentTestActions { + + private static String testName; + private static Throwable throwable; + private static int status; + + private static void logSuccessAfterTest(){ + final Status logStatus = Status.PASS; + addTag(logStatus, "Success"); + try{ + String message = "Finished the test with the following screenshot : "; + addScreenshotToReport(logStatus, testName, message); + }catch(Exception e){ + log(logStatus, "SUCCESS - The following exepction occured : " + e.getMessage()); + } + } + + private static void logFailAfterTest(){ + addTag(Status.FAIL, "Failure"); + try{ + log(Status.ERROR, "ERROR - The following exepction occured : "); + log(Status.ERROR, throwable); + String message = "Failure is described in the following screenshot : "; + addScreenshotToReport(Status.FAIL, testName, message); + }catch(Exception e){ + log(Status.ERROR, "ERROR - The following exepction occured : " + e.getMessage()); + } + } + + private static void logSkipAfterTest(){ + final Status logStatus = Status.SKIP; + addTag(logStatus, "Skipped"); + try{ + log(logStatus, "SKIP - The following exepction occured : "); + log(logStatus, throwable); + String message = "Skip is described in the following screenshot : "; + addScreenshotToReport(logStatus, testName, message); + }catch(Exception e){ + log(logStatus, "SKIP - The following exepction occured : " + e.getMessage()); + } + } + private static void logFatalAfterTest(){ + final Status logStatus = Status.FATAL; + addTag(logStatus, "Fatal"); + try{ + log(logStatus, "FATAL - The following exepction occured : "); + log(logStatus, throwable); + String message = "Fatal is described in the following screenshot : "; + addScreenshotToReport(logStatus, testName, message); + }catch(Exception e){ + log(logStatus, "FATAL - The following exepction occured : " + e.getMessage()); + } + } + + private static String addScreenshotToReport(Status logStatus, String testName, String message) throws IOException{ + + String addedValueFromDataProvider = WindowTestManager.getWindowMap().getAddedValueFromDataProvider(); + if (addedValueFromDataProvider != null){ + addedValueFromDataProvider = addedValueFromDataProvider.replace(":", "-"); + testName = testName + "...." + addedValueFromDataProvider; + } + + return addScreenshot(logStatus, testName, message); + } + + public static void report(ITestResult result, ITestContext context){ + + testName = result.getName(); + throwable = result.getThrowable(); + status = result.getStatus(); + + String suiteName = ExtentManager.getSuiteName(context); + + switch(status){ + case ITestResult.SUCCESS: + logSuccessAfterTest(); + break; + + case ITestResult.FAILURE: + + if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { + logFatalAfterTest(); + }else{ + logFailAfterTest(); + } + break; + + case ITestResult.SKIP: + logSkipAfterTest(); + break; + + default: + break; + } + + } + +} + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java index eec04bc297..0a01da06c3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java @@ -18,20 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.ci.tests.execute.resourceui; +package org.openecomp.sdc.ci.tests.execute.setup; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.testng.Assert; +import org.testng.IRetryAnalyzer; +import org.testng.ITestResult; +import org.testng.annotations.Test; -public class VFUITest extends SetupCDTest { +public class Retry implements IRetryAnalyzer { + private int retryCount = 0; + private int maxRetryCount = 1; - public VFUITest() { - super(); - } + public boolean retry(ITestResult result) { - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } + if (retryCount < maxRetryCount) { + retryCount++; + return true; + } + return false; + } + + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java index a72168e4c2..1838d3969d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java @@ -22,237 +22,231 @@ package org.openecomp.sdc.ci.tests.execute.setup; import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; - -import org.apache.commons.io.FileUtils; -import org.apache.log4j.Logger; -import org.openecomp.sdc.be.model.Component; +import java.util.UUID; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.LogManager; +import java.util.logging.Logger; + +import org.littleshoot.proxy.impl.ClientToProxyConnection; +import org.littleshoot.proxy.impl.ProxyToServerConnection; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.sanity.Onboard; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml; +import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.run.StartTest; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.AssertJUnit; +import org.testng.ITestContext; import org.testng.ITestResult; -import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Test; -import com.relevantcodes.extentreports.ExtentReports; -import com.relevantcodes.extentreports.ExtentTest; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; -public abstract class SetupCDTest { +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import groovyjarjarantlr.Utils; +import net.lightbody.bmp.BrowserMobProxyServer; +import net.lightbody.bmp.core.har.Har; - public SetupCDTest() { - // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - // lc.getLogger("org.apache").setLevel(Level.INFO); - //// System.setProperty("org.apache.commons.logging.Log", - // "org.apache.commons.logging.impl.SimpleLog"); - //// System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", - // "OFF"); - //// System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", - // "OFF"); +public abstract class SetupCDTest extends DriverFactory { + +// private static final String RE_RUN = "ReRun - "; + private static final String RE_RUN = "<html><font color=\"red\">ReRun - </font></html>"; + private static final String WEB_SEAL_PASSWORD = "123123a"; + public SetupCDTest() { + LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory(); + lc.getLogger("org.apache").setLevel(Level.INFO); } - public static Logger logger = Logger.getLogger(SetupCDTest.class.getName()); - /**************** CONSTANTS ****************/ private static final String CREDENTIALS_FILE = "credentials.yaml"; - private static final String REPORT_FILE_NAME = "ASDC_UI_Extent_Report.html"; - public static final String REPORT_FOLDER = "./ExtentReport/"; - public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub"; - private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots/"; + private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html"; + protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator; + protected static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator; + protected static final String HAR_FILES_FOLDER_NAME = "har_files"; + protected static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator; + + private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv"; private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2; - - /**************** USERS ****************/ - protected static User designerUser; - protected static User adminUser; - protected static User testerUser; - protected static User governorUser; - protected static User opsUser; - protected static User productManagerUser; - - public static Config config; + /**************** PRIVATES ****************/ - private Map<?, ?> credentialsYamlFileMap; private static String url; - private User user; private static boolean localEnv = true; - private int refreshAttempts = 0; - - protected abstract UserRoleEnum getRole(); - - protected ExtentReports extentReport; - protected static ExtentTest extendTest; - private static String screenshotFile; - - public static String getScreenshotFile() { - return screenshotFile; - } - - public static void setScreenshotFile(String screenshotFile) { - SetupCDTest.screenshotFile = screenshotFile; - } - + private static OnboardCSVReport csvReport; + private static Map<?, ?> credentials; + + protected static ITestContext myContext; + + + /**************** METHODS ****************/ public static ExtentTest getExtendTest() { - return extendTest; + return ExtentTestManager.getTest(); } - - private OnboardCSVReport csvReport; - + public static WindowTest getWindowTest(){ + return WindowTestManager.getWindowMap(); + } + public OnboardCSVReport getCsvReport() { return csvReport; } - + + public static String getReportFolder() { + return REPORT_FOLDER; + } + + public static String getScreenshotFolder() { + return SCREENSHOT_FOLDER; + } + + public static String getHarFilesFolder() { + return HAR_FILES_FOLDER; + } + + + protected abstract UserRoleEnum getRole(); + /**************** BEFORE ****************/ @BeforeSuite(alwaysRun = true) - public void setEnvParameters() throws Exception { - - File dir = new File(REPORT_FOLDER); - try { - FileUtils.deleteDirectory(dir); - } catch (IOException e) { - } - extentReport = new ExtentReports(REPORT_FOLDER + REPORT_FILE_NAME); - csvReport = new OnboardCSVReport(REPORT_FOLDER, SHORT_CSV_REPORT_FILE_NAME); - - System.out.println("Setup...."); - config = Utils.getConfig(); + public void setupBeforeSuite(ITestContext context) throws Exception { + RestCDUtils.deleteOnDemand(); + myContext=context; + setErrorConfigurationFile(); setUrl(); + ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context); + csvReport = new OnboardCSVReport(getReportFolder(), SHORT_CSV_REPORT_FILE_NAME); } - - @BeforeMethod(alwaysRun = true) - public void setBrowserBeforeTest(java.lang.reflect.Method method) throws Exception { - extendTest = extentReport.startTest(method.getName()); - extendTest.log(LogStatus.INFO, "Test started"); - setBrowserBeforeTest(getRole()); - } - - /**************** AFTER ****************/ - @AfterMethod(alwaysRun = true) - public void quitAfterTest(ITestResult result) throws Exception { - - StringBuilder sb = new StringBuilder(); - if (result.getParameters().length != 0) { - for (int i = 0; i < result.getParameters().length - 1; i++) { - sb.append(result.getParameters()[i].toString() + ","); + + private static void setErrorConfigurationFile() { + if (!System.getProperty("os.name").contains("Windows")){ + String errorConfigurationFilename = getConfig().getErrorConfigurationFile(); + errorConfigurationFilename = errorConfigurationFilename.substring(errorConfigurationFilename.lastIndexOf("/") + 1, errorConfigurationFilename.length()); + getConfig().setErrorConfigurationFile(FileHandling.getBasePath() + File.separator + "conf" + File.separator + errorConfigurationFilename); + if (new File(getConfig().getErrorConfigurationFile()).exists()){ + System.out.println("Found error-configuration.yaml in : " + getConfig().getErrorConfigurationFile()); } - sb.append(result.getParameters()[result.getParameters().length - 1].toString()); - } - - File imageFilePath = GeneralUIUtils.takeScreenshot(screenshotFile, SCREENSHOT_FOLDER, result.getName()); - final String absolutePath = new File(REPORT_FOLDER).toURI().relativize(imageFilePath.toURI()).getPath(); - if (result.getStatus() == ITestResult.SUCCESS) { - extendTest.log(LogStatus.PASS, "Test Result : <span class='label success'>Success</span>"); - extendTest.log(LogStatus.PASS, - "Finished the test with the following screenshot : " + extendTest.addScreenCapture(absolutePath)); - csvReport.writeRow(result.getName(), sb.toString(), "PASS"); - } else if (result.getStatus() == ITestResult.FAILURE || result.getStatus() == ITestResult.SKIP) { - extendTest.log(LogStatus.ERROR, "ERROR - The following exepction occured"); - extendTest.log(LogStatus.ERROR, result.getThrowable()); - extendTest.log(LogStatus.ERROR, - "Failure is described in the following screenshot : " + extendTest.addScreenCapture(absolutePath)); - extendTest.log(LogStatus.FAIL, "<span class='label failure'>Failure</span>"); - csvReport.writeRow(result.getName(), sb.toString(), "FAIL"); } - - extentReport.endTest(extendTest); - extentReport.flush(); - - quitBrowser(); -// deleteCreatedComponents2(getCatalogAsMap()); - } - - @AfterClass(alwaysRun = true) - public void afterSuite() { - csvReport.closeFile(); - } - - /*************************************/ - - private Map<String, ArrayList<Component>> getCatalogAsMap() throws IOException { - RestResponse catalog = CatalogRestUtils.getCatalog(getUser().getUserId()); - Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject = ResponseParser - .convertCatalogResponseToJavaObject(catalog.getResponse()); - return convertCatalogResponseToJavaObject; } - - private void deleteCreatedComponents2(Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject) - throws IOException { - final String userId = getUser().getUserId(); - ArrayList<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get("resources"); - - List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) - .map(e -> e.getUniqueId()).collect(Collectors.toList()); - for (String uId : collect) { - ResourceRestUtils.deleteResource(uId, userId); + + @BeforeMethod(alwaysRun = true ) + public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { + + boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); + if (emptyDataProvider) { + System.out.println("ExtentReport instance started from BeforeMethod..."); + String suiteName = ExtentManager.getSuiteName(context); + if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { + ExtentTestManager.startTest(RE_RUN + method.getName()); + }else{ + ExtentTestManager.startTest(method.getName()); + } + + ExtentTestManager.assignCategory(this.getClass()); + setBrowserBeforeTest(getRole()); + } else { + System.out.println("ExtentReport instance started from Test..."); } - - resourcesArrayList = convertCatalogResponseToJavaObject.get("services"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); - for (String uId : collect) { - ServiceRestUtils.deleteServiceById(uId, userId); + + getConfig().setWindowsDownloadDirectory(getWindowTest().getDownloadDirectory()); + + if (getConfig().getCaptureTraffic()){ + try{ + MobProxy.getPoxyServer().newHar(method.getName() + ".har"); + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + /**************** AFTER ****************/ + @AfterMethod(alwaysRun = true) + public void quitAfterTest(ITestResult result, ITestContext context) throws Exception { + + try{ + ReportAfterTestManager.report(result, context); + GeneralUIUtils.closeErrorMessage(); } - - resourcesArrayList = convertCatalogResponseToJavaObject.get("products"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); - for (String uId : collect) { - ProductRestUtils.deleteProduct(uId, userId); + finally{ + try { + if (getConfig().getCaptureTraffic()){ + addTrafficFileToReport(result); + } + + if (result.getInstanceName().equals(Onboard.class.getName()) && result.getStatus() == ITestResult.FAILURE){ + System.out.println("Onboarding test failed, closign browser...."); + getExtendTest().log(Status.INFO, "Onboarding test failed, closign browser...."); + quitDriver(); + } + else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())){ + boolean navigateToHomePageSuccess = HomePage.navigateToHomePage(); + if (!navigateToHomePageSuccess){ + System.out.println("Navigating to homepage failed, reopening driver...."); + getExtendTest().log(Status.INFO, "Navigating to homepage failed, reopening driver...."); + quitDriver(); + } + } + + } catch (Exception e) { + e.printStackTrace(); + getExtendTest().log(Status.ERROR, "Exception:"+ e.toString()); + } + + + + ExtentTestManager.endTest(); + addResultToCSV(result, context); +// ExtentManager.closeReporter(); + FileHandling.cleanCurrentDownloadDir(); + } + + } + public void addResultToCSV(ITestResult result, ITestContext context) { + String suiteName = ExtentManager.getSuiteName(context); + ExtentTest test = ExtentTestManager.getTest(); + com.aventstack.extentreports.model.Test model = test.getModel(); + String name = model.getName(); + String status = model.getStatus().toString(); + if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) { + getCsvReport().writeRow(result.getInstanceName(), name.replace(RE_RUN,""), status); } - } - - /**************** MAIN ****************/ - public static void main(String[] args) { - System.out.println("---------------------"); - System.out.println("running test from CLI"); - System.out.println("---------------------"); - - String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "sdc.yaml"; - System.setProperty("config.resource", attsdcFilePath); - System.out.println("sdc.yaml file path is : " + attsdcFilePath); - - Object[] testSuitsList = FileHandling - .getFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml"); - if (testSuitsList != null) { - System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length)); - args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class); - StartTest.main(args); + + @AfterSuite(alwaysRun = true) + public void afterSuite() throws Exception { + + if (getConfig().getUseBrowserMobProxy()){ + MobProxy.getPoxyServer().stop(); } + + csvReport.closeFile(); + RestCDUtils.deleteOnDemand(); } - - /***********************************************************************************/ - + protected static String setUrl() { - url = config.getUrl(); + url = getConfig().getUrl(); if (url == null) { String message = "no URL found"; System.out.println(message); @@ -263,276 +257,317 @@ public abstract class SetupCDTest { return url; } - private Map<String, String> loadCredentialsFile() throws Exception { - File credentialsFile = new File( - FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); - if (!credentialsFile.exists()) { - credentialsFile = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE); + public static void loadCredentialsFile() throws Exception { + if (credentials != null){ + return; + } + File credentialsFileRemote = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); + File credentialsFileLocal = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE); + File[] credentialFiles = {credentialsFileRemote, credentialsFileLocal}; + for (File credentialsFile : credentialFiles){ + if (credentialsFile.exists()){ + credentials = FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); + break; + } } - credentialsYamlFileMap = (Map<String, String>) FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); - return (Map<String, String>) credentialsYamlFileMap; } - protected UserCredentials getUserCredentialsFromFile(String userRole) throws Exception { - Map<String, String> credentialsMap = (Map<String, String>) credentialsYamlFileMap.get(userRole); + private UserCredentials getUserCredentialsFromFile(String userRole) throws Exception { + @SuppressWarnings("unchecked") + Map<String, String> credentialsMap = (Map<String, String>) credentials.get(userRole); String user = (String) credentialsMap.get("username"); String password = (String) credentialsMap.get("password"); String firstname = (String) credentialsMap.get("firstname"); String lastname = (String) credentialsMap.get("lastname"); - return new UserCredentials(user, password, firstname, lastname); + return new UserCredentials(user, password, firstname, lastname, userRole); } - public UserCredentials updateUserUserId(String role) throws Exception { - System.out.println("updating..."); - UserCredentials designerCredentialsFromFile = null; - UserCredentials testerCredentialsFromFile = null; - UserCredentials adminCredentialsFromFile = null; - UserCredentials opsCredentialsFromFile = null; - UserCredentials governorCredentialsFromFile = null; - UserCredentials productCredentialsFromFile = null; - UserCredentials productManagerCredentialsFromFile = null; - - String lowerCaseRole = role.toLowerCase(); - try { - if (lowerCaseRole.equals("designer")) { - designerCredentialsFromFile = getUserCredentialsFromFile("designer"); - designerUser.setUserId(designerCredentialsFromFile.getUserId()); - designerUser.setFirstName(designerCredentialsFromFile.getFirstName()); - designerUser.setLastName(designerCredentialsFromFile.getLastName()); - return designerCredentialsFromFile; - } else if (lowerCaseRole.equals("tester")) { - testerCredentialsFromFile = getUserCredentialsFromFile("tester"); - testerUser.setUserId(testerCredentialsFromFile.getUserId()); - testerUser.setFirstName(testerCredentialsFromFile.getFirstName()); - testerUser.setLastName(testerCredentialsFromFile.getLastName()); - return testerCredentialsFromFile; - } else if (lowerCaseRole.equals("admin")) { - adminCredentialsFromFile = getUserCredentialsFromFile("admin"); - adminUser.setUserId(adminCredentialsFromFile.getUserId()); - adminUser.setFirstName(adminCredentialsFromFile.getFirstName()); - adminUser.setLastName(adminCredentialsFromFile.getLastName()); - return adminCredentialsFromFile; - } else if (lowerCaseRole.equals("ops")) { - opsCredentialsFromFile = getUserCredentialsFromFile("ops"); - opsUser.setUserId(opsCredentialsFromFile.getUserId()); - opsUser.setFirstName(opsCredentialsFromFile.getFirstName()); - opsUser.setLastName(opsCredentialsFromFile.getLastName()); - return opsCredentialsFromFile; - } else if (lowerCaseRole == "governor") { - governorCredentialsFromFile = getUserCredentialsFromFile("governor"); - governorUser.setUserId(governorCredentialsFromFile.getUserId()); - governorUser.setFirstName(governorCredentialsFromFile.getFirstName()); - governorUser.setLastName(governorCredentialsFromFile.getLastName()); - return governorCredentialsFromFile; - } else if (lowerCaseRole == "product_local") { - productCredentialsFromFile = getUserCredentialsFromFile("product_local"); - productManagerUser.setUserId(productCredentialsFromFile.getUserId()); - productManagerUser.setFirstName(productCredentialsFromFile.getFirstName()); - productManagerUser.setLastName(productCredentialsFromFile.getLastName()); - return productCredentialsFromFile; - } else if (lowerCaseRole == "product_manager") { - productManagerCredentialsFromFile = getUserCredentialsFromFile("product_manager"); - productManagerUser.setUserId(productManagerCredentialsFromFile.getUserId()); - productManagerUser.setFirstName(productManagerCredentialsFromFile.getFirstName()); - productManagerUser.setLastName(productManagerCredentialsFromFile.getLastName()); - return productManagerCredentialsFromFile; - } - } - - catch (Exception e) { - System.out.print("An exception occured..."); - System.out.println("->exception message is : " + e.getMessage()); - } - - return null; - } public static void navigateToUrl(String url) throws Exception { - try { - WebDriver driver = GeneralUIUtils.getDriver(); - System.out.println("navigating to URL :" + url); - driver.manage().window().maximize(); - driver.manage().deleteAllCookies(); - driver.navigate().to(url); - GeneralUIUtils.windowZoomOut(); + System.out.println("Deleting cookies..."); + deleteCookies(); + + System.out.println("Navigating to URL : " + url); + getDriver().navigate().to(url); GeneralUIUtils.waitForLoader(); - } catch (Exception e) { - System.out.println("browser is unreachable"); - extendTest.log(LogStatus.ERROR, "browser is unreachable"); - Assert.fail("browser is unreachable"); + + System.out.println("Zooming out..."); + GeneralUIUtils.windowZoomOutUltimate(); + + } + catch (Exception e) { + String msg = "Browser is unreachable"; + System.out.println(msg); + getExtendTest().log(Status.ERROR, msg); + Assert.fail(msg); } } - - protected void loginToSystem(UserCredentials credentials, UserRoleEnum role) throws Exception { - - sendUserAndPasswordKeys(credentials); - refreshAttempts = (refreshAttempts == 0) ? NUM_OF_ATTEMPTS_TO_REFTRESH : refreshAttempts; - if (!getRole().equals(UserRoleEnum.ADMIN)) { - try { - if(!localEnv){ -// GeneralUIUtils.ultimateWait(); - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 3 * 60); - WebElement sdcApp = wait.until(ExpectedConditions.elementToBeClickable(By.id("app-image-SDC"))); - sdcApp.click(); - GeneralUIUtils.getDriver().switchTo().frame(1); - GeneralUIUtils.waitFordataTestIdVisibility("main-menu-input-search"); - } - else{ - enterToUserWorkspace(); - } - - } catch (Exception e) { - refreshAttempts--; - if (refreshAttempts <= 0) { - System.out.println("ERR : Something is wrong with browser!"); - Assert.fail("ERR : Something is wrong with browser!"); - } - System.out.println("trying again..."); - System.out.println(String.format("%s attempt(s) left", refreshAttempts)); - extendTest.log(LogStatus.INFO, "trying again..."); - extendTest.log(LogStatus.INFO, String.format("%s attempt(s) left", refreshAttempts)); - - quitAndReLogin(role); + private static void deleteCookies() throws Exception { + getDriver().manage().deleteAllCookies(); + Thread.sleep(1000); + + int attempts = 0; + final int max_attempts = 3; + + while (!getDriver().manage().getCookies().isEmpty() && attempts < max_attempts){ + getExtendTest().log(Status.INFO, "Trying to delete cookies one more time - " + (attempts + 1) + "/" + max_attempts + "attempts"); + String deleteCookiesJS = "document.cookie.split(';').forEach(function(c) { document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); });"; + ((JavascriptExecutor) getDriver()).executeScript(deleteCookiesJS); + attempts++; + + if (attempts == max_attempts){ + String msg = "Did not delete cookies, can't login as user " + WindowTestManager.getWindowMap().getUser().getRole(); + System.out.println(msg); + getExtendTest().log(Status.ERROR, msg); + Assert.fail(msg); } } } - - private void sendUserAndPasswordKeys(UserCredentials userId) { - + + protected void loginToSystem(UserRoleEnum role) throws Exception { + UserCredentials credentials; if (localEnv){ - System.out.println("Login with user : " + userId.getUserId()); - WebElement userNameTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userid")); - userNameTextbox.sendKeys(userId.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password")); - passwordTextbox.sendKeys(userId.getPassword()); - - WebElement submitButton = GeneralUIUtils.waitForElementVisibility(By.name("btnSubmit")); + loginToSimulator(role); + credentials = new UserCredentials(role.getUserId(), WEB_SEAL_PASSWORD, role.getFirstName(), role.getLastName(), role.name()); + } + else{ + credentials = getUserFromFileByRole(role); + sendUserAndPasswordKeys(credentials); + WebElement submitButton = GeneralUIUtils.getWebElementBy(By.name("btnSubmit"), 30); submitButton.click(); - WebElement buttonOK = GeneralUIUtils.waitForElementVisibility(By.name("successOK")); - AssertJUnit.assertTrue(buttonOK.isDisplayed()); + WebElement buttonOK = GeneralUIUtils.getWebElementBy(By.name("successOK"), 30); + Assert.assertTrue(buttonOK.isDisplayed(), "OK button is not displayed."); buttonOK.click(); } - else - { - System.out.println("Login with user : " + userId.getUserId()); - WebElement userNameTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='text']")); - userNameTextbox.sendKeys(userId.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='password']")); - passwordTextbox.sendKeys(userId.getPassword()); - - GeneralUIUtils.getDriver().findElement(By.id("loginBtn")).click(); - } - - + GeneralUIUtils.ultimateWait(); + getWindowTest().setUser(credentials); } - - public static String getUrl() { - return url; + protected UserCredentials getUserFromFileByRole(UserRoleEnum role) throws Exception { + loadCredentialsFile(); + return getUserCredentialsFromFile(role.name().toLowerCase()); } - - public static void setUrl(String url) { - SetupCDTest.url = url; + private void goToHomePage(UserRoleEnum role) throws Exception { + try { + getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() == 0 ? NUM_OF_ATTEMPTS_TO_REFTRESH : getWindowTest().getRefreshAttempts()); + if (!role.equals(UserRoleEnum.ADMIN)) { + + WebElement closeButton = GeneralUIUtils.getClickableButtonBy(By.className("sdc-welcome-close"), 10); + if (closeButton != null){ + closeButton.click(); + } + + if (!GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue())) + { + restartBrowser(role); + } + } + } + catch (Exception e) { + restartBrowser(role); + } } + private void restartBrowser(UserRoleEnum role) throws Exception { + getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() - 1); + if (getWindowTest().getRefreshAttempts() <= 0) { + System.out.println("ERR : Something is wrong with browser!"); + Assert.fail("ERR : Something is wrong with browser!"); + } + System.out.println("Trying again..."); + getExtendTest().log(Status.INFO, "Trying again..."); + getExtendTest().log(Status.INFO, String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() )); + System.out.println(String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() )); - public static Config getConfig() { - return config; + reloginWithNewRole(role); } - public void loginToSystem(UserRoleEnum role){ + public void loginToSimulator(UserRoleEnum role){ WebDriver driver = GeneralUIUtils.getDriver(); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']")))); - WebElement userIdTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userId")); + WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId")); userIdTextbox.sendKeys(role.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password")); - passwordTextbox.sendKeys("123123a"); - - wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Submit" + "']")))).click(); + WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password")); + passwordTextbox.sendKeys(WEB_SEAL_PASSWORD); - GeneralUIUtils.waitForLoader(); + wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click(); + } + + private void sendUserAndPasswordKeys(UserCredentials userId) { + System.out.println("Login as user : " + userId.getUserId()); + WebElement userNameTextbox = GeneralUIUtils.getWebElementBy(By.name("userid")); + userNameTextbox.sendKeys(userId.getUserId()); + WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password")); + passwordTextbox.sendKeys(userId.getPassword()); } public void loginWithUser(UserRoleEnum role) { - setUser(role); try { - navigateToUrl(url); - extendTest.log(LogStatus.INFO, String.format("login with user %s", role.name().toUpperCase())); - if (localEnv) { - loginToSystem(role); - enterToUserWorkspace(); - } - else{ - loadCredentialsFile(); - UserCredentials credentials = getUserCredentialsFromFile(role.name().toLowerCase()); - loginToSystem(credentials, role); - user = credentials; - } - + getExtendTest().log(Status.INFO, String.format("Login as user %s", role.name().toUpperCase())); + loginToSystem(role); + goToHomePage(role); } catch (Exception e) { throw new RuntimeException(e); } - } - - private void enterToUserWorkspace() { - WebElement enterToUserWorkspaceButton = GeneralUIUtils.waitForElementVisibility(By.className("asdc-welcome-main-back-btn"), 3 * 60); - enterToUserWorkspaceButton.click(); - System.out.println("Entering to system..."); - GeneralUIUtils.waitForLoader(); + finally{ + getWindowTest().setPreviousRole(getWindowTest().getUser().getRole()); + } } private void setUser(UserRoleEnum role) { - user = new User(); + User user = new User(); user.setUserId(role.getUserId()); user.setFirstName(role.getFirstName()); user.setRole(role.name()); user.setLastName(role.getLastName()); + + getWindowTest().setUser(user); } public User getUser() { - return user; + return getWindowTest().getUser(); + } + + private void setBrowserBeforeTest(UserRoleEnum role) { + System.out.println(String.format("Setup before test as %s.", role.toString().toUpperCase() )); + try { + System.out.println("Previous role is : " + getWindowTest().getPreviousRole() + " ; Current role is : " + role.name()); + if (!getWindowTest().getPreviousRole().toLowerCase().equals(role.name().toLowerCase())){ + System.out.println("Roles are different, navigate and login"); + navigateAndLogin(role); + } + } catch (Exception e) { + e.printStackTrace(); + } } - protected void setBrowserBeforeTest(UserRoleEnum role) { - refreshAttempts = 0; - System.out.println(String.format("Setup before test as %s", role.toString().toUpperCase())); - GeneralUIUtils.initDriver(); + public void navigateAndLogin(UserRoleEnum role) throws Exception { + getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() != 0 ? getWindowTest().getRefreshAttempts() : 0); + setUser(role); + navigateToUrl(url); loginWithUser(role); + GeneralUIUtils.ultimateWait(); } public User getUser(UserRoleEnum role) { User user = new User(); - user = new User(); user.setUserId(role.getUserId()); user.setFirstName(role.getFirstName()); + user.setLastName(role.getLastName()); user.setRole(role.name()); return user; } - protected void quitAndReLogin(UserRoleEnum role) throws Exception { - quitBrowser(); - if (localEnv) { - loginToSystem(role); - } - setBrowserBeforeTest(role); + protected void reloginWithNewRole(UserRoleEnum role) throws Exception { + System.out.println(String.format("Setup before relogin as %s", role.toString().toUpperCase())); + navigateAndLogin(role); } - private void quitBrowser() { - System.out.println("Closing browser..."); - GeneralUIUtils.getDriver().quit(); + public static void setLocalUrl(UserRoleEnum role) { + switch (role) { + case ADMIN: { + url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard"; + break; + } + case DESIGNER: { + url = "http://localhost:8181/sdc1/proxy-designer1#/dashboard"; + break; + } + case GOVERNOR: { + url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard"; + break; + } + case OPS: { + url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard"; + break; + } + case TESTER: { + url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; + break; + } + case PRODUCT_MANAGER1: { + url = "http://localhost:8181/sdc1/proxy-pm1#/dashboard"; + break; + } + case PRODUCT_MANAGER2: { + url = "http://localhost:8181/sdc1/proxy-pm2#/dashboard"; + break; + } + case PRODUCT_STRATEGIST1: { + url = "http://localhost:8181/sdc1/proxy-ps1#/dashboard"; + break; + } + case PRODUCT_STRATEGIST2: { + url = "http://localhost:8181/sdc1/proxy-ps2#/dashboard"; + break; + } + default: { + break; + } + } } - - - protected String getRandomComponentName(String prefix) { - return prefix + randomNumber(); + + public void addTrafficFileToReport(ITestResult result) { + try { + // Get the HAR data + Har har = MobProxy.getPoxyServer().getHar(); + String shortUUID = UUID.randomUUID().toString().split("-")[0]; + File harFile = new File(getHarFilesFolder() + result.getName() + shortUUID + ".har"); + new File(getHarFilesFolder()).mkdirs(); + + har.writeTo(harFile); + + String pathToFileFromReportDirectory = HAR_FILES_FOLDER_NAME + File.separator + harFile.getName(); + ExtentTestActions.addFileToReportAsLink(harFile, pathToFileFromReportDirectory, "File with captured traffic"); + } catch (IOException ioe) { + ioe.printStackTrace(); + } } - - protected int randomNumber() { - Random r = new Random(); - return r.nextInt(10000); + + /* + * * Start section of test in ExtentReport with DataProvider parameters, + * should be started from test method, see example in onboardVNFTest + */ + public void setLog(String fromDataProvider) { + + String suiteName = ExtentManager.getSuiteName(myContext); + if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { + ExtentTestManager.startTest(RE_RUN +Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); + }else{ + ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); + } + + + + getWindowTest().setAddedValueFromDataProvider(fromDataProvider); + ExtentTestManager.assignCategory(this.getClass()); + setBrowserBeforeTest(getRole()); } + + + + /**************** MAIN ****************/ + public static void main(String[] args) { + System.out.println("---------------------"); + System.out.println("running test from CLI"); + System.out.println("---------------------"); + String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "attsdc.yaml"; + System.setProperty("config.resource", attsdcFilePath); + System.out.println("attsdc.yaml file path is : " + attsdcFilePath); + + String filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; + System.setProperty("filepath", filepath); + System.out.println("filepath is : " + System.getProperty("filepath")); + + Object[] testSuitsList = FileHandling.filterFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml"); + if (testSuitsList != null) { + System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length)); + args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class); + StartTest.main(args); + } + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java new file mode 100644 index 0000000000..3b0439060a --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class TestFtp { + + public static void main(String[] args) throws IOException { + AttFtpClient instance = AttFtpClient.getInstance(); + + String server = "localhost"; + int port = 2121; + String user = "admin"; + String pass = "admin"; + AttFtpClient.getInstance().init(server, port, user, pass); + + try { + AttFtpClient.getInstance().retrieveListOfFile(); + + File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP(); + String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8); +// instance.deleteFilesFromFTPserver(); + System.out.println(content); + readFile(retrieveLastModifiedFileFromFTP); + + } finally { + instance.terminateClient(); + } + + + + + + + + } + public static void readFile(File retrieveLastModifiedFileFromFTP) { + + StringBuilder sb = new StringBuilder(); + BufferedReader br = null; + FileReader fileReader = null; + try { + fileReader = new FileReader(retrieveLastModifiedFileFromFTP.getPath()); + br = new BufferedReader(fileReader); + String line; + while ((line = br.readLine()) != null) { + if (sb.length() > 0) { + sb.append("\n"); + } + sb.append(line); + } + } catch (IOException e) { + System.out.println(e); + } finally { + try { + if (br != null) { + br.close(); + } + if(fileReader != null) { + fileReader.close(); + } + } catch (IOException ex) { + System.out.println(ex); + } + } + String contents = sb.toString(); + System.out.println(contents); + + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java new file mode 100644 index 0000000000..5a95df39f8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.File; +import java.io.FileNotFoundException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.UUID; + +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openqa.selenium.Platform; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxProfile; +import org.openqa.selenium.remote.CapabilityType; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.LocalFileDetector; +import org.openqa.selenium.remote.RemoteWebDriver; + +import net.lightbody.bmp.BrowserMobProxyServer; +import net.lightbody.bmp.client.ClientUtil; +import net.lightbody.bmp.proxy.CaptureType; + +public class WebDriverThread { + + public static final String AUTOMATION_DOWNLOAD_DIR = "automationDownloadDir"; + private WebDriver webdriver; + private FirefoxProfile firefoxProfile; + public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub"; + + public WebDriverThread(Config config) { + initDriver(config); + webdriver.manage().window().maximize(); + } + + public WebDriver getDriver() throws Exception { + return webdriver; + } + + public void quitDriver() { + if (webdriver != null) { + webdriver.quit(); + webdriver = null; + } + } + + + public void initDriver(Config config){ + try { + boolean remoteTesting = config.isRemoteTesting(); + if (!remoteTesting) { + boolean mobProxyStatus = config.getUseBrowserMobProxy(); + if (mobProxyStatus){ + setWebDriverWithMobProxy(); + } else { + System.out.println("Opening LOCAL browser"); + DesiredCapabilities cap = new DesiredCapabilities(); + + cap = DesiredCapabilities.firefox(); + cap.setBrowserName("firefox"); + cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile()); + + firefoxProfile.setPreference("network.proxy.type", 2); + firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://emea-auto.proxy.att.com:8001/"); + firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost"); + + webdriver = new FirefoxDriver(cap); + } + } else { + System.out.println("Opening REMOTE browser"); + String remoteEnvIP = config.getRemoteTestingMachineIP(); + String remoteEnvPort = config.getRemoteTestingMachinePort(); + + DesiredCapabilities cap = new DesiredCapabilities(); + cap = DesiredCapabilities.firefox(); + cap.setPlatform(Platform.ANY); + cap.setBrowserName("firefox"); + + String remoteNodeUrl = String.format(SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort); + RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(remoteNodeUrl), cap); + remoteWebDriver.setFileDetector(new LocalFileDetector()); + webdriver = remoteWebDriver; + } + + + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + private FirefoxProfile initFirefoxProfile() { + firefoxProfile = new FirefoxProfile(); + firefoxProfile.setPreference("browser.download.folderList",2); + firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false); + firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory()); + firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg"); + return firefoxProfile; + } + + private String getDownloadDirectory() { + String downloadDirectory = FileHandling.getBasePath() + File.separator + AUTOMATION_DOWNLOAD_DIR + UUID.randomUUID().toString().split("-")[0] + File.separator; + File dir = new File(downloadDirectory); + if(!dir.exists()) { + dir.mkdirs(); + } + return dir.getAbsolutePath(); + } + + public FirefoxProfile getFirefoxProfile() { + return firefoxProfile; + } + + private void setWebDriverWithMobProxy(){ + WebDriver driver = null; + MobProxy.setProxyServer(); + BrowserMobProxyServer proxyServer = MobProxy.getPoxyServer(); + + firefoxProfile = new FirefoxProfile(); + firefoxProfile.setPreference("browser.download.folderList",2); + firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false); + firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory()); + firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg"); + firefoxProfile.setAcceptUntrustedCertificates(true); + firefoxProfile.setAssumeUntrustedCertificateIssuer(true); +// firefoxProfile.setPreference("network.proxy.http", "localhost"); +// firefoxProfile.setPreference("network.proxy.http_port", proxyServer.getPort()); +// firefoxProfile.setPreference("network.proxy.ssl", "localhost"); +// firefoxProfile.setPreference("network.proxy.ssl_port", proxyServer.getPort()); +// firefoxProfile.setPreference("network.proxy.type", 1); +// firefoxProfile.setPreference("network.proxy.no_proxies_on", ""); + + DesiredCapabilities capabilities = new DesiredCapabilities(); + + capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile); + capabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(proxyServer)); + capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); + + webdriver = new FirefoxDriver(capabilities); + proxyServer.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.REQUEST_BINARY_CONTENT, + CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_COOKIES, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_BINARY_CONTENT); + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java new file mode 100644 index 0000000000..8df3c596fe --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.execute.setup; + +import java.io.File; + +import org.openecomp.sdc.be.model.User; + +public class WindowTest { + + public WindowTest(){ + refreshAttempts = 0; + previousRole = ""; + addedValueFromDataProvider = null; + try { + downloadDirectory = DriverFactory.getDriverFirefoxProfile().getStringPreference("browser.download.dir", null) + File.separator; + } catch (Exception e) { + e.printStackTrace(); + } + } + + private int refreshAttempts; + private String previousRole; + private User user; + private String addedValueFromDataProvider; + private String downloadDirectory; + + public int getRefreshAttempts() { + return refreshAttempts; + } + public void setRefreshAttempts(int refreshAttempts) { + this.refreshAttempts = refreshAttempts; + } + public String getPreviousRole() { + return previousRole; + } + public void setPreviousRole(String previousRole) { + this.previousRole = previousRole; + } + public User getUser() { + return user; + } + public void setUser(User user) { + this.user = user; + } + public synchronized String getAddedValueFromDataProvider() { + return addedValueFromDataProvider; + } + public synchronized void setAddedValueFromDataProvider(String addedValueFromDataProvider) { + this.addedValueFromDataProvider = addedValueFromDataProvider; + } + public String getDownloadDirectory() { + return downloadDirectory; + } + public void setDownloadDirectory(String downloadDirectory) { + this.downloadDirectory = downloadDirectory; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java index e5fcafb664..5e5ddc4fbd 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java @@ -20,26 +20,33 @@ package org.openecomp.sdc.ci.tests.execute.setup; -import java.net.URL; +import java.util.HashMap; -import org.junit.Ignore; -import org.junit.Test; -import org.openqa.selenium.Platform; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.remote.RemoteWebDriver; +import com.aventstack.extentreports.ExtentTest; -public class RemoteWebDriverTest { +public class WindowTestManager { + + private static HashMap<Long, WindowTest> windowMap = new HashMap<Long, WindowTest>(); - // @Test - public void remoteTest() throws Exception { - DesiredCapabilities cap = new DesiredCapabilities().firefox(); - cap.setPlatform(Platform.WINDOWS); - cap.setBrowserName("firefox"); + public static synchronized WindowTest getWindowMap() { + Long currentThreadId = Thread.currentThread().getId(); + boolean containsKey = windowMap.containsKey(currentThreadId); + if (!containsKey){ + setWindowMap(currentThreadId); + } + return windowMap.get(currentThreadId); + } - RemoteWebDriver remoteDriver = new RemoteWebDriver(new URL("http://1.2.3.4:5555/wd/hub"), cap); - remoteDriver.navigate().to("http://www.google.co.il"); - remoteDriver.findElementByName("q").sendKeys("execute automation"); - remoteDriver.findElementByName("btnK").click(); + private static synchronized void setWindowMap(Long currentThreadId) { + WindowTestManager.windowMap.put(currentThreadId, new WindowTest()); + } + + public static synchronized void removeWindowTest(){ + windowMap.remove(Thread.currentThread().getId()); + } + + public static synchronized HashMap<Long, WindowTest> getWholeMap(){ + return windowMap; } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java new file mode 100644 index 0000000000..98ef4318c8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import java.util.List; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.UserManagementTab; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +public class AdminGeneralPage extends GeneralPageElements { + + public AdminGeneralPage() { + super(); + } + + private static UserManagementTab userManagementTab = new UserManagementTab(); + + public static UserManagementTab getUserManagementTab() { + return userManagementTab; + } + + public static void selectCategoryManagmetTab() throws Exception { + + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.CATEGORY_MANAGEMENT.getValue()); + } + + public static void selectUserManagmetTab() throws Exception { + + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.USER_MANAGEMENT.getValue()); + } + + public static List<WebElement> getServiceCategoriesList() throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue()); + GeneralUIUtils.waitForLoader(); + return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_LIST.getValue()); + } + + public static List<WebElement> getResourceCategoriesList() throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue()); + GeneralUIUtils.waitForLoader(); + return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_LIST.getValue()); + } + + public static void createNewServiceCategory(String name) throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue()); + SetupCDTest.getExtendTest().log(Status.INFO, "Creating service..."); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(); + defineNewResourceCategoryName(name); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.waitForLoader(); + } + + public static void selectElementFromList(List<WebElement> list, String elementToSelect) throws Exception { + + for (WebElement webElement : list) { + if (webElement.getText().toLowerCase().equals(elementToSelect.toLowerCase())){ + webElement.click(); + } + } + + } + + + + public static void addSubCategoryToResource(List<WebElement> resourceList, String parentResource, String subCategoryName) throws Exception{ + + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue()); + selectElementFromList(resourceList, parentResource); + SetupCDTest.getExtendTest().log(Status.INFO, "Creating..."); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_SUB_CATEGORY_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(); + defineNewResourceCategoryName(subCategoryName); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.waitForLoader(); + + + } + + public static void createNewResourceCategory(String name) throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue()); + SetupCDTest.getExtendTest().log(Status.INFO, "Creating..."); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(); + defineNewResourceCategoryName(name); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.waitForLoader(); + + } + + public void insertPropertyDefaultValue(String value) { + WebElement propertyValue = GeneralUIUtils + .getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue()); + propertyValue.clear(); + propertyValue.sendKeys(value); + } + + private static void defineNewResourceCategoryName(String name) { + WebElement categoryNameTextbox = getCategoryName(); + categoryNameTextbox.clear(); + categoryNameTextbox.sendKeys(name); + } + + private static WebElement getCategoryName() { + return GeneralUIUtils.getWebElementByClassName(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_NAME.getValue()); + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java index e515ce9d64..496c537d49 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java @@ -22,35 +22,176 @@ package org.openecomp.sdc.ci.tests.pages; import java.util.List; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.Select; + +import com.aventstack.extentreports.Status; public class CompositionPage extends GeneralPageElements { public CompositionPage() { super(); } + + public static UploadArtifactPopup artifactPopup() { + return new UploadArtifactPopup(true); + } public static void searchForElement(String elementName) { - WebElement searchField = GeneralUIUtils.getWebElementWaitForVisible("searchAsset"); + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + elementName + " in the left panel"); + WebElement searchField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.SEARCH_ASSET.getValue()); searchField.clear(); searchField.sendKeys(elementName); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.sleep(500); + GeneralUIUtils.ultimateWait(); } - - public static void showDeploymentArtifactTab() { - GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click(); - GeneralUIUtils.waitForLoader(); + + public static void showDeploymentArtifactTab() throws Exception { + clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB); } - public static void showPropertiesAndAttributesTab() { - GeneralUIUtils.waitFordataTestIdVisibility("properties-and-attributes-tab").click(); - GeneralUIUtils.waitForLoader(); + public static void showInformationsTab() throws Exception { + clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.INFORMATION_TAB); + } + + public static void showPropertiesAndAttributesTab() throws Exception { + clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.PROPERTIES_AND_ATTRIBUTES_TAB); } public static List<WebElement> getProperties() { return PropertiesPage.getElemenetsFromTable(); } + + public static List<WebElement> getDeploymentArtifacts() { + return getAllAddedArtifacts(); + } + + public static List<WebElement> getAllAddedArtifacts() { + String dataTestsId = DataTestIdEnum.CompositionScreenEnum.ARTIFACTS_LIST.getValue(); + return GeneralUIUtils.getWebElementsListBy(By.xpath("//*[contains(@data-tests-id,'" + dataTestsId + "')]")); + } + + public static void moveToInputsScreen() throws Exception { + OpenPagesMenu(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.MENU_INPUTS.getValue()); + GeneralUIUtils.ultimateWait(); + } + + private static void OpenPagesMenu() { + Actions actions = new Actions(GeneralUIUtils.getDriver()); + List<WebElement> triangleList = GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.CompositionScreenEnum.MENU_TRIANGLE_DROPDOWN.getValue()); + WebElement pagesMenu = triangleList.get(2); + actions.moveToElement(pagesMenu).perform(); + } + + public static void changeComponentVersion(CanvasManager canvasManager, CanvasElement element, String version) { + try{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing component version to %s", version)); + canvasManager.clickOnCanvaElement(element); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()); + GeneralUIUtils.ultimateWait(); + Select selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue())); + while (selectlist.getOptions().size() == 0) { + selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue())); + } + GeneralUIUtils.ultimateWait();; + selectlist.selectByValue(version); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.clickSomewhereOnPage(); + } + catch(Exception e){ + throw e; + } + } + + public static void clickAddArtifactButton() throws Exception{ + clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.ADD_ARTIFACT); + GeneralUIUtils.getWebElementByClassName("sdc-add-artifact"); + } + + public static String getSelectedInstanceName(){ + return GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText(); + } + + public static void showInformationArtifactTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION_ARTIFACTS); + } + + public static void showAPIArtifactTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.API); + } + + public static void showInformationTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION); + } + + public static void showCompositionTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.COMPOSITION); + } + + public static void showInputsTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.INPUTS); + } + + public static void showRequirementsAndCapabilitiesTab() throws Exception { + clickOnTab(DataTestIdEnum.CompositionScreenEnum.REQUIREMENTS_AND_CAPABILITIES); + } + + public static List<WebElement> getOpenTabTitle() throws Exception{ +// return GeneralUIUtils.getElementsByCSS("expand-collapse span"); + return GeneralUIUtils.getElementsByCSS("expand-collapse"); + } + + public static void clickOnTab(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name())); + GeneralUIUtils.getElementsByCSS(tabSelector.getValue()).get(0).click(); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name())); + GeneralUIUtils.getWebElementByTestID(tabSelector.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } + + public static CanvasElement addElementToCanvasScreen(LeftPanelCanvasItems elementName, CanvasManager vfCanvasManager) throws Exception{ + CompositionPage.searchForElement(elementName.name()); + return vfCanvasManager.createElementOnCanvas(elementName); + } + + public static CanvasElement addElementToCanvasScreen(String elementName, CanvasManager vfCanvasManager) throws Exception{ + CompositionPage.searchForElement(elementName); + return vfCanvasManager.createElementOnCanvas(elementName); + } + + public static List<WebElement> getCompositionDeplymentArtifacts() { + return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue()); + } + public static WebElement getCustomizationUUID() throws Exception { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CUSTOMIZATION_UUID.getValue()); + } + + + public static List<WebElement> getCompositionEnvArtifacts(){ + return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue()); + } + + public static WebElement clickDownloadEnvArtifactComposition(String fileName) { + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue() + fileName); + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() +fileName); + } + + + + + + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java index 4c4edd8684..810a1f991c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java @@ -20,10 +20,24 @@ package org.openecomp.sdc.ci.tests.pages; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang.WordUtils; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.testng.collections.Lists; + +import com.aventstack.extentreports.Status; public class DeploymentArtifactPage extends GeneralPageElements { @@ -41,15 +55,15 @@ public class DeploymentArtifactPage extends GeneralPageElements { protected static void addNewArtifact(ArtifactGroupTypeEnum artifactGroupType) { switch (artifactGroupType) { - case DEPLOYMENT: - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_DEPLOYMENT_ARTIFACT.getValue()).click(); - break; - case INFORMATIONAL: - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_INFORMATIONAL_ARTIFACT.getValue()).click(); - break; - default: - break; - } + case DEPLOYMENT: + GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_DEPLOYMENT_ARTIFACT.getValue()).click(); + break; + case INFORMATIONAL: + GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_INFORMATIONAL_ARTIFACT.getValue()).click(); + break; + default: + break; + } } public static void clickAddNewArtifact() { @@ -57,35 +71,207 @@ public class DeploymentArtifactPage extends GeneralPageElements { } public static void clickAddAnotherArtifact() { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()).click(); } public static void clickEditArtifact(String artifactLabel) { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + artifactLabel).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + artifactLabel).click(); + } + + public static void clickEditEnvArtifact(String artifactLabel) { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactLabel).click(); } public static void clickDeleteArtifact(String artifactLabel) { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel)); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click(); } - public static void clickDownloadArtifact(String artifactLabel) { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + artifactLabel) - .click(); + public static WebElement clickDownloadArtifact(String artifactLabel) { + WebElement downloadButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + artifactLabel); + + return downloadButton; + } + + public static void clickDownloadEnvArtifact(String envFileNameToDownload) { + ExtentTestActions.log(Status.INFO, String.format("Downloading the updated %s artifact for validate parameters with the response after the update...", envFileNameToDownload)); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() + envFileNameToDownload); + ExtentTestActions.log(Status.INFO, String.format("%s Envartifact was downloaded successfully!", envFileNameToDownload)); + } + + public static void clickSaveEnvParameters() { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.SAVE.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } + + public static WebElement getAddOtherArtifactButton(){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()); + } + + public static void clickOK(){ + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.OK.getValue()).click(); + GeneralUIUtils.getWebElementBy(By.className("flex-container")); + GeneralUIUtils.waitForAngular(); } public static String getArtifactDescription(String artifactLabel) throws Exception { - clickOnArtifact(artifactLabel); // open artifact - WebElement artifactDescriptionElement = GeneralUIUtils.getWebElementWaitForVisible( - DataTestIdEnum.ArtifactPageEnum.GET_DEPLOYMENT_ARTIFACT_DESCRIPTION.getValue()); - String artifactDesc = artifactDescriptionElement.getText(); - clickOnArtifact(artifactLabel); // close artifact - + clickOnArtifactDescription(artifactLabel); // open artifact + WebElement artifactDescriptionElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.GET_DEPLOYMENT_ARTIFACT_DESCRIPTION.getValue()); + String artifactDesc = artifactDescriptionElement.getAttribute("value"); + closeArtifactDescription(artifactLabel); // close artifact return artifactDesc; } - public static void clickOnArtifact(String artifactLabel) throws Exception { - GeneralUIUtils.getWebButton(artifactLabel).click(); - GeneralUIUtils.waitForLoader(); + public static void closeArtifactDescription(String artifactLabel) { + GeneralUIUtils.clickOnElementByTestId("popover-x-button"); + } + + public static WebElement clickOnArtifactDescription(String artifactLabel) throws Exception { + try{ + WebElement artifact = GeneralUIUtils.getWebElementByTestID("descriptionIcon_" + artifactLabel); + artifact.click(); + GeneralUIUtils.waitForLoader(); + return artifact; + } + catch(Exception e){ + throw new Exception("Artifact " + artifactLabel + "is not found"); + } + } + + public static boolean checkElementsCountInTable(int expectedElementsCount) { + return GeneralPageElements.checkElementsCountInTable(expectedElementsCount + 1); + } + + public static String[] verifyArtifactsExistInTable(String filepath, String vnfFile) throws Exception{ + String[] artifactNamesFromZipFile = FileHandling.getArtifactsFromZip(filepath, vnfFile); + return verifyArtifactsExistInTable(artifactNamesFromZipFile); + } + + public static String[] verifyArtifactsExistInTable(String[] artifactNamesFromZipFile) throws Exception{ + if (artifactNamesFromZipFile != null){ + checkArtifactsDisplayed(artifactNamesFromZipFile); + checkEnvArtifactsDisplayed(); + } + + return artifactNamesFromZipFile; + } + + public static void checkArtifactsDisplayed(String[] artifactsFromZipFile) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the artifacts in the table"); + List<String> artifactList = Lists.newArrayList(artifactsFromZipFile).stream().filter(p -> !p.contains(".env")).map(p -> getVisualArtifactName(p)).collect(Collectors.toList()); + try{ +// List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span.ng-binding:nth-of-type(2)"); + List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span[data-tests-id^='artifactDisplayName']"); + for (WebElement r : rows){ + String artifactDisplayed = r.getAttribute("textContent").trim(); + if (artifactList.contains(artifactDisplayed)){ + artifactList.remove(artifactDisplayed); + } + else if (artifactDisplayed.toLowerCase().contains("license")){ + artifactList.add(artifactDisplayed); + } + } + checkLicenseArtifactsDisplayed(artifactList); + } + catch(Exception e){ + throw new Exception("Table problem"); + } + + + if (!artifactList.isEmpty()){ + throw new Exception(String.format("missing the following artifact(s) : %s", artifactList.toString())); + } + } + + public static void checkEnvArtifactsDisplayed() throws Exception { + List<WebElement> envRows; + List<WebElement> heatRows; + List<WebElement> heatNetRows; + List<WebElement> heatVolRows; + int envArtifactsSize = 0; + + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the HEAT_ENV artifacts in the table"); + + try{ + envRows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id='HEAT_ENV']"); + + heatRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT']"); + heatNetRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_NET']"); + heatVolRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_VOL']"); + + envArtifactsSize = heatRows.size() + heatNetRows.size() + heatVolRows.size(); + } + catch(Exception e){ + throw new Exception("Table problem"); + } + + if (envArtifactsSize !=envRows.size()){ + throw new Exception(String.format("some env artifacts are missing... there is %s instead of %s", envRows.size(), envArtifactsSize)); + } + + } + + public static void checkLicenseArtifactsDisplayed(List<String> rowsFromTable) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the license artifacts in the table"); + String vfLicense = getPreparedLicense(ArtifactTypeEnum.VF_LICENSE.getType()); + String[] split = vfLicense.split(" "); + vfLicense = vfLicense.replaceAll(split[0], split[0].toUpperCase()); + if (rowsFromTable.contains(vfLicense)){ + rowsFromTable.remove(vfLicense); + } + + String vendorLicense = getPreparedLicense(ArtifactTypeEnum.VENDOR_LICENSE.getType()); + if (rowsFromTable.contains(vendorLicense)){ + rowsFromTable.remove(vendorLicense); + } + + } + + public static String getPreparedLicense(String license) { + return WordUtils.capitalizeFully(license.replaceAll("_", " ")); + } + + + private static String getVisualArtifactName(String artifactName) { + if (artifactName.contains(".")){ + return artifactName.substring(0, artifactName.lastIndexOf(".")); + } + return artifactName; + } + + public static void updateDescription(String newDescription, ArtifactInfo artefact) throws Exception{ + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true); + DeploymentArtifactPage.clickEditArtifact(artefact.getArtifactLabel()); + artifactPopup.insertDescription(newDescription); + artifactPopup.clickDoneButton(); + } + + public static List<String> getDeploymentArtifactsNamesWorkSpace() { + return GeneralUIUtils.getWebElementListText(GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue())); + } + + //Get Artifact Type by Artifact Name. + public static String getArtifactType(String artifactName){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue()+artifactName).getText(); + } + + public static List<String> getHeatParametersInUI(String dataTestId){ + List<WebElement>elements; + List<String>Names=new ArrayList<>(); + elements=GeneralUIUtils.getWebElementsListByContainTestID(dataTestId); + for (WebElement webElement : elements) { + String attributevalue=webElement.getAttribute("data-tests-id"); + Names.add(attributevalue.replace("heatParameterName_", "")); + } + return Names; + } + + public static void searchBoxEnv(String parameterName) { + GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").sendKeys(parameterName); + } + + public static void clearSearchBoxEnv() { + GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").clear(); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java new file mode 100644 index 0000000000..5ee85e099e --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java @@ -0,0 +1,239 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collector; +import java.util.stream.Collectors; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DeploymentScreen; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import static org.testng.Assert.assertTrue; + + +import com.aventstack.extentreports.Status; + +public class DeploymentPage { + + public DeploymentPage() { + super(); + } + + public static List<WebElement> getGroupMembersList(String instanceName) { + List<WebElement> propertyRows = null; + clickOnModuleName(instanceName); + propertyRows = getVisibleMembers(); + return propertyRows; + } + + public static void clickOnModuleName(String instanceName) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", instanceName)); + GeneralUIUtils.clickOnElementByText(instanceName); + GeneralUIUtils.ultimateWait(); + } + + public static List<WebElement> getVisibleMembers() { + List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-module-member-list']")); + for (WebElement instance : instancesFromTable){ + Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance); + if (!parentAttributes.toString().contains("hidden")){ + return instance.findElements(By.cssSelector("div[class^='expand-collapse-sub-title']")); + } + } + return null; + } + + public static void clickOnProperties() throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties button")); + GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_PROPERTIES.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnArtifacts() throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Artifacts button")); + GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_ARTIFACTS.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnSaveButton(){ + clickInDeployment(DataTestIdEnum.DeploymentScreen.SAVE); + GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner")); + } + + public static void clickOnCancelButton(){ + clickInDeployment(DataTestIdEnum.DeploymentScreen.CANCEL); + GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner")); + } + + public static void clickOnXIcon(){ + clickInDeployment(DataTestIdEnum.DeploymentScreen.X_BUTTON); + GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner")); + } + + public static void clickOnEditIcon(){ + clickInDeployment(DataTestIdEnum.DeploymentScreen.PENCIL_ICON); + } + + public static void clickOnProperty(WebElement property) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s propertie ...", property.getText())); + property.click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue()); + } + + private static void clickInDeployment(DataTestIdEnum.DeploymentScreen element){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", element.getValue())); + GeneralUIUtils.clickOnElementByTestId(element.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static List<WebElement> getPropertyNames() throws Exception{ + clickOnProperties(); + return GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.PROPERTY_NAMES.getValue()); + } + + public static List<WebElement> getArtifactNames() throws Exception{ + clickOnArtifacts(); + return GeneralUIUtils.getInputElements(DataTestIdEnum.DeploymentScreen.ARTIFACT_NAME.getValue()); + } + + public static String updateModuleName(String currentModuleName, String newModuleName) throws Exception { + GeneralUIUtils.ultimateWait(); + ResourceUIUtils.clickOnElementByText(currentModuleName, null); + GeneralUIUtils.ultimateWait(); + clickOnEditIcon(); + WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue()); + String oldModuleName = moduleNameField.getAttribute("value"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating %s module name ...", currentModuleName)); + moduleNameField.clear(); + GeneralUIUtils.ultimateWait(); + moduleNameField.sendKeys(newModuleName); + GeneralUIUtils.ultimateWait(); + clickOnSaveButton(); + String newReconstructedModuleName = reconstructModuleName(currentModuleName.split("\\.\\."), newModuleName); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", currentModuleName, newReconstructedModuleName)); + return oldModuleName; + } + + public static String reconstructModuleName(String[] splittedName, String middleName){ + int i = 0; + StringBuilder builder = new StringBuilder(); + for(String s : splittedName) { + if (i == 1){ + builder.append(middleName); + } else { + builder.append(s); + } + if (i < 2 ){ + builder.append(".."); + } + i++; + } + return builder.toString(); + } + + public static List<WebElement> getVisibleModulesService() { + List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-modules-list']")); + for (WebElement instance : instancesFromTable){ + Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance); + if (!parentAttributes.toString().contains("hidden")){ + return instance.findElements(By.cssSelector("span[class^='expand-collapse-title-text']")); + } + } + return null; + } + + public static List<WebElement> getInstanceModulesList(String instanceName) { + List<WebElement> propertyRows = null; + ResourceUIUtils.clickOnElementByText(instanceName, null); + GeneralUIUtils.ultimateWait(); + propertyRows = getVisibleModulesService(); + return propertyRows; + } + + public static String getGroupVersion() throws Exception{ + return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-version']").get(0).getText(); + } + + public static String getModuleID() throws Exception{ + return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-group-uuid'] span[class^='small-font']").get(0).getText(); + } + + public static Map<String, HashMap<String, String>> collectMetaDataFromUI() throws Exception{ + ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen(); + Map<String, HashMap<String, String>> deploymentViewMetaData = new HashMap<String, HashMap<String, String>>(); + List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS("span[class^='expand-collapse-title-text']"); + for(WebElement moduleRow :moduleRowsFromTable){ + HashMap<String, String> tempGroupMap = new HashMap<String, String>(); + String moduleRowText = moduleRow.getText(); + GeneralUIUtils.clickOnElementByText(moduleRowText); + tempGroupMap.put("moduleID", getModuleID()); + tempGroupMap.put("version", DeploymentPage.getGroupVersion().split(":")[1].trim()); + deploymentViewMetaData.put(moduleRowText.split("\\.\\.")[1], tempGroupMap); + GeneralUIUtils.clickOnElementByText(moduleRowText); + } + return deploymentViewMetaData; + } + + public static void updateAndCancel(String newModuleName, DataTestIdEnum.DeploymentScreen buttonToClick){ + WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue()); + String oldModuleName = moduleNameField.getAttribute("value"); + moduleNameField.clear(); + GeneralUIUtils.ultimateWait(); + moduleNameField.sendKeys(newModuleName); + GeneralUIUtils.ultimateWait(); + if (buttonToClick.equals(DataTestIdEnum.DeploymentScreen.X_BUTTON)) + clickOnXIcon(); + else + clickOnCancelButton(); + } + + public static String getPropertyValueFromPropertiesList(String property) throws InterruptedException{ + List<WebElement> propertyDataElements = GeneralUIUtils.getElementsByCSS("div[class^='list-item property-data']"); + for(WebElement propertyDataElement: propertyDataElements){ + WebElement propertyNameElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, DeploymentScreen.PROPERTY_NAMES.getValue()); + if (propertyNameElement.getText().equals(property)){ + WebElement propertyValueElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, String.format("div[data-tests-id='%s']", DeploymentScreen.PROPERTY_SCHEMA_TYPE.getValue())); + return propertyValueElement.getText().trim().split(":")[1].trim(); + } + } + return null; + } + + public static List<WebElement> getPropertyErrorValidationMessdge() throws Exception{ + List<WebElement> propertyErrorElements = GeneralUIUtils.getElementsByCSS("div[class='input-error'] span[class='ng-scope']"); + return propertyErrorElements; + } + + public static boolean isPropertySaveButtonDisabled(){ + WebElement saveButtonElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue()); + return GeneralUIUtils.isElementDisabled(saveButtonElement); + } + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java index fea3843b7a..04e3a8bb28 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java @@ -20,120 +20,141 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.testng.AssertJUnit.assertTrue; import java.util.List; import java.util.function.Supplier; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public class GeneralPageElements { - public GeneralPageElements() { - super(); + public GeneralPageElements() { + super(); + } + + public static ResourceLeftMenu getLeftMenu() { + return new ResourceLeftMenu(); + } + + public static void clickOKButton() { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the OK button"); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.waitForLoader(); } - public static ResourceLeftMenu getLeftMenu() { - return new ResourceLeftMenu(); + public static void clickCreateButton() { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button."); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + ExtentTestActions.log(Status.INFO, "Succeeded."); + } + + public static void clickCreateButton(int timeout) { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button"); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), timeout); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + } + + public static void clickUpdateButton(){ + clickCreateButton(); } - public static void clickCreateButton() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "creating..."); - GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()).click(); - GeneralUIUtils.waitForLoader(); - } - - public static void clickCheckinButton(String componentName) throws Exception { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on checkin"); - GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()) - .sendKeys("Checkin " + componentName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); - assertTrue(GeneralUIUtils.getWebElementWaitForVisible("formlifecyclestate").getText() - .equals(LifeCycleStateEnum.CHECKIN.getValue())); - } - - public static void clickSubmitForTestingButton(String componentName) throws Exception { - try { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "submiting for testing"); - GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue()) - .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()) - .sendKeys("Submit for testing for " + componentName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.sleep(2000); - GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search"); - } catch (Exception e) { - throw e; - } - } - - public static void clickDeleteVersionButton() { - GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue()).click(); - } - - public static void clickRevertButton() { - GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue()).click(); - } - - public static String getLifeCycleState() { - return GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText(); - } - - public static void selectVersion(String version) { - GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()); - } - - public static List<WebElement> getElemenetsFromTable() { - GeneralUIUtils.waitForLoader(); - return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container")); - } - - public static boolean checkElementsCountInTable(int expectedElementsCount) { - // int maxWaitingPeriodMS = 1000; - // int napPeriodMS = 100; - // int sumOfWaiting = 0; - // List<WebElement> elememts = null; - // boolean isKeepWaiting = false; - // while (!isKeepWaiting){ - // GeneralUIUtils.sleep(napPeriodMS); - // sumOfWaiting += napPeriodMS; - // elememts = getElemenetsFromTable(); - // isKeepWaiting = ( expectedElementsCount == elememts.size() ); - // if (sumOfWaiting > maxWaitingPeriodMS) - // return false; - // } - // - // return true; - SetupCDTest.getExtendTest().log(LogStatus.INFO, "checking number of elements in table"); - return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable()); - } - - public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) { - int maxWaitingPeriodMS = 10000; - int napPeriodMS = 100; - int sumOfWaiting = 0; - List<WebElement> elements = null; - boolean isKeepWaiting = false; - while (!isKeepWaiting) { - GeneralUIUtils.sleep(napPeriodMS); - sumOfWaiting += napPeriodMS; - elements = func.get(); - isKeepWaiting = (expectedElementsCount == elements.size()); - if (sumOfWaiting > maxWaitingPeriodMS) - return false; - } - return true; - } + public static void clickCheckinButton(String componentName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CHECKIN button"); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys("Checkin " + componentName); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60); + GeneralUIUtils.ultimateWait(); + } + + public static void clickSubmitForTestingButton(String componentName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submiting for testing button"); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()).sendKeys("Submit for testing " + componentName); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60); + GeneralUIUtils.ultimateWait();; + } + + public static void clickCheckoutButton() throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on CHECKOUT button ..."); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKOUT_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickDeleteVersionButton() throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on DELETE VERSION button ..."); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue()); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickRevertButton() throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on REVERT button ..."); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue()); + } + + public static String getLifeCycleState() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText(); + } + + public static void selectVersion(String version) { + GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static List<WebElement> getElemenetsFromTable() { + GeneralUIUtils.ultimateWait();; + return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container")); + } + + public static boolean checkElementsCountInTable(int expectedElementsCount) { + return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable()); + } + + + public static void clickTrashButtonAndConfirm() throws InterruptedException{ + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on TRASH button ..."); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue()); + clickOKButton(); + } + + public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) { + SetupCDTest.getExtendTest().log(Status.INFO, "Checking the number of elements in the table; should be " + (expectedElementsCount - 1)); +// int maxWaitingPeriodMS = 10*1000; +// int napPeriodMS = 200; +// int sumOfWaiting = 0; +// List<WebElement> elements = null; +// boolean isKeepWaiting = false; +// while (!isKeepWaiting) { +// GeneralUIUtils.sleep(napPeriodMS); +// sumOfWaiting += napPeriodMS; +// elements = func.get(); +// isKeepWaiting = (expectedElementsCount == elements.size()); +// if (sumOfWaiting > maxWaitingPeriodMS) +// return false; +// } + GeneralUIUtils.ultimateWait(); + return true; + } + + public static void clickDeleteFile() throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on delete file X-button ..."); + GeneralUIUtils.clickOnAreaJS(GeneralUIUtils.getWebElementBy + (By.cssSelector("div[class='i-sdc-form-file-upload-x-btn']"))); + GeneralUIUtils.ultimateWait();; + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java index 9e7eaf1497..ff964e3a01 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java @@ -24,7 +24,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public class GovernorOperationPage { @@ -33,14 +33,14 @@ public class GovernorOperationPage { } public static void approveSerivce(String serviceName) { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "approving distrbution the service " + serviceName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click(); + SetupCDTest.getExtendTest().log(Status.INFO, "Approving the distrbution of the service " + serviceName); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click(); GeneralUIUtils.waitForLoader(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue()) + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue()) .sendKeys("service " + serviceName + " tested successfuly"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); GeneralUIUtils.waitForLoader(); - GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search"); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java new file mode 100644 index 0000000000..9caeee8f9f --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import java.io.File; +import java.util.List; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.MainMenuButtonsFromInsideFrame; +import org.openecomp.sdc.ci.tests.utilities.DownloadManager; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +public class HomePage extends GeneralPageElements { + + public HomePage() { + super(); + } + + public static void showVspRepository(){ + GeneralUIUtils.waitForElementInVisibilityBy(By.className("ui-notification"), 30); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.REPOSITORY_ICON.getValue()); + } + + public static boolean searchForVSP(String vspName){ + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ImportVfRepository.SEARCH.getValue()).sendKeys(vspName); + GeneralUIUtils.ultimateWait(); +// return checkElementsCountInTable(2); + return true; + } + + public static void importVSP(String vspName){ + HomePage.showVspRepository(); + boolean vspFound = HomePage.searchForVSP(vspName); + if (vspFound){ + List<WebElement> elemenetsFromTable = getElemenetsFromTable(); +// GeneralUIUtils.waitForLoader(); + WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); + WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); + findElement.click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue()); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(60*10); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + } + } + + + public static boolean navigateToHomePage() { + try{ + System.out.println("Searching for reporsitory icon."); + WebElement repositoryIcon = GeneralUIUtils.getInputElement("repository-icon"); + if (repositoryIcon != null){ + return true; + } + else{ + GeneralUIUtils.ultimateWait(); + List<WebElement> homeButtons = GeneralUIUtils.getElemenetsFromTable(By.xpath("//a[contains(.,'HOME')]")); + if (homeButtons.size() != 0){ + for (WebElement home : homeButtons){ + if (home.isDisplayed()){ + home.click(); + System.out.println("Clicked on home button"); + break; + } + } + GeneralUIUtils.closeErrorMessage(); + WebElement homeButton = GeneralUIUtils.getInputElement(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue()); + return homeButton.isDisplayed(); + } + + } + } + catch(Exception innerException){ + System.out.println("Can't click on home button."); + return false; + } + return false; + } + + public static File downloadVspCsarToDefaultDirectory(String vspName) throws Exception { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, ""); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + return latestFilefromDir; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java index 240272ae30..fd9befa148 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java @@ -31,7 +31,7 @@ public class IconPage extends GeneralPageElements { } public static void clickOnIcon(ResourceCategoryEnum iconName) { - GeneralUIUtils.getWebButton(iconStringBuilder(iconName) + DataTestIdEnum.ServiceMetadataEnum.ICON.getValue()) + GeneralUIUtils.getWebElementByTestID(iconStringBuilder(iconName) + DataTestIdEnum.ServiceMetadataEnum.ICON.getValue()) .click(); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java index 1dbf4dfa61..9916292e5b 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java @@ -22,15 +22,14 @@ package org.openecomp.sdc.ci.tests.pages; import java.util.List; -import javax.lang.model.util.Elements; - -import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import com.aventstack.extentreports.Status; + public class InformationalArtifactPage extends DeploymentArtifactPage { public InformationalArtifactPage() { @@ -41,17 +40,35 @@ public class InformationalArtifactPage extends DeploymentArtifactPage { addNewArtifact(ArtifactGroupTypeEnum.INFORMATIONAL); } - public static String getArtifactDescription(String artifactName) throws Exception { - clickOnArtifact(artifactName); - String artifactDesc = GeneralUIUtils.getWebElementWaitForVisible( - artifactName + DataTestIdEnum.ArtifactPageEnum.GET_INFORMATIONAL_ARTIFACT_DESCRIPTION.getValue()) + public static String getArtifactDescription(String artifactLabel) throws Exception { + InformationalArtifactPage.clickOnArtifact(artifactLabel); + String artifactDesc = GeneralUIUtils.getWebElementByTestID( + artifactLabel + DataTestIdEnum.ArtifactPageEnum.GET_INFORMATIONAL_ARTIFACT_DESCRIPTION.getValue()) .getText(); - clickOnArtifact(artifactName); // close artifact + InformationalArtifactPage.clickOnArtifact(artifactLabel); // close artifact return artifactDesc; } public static List<WebElement> getElemenetsFromTable() { - return GeneralUIUtils.getWebElementsListByDataTestId("InformationalArtifactRow"); + return GeneralUIUtils.getWebElementsListByTestID("InformationalArtifactRow"); + } + + public static WebElement clickOnArtifact(String artifactLabel) throws Exception { + try{ + WebElement artifact = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel); + artifact.click(); + GeneralUIUtils.waitForLoader(); + return artifact; + } + catch(Exception e){ + throw new Exception("Artifact " + artifactLabel + "is not found"); + } + } + + + public static void clickDeleteArtifact(String artifactLabel) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel)); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click(); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java new file mode 100644 index 0000000000..b977b263a0 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import java.util.List; +import java.util.stream.Collectors; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InputsScreenService; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.TestException; + +import com.aventstack.extentreports.Status; + +public class InputsPage extends GeneralPageElements { + + public InputsPage() { + super(); + + } + + public static List<WebElement> getInstancePropertiesList(String instanceName) { + List<WebElement> propertyRows = null; + GeneralUIUtils.clickOnElementByText(instanceName); + GeneralUIUtils.ultimateWait(); + propertyRows = getVisibleProperites(); + return propertyRows; + } + + public static List<WebElement> getVisibleProperites() { + List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']")); + for (WebElement instance : instancesFromTable){ + Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance); + if (!parentAttributes.toString().contains("hidden")){ + return instance.findElements(By.className("property-row")); + } + } + return null; + } + + public static void addInputToService(String VFInstanceName, String propertyName) throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding property %s from VF instance %s to Service", propertyName, VFInstanceName)); + List<WebElement> instaceInputs = getInstanceInputsList(VFInstanceName); + for(WebElement instancInput: instaceInputs){ + String actualPropertyName = instancInput.findElement(By.className("title-text")).getText(); + if (actualPropertyName.equals(propertyName) && clickOnVFInputCheckbox(instancInput)){ + clickOnAddInputButton(); + } + } + } + + public static List<WebElement> getInstanceInputsList(String instanceName) { + List<WebElement> inputRows = null; + GeneralUIUtils.clickOnElementByText(instanceName); + GeneralUIUtils.ultimateWait(); + inputRows = getVisibleInputs(inputRows); + return inputRows; + } + + public static List<WebElement> getVisibleInputs(List<WebElement> inputRows) { + List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']")); + for (WebElement instance : instancesFromTable){ + Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance); + if (!parentAttributes.toString().contains("hidden")){ + inputRows = instance.findElements(By.className("input-row")); + break; + } + } + return inputRows; + } + + public static void clickOnAddInputButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Add Input aka Greater than symbol button")); + GeneralUIUtils.clickOnElementByTestId(InputsScreenService.ADD_SELECTED_INPUTS_BTN.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static boolean clickOnVFInputCheckbox(WebElement instancInput){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on VF instance input checkbox")); + instancInput.findElement(By.className("tlv-checkbox-label")).click(); + GeneralUIUtils.ultimateWait(); + return instancInput.findElement(By.className("tlv-checkbox-i")).getAttribute("class").contains("ng-not-empty"); + } + + public static WebElement getServiceInput(String VFInstanceName, String propertyName) throws Exception{ + String expectedInputName = String.format("%s_%s", VFInstanceName.replace(" ", "").toLowerCase(), propertyName); + List<WebElement> inputsFromTable = GeneralUIUtils.getElementsByCSS(InputsScreenService.SERVICE_INPUT_ROW.getValue()); + for(WebElement inputFromTable: inputsFromTable){ + String actualInputName = inputFromTable.findElement(By.className("title-text")).getText(); + if(actualInputName.equals(expectedInputName)){ + return inputFromTable; + } + } + throw new TestException(String.format("%s input don't exist", expectedInputName)); + } + + public static void deleteServiceInput(String VFInstanceName, String propertyName) throws Exception{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting property %s in VF instance %s ", propertyName, VFInstanceName)); + WebElement serviceInput = getServiceInput(VFInstanceName, propertyName); + serviceInput.findElement(By.cssSelector(InputsScreenService.DELETE_INPUT_BTN.getValue())).click(); + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on OK button ")); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static List<String> getVFCInstancesNamesFromTable() throws Exception{ + WebElement inputsTable = getInputsTable("VFC "); + return inputsTable.findElements(By.cssSelector("span[class^='title-text']")).stream(). + map(e -> e.getText()). + collect(Collectors.toList()); + } + + public static WebElement getInputsTable(String tableName) throws Exception{ + List<WebElement> tableElements = GeneralUIUtils.getElementsByCSS("div.table"); + for(WebElement tableElement: tableElements){ + String tableTitle = GeneralUIUtils.getElementfromElementByCSS(tableElement, "div.table-header").getText(); + if (tableTitle.contains(tableName)){ + return tableElement; + } + } + throw new TestException(String.format("Can't find %s table", tableName)); + } + + public static void clickOnProperty(String propertyName) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName)); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName); + GeneralUIUtils.ultimateWait(); + } + + + + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java index e7151078f9..82171b8de9 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java @@ -20,12 +20,8 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.testng.AssertJUnit.assertEquals; - -import java.util.Iterator; import java.util.List; -import org.junit.Assert; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -35,7 +31,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public class OpsOperationPage { @@ -44,77 +40,69 @@ public class OpsOperationPage { } public static void distributeService() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "distributing..."); + SetupCDTest.getExtendTest().log(Status.INFO, "Distributing"); clickOnButton(DataTestIdEnum.DistributionChangeButtons.DISTRIBUTE); - GeneralUIUtils.getWebButton(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue()); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue()); } public static void displayMonitor() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on monitor button"); - // clickOnButton(DataTestIdEnum.DistributionChangeButtons.MONITOR); GeneralUIUtils.moveToStep(StepsEnum.MONITOR); } public static void re_distributeService() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "redistributing..."); + SetupCDTest.getExtendTest().log(Status.INFO, "Redistributing..."); clickOnButton(DataTestIdEnum.DistributionChangeButtons.RE_DISTRIBUTE); - GeneralUIUtils.getWebButton(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue()); } private static void clickOnButton(DataTestIdEnum.DistributionChangeButtons button) { - GeneralUIUtils.getWebElementWaitForVisible(button.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(button.getValue()).click(); GeneralUIUtils.waitForLoader(); } public static List<WebElement> getRowsFromMonitorTable() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "getting number of rows from distribution table"); - GeneralPageElements.checkElementsCountInTable(1, () -> GeneralUIUtils.waitForElementsListVisibility("ditributionTable")); - List<WebElement> distributionRecords = GeneralUIUtils.waitForElementsListVisibility("ditributionTable"); + SetupCDTest.getExtendTest().log(Status.INFO, "Counting the rows from the distribution table"); + GeneralPageElements.checkElementsCountInTable(1, () -> GeneralUIUtils.getWebElementsListByTestID("ditributionTable")); + List<WebElement> distributionRecords = GeneralUIUtils.getWebElementsListByTestID("ditributionTable"); List<WebElement> findElements = distributionRecords.get(0).findElements(By.className("w-sdc-distribute-parent-block")); return findElements; - - - } public static void showDistributionStatus(int rowIndex) { - GeneralUIUtils.getWebElementWaitForVisible("ShowRecordButton_" + String.valueOf(rowIndex)).click(); + GeneralUIUtils.getWebElementByTestID("ShowRecordButton_" + String.valueOf(rowIndex)).click(); GeneralUIUtils.waitForLoader(); } public static String getTotalArtifactsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("totalArtifacts_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("totalArtifacts_" + String.valueOf(rowIndex)).getText(); } public static String getNotifiedArtifactsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("notified_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("notified_" + String.valueOf(rowIndex)).getText(); } public static String getDownloadedArtifactsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("downloaded_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("downloaded_" + String.valueOf(rowIndex)).getText(); } public static String getDeployedArtifactsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("deployed_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("deployed_" + String.valueOf(rowIndex)).getText(); } public static String getNotNotifiedArtifactsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("NotNotified_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("NotNotified_" + String.valueOf(rowIndex)).getText(); } public static String getErrorsSum(int rowIndex) { - return GeneralUIUtils.waitFordataTestIdVisibility("errors_" + String.valueOf(rowIndex)).getText(); + return GeneralUIUtils.getWebElementByTestID("errors_" + String.valueOf(rowIndex)).getText(); } public static void clickRefreshTableButton(int rowIndex) { - // SetupCDTest.getExtendTest().log(LogStatus.INFO, "refreshing - // distribution table"); - GeneralUIUtils.getWebElementWaitForVisible("refreshButton").click(); - + GeneralUIUtils.getWebElementByTestID("refreshButton").click(); // wait until total artifacts field disappear - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); - wait.until(ExpectedConditions.invisibilityOfElementLocated( - By.xpath("//*[@data-tests-id='" + "totalArtifacts_" + String.valueOf(rowIndex) + "']"))); + WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 90); + wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + "totalArtifacts_" + String.valueOf(rowIndex) + "']"))); } public static void waitUntilArtifactsDistributed(int rowIndex) throws Exception { @@ -122,11 +110,11 @@ public class OpsOperationPage { } public static void waitUntilArtifactsDistributed(String expectedArtifactsSum, int rowIndex) throws Exception { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "waiting until all artifacts distributed"); + SetupCDTest.getExtendTest().log(Status.INFO, "Waiting until all artifacts are distributed"); boolean isKeepWaiting = true; int maxWaitingPeriodMS = 5 * 60 * 1000; int sumWaitingTime = 0; - int napPeriod = 1000; + int napPeriod = 10000; while (isKeepWaiting) { showDistributionStatus(rowIndex); String actualTotalArtifactsSize = getTotalArtifactsSum(rowIndex); @@ -139,37 +127,22 @@ public class OpsOperationPage { || !actualTotalArtifactsSize.equals(actualDeployedArtifactsSize) || actualTotalArtifactsSize.equals("0") || actualDownloadedArtifactsSize.equals("0") || actualNotifiedArtifactsSize.equals("0") || actualDeployedArtifactsSize.equals("0"); - // isKeepWaiting = - // !expectedArtifactsSum.equals(actualTotalArtifactsSize) && - // !expectedArtifactsSum.equals(actualNotifiedArtifactsSize) && - // !expectedArtifactsSum.equals(actualDownloadedArtifactsSize) && - // !expectedArtifactsSum.equals(actualDeployedArtifactsSize) && - // actualNotNotifedArtifactsSize.equals("0"); - // if (Integer.valueOf(actualTotalArtifactsSize) > - // Integer.valueOf(expectedArtifactsSum)){ - // isKeepWaiting = false; - // throw new Exception(String.format("MORE ARTIFACTS THEN EXPECTED - - // actual: %s, expected: %s", actualTotalArtifactsSize, - // expectedArtifactsSum)); - //// Assert.fail(String.format("MORE ARTIFACTS THEN EXPECTED - - // actual: %s, expected: %s", actualTotalArtifactsSize, - // expectedArtifactsSum)); - // } + if (isKeepWaiting) { if (Integer.parseInt(actualNotNotifedArtifactsSize) > 1) { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "Some artifacts are not notified..."); + SetupCDTest.getExtendTest().log(Status.INFO, "Some artifacts are not notified"); isKeepWaiting = false; - throw new Exception("Some artifacts are not notified... check distribution client"); + throw new Exception("Some artifacts are not notified..."); } GeneralUIUtils.sleep(napPeriod); sumWaitingTime += napPeriod; if (sumWaitingTime > maxWaitingPeriodMS) { - SetupCDTest.getExtendTest().log(LogStatus.FAIL, "not all artifacts are displayed"); + SetupCDTest.getExtendTest().log(Status.INFO, "Not all artifacts are displayed"); isKeepWaiting = false; - throw new Exception(String.format("NOT ALL ARTIFACTS ARE DISPLAYED WITHIN %s SECONDS", + throw new Exception(String.format("Not all artifacts are displayed withing %s seconds", String.valueOf(maxWaitingPeriodMS / 1000))); } @@ -177,7 +150,7 @@ public class OpsOperationPage { } } - SetupCDTest.getExtendTest().log(LogStatus.PASS, "all artifacts are distributed successfully"); + SetupCDTest.getExtendTest().log(Status.INFO, "All artifacts were successfully distributed"); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java new file mode 100644 index 0000000000..3bec4f636c --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import java.util.ArrayList; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +/** + * @author al714h + * + */ + +public class ProductGeneralPage extends ResourceGeneralPage { + + public ProductGeneralPage() { + super(); + } + + public static ProductLeftMenu getProductLeftMenu() { + return new ProductLeftMenu(); + } + + public static void defineName(String productName) { + WebElement productNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PRODUCT_NAME.getValue()); + productNameTextbox.clear(); + productNameTextbox.sendKeys(productName); + } + + public static void defineFullName(String productFullName) { + WebElement productFullNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.FULL_NAME.getValue()); + productFullNameTextbox.clear(); + productFullNameTextbox.sendKeys(productFullName); + } + + public static void defineProjectCode(String pmat) { + WebElement pmattTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue()); + pmattTextbox.clear(); + pmattTextbox.sendKeys(pmat); + } + + public static String getPmattText(){ + return getPmattField().getAttribute("value"); + } + + public static String[] getTags(){ + return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new); + } + + private static WebElement getPmattField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue()); + } + + public static void deleteOldTags(ProductReqDetails product){ + // Delete tag elements + int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size(); + while (i > 0){ + GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click(); + i--; + } + + product.setTags(new ArrayList<String>()); + } + + public static void clickAddWorkflow (){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow...")); + GeneralUIUtils.clickOnElementByText("Add Workflow"); + } + + public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{ + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name)); + insertText(name, "label + input"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name)); + insertText(description,"label + textarea"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button ")); + clickSave(); + } + + public static void insertText(String artifactDescriptoin, String element) throws InterruptedException { + GeneralUIUtils.getElementsByCSS("div[class='modal-content']"); + WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element)); + artifactDescriptionTextbox.clear(); + artifactDescriptionTextbox.sendKeys(artifactDescriptoin); + GeneralUIUtils.ultimateWait(); + } + + public static void clickSave() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button")); + GeneralUIUtils.clickOnElementByText("Save"); + GeneralUIUtils.ultimateWait(); + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java new file mode 100644 index 0000000000..2972e59618 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; + +/** + * @author al714h + * + */ + +public class ProductLeftMenu implements ComponentLeftMenu { + + public void moveToGeneralScreen() throws Exception { + GeneralUIUtils.moveToStep(StepsEnum.GENERAL); + } + + public void moveToIconScreen() throws Exception { + GeneralUIUtils.moveToStep(StepsEnum.ICON); + } + + public void moveToCompositionScreen() throws Exception { + GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); + } + + public void moveToHierarchyScreen() { + GeneralUIUtils.moveToStep(StepsEnum.HIERARCHY); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java index 614fa0a81a..4899ab15af 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java @@ -23,10 +23,13 @@ package org.openecomp.sdc.ci.tests.pages; import java.util.List; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import com.aventstack.extentreports.Status; + public class PropertiesPage extends GeneralPageElements { public PropertiesPage() { @@ -34,28 +37,38 @@ public class PropertiesPage extends GeneralPageElements { } public static List<WebElement> getElemenetsFromTable() { - return GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue()); + return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue()); } public static void clickAddPropertyArtifact() { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue()); } public static void clickEditPropertyArtifact(String propertyName) { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click(); } public static void clickDeletePropertyArtifact(String propertyName) { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName) - .click(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName)); + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), 10); } public static void clickOnProperty(String propertyName) { - GeneralUIUtils.getWebButton(propertyName).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click(); } public static PropertyPopup getPropertyPopup() { return new PropertyPopup(); } + + public static boolean verifyTotalProperitesField(int count){ + String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText(); + return ("Total Properties: " + count).equals(totalPropertiesCount); + } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java index 11cbea3093..5052406d4e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java @@ -21,57 +21,91 @@ package org.openecomp.sdc.ci.tests.pages; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; + +import com.aventstack.extentreports.Status; public class PropertyPopup { + public PropertyPopup() { } + public boolean getPopupForm(){ + return GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue(), 60); + } + public void insertPropertyName(String name) { - WebElement propertyNameField = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue()); + WebElement propertyNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_NAME.getValue()); propertyNameField.clear(); propertyNameField.sendKeys(name); } public void insertPropertyDefaultValue(String value) { - WebElement propertyValue = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_VALUE.getValue()); - propertyValue.clear(); - propertyValue.sendKeys(value); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Inserting to property default value: %s ", value)); + WebElement selectedType = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())).getFirstSelectedOption(); + if(selectedType.getText().equals("boolean")) { + GeneralUIUtils.getSelectList(value, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue()); + } else { + WebElement propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue()); + propertyValue.clear(); + propertyValue.sendKeys(value); + } + + GeneralUIUtils.ultimateWait(); } public void insertPropertyDescription(String description) { - WebElement propertyDescription = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_DESCRIPTION.getValue()); + WebElement propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue()); propertyDescription.clear(); propertyDescription.sendKeys(description); } public void selectPropertyType(String propertyType) { - GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPageEnum.PROPERTY_TYPE.getValue()); + boolean isEntrySchemaDisplayed; + try{ + GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue()); + isEntrySchemaDisplayed = GeneralUIUtils.getDriver().findElement(By.xpath(DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue())).isDisplayed(); + if (isEntrySchemaDisplayed){ + PropertiesPage.getPropertyPopup().selectEntrySchema(propertyType); + } + } + catch(NoSuchElementException e){ + + } + } + + public void selectEntrySchema(String propertyType){ + GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue()); } public void clickAdd() { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.ADD.getValue()).click(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.ADD.getValue()); + GeneralUIUtils.ultimateWait(); } public void clickSave() { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.SAVE.getValue()).click(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue()); + getPopupForm(); } public void clickCancel() { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.CANCEL.getValue()).click(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.CANCEL.getValue()); + GeneralUIUtils.ultimateWait(); } public void clickDone() { - GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.DONE.getValue()).click(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.DONE.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public void selectPropertyRadioButton(String propertyName) { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_RADIO_BUTTON_CONTAINER.getValue() + propertyName).findElement(By.className(DataTestIdEnum.PropertiesPopupEnum.RADIO_BUTTON_CLASS.getValue())).click(); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java index 2494282e1c..1412a4b969 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java @@ -23,17 +23,12 @@ package org.openecomp.sdc.ci.tests.pages; import java.util.ArrayList; import java.util.List; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ComponentType; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.Select; + public class ResourceGeneralPage extends GeneralPageElements { @@ -41,33 +36,32 @@ public class ResourceGeneralPage extends GeneralPageElements { super(); } - private static WebElement getNameField() { - return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.RESOURCE_NAME.getValue()); + public static WebElement getNameField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.RESOURCE_NAME.getValue()); } - private static WebElement getDescriptionField() { - return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue()); + public static WebElement getDescriptionField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue()); } - private static String getCategoryField() { + public static String getCategoryDataTestsIdAttribute() { return DataTestIdEnum.ResourceMetadataEnum.CATEGORY.getValue(); } - private static WebElement getVendorNameField() { - return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.VENDOR_NAME.getValue()); + public static WebElement getVendorNameField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_NAME.getValue()); } - private static WebElement getVendorReleaseField() { - return GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.VENDOR_RELEASE.getValue()); + public static WebElement getVendorReleaseField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_RELEASE.getValue()); } - private static WebElement getTagsField() { - return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.TAGS.getValue()); + public static WebElement getTagsField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS.getValue()); } - private static WebElement getUserIdField() { - return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.CONTACT_ID.getValue()); + public static WebElement getContactIdField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.CONTACT_ID.getValue()); } /***************************************************************/ @@ -81,6 +75,10 @@ public class ResourceGeneralPage extends GeneralPageElements { resourceNameTextbox.clear(); resourceNameTextbox.sendKeys(resourceName); } + + public static void defineNameWithPaste() { + defineTextBoxWithPaste(getNameField()); + } public static String getDescriptionText() { return getDescriptionField().getAttribute("value"); @@ -91,6 +89,10 @@ public class ResourceGeneralPage extends GeneralPageElements { descriptionTextbox.clear(); descriptionTextbox.sendKeys(description); } + + public static void defineDescriptionWithPaste() { + defineTextBoxWithPaste(getDescriptionField()); + } public static String getVendorNameText() { return getVendorNameField().getAttribute("value"); @@ -101,6 +103,10 @@ public class ResourceGeneralPage extends GeneralPageElements { vendorNameTextbox.clear(); vendorNameTextbox.sendKeys(vendorName); } + + public static void defineVendorNameWithPaste() { + defineTextBoxWithPaste(getVendorNameField()); + } public static String getVendorReleaseText() { return getVendorReleaseField().getAttribute("value"); @@ -111,6 +117,10 @@ public class ResourceGeneralPage extends GeneralPageElements { vendorReleaseTextbox.clear(); vendorReleaseTextbox.sendKeys(vendorRelease); } + + public static void defineVendorReleaseWithPaste() { + defineTextBoxWithPaste(getVendorReleaseField()); + } public static void defineTag(String resourceTags) { WebElement tagTextbox = getTagsField(); @@ -119,36 +129,49 @@ public class ResourceGeneralPage extends GeneralPageElements { tagTextbox.sendKeys(Keys.ENTER); } - public static void defineTagsList(ComponentReqDetails resource, String[] resourceTags) { + public static void defineTagsList(ComponentReqDetails component, String[] tags) { List<String> taglist = new ArrayList<String>(); - ; WebElement resourceTagsTextbox = getTagsField(); - for (String tag : resourceTags) { + for (String tag : tags) { resourceTagsTextbox.clear(); resourceTagsTextbox.sendKeys(tag); - GeneralUIUtils.sleep(1000); + GeneralUIUtils.sleep(500); resourceTagsTextbox.sendKeys(Keys.ENTER); taglist.add(tag); } - resource.setTags(taglist); + component.getTags().addAll(taglist); + } + + public static void defineTagsListWithPaste() { + List<String> taglist = new ArrayList<String>(); + WebElement resourceTagsTextbox = getTagsField(); + defineTextBoxWithPaste(resourceTagsTextbox); + resourceTagsTextbox.sendKeys(Keys.ENTER); } public static void defineCategory(String category) { -// GeneralUIUtils.getSelectList(category, getCategoryField()); - - Actions action = new Actions(GeneralUIUtils.getDriver()); - action.click(GeneralUIUtils.getWebElementByDataTestId(getCategoryField())); - action.sendKeys(category).perform(); + GeneralUIUtils.getSelectList(category, getCategoryDataTestsIdAttribute()); } - public static String getUserIdContactText() { - return getUserIdField().getAttribute("value"); + public static String getContactIdText() { + return getContactIdField().getAttribute("value"); } - public static void defineUserIdContact(String userId) { - WebElement contactIdTextbox = getUserIdField(); + public static void defineContactId(String userId) { + WebElement contactIdTextbox = getContactIdField(); contactIdTextbox.clear(); contactIdTextbox.sendKeys(userId); + GeneralUIUtils.waitForLoader(); } - + + public static List<WebElement> getElementsFromTagsTable(){ + return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS_TABLE.getValue()); + } + + public static void defineTextBoxWithPaste(WebElement textBox) { + textBox.clear(); + textBox.sendKeys(Keys.CONTROL + "v"); + GeneralUIUtils.ultimateWait(); + } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java index bd93f18d2a..a128aefdc8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java @@ -60,4 +60,8 @@ public class ResourceLeftMenu implements ComponentLeftMenu { public void moveToToscaArtifactsScreen() { GeneralUIUtils.moveToStep(StepsEnum.TOSCA_ARTIFACTS); } + + public void moveToInputsScreen() { + GeneralUIUtils.moveToStep(StepsEnum.INPUTS); + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java index 9e8c4b2265..0394978261 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java @@ -20,28 +20,95 @@ package org.openecomp.sdc.ci.tests.pages; +import java.util.ArrayList; + import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import com.aventstack.extentreports.Status; + public class ServiceGeneralPage extends ResourceGeneralPage { public ServiceGeneralPage() { super(); } + + public static ServiceLeftMenu getServiceLeftMenu() { + return new ServiceLeftMenu(); + } public static void defineName(String serviceName) { WebElement serviceNameTextbox = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.SERVICE_NAME.getValue()); + .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.SERVICE_NAME.getValue()); serviceNameTextbox.clear(); serviceNameTextbox.sendKeys(serviceName); } public static void defineProjectCode(String pmat) { WebElement projectCodeTextbox = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue()); + .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue()); projectCodeTextbox.clear(); projectCodeTextbox.sendKeys(pmat); } + + public static String getProjectCodeText(){ + return getProjectCodeField().getAttribute("value"); + } + + public static String[] getTags(){ + return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new); + } + + private static WebElement getProjectCodeField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue()); + } + + public static void deleteOldTags(ServiceReqDetails service){ + // Delete tag elements + int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size(); + while (i > 0){ + GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click(); + i--; + } + + service.setTags(new ArrayList<String>()); + } + + public static String getCategoryText() { + return GeneralUIUtils.getSelectedElementFromDropDown(getCategoryDataTestsIdAttribute()).getText(); + } + + public static void clickAddWorkflow (){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow...")); + GeneralUIUtils.clickOnElementByText("Add Workflow"); + } + + public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{ + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name)); + insertText(name, "label + input"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name)); + insertText(description,"label + textarea"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button ")); + clickSave(); + } + + public static void insertText(String artifactDescriptoin, String element) throws InterruptedException { + GeneralUIUtils.getElementsByCSS("div[class='modal-content']"); + WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element)); + artifactDescriptionTextbox.clear(); + artifactDescriptionTextbox.sendKeys(artifactDescriptoin); + GeneralUIUtils.ultimateWait(); + } + + public static void clickSave() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button")); + GeneralUIUtils.clickOnElementByText("Save"); + GeneralUIUtils.ultimateWait(); + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java index 5550287aba..127ada2309 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java @@ -18,16 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.ci.tests.execute.resourceui; +package org.openecomp.sdc.ci.tests.pages; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -public class VfTests extends SetupCDTest { - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; +public class ServiceLeftMenu implements ComponentLeftMenu { + + public void moveToManagmentWorkflow() throws Exception { + GeneralUIUtils.moveToStep(StepsEnum.MANAGEMENT_WORKFLOW); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java index 6c18561492..d9ef375d17 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java @@ -21,13 +21,10 @@ package org.openecomp.sdc.ci.tests.pages; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.Keys; -import org.openqa.selenium.interactions.Actions; -import org.testng.annotations.Test; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public class TesterOperationPage { @@ -35,37 +32,70 @@ public class TesterOperationPage { super(); } - public static void certifyComponent(String componentName) throws Exception { + public static void certifyComponent(String componentName) throws Exception{ clickStartTestingButton(); clickAccpetCertificationButton(componentName); - - } - - public static void clickAccpetCertificationButton(String componentName) { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on accept certification button"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()).click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()) - .sendKeys(componentName + " tested successfuly"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.sleep(2000); - GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search"); - SetupCDTest.getExtendTest().log(LogStatus.INFO, componentName + " is certifed "); } - public static void clickStartTestingButton() { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "start testing"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue()) - .click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()); - GeneralUIUtils.sleep(1000); + public static void clickAccpetCertificationButton(String componentName) throws Exception { + ExtentTestActions.log(Status.INFO, "Accepting certifiction of " + componentName); + String actionDuration = GeneralUIUtils.getActionDuration(() -> + { + try { + clickAccpetCertificationButtonWithoutDuration(componentName); + } catch (Exception e) { + e.printStackTrace(); + } + }); + ExtentTestActions.log(Status.INFO, componentName + " is certifed", actionDuration); - // bug - // Actions actionObject = new Actions(GeneralUIUtils.getDriver()); - // actionObject.keyDown(Keys.CONTROL).sendKeys(Keys.F5).perform(); - // + } + + public static void clickStartTestingButton() throws Exception{ + ExtentTestActions.log(Status.INFO, "Starting to test"); + String actionDuration = GeneralUIUtils.getActionDuration(() -> { + try { + clickStartTestingButtonWithoutDuration(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + ExtentTestActions.log(Status.INFO, "Ready for certification", actionDuration); + } + + + private static void certifyComponentWithoutDuration(String componentName) throws Exception { + clickStartTestingButtonWithoutDuration(); + clickAccpetCertificationButtonWithoutDuration(componentName); + } + + + private static void clickAccpetCertificationButtonWithoutDuration(String componentName) throws Exception { + try{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys(componentName + " tested successfuly"); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue()); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.sleep(2000); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); + } + catch (Exception e){ + throw new Exception("Accepting certification of " + componentName + " falied"); + } + } + + private static void clickStartTestingButtonWithoutDuration() throws Exception { + try{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue()); +// GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()); +// GeneralUIUtils.ultimateWait(); +// GeneralUIUtils.sleep(1000); + } + catch (Exception e){ + throw new Exception("Start testing falied"); + } } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java index dcc5f0640a..077ccacde1 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java @@ -20,16 +20,35 @@ package org.openecomp.sdc.ci.tests.pages; -import java.util.List; - +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -public class ToscaArtifactsPage extends InformationalArtifactPage { +public class ToscaArtifactsPage extends DeploymentArtifactPage { public ToscaArtifactsPage() { } + + public static String getArtifactName(int row){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_NAME.getValue() + row).getText(); + } + + public static String getArtifactType(int row){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_TYPE.getValue() + row).getText(); + } + + public static String getArtifactVersion(int row){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_VERSION.getValue() + row).getText(); + } + + public static WebElement getArtifactDetails(int row){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_DETAILS.getValue() + row); + } + + public static void downloadCsar() { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.DOWNLOAD_CSAR.getValue()); + GeneralUIUtils.ultimateWait(); + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java index 5d27809774..e97f3feb62 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java @@ -20,35 +20,70 @@ package org.openecomp.sdc.ci.tests.pages; +import java.io.File; + import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; +import org.testng.TestException; + +import com.aventstack.extentreports.Status; public class UploadArtifactPopup { + boolean isCompositionPage; + + public UploadArtifactPopup(boolean isCompositionPage) { + super(); + this.isCompositionPage = isCompositionPage; + } + public UploadArtifactPopup() { super(); } + + public WebElement getArtifactDescriptionWebElement(){ + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue()); + } public void loadFile(String path, String filename) { - final WebElement browseWebElement = GeneralUIUtils - .getWebElementByDataTestId(DataTestIdEnum.ArtifactPopup.BROWSE.getValue()); - browseWebElement.sendKeys(path + "\\" + filename); + final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue()); +// browseWebElement.sendKeys(path + filename); + browseWebElement.sendKeys(path + File.separator + filename); + GeneralUIUtils.ultimateWait(); + +// if (!browseWebElement.getAttribute("value").equals(filename)) +// { +// throw new TestException("File named " + filename + " does not presented"); +// } } + + public void insertDescription(String artifactDescriptoin) { - WebElement artifactDescriptionTextbox = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin)); + WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement(); artifactDescriptionTextbox.clear(); artifactDescriptionTextbox.sendKeys(artifactDescriptoin); + + GeneralUIUtils.ultimateWait();; } public Select defineArtifactLabel(String requiredArtifactLabel) { - Select selectList = GeneralUIUtils.getSelectList("Create New Artifact", - DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); - WebElement artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel")); + Select selectList = null; + WebElement artifactLabelWebElement = null; + +// if (isCompositionPage){ + artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); +// } +// else{ +// selectList = GeneralUIUtils.getSelectList("Create New Artifact", DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); +// artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue())); +// } + artifactLabelWebElement.clear(); artifactLabelWebElement.sendKeys(requiredArtifactLabel); return selectList; @@ -58,19 +93,34 @@ public class UploadArtifactPopup { return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue()); } - public void clickAddButton() throws Exception { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.ADD_BUTTON.getValue()).click(); + public void clickDoneButton() throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue()); GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), 10); } public void clickCancelButton() throws Exception { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click(); GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact"); } - public void clickUpdateButton() throws Exception { - GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click(); - GeneralUIUtils.waitForLoader(); +// public void clickUpdateButton() throws Exception { +// clickAddButton(); +// GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click(); +// GeneralUIUtils.waitForLoader(); +// GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("sdc-add-artifact"), 50); +// } + + public void insertURL(String artifactDescriptoin) throws Exception { + WebElement artifactDescriptionTextbox = getArtifactURLWebElement(); + artifactDescriptionTextbox.clear(); + artifactDescriptionTextbox. sendKeys(artifactDescriptoin); + } + + public WebElement getArtifactURLWebElement(){ + return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue()))); } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java index 1b7f4c3641..aa260ecc80 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java @@ -1,9 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.openecomp.sdc.ci.tests.utilities; +import java.util.concurrent.TimeUnit; + import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; +import com.paulhammant.ngwebdriver.NgWebDriver; + public class AdditionalConditions { public static ExpectedCondition<Boolean> jQueryAJAXCallsHaveCompleted() { @@ -20,10 +44,12 @@ public class AdditionalConditions { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { - String scriptJS = "return (window.angular !==undefined) &&" - + " (angular.element(document).injector() !==undefined) &&" - + " (angular.element(document).injector().get('$http').pendingRequests.length === 0)"; - return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString()); +// String scriptJS = "return (window.angular !==undefined) &&" +// + " (angular.element(document).injector() !==undefined) &&" +// + " (angular.element(document).injector().get('$http').pendingRequests.length === 0)"; +// return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString()); + new NgWebDriver((JavascriptExecutor) driver).waitForAngularRequestsToFinish(); + return true; } }; } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java index 472b69fd0b..db621f3355 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java @@ -20,52 +20,38 @@ package org.openecomp.sdc.ci.tests.utilities; -import org.junit.rules.TestName; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.Select; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage; public class AdminWorkspaceUIUtilies { - - public AdminWorkspaceUIUtilies(TestName name, String className) { - super(); - // TODO Auto-generated constructor stub + + + public static void createNewUser(String userId, UserRoleEnum userRole){ + AdminGeneralPage.getUserManagementTab().setNewUserBox(userId); + AdminGeneralPage.getUserManagementTab().selectUserRole(userRole); + AdminGeneralPage.getUserManagementTab().clickCreateButton(); +// AdminWorkspaceUIUtilies.highlightNewRow(); } - - protected static WebDriver driver; - - public static void deleteuser(String userId) throws Exception { - typeToSearchBox(userId); - if (GeneralUIUtils.getWebElements("tdRow") != null) { - GeneralUIUtils.getWebElementWaitForVisible("delete" + userId + "").click(); - GeneralUIUtils.clickOkButton(); - } + + private static void highlightNewRow(){ + GeneralUIUtils.HighlightMyElement(AdminGeneralPage.getUserManagementTab().getRow(0)); } - - public static String defineNewUserId(String userId) { - GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear(); - GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(userId); - ; - return userId; + + public static void updateUserRole(int rowIndx, UserRoleEnum userRole) { + AdminGeneralPage.getUserManagementTab().updateUser(rowIndx); + AdminGeneralPage.getUserManagementTab().updateUserRole(userRole, rowIndx); + AdminGeneralPage.getUserManagementTab().saveAfterUpdateUser(rowIndx); } - - public static String defineNewMacUid(String MacUid) { - GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear(); - GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(MacUid); - ; - return MacUid; + + public static void deleteFirstRow(){ + AdminGeneralPage.getUserManagementTab().deleteUser(0); } - - public static String selectUserRole(String Role) { - Select selectrole = new Select(GeneralUIUtils.getWebElementWaitForVisible("selectrole")); - selectrole.deselectByVisibleText(Role); - selectrole.selectByVisibleText(Role); - return Role; + + public static void searchForUser(String searchString){ + AdminGeneralPage.getUserManagementTab().searchUser(searchString); } + + - public static void typeToSearchBox(String Text) throws Exception { - GeneralUIUtils.getWebElementWaitForVisible("searchbox").clear(); - GeneralUIUtils.getWebElementWaitForVisible("searchbox").sendKeys(Text); - Thread.sleep(1000); - } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java index f22d52d3bd..d55ace4374 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java @@ -21,51 +21,98 @@ package org.openecomp.sdc.ci.tests.utilities; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.awt.AWTException; import java.awt.Robot; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.simple.JSONObject; import org.json.simple.JSONValue; +import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders; +import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts; +import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.testng.Assert; -import com.thinkaurelius.titan.diskstorage.util.StaticArrayBuffer; +import com.aventstack.extentreports.Status; public final class ArtifactUIUtils { + private static final String PARAMETERS = "parameters"; + private ArtifactUIUtils() { } public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo) throws Exception { - DeploymentArtifactPage.artifactPopup().loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename()); - DeploymentArtifactPage.artifactPopup().insertDescription(artifactInfo.getDescription()); - DeploymentArtifactPage.artifactPopup().defineArtifactLabel(artifactInfo.getArtifactLabel()); - DeploymentArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType()); - DeploymentArtifactPage.artifactPopup().clickAddButton(); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(); + fillAndAddNewArtifactParameters(artifactInfo, artifactPopup); +// artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel()); +// artifactPopup.selectArtifactType(artifactInfo.getArtifactType()); +// artifactPopup.insertDescription(artifactInfo.getDescription()); +// artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename()); +// artifactPopup.clickAddButton(); + } + + public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception { + artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel()); + artifactPopup.selectArtifactType(artifactInfo.getArtifactType()); + artifactPopup.insertDescription(artifactInfo.getDescription()); + artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename()); + artifactPopup.clickDoneButton(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("A new artifact of type %s was added", artifactInfo.getArtifactType())); } - public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifacts artifactLabel, - String filepath, String filename, String description) throws Exception { - GeneralUIUtils.getWebButton(artifactLabel.getValue()).click(); + public static void fillAndAddNewEnvArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception { + artifactPopup.insertDescription(artifactInfo.getDescription()); + artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename()); + artifactPopup.clickDoneButton(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("ENV parameters %s artifact updated ", artifactInfo.getArtifactType())); + } + + public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsPlaceholders artifactLabel,String filepath, String filename, String description) throws Exception { + GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue()); InformationalArtifactPage.artifactPopup().loadFile(filepath, filename); InformationalArtifactPage.artifactPopup().insertDescription(description); - InformationalArtifactPage.artifactPopup().clickAddButton(); + InformationalArtifactPage.artifactPopup().clickDoneButton(); + } + + public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsService artifactLabel, + String filepath, String filename, String description) throws Exception { + GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue()); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true); + artifactPopup.loadFile(filepath, filename); + artifactPopup.insertDescription(description); + artifactPopup.clickDoneButton(); + } + + public static void fillPlaceHolderAPIArtifact(DataTestIdEnum.APIArtifactsService artifactLabel, + String filepath, String filename, String description, String url) throws Exception { + GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue()); + UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true); + artifactPopup.loadFile(filepath, filename); + artifactPopup.insertURL(url); + artifactPopup.insertDescription(description); + artifactPopup.clickDoneButton(); } public static RestResponse deploymentArtifactResourceInUI(ResourceReqDetails resource, User user, @@ -131,18 +178,20 @@ public final class ArtifactUIUtils { } public static void addInformationArtifact(ArtifactReqDetails artifact, String filePath, - final InformationalArtifacts dataTestEnum) throws Exception { + final InformationalArtifactsPlaceholders dataTestEnum) throws Exception { GeneralUIUtils.waitForLoader(); GeneralUIUtils.sleep(2000); - GeneralUIUtils.getWebElementWaitForVisible(dataTestEnum.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(dataTestEnum.getValue()).click(); - final WebElement browseWebElement = GeneralUIUtils.retryMethodOnException( - () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue())); +// final WebElement browseWebElement = GeneralUIUtils.retryMethodOnException( +// () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue())); + + WebElement browseWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue()); browseWebElement.sendKeys(filePath); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DESCRIPTION.getValue()) + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.DESCRIPTION.getValue()) .sendKeys(artifact.getDescription()); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ADD.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ADD.getValue()).click(); } @@ -189,10 +238,10 @@ public final class ArtifactUIUtils { } String description = "This is Description"; String fileName = "Heat-File.yaml"; - GeneralUIUtils.defineDescription(description); - ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, fileName); - GeneralUIUtils.getWebButton("Add").click(); - GeneralUIUtils.waitFordataTestIdVisibility(labelName); + GeneralUIUtils.setWebElementByTestId("description", "description"); + ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName); + GeneralUIUtils.getWebElementByTestID("Add").click(); + GeneralUIUtils.getWebElementByTestID(labelName); artifactValues.put("type", type); artifactValues.put("description", description); @@ -210,7 +259,7 @@ public final class ArtifactUIUtils { labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getOptions().get(1).getText(); GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").selectByVisibleText(labelName); } catch (Exception e) { - labelName = GeneralUIUtils.getWebElementByName(artifactLabel).getText(); + labelName = GeneralUIUtils.getWebElementByClassName(artifactLabel).getText(); } ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel")); if (ArtifactLabel.getText().equals("")) { @@ -219,12 +268,12 @@ public final class ArtifactUIUtils { type = GeneralUIUtils.getSelectList(artifactType, "artifacttype").getFirstSelectedOption().getText(); } String description = "This is Description"; - GeneralUIUtils.defineDescription(description); - ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, fileName); + GeneralUIUtils.setWebElementByTestId("description", "description" ); + ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName); try { - GeneralUIUtils.getWebButton("Add").click(); + GeneralUIUtils.getWebElementByTestID("Add").click(); } catch (Exception e) { - GeneralUIUtils.getButtonByClassName("w-sdc-form-action add-property").click(); + GeneralUIUtils.getWebElementByClassName("w-sdc-form-action add-property").click(); } artifactValues.put("type", artifactType); @@ -233,6 +282,7 @@ public final class ArtifactUIUtils { artifactValues.put("fileName", fileName); return artifactValues; } + public static Map<String, String> addDeploymentArtifactFromCanvas(String artifactLabel) throws Exception { String type = null; @@ -248,9 +298,9 @@ public final class ArtifactUIUtils { String description = "This is Description"; String filePath = "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Files\\"; String fileName = "Heat-File.yaml"; - GeneralUIUtils.defineDescription(description); + GeneralUIUtils.setWebElementByTestId("description", "description"); ResourceUIUtils.importFileWithSendKeyBrowse(filePath, fileName); - GeneralUIUtils.getWebButton("Add").click(); + GeneralUIUtils.getWebElementByTestID("Add").click(); artifactValues.put("type", type); artifactValues.put("description", description); artifactValues.put("name", labelName); @@ -261,30 +311,30 @@ public final class ArtifactUIUtils { public static Map<String, String> valideArtifact(Map<String, String> artifactValues, Boolean condition) throws Exception { if (condition) { - GeneralUIUtils.getEelementBycontainsClassName("table-edit-btn").click(); + GeneralUIUtils.getWebElementByClassName("table-edit-btn").click(); } else { System.out.println(artifactValues.get("name")); - GeneralUIUtils.getWebElementWaitForVisible("edit_" + artifactValues.get("name")).click(); + GeneralUIUtils.getWebElementByTestID("edit_" + artifactValues.get("name")).click(); } Thread.sleep(1000); - String labelname = GeneralUIUtils.getWebElementByName("artifactLabel").getAttribute("value"); - String filename = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value"); + String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value"); + String filename = GeneralUIUtils.getWebElementByTestID("filename").getText(); + String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value"); String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText(); labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", "")); assertEquals(filename, artifactValues.get("fileName").replaceAll(" ", "-")); assertEquals(type, artifactValues.get("type")); assertEquals(description, artifactValues.get("description")); - GeneralUIUtils.getWebButton("Update").click(); + GeneralUIUtils.getWebElementByTestID("Update").click(); return artifactValues; } public static void valideArtifactFromCanvas(Map<String, String> artifactValues) throws Exception { - GeneralUIUtils.getWebElementWaitForVisible("artifactDisplayName-" + artifactValues.get("name")).click(); + GeneralUIUtils.getWebElementByTestID("artifactDisplayName-" + artifactValues.get("name")).click(); Thread.sleep(1000); - String labelname = GeneralUIUtils.getWebElementByName("artifactLabel").getAttribute("value"); - String filename = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value"); + String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value"); + String filename = GeneralUIUtils.getWebElementByTestID("filename").getText(); + String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value"); String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText(); labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", "")); assertEquals(filename, artifactValues.get("fileName")); @@ -298,5 +348,291 @@ public final class ArtifactUIUtils { Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList); return map; } + + public static void validateArtifactNameVersionType(String artifactLabel, String artifactVersion, String artifactType) { +// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactLabel); + if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactLabel)) { + SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact label not equal - this warnning represent defect."); + } + if(artifactVersion != null) { +// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactVersion, "Artifact version not equal."); + if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactVersion)) { + SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact version not equal - this warnning represent defect."); + } + } + if(artifactType != null) { +// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactType, "Artifact type not equal."); + if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactType)) { + SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact type not equal - this warnning represent defect."); + } + } + } + + public static void validateArtifactVersionByTypeAndLabel(String artifactLabel, String expectedArtifactVersion, ArtifactTypeEnum artifactType) { + if(expectedArtifactVersion != null) { + String xPath; + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to validate artifact version ...")); + if(artifactType.getType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){ + xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION_ENV.getValue() + artifactLabel + "']"; + }else{ + xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']"; + } + String actualartifactVersion = GeneralUIUtils.getDriver().findElement(By.xpath(xPath)).getAttribute("textContent").trim(); + Assert.assertEquals(actualartifactVersion, expectedArtifactVersion, "Artifact type " + artifactType.getType() + " expected version is " + expectedArtifactVersion + " not equal to " + actualartifactVersion); + } + } + + public static void validateExistArtifactOnDeploymentInformationPage(String expectedArtifactLabel, String artifactUUID, String artifactVersion, String artifactType, boolean isDownloadable, boolean isEditable, boolean isDeletable, boolean isArtifactParametersEditable) { + + String dataTestId = DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + expectedArtifactLabel; + + List<WebElement> artifactElements = GeneralUIUtils.getWebElementsListByContainTestID(dataTestId); + Assert.assertEquals(artifactElements.size(), 1, "There are more then one artifact named " + expectedArtifactLabel); + + WebElement artifact = artifactElements.get(0); + String actualArtifactLabel = GeneralUIUtils.getTextContentAttributeValue(artifact).trim(); + Assert.assertEquals(actualArtifactLabel, expectedArtifactLabel); + + if(artifactUUID != null) { + WebElement uuid = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + expectedArtifactLabel); + Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(uuid).trim(), artifactUUID, "Artifact uuid not equal."); + } + if(artifactVersion != null) { + WebElement version = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + expectedArtifactLabel); + Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(version).trim(), artifactVersion, "Artifact version not equal."); + } + if(artifactType != null) { + WebElement type = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + expectedArtifactLabel); + Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(type).trim(), artifactType, "Artifact type not equal."); + } + if(isArtifactParametersEditable) { + Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button enabled."); + } else if(isArtifactParametersEditable==false) { + Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button disabled."); + } + if(isDownloadable) { + Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button enabled."); + } else if(isDownloadable==false) { + Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button disabled."); + } + if(isEditable) { + Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button enabled."); + } else if(isEditable==false) { + Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button disabled."); + } + if(isDeletable) { + Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button enabled."); + } else if(isDeletable==false) { + Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button disabled."); + } + } + + public static void validateNotExistArtifactOnDeploymentInformationPage(String artifactLabel) { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel), false); + } + + public static void validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(String fileName, String artifactDisplayedName, + boolean isUpdateable, boolean isParametersEditable, boolean isDownloadable, boolean isDeleteable) { + Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName).getText(), fileName); + Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName).getText(), artifactDisplayedName); + + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName); + + if(isParametersEditable) { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), true, "Expect that parameters edit button enabled."); + } else { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), false, "Expect that parameters edit button disabled."); + } + if(isDownloadable) { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), true, "Expect that download button enabled."); + } else { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), false, "Expect that download button disabled."); + } + if(isDeleteable) { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), true, "Expect that delete button enabled."); + } else { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), false, "Expect that delete button disabled."); + } + if(isUpdateable) { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), true, "Expect that edit button enabled."); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue()); + GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue()); + } else { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName); + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false, "Expect that edit button disabled."); + } + + } + + public static void validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(String artifactDisplayedName) { + Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName), false); + } + + public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile, String dataTestId) throws Exception { + GeneralUIUtils.hoverOnAreaByTestId(dataTestId); + return verifyUpdatedEnvParameters(pairToUpdate, updateEnvFile); + } + + public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile) throws Exception { + + String heatDisplayName = pairToUpdate.getHeatArtifactDisplayName(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+heatDisplayName); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + + String pattern = PARAMETERS; + Map<String, Object> mapUpdetedEnvFile = FileHandling.parseYamlFileToMapByPattern(updateEnvFile, pattern); + Map<String, Object> mapDownloadedEnvFile = FileHandling.parseYamlFileToMapByPattern(latestFilefromDir, pattern); + + SetupCDTest.getExtendTest().log(Status.INFO, "Going to check, that ENV file was updated ..."); + assertTrue("File" + latestFilefromDir.getName() + " contains different parameters number from expected file", mapDownloadedEnvFile.size() == mapUpdetedEnvFile.size()); + assertTrue("Updated file contains not updated parameters value", mapDownloadedEnvFile.entrySet().containsAll(mapUpdetedEnvFile.entrySet())); + return latestFilefromDir; + } + + /** + * compare heat env files by pattern ("parameters") + * @param expectedFile + * @param actualFile + * @param pattern + * @throws Exception + */ + public static void compareYamlFilesByPattern(File expectedFile, File actualFile, String pattern) throws Exception { + + Map<String, Object> mapExpectedFile = FileHandling.parseYamlFileToMapByPattern(expectedFile, pattern); + Map<String, Object> mapActualFile = FileHandling.parseYamlFileToMapByPattern(actualFile, pattern); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ..."); + assertTrue("File" + actualFile.getName() + " contains different parameters number from expected file", mapActualFile.size() == mapExpectedFile.size()); + assertTrue("File " + actualFile.getName() + " does not contains all expected parametrs", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet())); + } + + public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedproperties, File actualFileproperties, String pattern) throws Exception { + + Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileproperties, pattern); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ..."); + assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedproperties.size()); + Map<String, Object> newMap = new HashMap<>(mapActualFileProerties); + assertTrue("Actual file does not contains all expected parametrs", newMap.entrySet().containsAll(mapExpectedproperties.entrySet())); + } + + + public static File uploadCreatedUpdateParametersEnvFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws Exception { +// created env file to upload + File pathToEnvParametersFile = prepareEnvParametersFile(heatEnvDetails, directoryPath); + ArtifactInfo heatEnvArtifactInfo = new ArtifactInfo(directoryPath, heatEnvDetails.getHeatEnvLabel()+".env", "heatEnvDesc", heatEnvDetails.getHeatEnvLabel(),heatEnvDetails.getHeatEnvArtifactType()); + ArtifactUIUtils.fillAndAddNewEnvArtifactParameters(heatEnvArtifactInfo, CompositionPage.artifactPopup()); + return pathToEnvParametersFile; + } + + public static File prepareEnvParametersFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws IOException { + File pathToEnvParametersFile = FileHandling.createEmptyFile(directoryPath+heatEnvDetails.getHeatEnvLabel()+".env"); +// fill file + FileHandling.writeToFile(pathToEnvParametersFile, "parameters:", 0); + for(HeatParameterDataDefinition paramDefinition : heatEnvDetails.getHeatParameterDefinition()){ + Object data = getDataToWrite(paramDefinition); + FileHandling.writeToFile(pathToEnvParametersFile, data, 2); + } + + return pathToEnvParametersFile; + } + + public static Object getDataToWrite(HeatParameterDataDefinition paramDefinition) { + Object data = ""; + switch (paramDefinition.getType()) { + case "string": + String text = "\"string\""; + data = getFormatedData(paramDefinition.getName(), text); + break; + case "number": + data = getFormatedData(paramDefinition.getName(), 666); + break; + case "json": + String jsonText = "{\"param1\":\"param1\", \"param2\":2}"; + data = getFormatedData(paramDefinition.getName(), jsonText); + break; + case "boolean": + if(paramDefinition.getCurrentValue().equals("true")){ + data = getFormatedData(paramDefinition.getName(), false); + }else{ + data = getFormatedData(paramDefinition.getName(), true); + } + break; + case "comma_delimited_list": + String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20"; + data = getFormatedData(paramDefinition.getName(), commaDelimitedListText); + break; + default: + break; + } + return data; + } + + + public static Map<String, Object> getDataToWriteInUI(List<HeatParameterDataDefinition> paramDefinitionFromGetResourceResponse) { + Map<String, Object>newValuesToUpdateInUI=new HashMap<>(); + for (HeatParameterDataDefinition param : paramDefinitionFromGetResourceResponse) { + System.out.println(param.getCurrentValue()); + switch (param.getType()) { + + case "string": + String text = "string"; + newValuesToUpdateInUI.put(param.getName(),text); + break; + case "number": + newValuesToUpdateInUI.put(param.getName(),666); + break; + case "json": + String jsonText = "{\"param1\":\"param1\", \"param2\":2}"; + newValuesToUpdateInUI.put(param.getName(),jsonText); + break; + case "boolean": + if (param.getCurrentValue().equals(true)) { + newValuesToUpdateInUI.put(param.getName(),false); + } else { + newValuesToUpdateInUI.put(param.getName(),true); + } + break; + case "comma_delimited_list": + String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20"; + newValuesToUpdateInUI.put(param.getName(),commaDelimitedListText); + break; + default: + break; + + } + + } + return newValuesToUpdateInUI; + } + + public static Object getValue(HeatParameterDataDefinition param) { + String type = param.getType(); + Object result = null; + switch(type){ + case "string": + result = param.getCurrentValue(); + break; + case "number": + result = new Integer(param.getCurrentValue()); + break; + case "json": + result = param.getCurrentValue(); + break; + case "boolean": + result = new Boolean(param.getCurrentValue()); + break; + case "comma_delimited_list": + result = param.getCurrentValue(); + break; + default: + break; + } + return result; + } + + public static Object getFormatedData(String name, Object text) { + return name + ": " + text; +} + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java index a52367a454..18cb338891 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java @@ -29,8 +29,6 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -47,10 +45,10 @@ public final class CanvasManager { private CanvasManager() { canvasElements = new HashMap<>(); actions = new Actions(GeneralUIUtils.getDriver()); - canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); + canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); try { WebElement webElement = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); + .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); reduceCanvasWidthFactor = webElement.getSize().width; } catch (Exception e) { reduceCanvasWidthFactor = 0; @@ -92,9 +90,9 @@ public final class CanvasManager { actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); actions.click(); actions.perform(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); canvasElements.remove(canvasElement.getUniqueId()); GeneralUIUtils.waitForLoader(); } @@ -157,11 +155,11 @@ public final class CanvasManager { private void selectReqAndCapAndConnect() { // Select First Cap - GeneralUIUtils.getWebElements(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); + GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); // Select First Req - GeneralUIUtils.getWebElements(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); + GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); // Connect - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); } private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java deleted file mode 100644 index e2b2f8800b..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.utilities; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.FileUtils; -import org.openqa.selenium.OutputType; -import org.openqa.selenium.TakesScreenshot; -import org.testng.ITestResult; -import org.testng.Reporter; -import org.testng.TestListenerAdapter; - -public class CaptureFailedTests extends TestListenerAdapter { - - @Override - public void onTestFailure(ITestResult tr) { - - String testName = tr.getName(); - String parameter = tr.getParameters().length == 1 ? tr.getParameters()[0].toString() : ""; - File folder = new File(String.format("test-output\\failure_screenshots\\%s_%s.png", testName, parameter)); - - File scrFile = ((TakesScreenshot) GeneralUIUtils.getDriver()).getScreenshotAs(OutputType.FILE); - - try { - FileUtils.copyFile(scrFile, folder); - } catch (IOException e) { - e.printStackTrace(); - } - Reporter.setEscapeHtml(false); - String screenPath = String.format("<img src=%s />", folder.getAbsolutePath()); - Reporter.log(screenPath); - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java index d204645566..e9ba11f0f4 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java @@ -23,19 +23,28 @@ package org.openecomp.sdc.ci.tests.utilities; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; - -import javax.json.Json; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelFilterTitle; +import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; +import org.openqa.selenium.WebElement; import org.testng.annotations.Test; +import com.aventstack.extentreports.Status; + public class CatalogUIUtilitis { + + + + // Get all Categories , Subcategories and Icons. public void getAllCategoriesAndSubcategories() throws IOException, JSONException { @@ -79,6 +88,59 @@ public class CatalogUIUtilitis { return allcat; } + + public static void clickTopMenuButton(TopMenuButtonsEnum button) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s button ...", button.name())); + switch (button) { + case CATALOG: + GeneralUIUtils.getWebElementByTestID(button.getButton()).click(); + break; + case HOME: + GeneralUIUtils.getWebElementByTestID(button.getButton()).click(); + break; + case ON_BOARDING: + GeneralUIUtils.getWebElementByTestID(button.getButton()).click(); + break; + default: + break; + } + GeneralUIUtils.ultimateWait(); + } + + public static String catalogFilterTypeChecBox(TypesEnum enumtype) throws Exception { + String Type = enumtype.toString().toLowerCase(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", Type)); + GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click(); + return Type; + } + + public static List<String> catalogFilterStatusChecBox(CheckBoxStatusEnum statusEnum) throws Exception { + List<String> status = null; + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s status", statusEnum.name())); + switch (statusEnum) { + case IN_DESIGN: + status = Arrays.asList("NOT_CERTIFIED_CHECKIN", "NOT_CERTIFIED_CHECKOUT"); + GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click(); + break; + case READY_FOR_TESTING: + status = Arrays.asList("READY_FOR_CERTIFICATION"); + GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click(); + break; + case IN_TESTING: + status = Arrays.asList("CERTIFICATION_IN_PROGRESS"); + GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click(); + break; + case CERTIFIED: + status = Arrays.asList("CERTIFIED"); + GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click(); + break; + case DISTRIBUTED: + status = Arrays.asList("CERTIFIED"); + GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click(); + break; + } + return status; + } // Get all Categories uniqueID .//The parent categories. public static List<String> getCategories() throws IOException, JSONException { @@ -144,5 +206,27 @@ public class CatalogUIUtilitis { } } } + + + public static WebElement clickOnUpperCategoryCheckbox() throws InterruptedException { + List<WebElement> categorieCheckboxes = GeneralUIUtils.getElementsByCSS("span[data-tests-id*='category']"); // get all categories and subcategories + WebElement categorieCheckbox = categorieCheckboxes.get(0); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s category ...", categorieCheckbox.getText())); + categorieCheckbox.click(); + GeneralUIUtils.ultimateWait(); + return categorieCheckbox; + } + + public static void clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle leftPanelElement) throws InterruptedException { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", leftPanelElement.name())); + GeneralUIUtils.getElementsByCSS(leftPanelElement.getValue()).forEach(WebElement::click); + } + + public static WebElement catalogSearchBox(String searchText) { + WebElement searchBox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); + searchBox.clear(); + searchBox.sendKeys(searchText); + return searchBox; + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java new file mode 100644 index 0000000000..ceada39b04 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.utilities; + +import java.io.File; +import java.util.List; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient; +import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +public class DownloadManager { + + + public File fetchDownloadedFile(){ + + File retrieveLastModifiedFileFromFTP = null; + + if (DriverFactory.getConfig().isRemoteTesting()){ + + + try { + + AttFtpClient instance = AttFtpClient.getInstance(); + AttFtpClient.getInstance().retrieveListOfFile(); + retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP(); + + } catch (Exception e) { + System.out.println("could not retriev file"); + } + + return retrieveLastModifiedFileFromFTP; + + } + + + return retrieveLastModifiedFileFromFTP; + + } + + + /** + * this method download csar file from VSP repository to default browser download directory + * @param vspName + * @throws Exception + */ + public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{ + FileHandling.cleanCurrentDownloadDir(); + HomePage.showVspRepository(); + boolean vspFound = HomePage.searchForVSP(vspName); + if (vspFound){ + ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName)); + List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); +// GeneralUIUtils.ultimateWait(); +// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5); +// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); + elemenetsFromTable.get(1).click(); +// findElement.click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue()); + ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspId + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory()); + GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click()); + GeneralUIUtils.ultimateWait(); + } + } + +// AttFtpClient instance = AttFtpClient.getInstance(); +// +// String server = "localhost"; +// int port = 2121; +// String user = "admin"; +// String pass = "admin"; +// AttFtpClient.getInstance().init(server, port, user, pass); +// +// try { +// AttFtpClient.getInstance().retrieveListOfFile(); +// +// File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP(); +// String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8); +//// instance.deleteFilesFromFTPserver(); +// System.out.println(content); +// readFile(retrieveLastModifiedFileFromFTP); +// +// } finally { +// instance.terminateClient(); +// } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java index 9533b6485e..6008f200d2 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java @@ -20,18 +20,41 @@ package org.openecomp.sdc.ci.tests.utilities; +import static org.testng.AssertJUnit.assertTrue; + +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.FilenameFilter; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.common.util.GeneralUtility; import org.yaml.snakeyaml.Yaml; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + public class FileHandling { +// ------------------yaml parser methods---------------------------- public static Map<?, ?> parseYamlFile(String filePath) throws Exception { Yaml yaml = new Yaml(); File file = new File(filePath); @@ -39,18 +62,69 @@ public class FileHandling { Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream); return map; } + + /** + * The method return map fetched objects by pattern from yaml file + * @param yamlFile + * @param pattern + * @return + * @throws Exception + */ + public static Map<String, Object> parseYamlFileToMapByPattern(File yamlFile, String pattern) throws Exception { + Map<?, ?> yamlFileToMap = FileHandling.parseYamlFile(yamlFile.toString()); + Map<String, Object> objectMap = getObjectMapByPattern(yamlFileToMap, pattern); + return objectMap; + } + + @SuppressWarnings("unchecked") + public static Map<String, Object> getObjectMapByPattern(Map<?, ?> parseUpdetedEnvFile, String pattern) { + Map<String, Object> objectMap = null; + + Object objectUpdetedEnvFile = parseUpdetedEnvFile.get(pattern); + if(objectUpdetedEnvFile instanceof HashMap){ + objectMap = (Map<String, Object>) objectUpdetedEnvFile; + } + return objectMap; + } + +// ------------------------------------------------------------------------------------------------- + + public static String getFilePath(String folder) { + String filepath = System.getProperty("filepath"); + if (filepath == null && System.getProperty("os.name").contains("Windows")) { + filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; + } + + else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ + filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; + } + + System.out.println(filepath); + + return filepath; + } public static String getBasePath() { - return System.getProperty("user.dir"); + return System.getProperty("user.dir") + File.separator; + } + + public static String getDriversPath() { + return getBasePath() + "src" + File.separator + "main" + File.separator + "resources" + + File.separator + "ci" + File.separator + "drivers" + File.separator; } public static String getResourcesFilesPath() { - return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources" + return getBasePath() + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "Files" + File.separator; } + + public static String getResourcesEnvFilesPath() { + return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources" + + File.separator + "Files" + File.separator + "ResourcesEnvFiles" +File.separator; + } public static String getCiFilesPath() { - return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources" + return getBasePath() + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "ci"; } @@ -61,19 +135,32 @@ public class FileHandling { public static String getTestSuitesFilesPath() { return getCiFilesPath() + File.separator + "testSuites" + File.separator; } + + public static String getVnfRepositoryPath() { + return getFilePath("VNFs"); + } + + public static File getConfigFile(String configFileName) throws Exception { + File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName); + if (!configFile.exists()) { + configFile = new File(FileHandling.getConfFilesPath() + configFileName); + } + return configFile; + } - public static Object[] getFileNamesFromFolder(String filepath, String extension) { + public static Object[] filterFileNamesFromFolder(String filepath, String extension) { try { File dir = new File(filepath); List<String> filenames = new ArrayList<String>(); + + FilenameFilter extensionFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.endsWith(extension); + } + }; + if (dir.isDirectory()) { - for (File file : dir.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.endsWith(extension); - } - })) { - + for (File file : dir.listFiles(extensionFilter)) { filenames.add(file.getName()); } return filenames.toArray(); @@ -85,4 +172,334 @@ public class FileHandling { return null; } + public static String[] getArtifactsFromZip(String filepath, String zipFilename){ + try{ + ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename); + Enumeration<? extends ZipEntry> entries = zipFile.entries(); + + String[] artifactNames = new String[zipFile.size() - 1]; + + int i = 0; + while(entries.hasMoreElements()){ + ZipEntry nextElement = entries.nextElement(); + if (!nextElement.isDirectory()){ + if (!nextElement.getName().equals("MANIFEST.json")){ + String name = nextElement.getName(); + artifactNames[i++] = name; + } + } + } + zipFile.close(); + return artifactNames; + } + catch(ZipException zipEx){ + System.err.println("Error in zip file named : " + zipFilename); + zipEx.printStackTrace(); + } catch (IOException e) { + System.err.println("Unhandled exception : "); + e.printStackTrace(); + } + + return null; + + } + + public static Object[] getZipFileNamesFromFolder(String filepath) { + return filterFileNamesFromFolder(filepath, ".zip"); + } + + public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){ + int fileCounter = 0; + for (String artifact : artifactsArr){ + String extensionFile = artifact.substring(artifact.lastIndexOf(".") + 1 , artifact.length()); + if (extensionFile.equals(reqExtension)){ + fileCounter++; + } + } + return fileCounter; + } + + + public static synchronized File getLastModifiedFileFromDir() throws Exception{ + return getLastModifiedFileFromDir(SetupCDTest.getWindowTest().getDownloadDirectory()); + } + + public static synchronized File getLastModifiedFileFromDir(String dirPath){ + File dir = new File(dirPath); + File[] files = dir.listFiles(); + if (files == null) { + assertTrue("File not found under directory " + dirPath, false); + return null; + } + + File lastModifiedFile = files[0]; + for (int i = 1; i < files.length; i++) { + if(files[i].isDirectory()) { + continue; + } + if (lastModifiedFile.lastModified() < files[i].lastModified()) { + lastModifiedFile = files[i]; + } + } + return lastModifiedFile; + } + + public static void deleteDirectory(String directoryPath) { + File dir = new File(directoryPath); + try { + FileUtils.deleteDirectory(dir); + } catch (IOException e) { + System.out.println("Failed to delete " + dir); + SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir); + } + } + + public static void createDirectory(String directoryPath) { + File directory = new File(String.valueOf(directoryPath)); + if (! directory.exists()){ + directory.mkdir(); + } + } + + + /** + * The method append data to existing file, if file not exists - create it + * @param pathToFile + * @param text + * @param leftSpaceCount + * @throws IOException + */ + public static synchronized void writeToFile(File pathToFile, Object text, Integer leftSpaceCount) throws IOException{ + + BufferedWriter bw = null; + FileWriter fw = null; + if(!pathToFile.exists()){ + createEmptyFile(pathToFile); + } + try { + fw = new FileWriter(pathToFile, true); + bw = new BufferedWriter(fw); + StringBuilder sb = new StringBuilder(); + if(leftSpaceCount > 0 ){ + for(int i = 0; i < leftSpaceCount; i++){ + sb.append(" "); + } + } + bw.write(sb.toString() + text); + bw.newLine(); + bw.close(); + fw.close(); + } catch (Exception e) { + SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile); + } + } + + public static synchronized void writeToFile(File pathToFile, Map<String, Pair<String, Object>> dataMap, Integer leftSpaceCount) throws IOException{ + + BufferedWriter bw = null; + FileWriter fw = null; + try { + if(!pathToFile.exists()){ + createEmptyFile(pathToFile); + } + fw = new FileWriter(pathToFile, true); + bw = new BufferedWriter(fw); + StringBuilder sb = new StringBuilder(); + if(leftSpaceCount > 0 ){ + for(int i = 0; i < leftSpaceCount; i++){ + sb.append(" "); + } + } + for(Map.Entry<String, Pair<String, Object>> entry : dataMap.entrySet()){ + Object record = ArtifactUIUtils.getFormatedData(entry.getKey(), entry.getValue().right); + bw.write(sb.toString() + record); + bw.newLine(); + } + bw.close(); + fw.close(); + } catch (Exception e) { + SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile); + } + } + + public static void deleteLastDowloadedFiles(List<File> files) throws IOException { + for (File file : files) { + File fileToDelete =new File(Config.instance().getWindowsDownloadDirectory()+file.getName()); + fileToDelete.delete(); + } + } + + public static void cleanCurrentDownloadDir() throws IOException { + try{ + ExtentTestActions.log(Status.INFO, "Cleaning directory " + SetupCDTest.getWindowTest().getDownloadDirectory()); + System.gc(); + FileUtils.cleanDirectory(new File(SetupCDTest.getWindowTest().getDownloadDirectory())); + } + catch(Exception e){ + + } + } + + public static boolean isFileDownloaded(String downloadPath, String fileName) { + boolean flag = false; + File dir = new File(downloadPath); + File[] dir_contents = dir.listFiles(); + for (int i = 0; i < dir_contents.length; i++) { + if (dir_contents[i].getName().equals(fileName)) + return flag = true; + } + return flag; + } + + public static String getMD5OfFile(File file) throws IOException { + String content = FileUtils.readFileToString(file); + String md5 = GeneralUtility.calculateMD5ByString(content); + return md5; + } + + public static File createEmptyFile(String fileToCreate) { + File file= new File(fileToCreate); + try { + if(file.exists()){ + deleteFile(file); + } + file.createNewFile(); + SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate); + } catch (IOException e) { + SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate); + e.printStackTrace(); + } + return file; + } + + public static File createEmptyFile(File fileToCreate) { + try { + if(fileToCreate.exists()){ + deleteFile(fileToCreate); + } + fileToCreate.createNewFile(); + SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate); + } catch (IOException e) { + SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate); + e.printStackTrace(); + } + return fileToCreate; + } + + public static void deleteFile(File file){ + + try{ + if(file.exists()){ + file.deleteOnExit(); + SetupCDTest.getExtendTest().log(Status.INFO, "File " + file.getName() + "has been deleted"); + }else{ + SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete file " + file.getName()); + } + }catch(Exception e){ + e.printStackTrace(); + } + + } + + + /** + * get file list from directory by extension array + * @param directory + * @param okFileExtensions + * @return + */ + public static List<File> getHeatAndHeatEnvArtifactsFromZip(File directory, String[] okFileExtensions){ + + List<File> fileList = new ArrayList<>(); + File[] files = directory.listFiles(); + + for (String extension : okFileExtensions){ + for(File file : files){ + if (file.getName().toLowerCase().endsWith(extension)){ + fileList.add(file); + } + } + } + return fileList; + } + + private static final int BUFFER_SIZE = 4096; + public static void unzip(String zipFilePath, String destDirectory) throws IOException { + File destDir = new File(destDirectory); + if (!destDir.exists()) { + destDir.mkdir(); + } + ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath)); + ZipEntry entry = zipIn.getNextEntry(); +// iterates over entries in the zip file + while (entry != null) { + String entryName; + if(System.getProperty("os.name").contains("Windows")){ + entryName = entry.getName().replaceAll("/", "\\"+File.separator); + }else{ + entryName = entry.getName(); + } + String filePath = destDirectory + entryName; + String currPath = destDirectory; + String[] dirs = entryName.split("\\"+File.separator); + String currToken; + for(int i = 0; i<dirs.length;++i){ + currToken = dirs[i]; + if(!entry.isDirectory() && i==dirs.length-1){ + extractFile(zipIn, filePath); + } else { + if(currPath.endsWith(File.separator)){ + currPath = currPath + currToken; + }else{ + currPath = currPath + File.separator + currToken; + } +// if the entry is a directory, make the directory + File dir = new File(currPath); + dir.mkdir(); + } + } + zipIn.closeEntry(); + entry = zipIn.getNextEntry(); + } + zipIn.close(); + } + + private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException { + BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath)); + byte[] bytesIn = new byte[BUFFER_SIZE]; + int read = 0; + while ((read = zipIn.read(bytesIn)) != -1) { + bos.write(bytesIn, 0, read); + } + bos.close(); + } + + public static int getFileCountFromDefaulDownloadDirectory(){ + return new File(SetupCDTest.getWindowTest().getDownloadDirectory()).listFiles().length; + } + + + public static String getKeyByValueFromPropertyFormatFile(String fullPath, String key) { + Properties prop = new Properties(); + InputStream input = null; + String value = null; + try { + input = new FileInputStream(fullPath); + prop.load(input); + value = (prop.getProperty(key)); + + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + return value.replaceAll("\"",""); + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java index 4fd36955ae..19c2242550 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java @@ -23,119 +23,88 @@ package org.openecomp.sdc.ci.tests.utilities; import java.awt.AWTException; import java.awt.Robot; import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; import java.io.File; -import java.io.FileWriter; import java.io.IOException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; import java.util.List; +import java.util.Random; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.time.StopWatch; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum; -import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; -import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.MenuOptionsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum; +import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; +import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.OutputType; -import org.openqa.selenium.Platform; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.Reporter; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; + public final class GeneralUIUtils { - - private static int timeOut=60*3; public static final String FILE_NAME = "Valid_tosca_Mycompute.yml"; - - /**************** DRIVERS ****************/ - private static WebDriver driver; - - public static void findComponentAndClick(String componentName) throws Exception { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "finding component " + componentName); - waitFordataTestIdVisibility("main-menu-input-search").sendKeys(componentName); - WebElement foundComp = null; - try { - foundComp = waitFordataTestIdVisibility(componentName); - foundComp.click(); - GeneralUIUtils.waitForLoader(); - waitFordataTestIdVisibility("formlifecyclestate"); - } catch (Exception e) { - String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName); - SetupCDTest.getExtendTest().log(LogStatus.FAIL, msg); - System.out.println(msg); - Assert.fail(msg); + + private static int timeOut=(int) (60*1.5); + +// public static void setTimeOut(int time) { +// if (time>0) { +// timeOut=time; +// } +// else { +// timeOut=timeOut; +// } +// } + + /**************** DRIVER ****************/ + + public static WebDriver getDriver() { + try{ + return DriverFactory.getDriver(); } + catch(Exception e){ + e.printStackTrace(); + } + return null; } - + /****************************************/ + public static List<WebElement> getElemenetsFromTable(By by) { - return GeneralUIUtils.getDriver().findElements(by); - } - - private static List<WebElement> getNewButtonsList() { - WebElement createButtonsArea = driver.findElement(By.className("w-sdc-dashboard-card-new")); - createButtonsArea.click(); - List<WebElement> buttonsList = driver.findElements(By.className("w-sdc-dashboard-card-new-button")); - return buttonsList; - } - - public static final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\"; - public static String fileName = "JDM_vfc.yml"; - public static final String toscaErrorMessage = "Invalid TOSCA template."; - public static final String yamlError = "Invalid YAML file."; - public static final String allReadyExistErro = "Imported resource already exists in ASDC Catalog."; - - public static WebElement hoverOnArea(String areaId) { - Actions actions = new Actions(driver); - WebElement area = getWebElementWaitForVisible(areaId); - actions.moveToElement(area).perform(); - return area; + return getDriver().findElements(by); } - public static WebElement actionBuild(WebElement element) throws InterruptedException { - // make an action on page//hover on element - Actions build = new Actions(driver); // here you state ActionBuider - build.moveToElement(element).build().perform();// hover the element. - Thread.sleep(1000); - return element; - } - - public static File takeScreenshot(String zipFile, String dir, String testName) throws IOException { - if (zipFile == null) { - zipFile = testName; + public static File takeScreenshot(String screenshotFilename, String dir, String testName) throws IOException { + if (screenshotFilename == null) { + if (testName != null){ + screenshotFilename = testName; + } + else + { + screenshotFilename = UUID.randomUUID().toString(); + } } try { - File scrFile = ((TakesScreenshot) GeneralUIUtils.getDriver()).getScreenshotAs(OutputType.FILE); - File filePath = new File(String.format("%s/%s.png", dir, zipFile)); + File scrFile = ((TakesScreenshot) getDriver()).getScreenshotAs(OutputType.FILE); + File filePath = new File(String.format("%s/%s.png", dir, screenshotFilename)); new File(dir).mkdirs(); FileUtils.copyFile(scrFile, filePath); return filePath; @@ -144,655 +113,319 @@ public final class GeneralUIUtils { } return null; } - - public static void errorMessagePopupHandle(@SuppressWarnings("rawtypes") Supplier func) throws Exception { - try { - WebElement errorMessagePopupHeader = getDriver().findElement(By.className("w-sdc-modal-head-text")); - if (errorMessagePopupHeader.getText().equals("Error")) { - WebElement okButton = getWebButton("OK"); - if (okButton.isDisplayed()) { - okButton.click(); - func.get(); - } - } - } catch (Exception e) { - throw new Exception("something went wrong, can't do anything"); - } - } - - public static void waitForLoader() { - waitForElements(By.className("tlv-loader"), 200, 3 * 60 * 1000); + + public static File takeScreenshot(String screenshotFilename, String dir) throws IOException{ + return takeScreenshot(screenshotFilename, dir, null); } - public static void waitForLoaderOnboarding() { - waitForElements(By.className("tlv-loader"), 200, 13 * 60 * 1000); - } - public static List<WebElement> waitForElements(By by, int napPeriod, int maxWaitMS) { - boolean isKeepWaiting = true; - int currentWaitTimeMS = 0; - List<WebElement> elements = null; - while (isKeepWaiting) { - elements = getDriver().findElements(by); - isKeepWaiting = elements.size() > 0; - if (isKeepWaiting) { - sleep(napPeriod); - currentWaitTimeMS += napPeriod; - if (currentWaitTimeMS > maxWaitMS) { - isKeepWaiting = false; - } - } + public static void scrollDown() { + try{ + Robot robot = new Robot(); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + GeneralUIUtils.waitForLoader(); } - - return elements; - - } - - public static WebDriver getDriver() { - return driver; - } - - public static WebElement rihtPanelAPI() { - return getWebElementWaitForVisible("tab-api"); - } - - public static void scrollDown() throws AWTException { - Robot robot = new Robot(); - robot.keyPress(KeyEvent.VK_DOWN); - robot.keyRelease(KeyEvent.VK_DOWN); - } - - // solution for "element not attached to the DOM anymore" - public static List<WebElement> getWorkspaceElements() throws InterruptedException { - Thread.sleep(1000); - List<WebElement> assets = GeneralUIUtils.getEelementsByClassName("w-sdc-dashboard-card-body"); - return assets; - } - - public static String getMethodName(Method method) { - return method.getName(); - } - - public static FileWriter InitializeprintToTxt(String testName) { - String idForTxtFile = new SimpleDateFormat("dd.MM.yyyy_HH.mm.ss").format(new Date()); - File file = new File(testName + idForTxtFile); - FileWriter fw = null; - try { - fw = new FileWriter(file, true); - - } catch (IOException e) { + catch(Exception e){ e.printStackTrace(); - System.out.println(e.getLocalizedMessage()); - } - return fw; - } - - public static void closeFileWriter(FileWriter file) throws IOException { - file.flush(); - file.close(); - } - - public static WebElement createAndImportButtons(CreateAndImportButtonsEnum type, WebDriver driver) - throws InterruptedException { - switch (type) { - case IMPORT_CP: - case IMPORT_VFC: - case IMPORT_VL: - hoverOnArea("importButtonsArea"); - return GeneralUIUtils.getWebElementWaitForVisible("importVFCbutton"); - - case IMPORT_VF: - hoverOnArea("importButtonsArea"); - return GeneralUIUtils.getWebElement(driver, "importVFbutton"); - case CREATE_SERVICE: - hoverOnArea("AddButtonsArea", driver); - GeneralUIUtils.getWebElementWaitForVisible("createServiceButton").click(); - ; - break; - - case CREATE_PRODUCT: - GeneralUIUtils.getWebElement(driver, "createServiceButton").click(); - GeneralUIUtils.getWebElementWaitForVisible("createServiceButton").click(); - break; - - default: - hoverOnArea("AddButtonsArea"); - driver.findElement(By.xpath("//*[@data-tests-id='createResourceButton']")).click(); - break; - } - return null; - - } - - public static String checkBoxLifeCyclestate(CheckBoxStatusEnum lifeCycle) { - String Status = "IN DESIGN CHECK OUT"; - switch (lifeCycle) { - case CHECKIN: - Status = "IN DESIGN CHECK IN"; - if (GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).isDisplayed()) { - GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click(); - } - break; - case CHECKOUT: - GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click(); - Status = "IN DESIGN CHECK OUT"; - break; - case IN_TESTING: - GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click(); - Status = "IN TESTING"; - break; - case READY_FOR_TESTING: - GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click(); - Status = "READY FOR TESTING"; - break; - case CERTIFIED: - GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click(); - Status = "CERTIFIED"; - break; } - return Status; - } - - public static String setFileTypeAndGetUniqId(ResourceTypeEnum fileType, ResourceReqDetails resourceDetails, - User user) throws IOException, Exception { - resourceDetails.setResourceType(fileType.toString()); - RestCDUtils.getResource(resourceDetails, user); - return resourceDetails.getUniqueId(); } public static void minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum titlesEnum) { switch (titlesEnum) { case CATEGORIES: - GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click(); break; case STATUS: - GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click(); break; case TYPE: - GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click(); break; default: break; } - // webElementWaitForVisible.get(0).click(); - // } - } - - public static WebElement getWebElementWaitForVisible(String dataTestId) { - // try{ - return waitFordataTestIdVisibility(dataTestId); - // } - // catch(Exception e){ - // try{ - // WebElement errorMessagePopupHeader = - // GeneralUIUtils.getDriver().findElement(By.className("w-sdc-modal-head-text")); - // if (errorMessagePopupHeader.getText().equals("Error")){ - // WebElement okButton = GeneralUIUtils.getWebButton("OK"); - // if (okButton.isDisplayed()){ - //// takeScreenshot(LocalDateTime.now().toString().replaceAll(":", ""), - // SetupCDTest.SCREENSHOT_LOG_DIR); - // okButton.click(); - // return getWebElementWaitForVisible(dataTestId); - // } - // } - // } - // catch(Exception exception){ - // System.out.println(String.format("didn't find element with - // data-tests-id of %s", dataTestId)); - // } - // } - // return null; - - } - - public static WebElement getWebElementById(String id) { - WebDriverWait wait = new WebDriverWait(driver, 5); - return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='" + id + "']"))); - } - - public static WebElement getWebElementByName(String name) { - return driver.findElement(By.name(name)); - } - - // New tedy , this function will get the web elements by The new attribute - // value(data-tests-id) - public static List<WebElement> getWebElements(String dataTestId) { - return waitForElementsListVisibility(dataTestId); + } - // New tedy , this function will get the web element Button by The new - // attribute value(data-tests-id) - public static WebElement getWebButton(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait - .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); + public static WebElement getWebElementByTestID(String dataTestId) { + return getWebElementByTestID(dataTestId, timeOut); } - - // New tedy , this function will wait till the web element be - // visible(data-tests-id) - public static Boolean waitForInvisibileElement(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until( - ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); - } - - public static WebElement waitFordataTestIdVisibility(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until( - ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); + + public static WebElement getWebElementByTestID(String dataTestId, int timeout) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeout); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); } - - public static boolean clickcheckbox(String category) { - try { - - } catch (Exception e) { + + public static boolean isWebElementExistByTestId(String dataTestId) { + if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) { return false; } return true; } - public static WebElement waitForContainsdataTestIdVisibility2(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 5); - return wait.until(ExpectedConditions - .visibilityOfElementLocated(By.xpath("//*[contains (@data-tests-id, '" + dataTestId + "'])"))); - } - - public static List<WebElement> waitForContainsdataTestIdVisibility(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 5); - return wait.until(ExpectedConditions - .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains (@data-tests-id, '" + dataTestId + "'])"))); - } - - public static WebElement waitForClassNameVisibility(String className) { - return waitForElementVisibility(By.className(className)); + public static WebElement getInputElement(String dataTestId) { + try{ + ultimateWait(); + return getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); + } + catch(Exception e){ + return null; + } } - public static WebElement waitForElementVisibility(By by) { - return waitForElementVisibility(by, 3 * 60); - } + public static List<WebElement> getInputElements(String dataTestId) { + ultimateWait(); + return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); - public static WebElement waitForElementVisibility(By by, int duration) { - WebDriverWait wait = new WebDriverWait(driver, duration); - return wait.until(ExpectedConditions.visibilityOf(driver.findElement(by))); } - - public static List<WebElement> waitForElementsListVisibility(By by) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions.visibilityOfAllElements(driver.findElements(by))); + + public static WebElement getWebElementBy(By by) { + return getWebElementBy(by, timeOut); } - public static boolean waitForElementsListInvisibility(By by) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions.invisibilityOfElementLocated(by)); + public static WebElement getWebElementBy(By by, int timeOut) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfElementLocated(by)); } - - // New tedy , this function will wait till the web elements be - // visible(data-tests-id) - public static List<WebElement> waitForElementsListVisibility(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - List<WebElement> findElements = wait.until(ExpectedConditions - .visibilityOfAllElementsLocatedBy(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); - if (findElements.size() > 0) { - return findElements; + + public static List<String> getWebElementListText(List<WebElement>elements) { + List<String>Text=new ArrayList<>(); + for (WebElement webElement : elements) { + Text.add(webElement.getText()); } - System.out.println("Elements not Exist!"); - return null; - } - - public static List<WebElement> waitForElementsListVisibilityTestMethod(String dataTestId) { - return driver.findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); + return Text; } - - public static WebElement waitForBrowseButton(String dataTestId) { - - return driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); - } - - public static List<WebElement> getWebElementsListByDataTestId(String dataTestId) { - return driver.findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); - - } - - public static WebElement getWebElementByDataTestId(String dataTestId) { - return driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); - } - - public static WebElement waitUntilClickableButton(String dataTestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions - .elementToBeClickable(driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")))); + + + public static List<WebElement> getWebElementsListBy(By by) { + return getWebElementsListBy(by, timeOut); } - - // interface Throws { - // <T,R, E extends Exception> R apply(T t) throws E; - // } - // public static <R> R swallowException(Throws<T,R,E> supplier){ - // R returnValue; - // try{ - // returnValue = supplier.get(); - // } - // catch(Exception e){ - // returnValue = null; - // } - // return returnValue; - // } - // Use this method only for special cases, otherwise use - // org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.getWebElementWaitForVisible(WebDriver, - // String) - - public static boolean isElementPresent(String dataTestId) { - try { - driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); - return true; - } catch (org.openqa.selenium.NoSuchElementException e) { - return false; - } + + public static List<WebElement> getWebElementsListBy(By by, int timeOut) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(by)); } - - public static <R> R retryMethodOnException(Supplier<R> supplier) { - boolean stopSearch = false; - R ret = null; - Exception throwMe = null; - int timeElapsed = 0; - while (!stopSearch) { - try { - ret = supplier.get(); - } catch (Exception e) { - throwMe = e; - GeneralUIUtils.sleep(250); - timeElapsed += 250; - if (timeElapsed > 5000) { - stopSearch = true; - } - - } finally { - if (ret != null) { - stopSearch = true; - } - } + + public static List<WebElement> getWebElementsListByContainTestID(String dataTestId) { + try{ + WebDriverWait wait = new WebDriverWait(getDriver(), 10); + return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '"+dataTestId+"')]"))); } - if (ret == null) { - throw new RuntimeException(throwMe); - } else { - return ret; + catch(Exception e){ + return new ArrayList<WebElement>(); } - } - - // this method will login as tester and start test or accept Assets. - public static void testerUser(Boolean startTest, Boolean accept, ResourceReqDetails resource) throws Exception { - // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click(); - String url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; - sleep(2000); - SetupCDTest.navigateToUrl(url); - GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click(); - - if (startTest) { - clickStartTesting(); - } - - if (accept) { - clickAccept(); - } + + public static List<WebElement> getWebElementsListByContainsClassName(String containedText) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '"+containedText+"')]"))); } - - public static void governorUser(Boolean reject, Boolean approve, ResourceReqDetails resource) throws Exception { - // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click(); - String url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard"; - sleep(2000); - SetupCDTest.navigateToUrl(url); - GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info"); - GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click(); - if (reject) { - clickReject(); - } - if (approve) { - clickApprove(); - } - sleep(1000); + + public static WebElement getWebElementByContainsClassName(String containedText) { + return getWebElementBy(By.xpath("//*[contains(@class, '"+containedText+"')]")); } - - public static void opsUser(Boolean disribute, Boolean reDisribute, ResourceReqDetails resource) throws Exception { - // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click(); - String url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard"; - sleep(2000); - SetupCDTest.navigateToUrl(url); - sleep(2000); - GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info"); - GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click(); - if (reDisribute) { - clickReDistribute(); - } - if (disribute) { - clickDistribute(); - } - sleep(1000); + + public static WebElement getWebElementByClassName(String className) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.className(className))); } - - // this function located select list by the data-test-id value and the item - // to be selected.. - public static Select getSelectList(String item, String datatestsid) { - Select selectlist = new Select(waitFordataTestIdVisibility(datatestsid)); - if (item != null) { - selectlist.selectByVisibleText(item); - } - return selectlist; + + public static WebElement getWebElementByLinkText(String linkText) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='" + linkText + "']"))); } - - // Define description area . - public static String defineDescription(String descriptionText) { - - WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementWaitForVisible("description"); - resourceDescriptionTextbox.clear(); - resourceDescriptionTextbox.sendKeys(descriptionText); - return descriptionText; + + + public static List<WebElement> getWebElementsListByTestID(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); } - - public static WebElement catalogSearchBox(String searchText) { - WebElement searchBox = GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search"); - searchBox.clear(); - searchBox.sendKeys(searchText); - return searchBox; + + public static List<WebElement> getWebElementsListByClassName(String className) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className(className))); } + + - // enum - public static void selectMenuOptionbyname(List<WebElement> options, MenuOptionsEnum optionName) - throws InterruptedException { - for (WebElement webElement : options) { - if (webElement.getText().equals(optionName.getValue())) { - actionBuild(webElement).click(); - } else { - System.out.println("No such element!"); + public static Boolean isElementInvisibleByTestId(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until( + ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); + } + + public static Boolean isElementVisibleByTestId(String dataTestId) { + try{ + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + if(wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//*[@data-tests-id='" + dataTestId + "']")))).isDisplayed()){ + return true; + }else { + return false; } } - - } - - // back to workspace by Clicking the ASDC Logo.! - public static void clickASDCLogo() { - WebDriverWait wait = new WebDriverWait(driver, 15); - wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("ASDC"))); - WebElement ClickASDCLogo = driver.findElement(By.linkText("ASDC")); - ClickASDCLogo.click(); - GeneralUIUtils.waitForLoader(); - } - - public static void clickExitSign() throws InterruptedException { - WebElement exitSign = driver.findElement(By.xpath("//*[contains(@class, 'x-btn')]")); - actionBuild(exitSign); - Thread.sleep(1000); - driver.findElement(By.xpath("//*[contains(@class, 'x-btn')]")).click(); - } - - public static void clickCreateButton() throws Exception { - getWebButton("create/save").click(); - GeneralUIUtils.waitForLoader(); - getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue()); - } - - public static void clickUpdateButton() throws Exception { - GeneralUIUtils.sleep(500); - clickCreateButton(); - } - - public static void checkOut() throws InterruptedException, AWTException { - actionBuild(getWebButton("check_out")); - getWebButton("check_out").click(); - waitForInvisibileElement("check_out"); - } - - public static void clickStartTesting() throws InterruptedException { - actionBuild(getWebButton("start_testing")); - getWebButton("start_testing").click(); - waitForInvisibileElement("start_testing"); - getWebButton("create/save").click(); - } - - public static void clickAccept() throws InterruptedException { - actionBuild(getWebButton("accept")); - getWebButton("accept").click(); - getWebElementWaitForVisible("checkindialog").sendKeys("Accept!"); - clickOkButton(); - sleep(1000); - } - - public static void clickReject() throws InterruptedException { - actionBuild(getWebButton("reject")); - getWebButton("reject").click(); - waitForInvisibileElement("reject"); + catch(Exception e){ + return false; + } } - - public static void clickApprove() throws InterruptedException { - actionBuild(getWebButton("approve")); - getWebButton("approve").click(); - waitForInvisibileElement("approve"); + + public static void clickOnElementByTestId(String dataTestId) { + clickOnElementByTestIdWithoutWait(dataTestId); + ultimateWait(); } - - public static void clickDistribute() throws InterruptedException { - actionBuild(getWebButton("distribute")); - getWebButton("distribute").click(); - waitForInvisibileElement("redistribute"); + + public static void clickOnElementByTestIdWithoutWait(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click(); } - - public static void clickReDistribute() throws InterruptedException { - actionBuild(getWebButton("redistribute")); - getWebButton("redistribute").click(); + + public static void clickOnElementByTestId(String dataTestId, int customTimeout) { + WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout); + wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click(); } - public static void clickCancel() { - getWebButton("cancel").click(); - waitForInvisibileElement("cancel"); + public static WebElement waitForElementVisibilityByTestId(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); } - - public static void checkIn() throws InterruptedException { - actionBuild(getWebButton("check_in")); - getWebButton("check_in").click(); - getWebElementWaitForVisible("checkindialog").sendKeys("Check in!"); - clickOkButton(); - waitForInvisibileElement("checkindialog"); + + public static Boolean waitForElementInVisibilityByTestId(String dataTestId) { + return waitForElementInVisibilityByTestId(dataTestId, timeOut); } - - public static void clickSaveIcon() throws InterruptedException { - actionBuild(GeneralUIUtils.waitFordataTestIdVisibility("create/save")); - GeneralUIUtils.getWebButton(/* "delete_version" */"create/save").click(); - Thread.sleep(1000); - + + public static Boolean waitForElementInVisibilityByTestId(String dataTestId, int timeOut) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + boolean displayed = getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).isEmpty(); + if (!displayed){ + Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "'])"))); + ultimateWait(); + return until; + } + return false; } - - // Open menu of Created Object and select option. - public static void openObjectMenuAndSelectOption(String uniqid, MenuOptionsEnum optionName) - throws InterruptedException, AWTException { - WebElement hoverOnMenu = actionBuild(getWebElementWaitForVisible(uniqid)); - List<WebElement> menuOptions = hoverOnMenu.findElement(By.xpath("./following-sibling::*[1]")) - .findElements(By.xpath(".//*")); - selectMenuOptionbyname(menuOptions, optionName); + + public static Boolean waitForElementInVisibilityByTestId(By by) { + return waitForElementInVisibilityBy(by, timeOut); } - - // Get elements by className. - public static WebElement getEelementByClassName(String element) { - try { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='" + element + "']"))); - } catch (Exception e) { - return null; + + + public static Boolean waitForElementInVisibilityBy(By by, int timeOut) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + boolean displayed = getDriver().findElements(by).isEmpty(); + if (!displayed){ + Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(by)); + sleep(1000); + return until; } + return false; } - - public static List<WebElement> getEelementsByClassName(String element) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait - .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@class='" + element + "']"))); - } - - public static WebElement getEelementByContainsdatatestsid(String datatestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions - .visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, '" + datatestId + "')]"))); + + + public static void setWebElementByTestId(String elemetID, String value) { + WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementByTestID(elemetID); + resourceDescriptionTextbox.clear(); + resourceDescriptionTextbox.sendKeys(value); + } - - // list - public static List<WebElement> getEelementsByContainsDataTestsId(String datatestId) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions - .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '" + datatestId + "')]"))); + + public static WebElement hoverOnAreaByTestId(String areaId) { + Actions actions = new Actions(getDriver()); + WebElement area = getWebElementByTestID(areaId); + actions.moveToElement(area).perform(); + ultimateWait(); + return area; } - - public static WebElement getEelementBycontainsClassName(String classname) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until( - ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@class, '" + classname + "')]"))); + + public static WebElement hoverOnAreaByClassName(String className) { + Actions actions = new Actions(getDriver()); + WebElement area = getWebElementByClassName(className); + actions.moveToElement(area).perform(); + GeneralUIUtils.ultimateWait(); + return area; } - - public static WebElement getEelementByLinkText(String linkText) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='" + linkText + "']"))); + + public static void clickElementUsingActions(WebElement element){ + Actions actions = new Actions(getDriver()); + + actions.moveToElement(element); + actions.perform(); + + actions.click(); + actions.perform(); + + ultimateWait(); } - - public static List<WebElement> getEelementsBycontainsClassName(String classname) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions - .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '" + classname + "')]"))); + + public static void waitForLoader() { + waitForLoader(timeOut); } - - public static WebElement getButtonByClassName(String element) { - WebDriverWait wait = new WebDriverWait(driver, 3 * 60); - return wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='" + element + "']"))); + + public static void waitForLoader(int timeOut) { + sleep(500); + waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut); } - - public static void checkinCheckout(String elementName) throws Exception, Exception { - checkIn(); - getWebElementWaitForVisible(elementName).click(); - ; - checkOut(); - + + public static void findComponentAndClick(String resourceName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); + try{ + searchTextbox.clear(); + searchTextbox.sendKeys(resourceName); + ultimateWait(); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); + e.printStackTrace(); + } + + + try{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName)); + clickOnElementByTestId(resourceName); + GeneralUIUtils.ultimateWait(); + getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); + e.printStackTrace(); + } } - - public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) { - moveToStep(Stepname.getValue()); + + + public static String getComponentVersion(String componentName) { + return GeneralUIUtils.getWebElementByTestID(componentName + "Version").getText(); } - - public static void moveToStep(String dataTestId) { - getWebButton(dataTestId).click(); - waitForLoader(); + + public static void windowZoomOut() { + final int zoomOutFactor = 3; + for (int i = 0; i < zoomOutFactor; i++) { + if(getDriver() instanceof FirefoxDriver) { + getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); + } + } } - - public static void editFile(String name) { - WebElement editfilebutton = driver.findElement(By.id("edit" + name + "")); - editfilebutton.click(); + + public static void resetZoom(){ + getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, "0")); } - - public static void deleteFile(String name) { - WebElement deletebutton = driver.findElement(By.id("delete" + name + "")); - deletebutton.click(); + + public static void windowZoomOutUltimate(){ + resetZoom(); + windowZoomOut(); +// JavascriptExecutor js = (JavascriptExecutor) driver; +// js.executeScript("document.body.style.zoom='90%'"); } - - public static void downloadFile(String name) { - WebElement downloadbutton = driver.findElement(By.id("download" + name + "")); - downloadbutton.click(); + + public static void clickASDCLogo() { + WebDriverWait wait = new WebDriverWait(getDriver(), 15); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("ASDC"))); + WebElement ClickASDCLogo = getDriver().findElement(By.linkText("ASDC")); + ClickASDCLogo.click(); + GeneralUIUtils.waitForLoader(); } - + public static void sleep(int duration) { try { Thread.sleep(duration); @@ -800,282 +433,358 @@ public final class GeneralUIUtils { throw new RuntimeException(e); } } - - public static void hasDriver() { - try { - driver.getCurrentUrl(); - driver.quit(); - } catch (NullPointerException e) { - } + + public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) { + moveToStep(Stepname.getValue()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", Stepname.toString())); } - public static void initDriver() { - try { - boolean remoteTesting = SetupCDTest.config.isRemoteTesting(); - if (!remoteTesting) { - System.out.println("opening LOCAL browser"); - driver = new FirefoxDriver(); - - } else { - System.out.println("opening REMOTE browser"); - String remoteEnvIP = SetupCDTest.config.getRemoteTestingMachineIP(); - String remoteEnvPort = SetupCDTest.config.getRemoteTestingMachinePort(); - DesiredCapabilities cap = new DesiredCapabilities(); - cap = DesiredCapabilities.firefox(); - cap.setPlatform(Platform.WINDOWS); - cap.setBrowserName("firefox"); - - String remoteNodeUrl = String.format(SetupCDTest.SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort); - driver = new RemoteWebDriver(new URL(remoteNodeUrl), cap); - } - - - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - + public static void moveToStep(String dataTestId) { + clickOnElementByTestId(dataTestId); + ultimateWait(); } - - public static void windowZoomOut() { - final int zoomOutFactor = 2; - for (int i = 0; i < zoomOutFactor; i++) { - driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); + + + public static Select getSelectList(String item, String datatestsid) { + Select selectlist = new Select(getWebElementByTestID(datatestsid)); + if (item != null) { + selectlist.selectByVisibleText(item); } + return selectlist; + } + + public static List<WebElement> waitForElementsListVisibilityTestMethod(DashboardCardEnum dataTestId) { + GeneralUIUtils.waitForLoader(); + return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']")); } - - public static void defineTagsList(ResourceReqDetails resource, String[] resourceTags) { - List<String> taglist = new ArrayList<String>(); - ; - WebElement resourceTagsTextbox = getWebElementWaitForVisible("i-sdc-tag-input"); - for (String tag : resourceTags) { - resourceTagsTextbox.clear(); - resourceTagsTextbox.sendKeys(tag); - resourceTagsTextbox.sendKeys(Keys.ENTER); - taglist.add(tag); - // waitForElements(By.className("sdc-loader"), 250, 15000); - } + + public static List<WebElement> getElementsByCSS(String cssString) throws InterruptedException { + GeneralUIUtils.waitForLoader(); + List<WebElement> assets = getDriver().findElements(By.cssSelector(cssString)); + return assets; } + + public static WebElement getElementfromElementByCSS(WebElement parentElement, String cssString){ + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + GeneralUIUtils.waitForLoader(); + return parentElement.findElement(By.cssSelector(cssString)); + } + + public static WebElement getElementfromElementByXPATH(WebElement parentElement, DashboardCardEnum dataTestId){ + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + GeneralUIUtils.waitForLoader(); + return HighlightMyElement( parentElement.findElement(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']"))); + } + + public static WebElement HighlightMyElement(WebElement element) { + JavascriptExecutor javascript = (JavascriptExecutor) getDriver(); + javascript.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: yellow; border: 4px solid yellow;"); + return element; + } + + public static WebElement getSelectedElementFromDropDown(String dataTestId){ + GeneralUIUtils.ultimateWait();; + WebElement selectedElement = new Select (getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).getFirstSelectedOption(); + return selectedElement; + } + + + public static void waitForPageLoadByReadyState() { + new WebDriverWait(getDriver(), 30).until((ExpectedCondition<Boolean>) wd -> + ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete")); + } + - // public static List<WebElement> waitForElements(By by, int napPeriod, int - // maxWaitMS){ - // List<WebElement> elements = null; - // - // elements = getDriver().findElements(by); - // if( currentWaitTimeMS > maxWaitMS){ - // } - // resource.setTags(taglist); - // return elements; - // } - public static void selectTabInRightPallete(String className) throws Exception { - WebElement tab = getEelementBycontainsClassName(className); - tab.click(); + public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) { + int maxWaitingPeriodMS = 10 * 1000; + int napPeriodMS = 100; + int sumOfWaiting = 0; + List<WebElement> elements = null; + boolean isKeepWaiting = false; + while (!isKeepWaiting) { + elements = func.get(); + isKeepWaiting = (expectedElementsCount == elements.size()); + sleep(napPeriodMS); + sumOfWaiting += napPeriodMS; + if (sumOfWaiting > maxWaitingPeriodMS) + return false; + } + return true; } - - public static WebElement getWebElement(WebDriver driver, String dataTestId) { - return waitForElementVisibility(dataTestId); + + public static String getActionDuration(Runnable func) throws Exception{ + long startTime = System.nanoTime(); + func.run(); + long estimateTime = System.nanoTime(); + long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime); + String durationString = String.format("%02d:%02d", duration / 60, duration % 60); + return durationString; } + + public static WebElement clickOnAreaJS(String areaId) { + return clickOnAreaJS(areaId, timeOut); + } + + + public static WebElement clickOnAreaJS(String areaId, int timeout) { + try{ + ultimateWait(); + WebElement area = getWebElementByTestID(areaId); + JavascriptExecutor javascript = (JavascriptExecutor) getDriver(); + //HighlightMyElement(area); + Object executeScript = javascript.executeScript("arguments[0].click();", area, "color: yellow; border: 4px solid yellow;"); + waitForLoader(timeout); + return area; + } + catch (Exception e){ + e.printStackTrace(); + } + return null; + } - public static void clickOkButton() throws InterruptedException { - // actionBuild(getWebButton("OK")); - // sleep(2000); - getWebButton("OK").click(); + + + public static WebElement clickOnAreaJS(WebElement areaId) throws InterruptedException { + JavascriptExecutor javascript = (JavascriptExecutor) getDriver(); + //HighlightMyElement(area); + javascript.executeScript("arguments[0].click();", areaId, "color: yellow; border: 4px solid yellow;"); + return areaId; + } + + + + public static void clickSomewhereOnPage() { + getDriver().findElement(By.cssSelector(".asdc-app-title")).click(); } - - public static WebElement waitForElementVisibility(String dataTestId) { - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); - return wait.until( - ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); + + public static void findComponentAndClickInCatalog(String resourceName) throws Exception { + // This method will find element by element name, don't use data-tests-id argument + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); + searchTextbox.clear(); + searchTextbox.sendKeys(resourceName); + ultimateWait(); + clickOnElementByText(resourceName); + ultimateWait(); } - - public static WebElement deleteVersion() { - return GeneralUIUtils.waitFordataTestIdVisibility("delete_version"); + + public static void clickOnElementByText(String textInElement) { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + HighlightMyElement(wait.until( + ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click(); } - - // public static List<WebElement> getFilterTitles() throws Exception { - // - // return - // GeneralUIUtils.getEelementsByClassName("i-sdc-designer-leftbar-section-title-text"); - // - // } - - public static void deleteVersionInUI() throws Exception { - - actionBuild(deleteVersion()); - deleteVersion().click(); - GeneralUIUtils.clickOkButton(); + + public static void clickOnElementByText(String textInElement, int customTimeout) { + WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout); + HighlightMyElement(wait.until( + ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click(); } - - public static void uploadFileWithJavaRobot(String FilePath, String FileName) throws Exception { - StringSelection sel = new StringSelection(FilePath + FileName); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null); - Thread.sleep(1000); - Robot robot = new Robot(); - robot.delay(1000); - - // Release Enter - robot.keyRelease(KeyEvent.VK_ENTER); - - // Press CTRL+V - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_V); - - // Release CTRL+V - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyRelease(KeyEvent.VK_V); - Thread.sleep(1000); - - // Press Enter - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - Thread.sleep(3000); + + public static void clickJSOnElementByText(String textInElement) throws Exception { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + clickOnAreaJS(wait.until( + ExpectedConditions.elementToBeClickable(findByText(textInElement)))); } + + public static void fluentWaitTestID(String dataTestId, String text) { + FluentWait<WebDriver> fluentWait = new FluentWait<WebDriver>(getDriver()) + .withTimeout(30, TimeUnit.SECONDS) + .pollingEvery(50, TimeUnit.MILLISECONDS) + .ignoring(NoSuchElementException.class); + + fluentWait.until(ExpectedConditions.refreshed( + ExpectedConditions.textToBePresentInElementValue(By.xpath("//*[@data-tests-id='" + dataTestId + "']"), text))); + } + + public static void regularWait(WebElement element, String text){ + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); - public static String catalogFilterTypeChecBox(TypesEnum enumtype) throws Exception { - String Type = enumtype.toString().toLowerCase(); - getWebElementWaitForVisible(enumtype.getValue()).click(); - return Type; + wait.until(ExpectedConditions.textToBePresentInElementValue(element, text)); + } + + public static void waitForAngular(){ + WebDriverWait wait = new WebDriverWait(getDriver(), 90, 100); + wait.until(AdditionalConditions.pageLoadWait()); + wait.until(AdditionalConditions.angularHasFinishedProcessing()); + } + + public static Object getAllElementAttributes(WebElement element) { + return ((JavascriptExecutor)getDriver()).executeScript("var s = []; var attrs = arguments[0].attributes; for (var l = 0; l < attrs.length; ++l) { var a = attrs[l]; s.push(a.name + ':' + a.value); } ; return s;", element); } + + public static boolean isElementReadOnly(WebElement element){ + try { + HighlightMyElement(element).clear(); + return false; + } catch (Exception e) { + return true; + } + } + + public static boolean isElementReadOnly(String dataTestId){ + return isElementReadOnly( + waitForElementVisibilityByTestId(dataTestId)); + } + + public static boolean isElementDisabled(WebElement element){ + return HighlightMyElement(element).getAttribute("class").contains("view-mode") || + element.getAttribute("class").contains("disabled"); + } + + public static boolean isElementDisabled(String dataTestId){ + return isElementDisabled( + waitForElementVisibilityByTestId(dataTestId)); + } + + public static void ultimateWait(){ + long startTime = System.nanoTime(); - public static List<String> catalogFilterStatusChecBox(CheckBoxStatusEnum statusEnum) throws Exception { - List<String> status = null; - switch (statusEnum) { - case IN_DESIGN: - status = Arrays.asList("NOT_CERTIFIED_CHECKIN", "NOT_CERTIFIED_CHECKOUT"); - getWebElementWaitForVisible(statusEnum.getCatalogValue()).click(); - break; - case READY_FOR_TESTING: - status = Arrays.asList("READY_FOR_CERTIFICATION"); - getWebElementWaitForVisible(statusEnum.getCatalogValue()).click(); - break; - case IN_TESTING: - status = Arrays.asList("CERTIFICATION_IN_PROGRESS"); - getWebElementWaitForVisible(statusEnum.getCatalogValue()).click(); - break; - case CERTIFIED: - status = Arrays.asList("CERTIFIED"); - getWebElementWaitForVisible(statusEnum.getCatalogValue()).click(); - break; - case DISTRIBUTED: - status = Arrays.asList("CERTIFIED"); - getWebElementWaitForVisible(statusEnum.getCatalogValue()).click(); - break; + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForBackLoader(); + GeneralUIUtils.waitForAngular(); + + long estimateTime = System.nanoTime(); + long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime); +// System.out.println("UltimateWait took: "+ duration); + if(duration > timeOut){ + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Delays on page, %d seconds", duration)); } - return status; +// waitForUINotification(); + } + + public static WebElement makeElementVisibleWithJS(WebElement element){ + String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';"; + ((JavascriptExecutor) getDriver()).executeScript(js, element); + return element; + } + + public static WebElement unhideElement(WebElement element, String attributeValue){ + String js = "arguments[0].setAttribute('class','" + attributeValue + "');"; + ((JavascriptExecutor) getDriver()).executeScript(js, element); + return element; + } + + public static WebElement findByText(String textInElement){ + return getDriver().findElement(searchByTextContaining(textInElement)); + } + public static By searchByTextContaining(String textInElement) { + return By.xpath("//*[contains(text(),'" + textInElement + "')]"); } - - public static void clickBreadCrumbs(BreadCrumbsButtonsEnum button) { - switch (button) { - case CATALOG: - GeneralUIUtils.getWebButton(button.getButton()).click(); - break; - case HOME: - GeneralUIUtils.getWebButton(button.getButton()).click(); - break; - case ON_BOARDING: - GeneralUIUtils.getWebButton(button.getButton()).click(); - break; - default: - break; + + + public static boolean findAndWaitByText(String textInElement, int timeout){ + try{ + WebDriverWait wait = new WebDriverWait(getDriver(), timeout); + wait.until(ExpectedConditions.presenceOfElementLocated(searchByTextContaining(textInElement))); + return true; + } + catch(Exception e){ + return false; + } + } + + public static WebElement getClickableButtonBy(By by, int timout){ + try{ + WebDriverWait wait = new WebDriverWait(getDriver(), timout); + WebElement element = wait.until(ExpectedConditions.elementToBeClickable(by)); + return element; + } + catch(Exception e){ + return null; + } + } + + + + public static WebElement getButtonWithText(String textInButton){ + try{ + return getDriver().findElement(By.xpath("//button[contains(text(),'" + textInButton + "')]")); + } + catch(Exception e) + { + return null; + } + } + + + public static List<WebElement> getElementsByDataTestsIdStartWith(String startWithString){ + ultimateWait(); + return getDriver().findElements(By.xpath("//*[starts-with(@data-tests-id,'" + startWithString + "')]")); + } + + public static void closeErrorMessage() { + WebElement okWebElement = getButtonWithText("OK"); + if (okWebElement != null){ + okWebElement.click(); + ultimateWait(); } } - - public static void clickPrintScreen() { - getEelementByClassName("e-sdc-small-print-screen").click(); + + public static WebElement getElementByCSS(String cssString) throws InterruptedException { + ultimateWait(); + return getDriver().findElement(By.cssSelector(cssString)); } - - public static void clickSubmitForTest() throws InterruptedException { - getWebButton("submit_for_testing").click(); - WebElement commentText = getDriver().findElement(By.className("w-sdc-modal-body-email")); - commentText.sendKeys("Submit For Test"); - sleep(3000); - clickOkButton(); + + public static String getDataTestIdAttributeValue(WebElement element) { + return element.getAttribute("data-tests-id"); } - - public static WebElement hoverOnArea(String areaId, WebDriver driver) { - Actions actions = new Actions(driver); - WebElement area = getWebElement(driver, areaId); - actions.moveToElement(area).perform(); - return area; + + public static String getTextContentAttributeValue(WebElement element) { + return element.getAttribute("textContent"); } - - public static WebElement moveToNextStep(DataTestIdEnum.StepsEnum Stepname) { - return getWebButton(Stepname.getValue()); + + public static WebElement getElementInsideElementByDataTestsId(WebElement element, String dataTestId) { + try{ + return element.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); + } + catch(Exception e){ + return null; + } } - - public static String getComponentVersion(String componentName) { - return GeneralUIUtils.getWebElementWaitForVisible(componentName + "Version").getText(); + + public static void clickOnElementByCSS(String cssString) throws Exception { + WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(cssString))).click(); + ultimateWait(); } - - public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception { - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); - StopWatch performanceMesuring = new StopWatch(); - performanceMesuring.start(); - WebElement element = wait - .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); - performanceMesuring.stop(); - element.click(); - performanceMesuring(dataTestId, performanceMesuring); - + public static String getRandomComponentName(String prefix) { + return prefix + GeneralUIUtils.randomNumber(); } - - private static void performanceMesuring(String dataTestId, StopWatch performanceMesuring) { - Reporter.log("click on: " + dataTestId); - System.out.println("click on: " + dataTestId); - Reporter.log("Total Load Time Until click on button : " + dataTestId + " " - + (((double) performanceMesuring.getTime()) / 1000) + " seconds"); - System.out.println("Total Load Time Until click on button : " + dataTestId + " " - + (((double) performanceMesuring.getTime()) / 1000) + " seconds"); - performanceMesuring.reset(); - performanceMesuring.start(); - Boolean waitForElementInVisibilityByClassName = GeneralUIUtils.waitForElementInVisibilityByClassName(driver, - "tlv-loader"); - performanceMesuring.stop(); - Reporter.log("Total time before loader disappear: " + (((double) performanceMesuring.getTime()) / 1000) - + " seconds"); - System.out.println("Total time before loader disappear: " + (((double) performanceMesuring.getTime()) / 1000) - + " seconds"); + public static int randomNumber() { + Random r = new Random(); + return r.nextInt(10000); } - - public static Boolean waitForElementInVisibilityByClassName(WebDriver driver, String className) { - WebDriverWait wait = new WebDriverWait(driver, 30); - return wait.until(ExpectedConditions.invisibilityOfElementLocated(By.className(className))); + + public static void waitForUINotification() { + List<WebElement> notificationElements = getDriver().findElements(By.className("ui-notification")); + if (!notificationElements.isEmpty()){ + notificationElements.forEach(WebElement::click); + } } - - public static void findComponentAndClick(ResourceReqDetails resource) throws Exception { - - WebElement searchTextbox = GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search"); - searchTextbox.clear(); - searchTextbox.sendKeys(resource.getName()); - clickOnHTMLElementByDataTestId(resource.getName()); + + public static boolean checkForDisabledAttribute(String dataTestId){ + Object elementAttributes = getAllElementAttributes(waitForElementVisibilityByTestId(dataTestId)); + return elementAttributes.toString().contains("disabled"); } - - public static void clickOnHTMLElementBylinkText(String linkText) throws Exception { - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); - StopWatch performanceMesuring = new StopWatch(); - performanceMesuring.start(); - WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText(linkText))); - performanceMesuring.stop(); - element.click(); - performanceMesuring(linkText, performanceMesuring); + + public static void dragAndDropElementByY(WebElement area, int yOffset) { + Actions actions = new Actions(getDriver()); + actions.dragAndDropBy(area, 10, yOffset).perform(); + ultimateWait(); } - public static void ultimateWait(){ - long startTime = System.nanoTime(); - - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.waitForAngular(); - - long estimateTime = System.nanoTime(); - long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime); - if(duration > timeOut){ - SetupCDTest.getExtendTest().log(LogStatus.WARNING, String.format("Delays on page, %d seconds", duration)); - } - } + public static void waitForBackLoader() { + waitForBackLoader(timeOut); + } + + public static void waitForBackLoader(int timeOut) { + sleep(100); + waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut); + } + + public static void addStringtoClipboard(String text){ + StringSelection selection = new StringSelection(text); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(selection, selection); + } - public static void waitForAngular(){ - WebDriverWait wait = new WebDriverWait(getDriver(), 90, 100); - wait.until(AdditionalConditions.pageLoadWait()); - wait.until(AdditionalConditions.angularHasFinishedProcessing()); - } - } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java new file mode 100644 index 0000000000..1bef2ad32c --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.utilities; + +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; +import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.testng.Assert; + +import com.aventstack.extentreports.Status; + +public final class HomeUtils { + + public static WebElement createAndImportButtons(CreateAndImportButtonsEnum type, WebDriver driver) + throws InterruptedException { + switch (type) { + case IMPORT_CP: + case IMPORT_VFC: + case IMPORT_VL: + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue()); + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue()); + + case IMPORT_VF: + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue()); + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue()); + case CREATE_SERVICE: + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click(); + ; + break; + + case CREATE_PRODUCT: + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click(); + break; + + default: + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue()); + driver.findElement(By.xpath("//*[@data-tests-id='createResourceButton']")).click(); + break; + } + return null; + + } + + public static String checkBoxLifeCyclestate(CheckBoxStatusEnum lifeCycle) { + String Status = "IN DESIGN CHECK OUT"; + switch (lifeCycle) { + case CHECKIN: + Status = "IN DESIGN CHECK IN"; + if (GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).isDisplayed()) { + GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click(); + } + break; + case CHECKOUT: + GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click(); + Status = "IN DESIGN CHECK OUT"; + break; + case IN_TESTING: + GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click(); + Status = "IN TESTING"; + break; + case READY_FOR_TESTING: + GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click(); + Status = "READY FOR TESTING"; + break; + case CERTIFIED: + GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click(); + Status = "CERTIFIED"; + break; + } + return Status; + } + + public static void findComponentAndClick(String componentName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "finding component " + componentName); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(componentName); + WebElement foundComp = null; + try { + foundComp = GeneralUIUtils.getWebElementByTestID(componentName); + foundComp.click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); + } catch (Exception e) { + String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName); + SetupCDTest.getExtendTest().log(Status.FAIL, msg); + System.out.println(msg); + Assert.fail(msg); + } + } + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java index f917a4784f..d1045eab76 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java @@ -23,21 +23,28 @@ package org.openecomp.sdc.ci.tests.utilities; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ImportAssetUIUtils { + + public static final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\"; + public static String fileName = "JDM_vfc.yml"; + public static final String toscaErrorMessage = "Invalid TOSCA template."; + public static final String yamlError = "Invalid YAML file."; + public static final String allReadyExistErro = "Imported resource already exists in ASDC Catalog."; public static void importAsssetAndFillGeneralInfo(String FILE_PATH, String fileName, ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception { ResourceUIUtils.importFileWithSendKey(FILE_PATH, fileName, type); - ResourceUIUtils.fillResourceGeneralInformationPage(resourceDetails, user); + ResourceUIUtils.fillResourceGeneralInformationPage(resourceDetails, user,true); } public static void importAsssetFillGeneralInfoAndSelectIcon(String FILE_PATH, String fileName, ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception { importAsssetAndFillGeneralInfo(FILE_PATH, fileName, resourceDetails, user, type); - GeneralUIUtils.clickCreateButton(); + GeneralPageElements.clickCreateButton(); ResourceUIUtils.selectRandomResourceIcon(); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java index db6bada41e..95fbefa040 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java @@ -23,40 +23,58 @@ package org.openecomp.sdc.ci.tests.utilities; import static org.testng.AssertJUnit.assertEquals; import java.io.File; -import java.io.FilenameFilter; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.nio.file.FileSystems; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.zip.ZipFile; +import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.json.JSONException; import org.json.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; public class OnboardingUtils { @@ -68,44 +86,106 @@ public class OnboardingUtils { private static String vendorLicenseAgreementId; private static String featureGroupId; - public int countFilesInZipDirectory(String filepath, String filename) throws Exception, Throwable { - ZipFile zipFile = new ZipFile(filepath + filename); - return zipFile.size() - 1; + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user) + throws Exception { + Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user); + + String vspid = pair.right.get("vspId"); + + prepareVspForUse(user, vspid); + + return pair; } - public static Object[] getZipFileNamesFromFolder(String filepath) { - return FileHandling.getFileNamesFromFolder(filepath, ".zip"); + public static void prepareVspForUse(User user, String vspid) throws Exception { + RestResponse checkin = checkinVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = submitVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); + + RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user); + assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); + + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); } - public static String createVendorSoftwareProduct(String HeatFileName, String filepath, User user) + public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user) throws Exception { + String vspName = handleFilename(HeatFileName); + + SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); + + Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user); + RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; + assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); + String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); + String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); + + Map<String, String> vspMeta = createNewVspPair.right; + Map<String, String> vspObject = new HashMap<String, String>(); + Iterator<String> iterator = vspMeta.keySet().iterator(); + while(iterator.hasNext()){ + Object key = iterator.next(); + Object value = vspMeta.get(key); + vspObject.put(key.toString(), value.toString()); + } + vspObject.put("vspId", vspid); + vspObject.put("componentId", componentId); + vspObject.put("vendorName", vendorLicenseName); + vspObject.put("attContact", user.getUserId()); + + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); + assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = validateUpload(vspid, user); + assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); + + Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); + + return pair; + } + + public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{ + RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); + deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL); + ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); + deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP); + addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId); + prepareVspForUse(user, vspId); + } + + public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user) throws Exception, Throwable { String vspName = handleFilename(HeatFileName); - SetupCDTest.getExtendTest().log(LogStatus.INFO, "Starting to create vendor software product"); + SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product"); - RestResponse createNewVendorSoftwareProduct = createNewVendorSoftwareProduct(vspName, vendorLicenseName, - vendorId, vendorLicenseAgreementId, featureGroupId, user); - assertEquals("did not succeed to create new VSP", 200, - createNewVendorSoftwareProduct.getErrorCode().intValue()); - String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); + RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user); assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = validateUpload(vspId, user); + assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); + + RestResponse checkin = checkinVendorSoftwareProduct(vspId, user); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); - RestResponse checkin = checkinVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); - RestResponse submit = submitVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); + RestResponse submit = submitVendorSoftwareProduct(vspId, user); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); + RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user); + assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue()); - SetupCDTest.getExtendTest().log(LogStatus.INFO, "Succeeded to create vendor software product"); + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product"); return vspName; } - private static String handleFilename(String heatFileName) { + public static String handleFilename(String heatFileName) { final String namePrefix = "ciVFOnboarded-"; final String nameSuffix = "-" + getShortUUID(); @@ -123,9 +203,88 @@ public class OnboardingUtils { String vnfName = namePrefix + subHeatFileName + nameSuffix; return vnfName; } + + public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{ + vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; + if (vspComponentId != null){ + if (snmpPoll != null){ + ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); + RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId); + assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue()); + } + if (snmpTrap != null){ + ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); + RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId); + assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue()); + } + } + + return vspComponentId; + } + + public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{ + return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null); + } + + private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user, + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + Config config = Utils.getConfig(); + String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload", + config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + return uploadFile(filepath, zipArtifact, snmpPollUrl, user); + } + + private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user, + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + Config config = Utils.getConfig(); + String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload", + config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + return uploadFile(filepath, zipArtifact, snmpTrapUrl, user); + } + + private static RestResponse deleteSnmpArtifact(String componentId, String vspId, User user, SnmpTypeEnum snmpType) throws Exception + { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s", + config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue()); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendDelete(url, headersMap); + return response; + } + + + + private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException { + RestResponse components = getVSPComponents(vspid, user); + String response = components.getResponse(); + Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response); + JSONArray results = (JSONArray)responseMap.get("results"); + for (Object res : results){ + Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString()); + String componentId = compMap.get("id").toString(); + return componentId; + } + return null; + } + + private static RestResponse getVSPComponents(String vspid, User user) throws Exception{ + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendGet(url, headersMap); + return response; + } public static void createVendorLicense(User user) throws Exception { - SetupCDTest.getExtendTest().log(LogStatus.INFO, "Starting to create vendor license"); + SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); vendorLicenseName = "ciLicense" + getShortUUID(); RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); assertEquals("did not succeed to create vendor license model", 200, @@ -161,16 +320,18 @@ public class OnboardingUtils { RestResponse submitVendorLicense = submitVendorLicense(vendorId, user); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); - SetupCDTest.getExtendTest().log(LogStatus.INFO, "Succeeded to create vendor license"); + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); } private static String getShortUUID() { return UUID.randomUUID().toString().split("-")[0]; } - private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) throws Exception { + private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) + throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/actions", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -183,18 +344,20 @@ public class OnboardingUtils { return response; } - private static RestResponse checkinVendorLicense(String vspid, User user) throws Exception { + public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception { return actionOnComponent(vspid, "Checkin", "vendor-license-models", user); } - private static RestResponse submitVendorLicense(String vspid, User user) throws Exception { + public static RestResponse submitVendorLicense(String vspid, User user) throws Exception { return actionOnComponent(vspid, "Submit", "vendor-license-models", user); } - private static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { + public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), config.getCatalogBePort()); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), + config.getCatalogBePort()); String userId = user.getUserId(); + JSONObject jObject = new JSONObject(); jObject.put("vendorName", name); jObject.put("description", "new vendor license model"); @@ -208,12 +371,11 @@ public class OnboardingUtils { } - private static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) + public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-agreements", + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); JSONObject licenseTermpObject = new JSONObject(); @@ -234,12 +396,11 @@ public class OnboardingUtils { return response; } - private static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, + public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, String entitlementPoolId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/feature-groups", + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -257,11 +418,10 @@ public class OnboardingUtils { } - private static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { + public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/entitlement-pools", + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); JSONObject jEntitlementMetricObject = new JSONObject(); @@ -299,11 +459,10 @@ public class OnboardingUtils { return response; } - private static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { + public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-key-groups", + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); JSONObject jOperationalScope = new JSONObject(); @@ -323,8 +482,11 @@ public class OnboardingUtils { return response; } - private static RestResponse createNewVendorSoftwareProduct(String name, String vendorName, String vendorId, + public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, String vendorName, String vendorId, String licenseAgreementId, String featureGroupsId, User user) throws Exception { + + Map<String, String> vspMetadta = new HashMap<String, String>(); + Config config = Utils.getConfig(); String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products", config.getCatalogBeHost(), config.getCatalogBePort()); @@ -334,36 +496,79 @@ public class OnboardingUtils { JSONObject jlicensingDataObj = new JSONObject(); jlicensingDataObj.put("licenseAgreement", licenseAgreementId); jlicensingDataObj.put("featureGroups", Arrays.asList(featureGroupsId).toArray()); + + JSONObject jlicensingVersionObj = new JSONObject(); + jlicensingVersionObj.put("id", "1.0"); + jlicensingVersionObj.put("label", "1.0"); JSONObject jObject = new JSONObject(); jObject.put("name", name); jObject.put("description", "new VSP description"); jObject.put("category", "resourceNewCategory.generic"); jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("licensingVersion", "1.0"); + jObject.put("licensingVersion", jlicensingVersionObj); jObject.put("vendorName", vendorName); jObject.put("vendorId", vendorId); jObject.put("icon", "icon"); jObject.put("licensingData", jlicensingDataObj); - + + vspMetadta.put("description", jObject.getString("description")); + vspMetadta.put("category", jObject.getString("category")); + vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]); + Map<String, String> headersMap = prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + + return new Pair<RestResponse, Map<String, String>>(response, vspMetadta); + } + + public static RestResponse getVendorSoftwareProduct(Map vspObject, User user) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/" + vspObject.get("vspId"), + config.getCatalogBeHost(), config.getCatalogBePort()); + + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + HttpRequest http = new HttpRequest(); + + RestResponse response = http.httpsSendGet(url, headersMap); return response; } + + public static RestResponse validateUpload(String vspid, User user) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - private static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) - throws Exception { + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + HttpRequest http = new HttpRequest(); + + String body =null; + + RestResponse response = http.httpSendPut(url, body, headersMap); + + return response; + } + + public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception { Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + return uploadFile(filepath, filename, url, user); + } + + private static RestResponse uploadFile(String filepath, String filename, String url, User user) + throws FileNotFoundException, IOException, ClientProtocolException { CloseableHttpResponse response = null; MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create(); mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename))); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/upload", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - Map<String, String> headersMap = prepareHeadersMap(user.getUserId()); headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data"); @@ -433,15 +638,19 @@ public class OnboardingUtils { return filePath.toFile(); } - private static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception { + public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception { return actionOnComponent(vspid, "Checkin", "vendor-software-products", user); } + + private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception { + return actionOnComponent(vspid, "Checkout", "vendor-software-products", user); + } - private static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception { + public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception { return actionOnComponent(vspid, "Submit", "vendor-software-products", user); } - private static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception { + public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception { return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user); } @@ -450,8 +659,162 @@ public class OnboardingUtils { headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); - return headersMap; } + + private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{ + String vspName = vsp.left; + Map<String, String> vspMetadata = vsp.right; + boolean vspFound = HomePage.searchForVSP(vspName); + + if (vspFound){ + + List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); +// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); +// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); +// findElement.click(); + elemenetsFromTable.get(1).click(); + GeneralUIUtils.waitForLoader(); + + if (isUpdate){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); + + } + else{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue()); + } + + String lifeCycleState = ResourceGeneralPage.getLifeCycleState(); + boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue()); + if (needCheckout) + { + try { + ResourceGeneralPage.clickCheckoutButton(); + Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout"); + + } catch (Exception e) { + ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout"); + e.printStackTrace(); + } + GeneralUIUtils.waitForLoader(); + } + + //Metadata verification + VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata); + + ExtentTestActions.log(Status.INFO, "Clicking create/update VNF"); + String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated()); + ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration); + } + else{ + Assert.fail("Did not find VSP named " + vspName); + } + } + + private static void waitUntilVnfCreated() { + GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(60*10); + GeneralUIUtils.waitForAngular(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + } + + public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{ + ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left); + importUpdateVSP(vsp, true); + } + + public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{ + ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left); + importUpdateVSP(vsp, false); + } + + public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable { + ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); + System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile)); + + Map<String, String> vspMap = vsp.right; + String vspId = vspMap.get("vspId"); + + updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user); + HomePage.showVspRepository(); + updateVSP(vsp); + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile); + } + + public static Pair<String, Map<String, String>> onboardAndValidate(String filepath, String vnfFile, User user) throws Exception { + ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); + System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); + + createVendorLicense(user); + Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user); + String vspName = createVendorSoftwareProduct.left; + + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); + File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); + + ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); + HomePage.showVspRepository(); + ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf(".")))); + importVSP(createVendorSoftwareProduct); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + // Verify deployment artifacts + Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath()); + + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); + ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts); + + List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")). + map(e -> e.getFileName()). + collect(Collectors.toList()); + + validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); + + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + return createVendorSoftwareProduct; + } + + public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts, + List<String> heatEnvFilesFromCSAR) { + String artifactVersion; + String artifactName; + + for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { + artifactVersion = "1"; + + if(deploymentArtifact.getType().equals("HEAT_ENV")) { + continue; + } else if(deploymentArtifact.getFileName().contains(".")) { + artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")); + } else { + artifactName = deploymentArtifact.getFileName().trim(); + } + + if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){ + artifactVersion = "2"; + } + ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType()); + } + } + +} + +enum SnmpTypeEnum{ + SNMP_POLL ("snmp"), + SNMP_TRAP ("snmp-trap"); + + private String value; + + public String getValue() { + return value; + } + + private SnmpTypeEnum(String value) { + this.value = value; + } + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java new file mode 100644 index 0000000000..9e478c8523 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.utilities; + +import java.awt.AWTException; +import java.util.List; + +import org.junit.rules.TestName; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +/** + * @author al714h + * + */ + +public class ProductUIUtils { + + protected static WebDriver driver; + + public ProductUIUtils(TestName name, String className) { + super(); + } + + public static void fillProductGeneralPage(ProductReqDetails product, User user) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page.. ")); + ProductGeneralPage.defineName(product.getName()); + ProductGeneralPage.defineFullName(product.getFullName()); + ProductGeneralPage.defineDescription(product.getDescription()); + ProductGeneralPage.defineProjectCode(product.getProjectCode()); + defineTagsList2(product.getTags()); + ProductGeneralPage.defineContactId(product.getContactId()); + GeneralUIUtils.clickSomewhereOnPage(); + } + + public static void createProduct(ProductReqDetails product, User user) throws Exception, AWTException { + clikAddProduct(); + fillProductGeneralPage(product, user); + GeneralPageElements.clickCreateButton(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Product %s created", product.getName())); + } + + public static void defineTagsList2(List<String> productTags){ + WebElement productTagsTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.TAGS.getValue()); + for (String tag : productTags) { + productTagsTextbox.clear(); + productTagsTextbox.sendKeys(tag); + GeneralUIUtils.waitForAngular(); + productTagsTextbox.sendKeys(Keys.ENTER); + } + } + + public static void clikAddProduct(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Product button")); + try { + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } catch (Exception e){ + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Product button, retrying ...")); + GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new"); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java index a625630196..62b2f832bd 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java @@ -23,10 +23,13 @@ package org.openecomp.sdc.ci.tests.utilities; import java.util.HashMap; import java.util.Map; -import org.openecomp.sdc.ci.tests.datatypes.PropertyInfo; +import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.PropertiesPage; import org.openqa.selenium.WebElement; +import com.aventstack.extentreports.Status; + public class PropertiesUIUtils { // public static void addPropertByType(String type,String name,String @@ -46,17 +49,17 @@ public class PropertiesUIUtils { ResourceUIUtils.definePropertyName(name); if (itemType == "boolean") { ResourceUIUtils.defineBoolenDefaultValue(defaultValue); - GeneralUIUtils.defineDescription(description); + GeneralUIUtils.setWebElementByTestId("description","description"); Thread.sleep(2000); - GeneralUIUtils.getWebButton("Add").click(); + GeneralUIUtils.getWebElementByTestID("Add").click(); ; } else if (itemType == "list" || itemType == "map") { GeneralUIUtils.getSelectList(schemaType, "schemaType"); } if (!(itemType == "boolean")) { ResourceUIUtils.defineDefaultValueByType(defaultValue); - GeneralUIUtils.defineDescription(description); - GeneralUIUtils.getWebButton("Add").click(); + GeneralUIUtils.setWebElementByTestId("description", "des"); + GeneralUIUtils.getWebElementByTestID("Add").click(); ; Thread.sleep(2000); } @@ -69,23 +72,36 @@ public class PropertiesUIUtils { } public static void vlidateProperties(Map<String, String> propertyValues) throws InterruptedException { - WebElement name = GeneralUIUtils - .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name"))); + WebElement name = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name")); name.getText().equalsIgnoreCase(propertyValues.get("name")); - WebElement defaultValue = GeneralUIUtils - .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name"))); + WebElement defaultValue = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name")); defaultValue.getText().equalsIgnoreCase(propertyValues.get("defaultValue")); - WebElement type = GeneralUIUtils - .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("type"))); + WebElement type = GeneralUIUtils.getWebElementByTestID(propertyValues.get("type")); type.getText().equalsIgnoreCase(propertyValues.get("type")); } - public static void addNewProperty(PropertyInfo property) { + public static void addNewProperty(PropertyTypeEnum property) { + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding new %s property", property.name())); + PropertiesPage.clickAddPropertyArtifact(); PropertiesPage.getPropertyPopup().insertPropertyName(property.getName()); - PropertiesPage.getPropertyPopup().selectPropertyType(property.getType().getType()); + PropertiesPage.getPropertyPopup().selectPropertyType(property.getType()); PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription()); PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue()); - + PropertiesPage.getPropertyPopup().clickSave(); + } + + public static void updateProperty(PropertyTypeEnum property) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating property: %s", property.name())); + PropertiesPage.clickOnProperty(property.getName()); + PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription()); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue()); + PropertiesPage.getPropertyPopup().clickSave(); + } + + public static void changePropertyDefaultValueInComposition(String propertyName, String defaultValue) { + GeneralUIUtils.clickOnElementByTestId(propertyName); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(defaultValue); PropertiesPage.getPropertyPopup().clickSave(); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java index 9b374c10b8..c76bf4b74a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java @@ -26,7 +26,11 @@ import static org.testng.AssertJUnit.assertTrue; import java.awt.AWTException; import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; +import java.io.File; import java.util.Arrays; import java.util.List; import java.util.Random; @@ -45,16 +49,21 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceCategoriesNameEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openqa.selenium.By; +import org.openqa.selenium.ElementNotVisibleException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.AssertJUnit; +import com.aventstack.extentreports.Status; + public final class ResourceUIUtils { public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-"; protected static final boolean IS_BEFORE_TEST = true; @@ -78,20 +87,62 @@ public final class ResourceUIUtils { GeneralUIUtils.getSelectList(category, datatestsid); } - + + // public static void uploadFileWithJavaRobot(String FilePath,String + // FileName) throws Exception{ + // + // StringSelection Path= new StringSelection(FilePath+FileName); + // Thread.sleep(1000); + // java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(Path, + // null); + // Robot robot = new Robot(); + // robot.delay(1000); + // robot.keyPress(KeyEvent.VK_CONTROL); + // robot.keyPress(KeyEvent.VK_V); + // robot.keyRelease(KeyEvent.VK_V); + // robot.keyRelease(KeyEvent.VK_CONTROL); + // robot.delay(1000); + // robot.keyPress(KeyEvent.VK_ENTER); + // robot.keyRelease(KeyEvent.VK_ENTER); + // robot.delay(1000); + // } + // click and upload tosca file //**to be changed. public static void importFileWithSendKey(String FilePath, String FileName, CreateAndImportButtonsEnum type) throws Exception { - WebElement importButton = GeneralUIUtils.createAndImportButtons(type, driver).findElement(By.tagName("input")); + WebElement importButton = HomeUtils.createAndImportButtons(type, driver).findElement(By.tagName("input")); importButton.sendKeys(FilePath + FileName); } public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception { - WebElement browsebutton = GeneralUIUtils.waitForBrowseButton("browseButton"); + WebElement browsebutton = GeneralUIUtils.getWebElementByTestID("browseButton"); browsebutton.sendKeys(FilePath + FileName); } + // public static void defineVendorName(String resourceVendorName) { + // + // WebElement resourceVendorNameTextbox = + // GeneralUIUtils.getWebElementByTestID("vendorName"); + // resourceVendorNameTextbox.clear(); + // resourceVendorNameTextbox.sendKeys(resourceVendorName); + // } + + // public static void defineTagsList(ResourceReqDetails resource,String + // []resourceTags) { + // List<String>taglist = new ArrayList<String>();; + // WebElement resourceTagsTextbox = + // GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input"); + // for (String tag : resourceTags) { + // resourceTagsTextbox.clear(); + // resourceTagsTextbox.sendKeys(tag); + // resourceTagsTextbox.sendKeys(Keys.ENTER); + // taglist.add(tag); + // } + // resource.setTags(taglist); + // } + public static String defineUserId(String userId) { - WebElement resourceUserIdTextbox = GeneralUIUtils.getWebElementWaitForVisible("contactId"); + // + WebElement resourceUserIdTextbox = ResourceGeneralPage.getContactIdField(); resourceUserIdTextbox.clear(); resourceUserIdTextbox.sendKeys(userId); return userId; @@ -99,7 +150,7 @@ public final class ResourceUIUtils { public static void defineVendorRelease(String resourceVendorRelease) { - WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementWaitForVisible("vendorRelease"); + WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementByTestID("vendorRelease"); resourceVendorReleaseTextbox.clear(); resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease); } @@ -138,7 +189,7 @@ public final class ResourceUIUtils { public static String getErrorMessageText(String text) throws Exception { - return GeneralUIUtils.getEelementBycontainsClassName(text).getText(); + return GeneralUIUtils.getWebElementByClassName(text).getText(); } @@ -234,32 +285,65 @@ public final class ResourceUIUtils { return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-View']", 5); } - public static void waitOpenCard(String requiredElementUniqueId) throws Exception { - WebElement menu = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']")); - GeneralUIUtils.actionBuild(menu); - } +// public static void waitOpenCard(String requiredElementUniqueId) throws Exception { +// WebElement menu = GeneralUIUtils.getDriver() +// .findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']")); +// GeneralUIUtils.hoverOnAreaByTestId(menu); +// } - public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user) { + public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user, boolean isNewResource) { try { - ResourceGeneralPage.defineName(resource.getName()); ResourceGeneralPage.defineDescription(resource.getDescription()); ResourceGeneralPage.defineCategory(resource.getCategories().get(0).getSubcategories().get(0).getName()); ResourceGeneralPage.defineVendorName(resource.getVendorName()); ResourceGeneralPage.defineVendorRelease(resource.getVendorRelease()); - ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" }); + if (isNewResource){ + ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" }); + } + else{ + ResourceGeneralPage.defineTagsList(resource, new String[] { "one-more-tag" }); + } } catch (Exception e) { throw new RuntimeException(e); } } + + public static void fillMaxValueResourceGeneralInformationPage(ResourceReqDetails resource) { + String stringPattern = "ABCDabcd123456"; + GeneralUIUtils.addStringtoClipboard(buildStringFromPattern(stringPattern, 5000)); + ResourceGeneralPage.defineNameWithPaste(); + ResourceGeneralPage.defineDescriptionWithPaste(); + ResourceGeneralPage.defineVendorNameWithPaste(); + ResourceGeneralPage.defineVendorReleaseWithPaste(); +// ResourceGeneralPage.defineName(buildStringFromPattern(stringPattern, 5000)); +// ResourceGeneralPage.defineDescription(buildStringFromPattern(stringPattern, 5000)); +// ResourceGeneralPage.defineVendorName(buildStringFromPattern(stringPattern, 5000)); +// ResourceGeneralPage.defineVendorRelease(buildStringFromPattern(stringPattern, 5000)); +// ResourceGeneralPage.defineTagsList(resource, new String[] { buildStringFromPattern(stringPattern, 5000) }); + ResourceGeneralPage.defineTagsListWithPaste(); + GeneralUIUtils.waitForAngular(); + } + + public static String buildStringFromPattern(String stringPattern, int stringLength){ + char[] chars = stringPattern.toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < stringLength; i++) { + char c = chars[random.nextInt(chars.length)]; + sb.append(c); + } + return sb.toString(); + } public static void fillNewResourceValues(ResourceReqDetails resource, User user) throws Exception { - fillResourceGeneralInformationPage(resource, user); - GeneralUIUtils.clickCreateButton(); + fillResourceGeneralInformationPage(resource, user, true); + GeneralPageElements.clickCreateButton(); + // selectIcon(); } // coded by teddy. + public static WebElement waitfunctionforallelements(String element) { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5); return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + element + "']"))); @@ -273,18 +357,18 @@ public final class ResourceUIUtils { public static void getVFCGeneralInfo(ResourceReqDetails resource, User user) throws InterruptedException { Thread.sleep(2000); - String version = GeneralUIUtils.getWebElements("versionvalue").get(0).getText().substring(1); - String name = GeneralUIUtils.getWebElementWaitForVisible("name").getAttribute("value"); - String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value"); + String version = GeneralUIUtils.getWebElementsListByTestID("versionvalue").get(0).getText().substring(1); + String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value"); + String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value"); String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption() .getText(); - String vendorName = GeneralUIUtils.getWebElementWaitForVisible("vendorName").getAttribute("value"); - String vendorRelease = GeneralUIUtils.getWebElementWaitForVisible("vendorRelease").getAttribute("value"); - List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text"); - String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText(); + String vendorName = GeneralUIUtils.getWebElementByTestID("vendorName").getAttribute("value"); + String vendorRelease = GeneralUIUtils.getWebElementByTestID("vendorRelease").getAttribute("value"); + List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text"); + String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText(); int index = type.lastIndexOf(":"); System.out.println(type.substring(0, index)); - String ContactId = GeneralUIUtils.getWebElementWaitForVisible("contactId").getAttribute("value"); + String AttContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value"); System.out.println(resource.getVersion()); assertTrue(resource.getVersion().equals(version)); assertTrue(resource.getName().equals(name)); @@ -294,7 +378,7 @@ public final class ResourceUIUtils { assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category)); assertTrue(resource.getVendorName().equals(vendorName)); assertTrue(resource.getVendorRelease().equals(vendorRelease)); - assertTrue(resource.getCreatorUserId().equals(ContactId)); + assertTrue(resource.getCreatorUserId().equals(AttContact)); assertEquals(type.substring(0, index), resource.getResourceType()); for (int i = 0; i < tags.size(); i++) { @@ -303,8 +387,39 @@ public final class ResourceUIUtils { } public static void getGeneralInfo(ResourceReqDetails resource, User user) { - List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("tag"); + // clickMore(); + // String + // componentType=waitFunctionForaGetElements("componentType",3).getText(); + // String version=waitFunctionForaGetElements("version",3).getText(); + // String + // category=waitFunctionForaGetElements("category",3).getText();//get + // right panel Category. + // String + // resourceType=waitFunctionForaGetElements("resourceType",3).getText();//get + // right panel SubCategory. + // String date=waitfunctionforelements("creationDate",3).getText(); + // String aouthor=waitfunctionforallelements("author'",3).getText(); + // String + // vendorName=waitFunctionForaGetElements("vendorName",3).getText(); + // String + // vendorRelease=waitFunctionForaGetElements("vendorRelease",3).getText(); + // String + // AttContact=waitFunctionForaGetElements("attContact",3).getText(); + // String + // Description=waitFunctionForaGetElements("description",3).getText(); + List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag"); + // // String TagVF=waitFunctionForaGetElements("tag",3).getText(); + // assertTrue(componentType.equals("RESOURCE")); + // assertTrue(version.equals(resource.getVersion())); + // assertTrue(category.equals(resource.getCategories().get(0).getName())); + // assertEquals(resourceType,resource.getResourceType()); + // // assertEquals(Date,resource.getCreationDate()); + // // assertEquals(Aouthor,resource.getCreatorFullName()); + // assertTrue(vendorName.equals(resource.getVendorName())); + // assertTrue(vendorRelease.equals(resource.getVendorRelease())); + // assertTrue(AttContact.equals(resource.getAttContact())); + // assertTrue(Description.equals(resource.getDescription()+"\nLess")); for (WebElement tag : tags) { System.out.println(resource.getTags().get(0)); } @@ -323,13 +438,13 @@ public final class ResourceUIUtils { // right // panel // SubCategory. - String date = GeneralUIUtils.getEelementByClassName("creationDate").getText(); + String date = GeneralUIUtils.getWebElementByClassName("creationDate").getText(); String aouthor = waitfunctionforallelements("author'").getText(); String vendorName = waitFunctionForaGetElements("vendorName", 3).getText(); String vendorRelease = waitFunctionForaGetElements("vendorRelease", 3).getText(); - String contactId = waitFunctionForaGetElements("contactId", 3).getText(); + String attContact = waitFunctionForaGetElements("attContact", 3).getText(); String description = waitFunctionForaGetElements("description", 3).getText(); - List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("tag"); + List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag"); assertTrue(componentType.equals("RESOURCE")); assertTrue(version.equals(resource.getVersion())); assertTrue(category.equals(resource.getCategories().get(0).getName())); @@ -338,7 +453,7 @@ public final class ResourceUIUtils { // assertEquals(Aouthor,resource.getCreatorFullName()); assertTrue(vendorName.equals(resource.getVendorName())); assertTrue(vendorRelease.equals(resource.getVendorRelease())); - assertTrue(contactId.equals(resource.getContactId())); + assertTrue(attContact.equals(resource.getContactId())); assertTrue(description.equals(resource.getDescription() + "\nLess")); assertTrue(tags.equals("Tag-150")); } @@ -390,7 +505,7 @@ public final class ResourceUIUtils { // Aouthor=waitfunctionforallelements("selectedComponent.creatorFullName'").getText(); String VendorName = waitfunctionforallelements("selectedComponent.vendorName").getText(); String VendorRelease = waitfunctionforallelements("selectedComponent.vendorRelease").getText(); - String contactId = waitfunctionforallelements("selectedComponent.contactId").getText(); + String AttContact = waitfunctionforallelements("selectedComponent.attContact").getText(); String Description = waitfunctionforallelements("selectedComponent.description").getText(); String TagVF = waitfunctionforallelements("tag").getText(); AssertJUnit.assertEquals(ResourceType, resource.getResourceType()); @@ -402,7 +517,7 @@ public final class ResourceUIUtils { // assertEquals(Aouthor,resource.getCreatorFullName()); AssertJUnit.assertEquals(VendorName, resource.getVendorName()); AssertJUnit.assertEquals(VendorRelease, resource.getVendorRelease()); - AssertJUnit.assertEquals(contactId, resource.getContactId()); + AssertJUnit.assertEquals(AttContact, resource.getContactId()); AssertJUnit.assertEquals(Description, resource.getDescription() + "\nLess"); AssertJUnit.assertEquals(TagVF, "qa123"); } @@ -412,7 +527,7 @@ public final class ResourceUIUtils { .findElement(By.className("ellipsis-directive-more-less")); clickButtonSubmit.click(); } - + public static RestResponse createResourceInUI(ResourceReqDetails resource, User user) throws Exception, AWTException { System.out.println("creating resource..."); @@ -424,23 +539,51 @@ public final class ResourceUIUtils { return getCreatedResource; } - public static RestResponse createResource(ResourceReqDetails resource, User user) throws Exception, AWTException { - - ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); - ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); - GeneralUIUtils.waitForLoader(); - // GeneralUIUtils.sleep(1000); - fillResourceGeneralInformationPage(resource, user); - GeneralUIUtils.clickCreateButton(); - return null; - + public static void createResource(ResourceReqDetails resource, User user) throws Exception { + ExtentTestActions.log(Status.INFO, "Going to create a new VF."); + WebElement addVFButton = null; + try { + GeneralUIUtils.ultimateWait(); + try{ + GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new"); + addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); + } + catch (Exception e){ + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resource.getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.WARNING, "Add VF button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath)); + showButtonsADD(); + addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); + } + addVFButton.click(); + GeneralUIUtils.ultimateWait(); + } + catch (Exception e ) { + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD VF button, retrying ... ")); + GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new"); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } + fillResourceGeneralInformationPage(resource, user, true); + resource.setVersion("0.1"); + GeneralPageElements.clickCreateButton(); } + + public static void updateResource(ResourceReqDetails resource, User user){ + ResourceGeneralPage.defineContactId(resource.getContactId()); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating General screen fields ...")); + fillResourceGeneralInformationPage(resource, user, false); + ResourceGeneralPage.clickUpdateButton(); + } + + public static RestResponse updateResourceInformationPage(ResourceReqDetails resource, User user) throws Exception, AWTException { - fillResourceGeneralInformationPage(resource, user); - GeneralUIUtils.clickCreateButton(); + fillResourceGeneralInformationPage(resource, user, true); + GeneralPageElements.clickCreateButton(); return null; } @@ -504,7 +647,7 @@ public final class ResourceUIUtils { } public static String lifeCycleStateUI() throws InterruptedException { - return GeneralUIUtils.getWebElementWaitForVisible("formlifecyclestate").getText(); + return GeneralUIUtils.getWebElementByTestID("formlifecyclestate").getText(); } public static List<String> catalogFilterResourceCategoriesChecBox(ResourceCategoriesNameEnum enumName) @@ -512,106 +655,106 @@ public final class ResourceUIUtils { List<String> categories = Arrays.asList(); switch (enumName) { case APPLICATIONL4: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("applicationServer", "defaulticon", "vl", "cp", "call_controll", "borderElement", "network", "firewall", "database", "loadBalancer"); break; case APPLICATION_SERVER: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon"); break; case BORDER_ELEMENT: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("borderElement", "vl", "cp", "defaulticon"); break; case CALL_CONTROL: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("call_controll", "vl", "cp", "defaulticon"); break; case COMMON_NETWORK_RESOURCES: - GeneralUIUtils.getEelementByLinkText("Common Network Resources").click(); + GeneralUIUtils.getWebElementByLinkText("Common Network Resources").click(); categories = Arrays.asList("network", "vl", "cp", "defaulticon"); break; case CONNECTION_POINTS: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("cp", "defaulticon"); break; case DATABASE: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("database", "vl", "cp", "defaulticon"); break; case DATABASE_GENERIC: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("database", "vl", "cp", "defaulticon"); break; case FIREWALL: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("firewall", "vl", "cp", "defaulticon"); break; case GATEWAY: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("gateway", "vl", "cp", "defaulticon"); break; case INFRASTRUCTURE: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("connector", "vl", "cp", "defaulticon"); break; case INFRASTRUCTUREL23: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("ucpe", "vl", "cp", "defaulticon"); break; case LAN_CONNECTORS: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon"); break; case LOAD_BALANCER: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("loadBalancer", "vl", "cp", "defaulticon"); break; case MEDIA_SERVERS: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "vl", "cp", "defaulticon"); break; case NETWORKL4: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "vl", "cp", "defaulticon"); break; case NETWORK_ELEMENTS: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("port", "defaulticon", "network", "connector", "vl", "cp"); break; case NETWORK_L23: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "vl", "defaulticon", "cp", "router", "port", "connector", "gateway", "ucpe"); break; case NETWORK_CONNECTIVITY: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "vl", "cp", "defaulticon"); break; case GENERIC: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("database", "port", "loadBalancer", "vl", "cp", "objectStorage", "compute", "defaulticon", "ucpe", "network", "connector"); break; case ABSTRACT: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("objectStorage", "compute", "defaulticon", "cp", "vl"); break; case Router: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("router", "vl", "cp", "defaulticon"); break; case VIRTUAL_LINKS: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("vl", "defaulticon"); break; case WAN_Connectors: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon"); break; case WEB_SERVER: - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon"); break; } @@ -625,7 +768,7 @@ public final class ResourceUIUtils { } public static void selectTabInRightPallete(String className) throws Exception { - WebElement tab = GeneralUIUtils.getEelementBycontainsClassName(className); + WebElement tab = GeneralUIUtils.getWebElementByClassName(className); tab.click(); } @@ -643,7 +786,7 @@ public final class ResourceUIUtils { * @param dataTestId * @throws Exception */ - public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception { + public static void getWebElementByTestID(String dataTestId) throws Exception { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); WebElement element = wait .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); @@ -662,12 +805,12 @@ public final class ResourceUIUtils { * * @param className */ - public static void moveToHTMLElementByClassName(String className) { - Actions actions = new Actions(GeneralUIUtils.getDriver()); - final WebElement createButtonsArea = GeneralUIUtils - .retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className))); - actions.moveToElement(createButtonsArea).perform(); - } +// public static void moveToHTMLElementByClassName(String className) { +// Actions actions = new Actions(GeneralUIUtils.getDriver()); +// final WebElement createButtonsArea = GeneralUIUtils +// .retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className))); +// actions.moveToElement(createButtonsArea).perform(); +// } /** * Move to HTML element by element id. When moving to the HTML element, it @@ -675,29 +818,29 @@ public final class ResourceUIUtils { * * @param className */ - static void moveToHTMLElementByDataTestId(String dataTestId) { - // WebElement hoverArea = - // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" - // + dataTestId + "']")); - WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId); - // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), - // 30); - // wait.until(ExpectedConditions.visibilityOf(hoverArea)); - - Actions actions = new Actions(GeneralUIUtils.getDriver()); - actions.moveToElement(hoverArea).perform(); - } +// static void moveToHTMLElementByDataTestId(String dataTestId) { +// // WebElement hoverArea = +// // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" +// // + dataTestId + "']")); +// WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId); +// // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), +// // 30); +// // wait.until(ExpectedConditions.visibilityOf(hoverArea)); +// +// Actions actions = new Actions(GeneralUIUtils.getDriver()); +// actions.moveToElement(hoverArea).perform(); +// } // public static ResourceReqDetails createResourceInUI(User user){ // try{ // ResourceReqDetails defineResourceDetails = // defineResourceDetails(ResourceTypeEnum.VF); // ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); - // ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); + // ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); // GeneralUIUtils.waitForLoader(); //// GeneralUIUtils.sleep(1000); // fillResourceGeneralInformationPage(defineResourceDetails, user); - // GeneralUIUtils.clickCreateButton(); + // GeneralPageElements.clickCreateButton(); // return defineResourceDetails; // } // catch( Exception e){ @@ -717,18 +860,122 @@ public final class ResourceUIUtils { public static void importVfc(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user) throws Exception { - GeneralUIUtils.hoverOnArea(Dashboard.IMPORT_AREA.getValue()); + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VFC resource ", resourceMetaData.getName())); + GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue()); + GeneralUIUtils.ultimateWait(); + // Insert file to the browse dialog + WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC"); + WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue()); + if (!buttonVFC.isDisplayed()){ + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath)); + } + try{ + fileInputElement.sendKeys(filePath + fileName); + } catch (ElementNotVisibleException e) { + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible")); + showButtons(); + fileInputElement.sendKeys(filePath + fileName); + } + // Fill the general page fields. + GeneralUIUtils.ultimateWait(); + fillResourceGeneralInformationPage(resourceMetaData, user, true); + GeneralPageElements.clickCreateButton(); + } + + public static void importVfcNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user) + throws Exception { + GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue()); // Insert file to the browse dialog - final WebElement browseWebElement = GeneralUIUtils - .getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue()); - browseWebElement.sendKeys(filePath + fileName); - + WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC"); + WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue()); + if (!buttonVFC.isDisplayed()){ + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath)); + } + try{ + fileInputElement.sendKeys(filePath + fileName); + } catch (ElementNotVisibleException e) { + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible")); + showButtons(); + fileInputElement.sendKeys(filePath + fileName); + } // Fill the general page fields. GeneralUIUtils.waitForLoader(); - fillResourceGeneralInformationPage(resourceMetaData, user); - GeneralUIUtils.clickCreateButton(); - + fillResourceGeneralInformationPage(resourceMetaData, user, true); + } + + + public static void importVfFromCsar(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user) + throws Exception { + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s", resourceMetaData.getName())); + GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue()); + GeneralUIUtils.ultimateWait(); + // Insert file to the browse dialog + WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset"); + WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue()); + if (!buttonDCAE.isDisplayed()){ + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath)); + } + try{ + fileInputElement.sendKeys(filePath + fileName); + } catch (ElementNotVisibleException e) { + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible")); + showButtons(); + fileInputElement.sendKeys(filePath + fileName); + } + // Fill the general page fields. + GeneralUIUtils.ultimateWait(); + fillResourceGeneralInformationPage(resourceMetaData, user, true); + GeneralPageElements.clickCreateButton(10*60); +// GeneralUIUtils.ultimateWait(); "don't change import of csar can take longer then 3 minutes" + GeneralUIUtils.waitForLoader(10*60); } + + public static void importVfFromCsarNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user) + throws Exception { + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s, Create button will not be clicked", resourceMetaData.getName())); + GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue()); + GeneralUIUtils.ultimateWait(); + // Insert file to the browse dialog + WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset"); + WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue()); + if (!buttonDCAE.isDisplayed()){ + File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName()); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath)); + } + try{ + fileInputElement.sendKeys(filePath + fileName); + } catch (ElementNotVisibleException e) { + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible")); + showButtons(); + fileInputElement.sendKeys(filePath + fileName); + } + // Fill the general page fields. + GeneralUIUtils.ultimateWait(); + fillResourceGeneralInformationPage(resourceMetaData, user, true); + GeneralUIUtils.waitForLoader(10*60); + } + + public static void updateVfWithCsar(String filePath, String fileName) { + ExtentTestActions.log(Status.INFO, "Updating VF with updated CSAR file named " + fileName); + WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.GeneralElementsEnum.UPLOAD_FILE_INPUT.getValue()); + browseWebElement.sendKeys(filePath + fileName); + GeneralUIUtils.ultimateWait(); + GeneralPageElements.clickUpdateButton(); + GeneralUIUtils.waitForLoader(); + ExtentTestActions.log(Status.INFO, "VF is updated."); + } + + // public static ResourceReqDetails importVfcInUI(User user, String // filePath, String fileName, ResourceTypeEnum resourceType) { @@ -744,7 +991,7 @@ public final class ResourceUIUtils { // // Fill the general page fields. // GeneralUIUtils.waitForLoader(); // fillResourceGeneralInformationPage(defineResourceDetails, user); - // GeneralUIUtils.clickCreateButton(); + // GeneralPageElements.clickCreateButton(); // return defineResourceDetails; // } @@ -771,7 +1018,7 @@ public final class ResourceUIUtils { // // Fill the general page fields. // GeneralUIUtils.waitForLoader(); // fillResourceGeneralInformationPage(defineResourceDetails, user); - // GeneralUIUtils.clickCreateButton(); + // GeneralPageElements.clickCreateButton(); // return defineResourceDetails; // } @@ -807,13 +1054,14 @@ public final class ResourceUIUtils { public static WebElement getErrorMessageText(WebDriver driver, String text) throws Exception { - return GeneralUIUtils.getEelementBycontainsClassName(text); + return GeneralUIUtils.getWebElementByClassName(text); } public static void fillGeneralInfoValuesAndIcon(ResourceReqDetails resource, User user) throws Exception { - fillResourceGeneralInformationPage(resource, user); - GeneralUIUtils.clickCreateButton(); + fillResourceGeneralInformationPage(resource, user, true); + + GeneralPageElements.clickCreateButton(); selectRandomResourceIcon(); } @@ -824,17 +1072,17 @@ public final class ResourceUIUtils { Thread.sleep(2000); WebDriver driver = GeneralUIUtils.getDriver(); String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText(); - String name = GeneralUIUtils.getWebElement(driver, "name").getAttribute("value"); - String description = GeneralUIUtils.getWebElement(driver, "description").getAttribute("value"); + String name = GeneralUIUtils.getWebElementByTestID( "name").getAttribute("value"); + String description = GeneralUIUtils.getWebElementByTestID( "description").getAttribute("value"); String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption() .getText(); - String vendorName = GeneralUIUtils.getWebElement(driver, "vendorName").getAttribute("value"); - String vendorRelease = GeneralUIUtils.getWebElement(driver, "vendorRelease").getAttribute("value"); - List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text"); - String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText(); + String vendorName = GeneralUIUtils.getWebElementByTestID( "vendorName").getAttribute("value"); + String vendorRelease = GeneralUIUtils.getWebElementByTestID( "vendorRelease").getAttribute("value"); + List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text"); + String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText(); int index = type.lastIndexOf(":"); System.out.println(type.substring(0, index)); - String contactId = GeneralUIUtils.getWebElement(driver, "contactId").getAttribute("value"); + String AttContact = GeneralUIUtils.getWebElementByTestID( "attContact").getAttribute("value"); System.out.println(resource.getVersion()); assertTrue(resource.getVersion().equals(version.substring(1))); assertTrue(resource.getName().equals(name)); @@ -844,7 +1092,7 @@ public final class ResourceUIUtils { assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category)); assertTrue(resource.getVendorName().equals(vendorName)); assertTrue(resource.getVendorRelease().equals(vendorRelease)); - assertTrue(resource.getCreatorUserId().equals(contactId)); + assertTrue(resource.getCreatorUserId().equals(AttContact)); assertEquals(type.substring(0, index), resource.getResourceType()); for (int i = 0; i < tags.size(); i++) { @@ -854,11 +1102,42 @@ public final class ResourceUIUtils { public static RestResponse createResourceNG(ResourceReqDetails resource, User user) throws Exception, AWTException { - ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); - ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); - fillResourceGeneralInformationPage(resource, user); - GeneralUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()); + GeneralUIUtils.hoverOnAreaByTestId("w-sdc-dashboard-card-new"); + ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()); + fillResourceGeneralInformationPage(resource, user, true); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()); return null; } + + public static void showButtons(){ + String parentElementClassAttribute = "sdc-dashboard-import-element-container"; + WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute)); + GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute); + GeneralUIUtils.ultimateWait(); + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible...")); + } + + public static void showButtonsADD(){ + try { + GeneralUIUtils.ultimateWait(); + String parentElementClassAttribute = "sdc-dashboard-create-element-container"; + WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute)); + GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute); + GeneralUIUtils.ultimateWait(); + } catch (Exception e ){ + GeneralUIUtils.ultimateWait(); + String parentElementClassAttribute = "sdc-dashboard-create-element-container"; + WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute)); + GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute); + GeneralUIUtils.ultimateWait(); + } + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible...")); + } + + public static void clickOnElementByText(String textToClick, String customizationFoLog){ + String customizationFoLogLocal = customizationFoLog != null ? customizationFoLog : ""; + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s %s", textToClick, customizationFoLogLocal)); + GeneralUIUtils.clickOnElementByText(textToClick); + } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java index 10535e0157..b2bad99d2a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java @@ -23,23 +23,41 @@ package org.openecomp.sdc.ci.tests.utilities; import static org.testng.AssertJUnit.assertTrue; import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils; + +import com.aventstack.extentreports.Status; public class RestCDUtils { @@ -49,36 +67,40 @@ public class RestCDUtils { } public static RestResponse getResource(ResourceReqDetails resource, User user) { + final String getResourceMsg = "Trying to get resource named " + resource.getName() + " with version " + resource.getVersion(); + final String succeedGetResourceMsg = "Succeeded to get resource named " + resource.getName() + " with version " + resource.getVersion(); + final String failedGetResourceMsg = "Failed to get resource named " + resource.getName() + " with version " + resource.getVersion(); try { - System.out.println("trying to get resource"); + ExtentTestActions.log(Status.INFO, getResourceMsg); + System.out.println(getResourceMsg); GeneralUIUtils.sleep(1000); RestResponse getResourceResponse = null; String reourceUniqueId = resource.getUniqueId(); if (reourceUniqueId != null) { getResourceResponse = ResourceRestUtils.getResource(reourceUniqueId); if (getResourceResponse.getErrorCode().intValue() == 200) { - System.out.println("succeeded to get resource"); + ExtentTestActions.log(Status.INFO, succeedGetResourceMsg); + System.out.println(succeedGetResourceMsg); } return getResourceResponse; } JSONObject getResourceJSONObject = null; - getResourceResponse = ResourceRestUtils.getResourceByNameAndVersion(user.getUserId(), resource.getName(), - resource.getVersion()); + getResourceResponse = ResourceRestUtils.getResourceByNameAndVersion(user.getUserId(), resource.getName(), resource.getVersion()); if (getResourceResponse.getErrorCode().intValue() == 200) { - JSONArray jArray = new JSONArray(getResourceResponse.getResponse()); - for (int i = 0; i < jArray.length(); i++) { - getResourceJSONObject = jArray.getJSONObject(i); - String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(), - "resourceType"); - if (resourceType.equals(resource.getResourceType())) { - getResourceResponse.setResponse(getResourceJSONObject.toString()); +// JSONArray jArray = new JSONArray(getResourceResponse.getResponse()); +// for (int i = 0; i < jArray.length(); i++) { +// getResourceJSONObject = jArray.getJSONObject(i); +// String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(), "resourceType"); +// if (resourceType.equals(resource.getResourceType())) { +// getResourceResponse.setResponse(getResourceJSONObject.toString()); setResourceUniqueIdAndUUID(resource, getResourceResponse); - System.out.println("succeeded to get resource"); + ExtentTestActions.log(Status.INFO, succeedGetResourceMsg); + System.out.println(succeedGetResourceMsg); return getResourceResponse; - } - } +// } +// } } - + ExtentTestActions.log(Status.INFO, failedGetResourceMsg); return getResourceResponse; } catch (Exception e) { throw new RuntimeException(e); @@ -179,4 +201,144 @@ public class RestCDUtils { componentDetails.setUniqueId(null); } + + + public static String getExecutionHostAddress() { + + String computerName = null; + try { + computerName = InetAddress.getLocalHost().getHostAddress().replaceAll("\\.", "·"); + System.out.println(computerName); + if (computerName.indexOf(".") > -1) + computerName = computerName.substring(0, + computerName.indexOf(".")).toUpperCase(); + } catch (UnknownHostException e) { + System.out.println("Uknown hostAddress"); + } + return computerName != null ? computerName : "Uknown hostAddress"; + } + + public static Map<String, List<Component>> getCatalogAsMap() throws IOException { + User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); + RestResponse catalog = CatalogRestUtils.getCatalog(defaultAdminUser.getUserId()); + Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser + .convertCatalogResponseToJavaObject(catalog.getResponse()); + return convertCatalogResponseToJavaObject; + } + + public static Map<String, List<CategoryDefinition>> getCategories() throws Exception { + + User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); + + Map<String,List<CategoryDefinition>> map = new HashMap<String,List<CategoryDefinition>>(); + + + RestResponse allResourceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.RESOURCE_PARAM_NAME); + RestResponse allServiceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.SERVICE_PARAM_NAME); + + List<CategoryDefinition> parsedResourceCategories = ResponseParser.parseCategories(allResourceCategories); + List<CategoryDefinition> parsedServiceCategories = ResponseParser.parseCategories(allServiceCategories); + + map.put(ComponentTypeEnum.RESOURCE_PARAM_NAME, parsedResourceCategories); + map.put(ComponentTypeEnum.SERVICE_PARAM_NAME, parsedServiceCategories); + + return map; + } + + public static void deleteCreatedComponents(Map<String, List<Component>> map) throws IOException { + + System.out.println("going to delete all created components..."); + + User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); + final String userId = defaultAdminUser.getUserId(); + + List<Component> resourcesArrayList = map.get("products"); + List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("Ci")).map(e -> e.getUniqueId()) + .collect(Collectors.toList()); + for (String uId : collect) { + ProductRestUtils.deleteProduct(uId, userId); + } + + resourcesArrayList = map.get("services"); + collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) + .collect(Collectors.toList()); + for (String uId : collect) { + ServiceRestUtils.markServiceToDelete(uId, userId); + } + ServiceRestUtils.deleteMarkedServices(userId); + + resourcesArrayList = map.get("resources"); + collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) + .map(e -> e.getUniqueId()).collect(Collectors.toList()); + for (String uId : collect) { + ResourceRestUtils.markResourceToDelete(uId, userId); + } + ResourceRestUtils.deleteMarkedResources(userId); + + + + + + } + + public static void deleteCategoriesByList(List<CategoryDefinition> listCategories, String componentType, User user) throws Exception { + + for (CategoryDefinition categoryDefinition : listCategories) { + if (categoryDefinition.getName().toLowerCase().startsWith("ci")) { + List<SubCategoryDefinition> subcategories = categoryDefinition.getSubcategories(); + if (subcategories != null) { + for (SubCategoryDefinition subCategoryDefinition : subcategories) { + + CategoryRestUtils.deleteSubCategory(subCategoryDefinition.getUniqueId(), + categoryDefinition.getUniqueId(), user.getUserId(), + componentType); + } + } + + CategoryRestUtils.deleteCategory(categoryDefinition.getUniqueId(), user.getUserId(), + componentType); + + } + } + } + + public static String getUserRole(User reqUser, User user){ + try{ + RestResponse getUserRoleResp = UserRestUtils.getUserRole(reqUser, user); + JSONObject jObject = new JSONObject(getUserRoleResp.getResponse()); + return jObject.getString("role"); + } + catch(Exception e){ + return null; + } + } + + public static RestResponse getUser(User reqUser, User user){ + try{ + return UserRestUtils.getUser(reqUser, user); + } + catch(Exception e){ + return null; + } + } + + /*************************************/ + + public static void deleteOnDemand() throws IOException { + Config config = DriverFactory.getConfig(); + if(!config.getSystemUnderDebug()){ + deleteCreatedComponents(getCatalogAsMap()); + }else{ + System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ..."); + } + } + + public static void deleteCategories(User user) throws Exception { + Map<String, List<CategoryDefinition>> categoriesMap = getCategories(); + List<CategoryDefinition> listCategories = categoriesMap.get(ComponentTypeEnum.RESOURCE_PARAM_NAME); + deleteCategoriesByList(listCategories, ComponentTypeEnum.RESOURCE_PARAM_NAME, user); + listCategories = categoriesMap.get(ComponentTypeEnum.SERVICE_PARAM_NAME); + deleteCategoriesByList(listCategories, ComponentTypeEnum.SERVICE_PARAM_NAME, user); + } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java index 5c2608b51e..8b07e621d9 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java @@ -30,11 +30,14 @@ import java.util.List; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; import org.openecomp.sdc.ci.tests.datatypes.ServiceCategoriesNameEnum; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -45,7 +48,7 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; -import com.relevantcodes.extentreports.LogStatus; +import com.aventstack.extentreports.Status; public class ServiceUIUtils { @@ -56,7 +59,7 @@ public class ServiceUIUtils { } public static String defineServiceName(String Name) { - WebElement serviceName = GeneralUIUtils.getWebElementWaitForVisible("name"); + WebElement serviceName = GeneralUIUtils.getWebElementByTestID("name"); serviceName.clear(); serviceName.sendKeys(Name); return Name; @@ -90,7 +93,7 @@ public class ServiceUIUtils { public static String catalogFilterServiceCategoriesChecBox(ServiceCategoriesNameEnum enumName) throws Exception { String Type = null; - GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click(); return Type; } @@ -98,19 +101,19 @@ public class ServiceUIUtils { List<String> categories = null; switch (enumtype) { case NETWORK_L13: - GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click(); categories = Arrays.asList("network_l_1-3"); break; case NETWORKL4: - GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click(); categories = Arrays.asList("network_l_4 "); break; case MOBILITY: - GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click(); categories = Arrays.asList("mobility"); break; case VOIPCALL_CONTROL: - GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click(); + GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click(); categories = Arrays.asList("call_controll "); break; } @@ -118,16 +121,16 @@ public class ServiceUIUtils { } public static WebElement waitToNextButtonEnabled() { - return GeneralUIUtils.getWebButton("Next"); + return GeneralUIUtils.getWebElementByTestID("Next"); } public static WebElement waitToFinishButtonEnabled() { - return GeneralUIUtils.getWebButton("Finish"); + return GeneralUIUtils.getWebElementByTestID("Finish"); } public static WebElement deleteServiceInUI() { - return GeneralUIUtils.getWebButton("deleteVersion"); + return GeneralUIUtils.getWebElementByTestID("deleteVersion"); } // get the service view data for validate. @@ -136,42 +139,52 @@ public class ServiceUIUtils { Thread.sleep(2000); String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText() .substring(1); - String name = GeneralUIUtils.getWebElementWaitForVisible("name").getAttribute("value"); - String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value"); + String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value"); + String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value"); String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption() .getText(); - List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text"); - String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText(); + List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text"); + String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText(); int index = type.lastIndexOf(":"); System.out.println(type.substring(0, index)); - String contactId = GeneralUIUtils.getWebElementWaitForVisible("contactId").getAttribute("value"); - String projectCode = GeneralUIUtils.getWebElementWaitForVisible("projectCode").getAttribute("value"); + String attContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value"); + String pmatt = GeneralUIUtils.getWebElementByTestID("pmatt").getAttribute("value"); System.out.println(service.getVersion()); assertTrue(service.getVersion().equals(version)); assertTrue(service.getName().equals(name)); assertTrue(service.getDescription().equals(description)); assertTrue(service.getCategories().get(0).getName().equals(category)); System.out.println(service.getContactId()); - assertTrue(service.getContactId().equals(contactId)); - assertTrue(service.getProjectCode().equals(projectCode)); + assertTrue(service.getContactId().equals(attContact)); + assertTrue(service.getProjectCode().equals(pmatt)); for (int i = 0; i < tags.size(); i++) { assertEquals(service.getTags().get(i), tags.get(i).getText()); } } - public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) { - List<String> taglist = new ArrayList<String>(); - ; - WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementWaitForVisible("i-sdc-tag-input"); +// public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) { +// List<String> taglist = new ArrayList<String>(); +// WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input"); +// for (String tag : serviceTags) { +// serviceTagsTextbox.clear(); +// serviceTagsTextbox.sendKeys(tag); +// GeneralUIUtils.sleep(1000); +// serviceTagsTextbox.sendKeys(Keys.ENTER); +// taglist.add(tag); +// } +// taglist.add(0, service.getName()); +// service.setTags(taglist); +// } + + public static void defineTagsList2(List<String> serviceTags){ + WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input"); for (String tag : serviceTags) { serviceTagsTextbox.clear(); serviceTagsTextbox.sendKeys(tag); + GeneralUIUtils.waitForAngular(); serviceTagsTextbox.sendKeys(Keys.ENTER); - taglist.add(tag); } - taglist.add(0, service.getName()); - service.setTags(taglist); } public static Select defineServiceCategory(String category) { @@ -179,10 +192,10 @@ public class ServiceUIUtils { return GeneralUIUtils.getSelectList(category, "selectGeneralCategory"); } - public static void defineServiceProjectCode(String projectCode) { - WebElement projectCodeTextbox = GeneralUIUtils.getWebElementWaitForVisible("projectCode"); - projectCodeTextbox.clear(); - projectCodeTextbox.sendKeys(projectCode); + public static void defineServicePmatt(String pmatt) { + WebElement attPmattTextbox = GeneralUIUtils.getWebElementByTestID("pmatt"); + attPmattTextbox.clear(); + attPmattTextbox.sendKeys(pmatt); } public static void selectRandomResourceIcon() throws Exception { @@ -194,48 +207,80 @@ public class ServiceUIUtils { } public static String defineDescription(String description) { - WebElement descriptionTextbox = GeneralUIUtils.getWebElementWaitForVisible("description"); + WebElement descriptionTextbox = GeneralUIUtils.getWebElementByTestID("description"); descriptionTextbox.clear(); descriptionTextbox.sendKeys(description); return description; } public static void defineContactId(String userId) { - WebElement contactId = GeneralUIUtils.getWebElementWaitForVisible("contactId"); - contactId.clear(); - contactId.sendKeys(userId); + WebElement attContact = GeneralUIUtils.getWebElementByTestID("attContact"); + attContact.clear(); + attContact.sendKeys(userId); } public static WebElement clickAddArtifact() { - - return GeneralUIUtils.getWebButton("addArtifactButton"); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Artifact button")); + return GeneralUIUtils.getWebElementByTestID("addArtifactButton"); } public static WebElement getArtifactName() { - return GeneralUIUtils.getWebButton("artifactName"); + return GeneralUIUtils.getWebElementByTestID("artifactName"); } public static WebElement getArtifactDetails() { - return GeneralUIUtils.getWebButton("artifactDisplayName"); + return GeneralUIUtils.getWebElementByTestID("artifactDisplayName"); } public static void fillServiceGeneralPage(ServiceReqDetails service, User user) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page")); ServiceGeneralPage.defineName(service.getName()); ServiceGeneralPage.defineDescription(service.getDescription()); ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName()); ServiceGeneralPage.defineProjectCode(service.getProjectCode()); - ServiceGeneralPage.defineTagsList(service, new String[] { "This-is-tag", "another-tag" }); - + defineTagsList2(service.getTags()); + ServiceGeneralPage.defineContactId(service.getContactId()); + GeneralUIUtils.clickSomewhereOnPage(); } - + public static void createService(ServiceReqDetails service, User user) throws Exception, AWTException { - - ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); - ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()); - GeneralUIUtils.waitForLoader(); + clickAddService(); fillServiceGeneralPage(service, user); - GeneralUIUtils.clickCreateButton(); - SetupCDTest.getExtendTest().log(LogStatus.INFO, String.format("Service %s created", service.getName())); + GeneralPageElements.clickCreateButton(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("The service %s was created", service.getName())); + } + + public static void setServiceCategory(ServiceReqDetails service, ServiceCategoriesEnum category){ + CategoryDefinition categoryDefinition = new CategoryDefinition(); + categoryDefinition.setName(category.getValue()); + List<CategoryDefinition> categories = new ArrayList<>(); + categories.add(categoryDefinition); + service.setCategories(categories); + } + + public static void createServiceWithDefaultTagAndUserId(ServiceReqDetails service, User user) { + clickAddService(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Defining General Page fields")); + ServiceGeneralPage.defineName(service.getName()); + ServiceGeneralPage.defineDescription(service.getDescription()); + ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName()); + ServiceGeneralPage.defineProjectCode(service.getProjectCode()); + GeneralUIUtils.ultimateWait(); + GeneralPageElements.clickCreateButton(); + } + + public static void clickAddService(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking the Add Service button")); + try { + GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } catch (Exception e){ + SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Service button, retrying ...")); + GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new"); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click(); + GeneralUIUtils.ultimateWait(); + } } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java new file mode 100644 index 0000000000..25f71eeb0a --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.testng.Assert; +import org.testng.TestNGException; + +import com.aventstack.extentreports.Status; + +public class CatalogVerificator { + + public static int getResourceNumber(ResourceTypeEnum resourceType, Map<String, List<Component>> catalogAsMap) throws Exception { + List<Component> resourcesArrayList = catalogAsMap.get("resources"); + return resourcesArrayList.stream(). + filter(s -> ((Resource)s).getResourceType().equals(resourceType)). + collect(Collectors.toList()).size(); + } + + public static int getTypeNumber(TypesEnum enumtype) throws Exception{ + Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap(); + switch (enumtype) { + case RESOURCE: + return getResourceNumber(catalogAsMap); + case SERVICE: + return getServiceNumber(catalogAsMap); + case PRODUCT: + return getProductsNumber(catalogAsMap); + default: + return getResourceNumber(ResourceTypeEnum.valueOf(enumtype.name()), catalogAsMap); + } + } + + public static int getResourceNumber(Map<String, List<Component>> catalogAsMap) throws Exception { + return catalogAsMap.get("resources").size(); + } + + public static int getServiceNumber(Map<String, List<Component>> catalogAsMap) throws Exception { + return catalogAsMap.get("services").size(); + } + + public static int getProductsNumber(Map<String, List<Component>> catalogAsMap) throws Exception { + return catalogAsMap.get("products").size(); + } + + public static void validateType(TypesEnum enumtype) throws Exception{ + int numberOfElementsFromBE = getTypeNumber(enumtype); + int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements, should be %s ...", enumtype.name(), numberOfElementsFromBE)); + Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI)); + } + + public static int getStatusNumber(List<LifeCycleStateEnum> status) throws Exception { + Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap(); + return catalogAsMap.entrySet().stream(). + map(s -> s.getValue()). + flatMap(List::stream). + filter(s -> status.contains(mapBeLifecycleToUIStatus(s))). + collect(Collectors.toList()).size(); + } + + public static void validateStatus(List<LifeCycleStateEnum> status, String checkboxName) throws Exception{ + int numberOfElementsFromBE = getStatusNumber(status); + int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements , should be %s ...", checkboxName, numberOfElementsFromBE)); + Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI)); + } + + public static int getCategoryNumber(String categoryName) throws Exception { + Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap(); + List<Component> serviceAndResourceList = new ArrayList<Component>(); + serviceAndResourceList.addAll(catalogAsMap.get("resources")); + serviceAndResourceList.addAll(catalogAsMap.get("services")); + return serviceAndResourceList.stream(). + filter(s -> s.getCategories().get(0).getName().equals(categoryName)). + collect(Collectors.toList()).size(); + } + + public static void validateCategory(String categoryName) throws Exception{ + int numberOfElementsFromBE = getCategoryNumber(categoryName); + int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s category elements , should be %s ...", categoryName, numberOfElementsFromBE)); + Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI)); + } + + public static int getSubCategoryNumber(String categoryName , String subCategoryName) throws Exception { + Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap(); + List<Component> resourcesArrayList = catalogAsMap.get("resources"); + return resourcesArrayList.stream(). + filter(s -> s.getCategories().get(0).getName().equals(categoryName) && + s.getCategories().get(0).getSubcategories().get(0).getName().equals(subCategoryName)). + collect(Collectors.toList()).size(); + } + + public static void validateSubCategory(String categoryName, String subCategoryName) throws Exception{ + int numberOfElementsFromBE = getSubCategoryNumber(categoryName, subCategoryName); + int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s/%s subcategory elements , should be %s ...", categoryName, subCategoryName, numberOfElementsFromBE)); + Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI)); + } + + public static int getNumberOfElementsFromCatalogHeader(){ + String elementsAsString = GeneralUIUtils.getWebElementByClassName("w-sdc-dashboard-catalog-header").getText(); + String numberOfElementsAsString = elementsAsString.split(" ")[0]; + if (numberOfElementsAsString.equals("No")){ + return 0; + } else { + return Integer.parseInt(numberOfElementsAsString); + } + } + + private static LifeCycleStateEnum mapBeLifecycleToUIStatus(Component component){ + boolean isServiceAndDistributed = component.getComponentType().equals(ComponentTypeEnum.SERVICE) && + ((Service) component).getDistributionStatus().equals(DistributionStatusEnum.DISTRIBUTED); + switch (component.getLifecycleState()) { + case CERTIFIED: + if (isServiceAndDistributed){ + return LifeCycleStateEnum.DISTRIBUTED; + } else { + return LifeCycleStateEnum.CERTIFIED; + } + case READY_FOR_CERTIFICATION: + return LifeCycleStateEnum.READY_FOR_TESTING; + case CERTIFICATION_IN_PROGRESS: + return LifeCycleStateEnum.IN_TESTING; + case NOT_CERTIFIED_CHECKIN: + return LifeCycleStateEnum.CHECKIN; //to IN DESIGN + case NOT_CERTIFIED_CHECKOUT: + return LifeCycleStateEnum.CHECKOUT; //to IN DESIGN + default: + throw new TestNGException("Missing enum value in enum converter"); + } + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java new file mode 100644 index 0000000000..9cb305deae --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class CustomizationUUIDVerificator { + + public static void validateCustomizationUUIDuniqueness(List customizationUUIDs) { + boolean hasNoDuplicates = CustomizationUUIDVerificator.containsUnique(customizationUUIDs); + assertTrue("There are duplicate customizationUUIDs in list",hasNoDuplicates==true); + } + + public static <T> boolean containsUnique(List<T> list){ + Set<T> set = new HashSet<>(); + + for (T t: list){ + if (!set.add(t)) + return false; + } + + return true; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java new file mode 100644 index 0000000000..0d06d8ef96 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java @@ -0,0 +1,328 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.openqa.selenium.WebElement; +import org.testng.SkipException; +import org.testng.TestException; +import org.testng.TestNGException; + +import com.aventstack.extentreports.Status; + +public class DeploymentViewVerificator { + + private static String[] currentProperties = {"isBase", + "vf_module_label", + "vf_module_description", + "min_vf_module_instances", + "max_vf_module_instances", + "initial_count", + "vf_module_type", + "volume_group", + "vfc_list", + "availability_zone_count"}; + + private static Map<String, HashMap<String, List<String>>> deploymentViewData = new HashMap<String, HashMap<String, List<String>>>(){ + { + HashMap<String, List<String>> segw_heat_c3_base , segw_heat_c3_VMs1 ; + + segw_heat_c3_base = new HashMap<String, List<String>>(); + segw_heat_c3_base.put("members", Arrays.asList("segw_internet_security_group", "segw_security_group", "int_layer2vlan_net")); + segw_heat_c3_base.put("artifacts", Arrays.asList("segw_heat_c3_base.yml", "segw_heat_c3_base.env")); + segw_heat_c3_base.put("properties", Arrays.asList(currentProperties)); + put("segw_heat_c3_base", segw_heat_c3_base); + segw_heat_c3_VMs1 = new HashMap<String, List<String>>(); + segw_heat_c3_VMs1.put("members", Arrays.asList("segw_oam_protected_0_port", + "fw_oam_int_layer2vlan_1_port", + "segw_0", "segw_internet_1_port", + "segw_layer2vlan_2_port", + "fw_gn_0", "fw_gn_hsl_direct_3_port", + "fw_oam_oam_mgmt_0_port", + "fw_oam_hsl_direct_3_port", + "fw_gn_oam_mgmt_0_port", + "fw_oam_oam_direct_2_port", + "fw_gn_gn_direct_2_port", + "fw_oam_0", + "fw_gn_int_layer2vlan_1_port")); + segw_heat_c3_VMs1.put("artifacts", Arrays.asList("segw_heat_c3_VMs1.yml", "segw_heat_c3_VMs1.env")); + segw_heat_c3_VMs1.put("properties", Arrays.asList(currentProperties)); + put("segw_heat_c3_VMs1", segw_heat_c3_VMs1); + } + }; + + private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtefects = new HashMap<String, HashMap<String, List<String>>>(){ + { + HashMap<String, List<String>> module_1_ldsa, module_2_ldsa, base_ldsa; + + module_1_ldsa = new HashMap<String, List<String>>(); + module_1_ldsa.put("members", new ArrayList(Arrays.asList("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0"))); + module_1_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml"))); + module_1_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + put("module_1_ldsa", module_1_ldsa); + module_2_ldsa = new HashMap<String, List<String>>(); + module_2_ldsa.put("members", new ArrayList(Arrays.asList("ltm_server_0"))); + module_2_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml"))); + module_2_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + put("module_2_ldsa", module_2_ldsa); + base_ldsa = new HashMap<String, List<String>>(); + base_ldsa.put("members", new ArrayList(Arrays.asList("ldsa_sec_grp_1"))); + base_ldsa.put("artifacts", new ArrayList(Arrays.asList("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml"))); + base_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + put("base_ldsa", base_ldsa); + } + }; + + private Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile; + + public DeploymentViewVerificator(String pathToCSAR) throws Exception { + deploymentViewDataFromFile = getDeploymentViewDataFromCSAR(pathToCSAR); + } + + public DeploymentViewVerificator() throws Exception { + deploymentViewDataFromFile = deploymentViewDataMixedArtefects; + } + + + public void verifyDeploymentPageSubElements(String moduleName) throws Exception{ + HashMap<String, List<String>> moduleProperties = getDeploymentViewData().get(moduleName); + + // add env placeholder to deployment view data + if (!moduleProperties.get("artifacts").contains(moduleName + ".env")){ + moduleProperties.get("artifacts").add(moduleName + ".env"); + } + + List<WebElement> members, artifacts, properties; + members = DeploymentPage.getGroupMembersList(moduleName); + artifacts = DeploymentPage.getArtifactNames(); + properties = DeploymentPage.getPropertyNames(); + + File imageFilePath = GeneralUIUtils.takeScreenshot(moduleName + UUID.randomUUID(), SetupCDTest.getScreenshotFolder(), null); + final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artefacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath), + moduleName, moduleProperties.get("members").size(), moduleProperties.get("artifacts").size())); + + assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size()); + assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream(). + map(e -> e.getAttribute("textContent")). + collect(Collectors.toList()))); + assertTrue(moduleProperties.get("members").size() == members.size(), "Members amount not as expected, expected " + moduleProperties.get("members").size()); + assertTrue(moduleProperties.get("members").containsAll(members.stream(). + map(e -> e.getAttribute("textContent")). + collect(Collectors.toList()))); + assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size()); + assertTrue(moduleProperties.get("properties").containsAll(properties.stream(). + map(e -> e.getAttribute("textContent")). + collect(Collectors.toList()))); + DeploymentPage.clickOnProperties(); + DeploymentPage.clickOnArtifacts(); + } + + public void verifyDeploymentPageModules(List<WebElement> modules){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF groups , should be %s groups ", getDeploymentViewData().size())); + assertFalse(modules.isEmpty(), "No modules found"); + assertTrue(modules.size() == getDeploymentViewData().size(), "Modules amount not as expected, expected " + getDeploymentViewData().size()); + for (WebElement module: modules){ + assertTrue(getDeploymentViewData().containsKey(module.getText().split("\\.\\.")[1])); + } + } + + public static void verifyComponentNameChanged(String oldName, String newName){ + try{ + GeneralUIUtils.clickOnElementByText(oldName, 10); + assertTrue(false, "Element name don't changed"); + } catch(Exception e){ + GeneralUIUtils.clickOnElementByText(newName); + } + } + + public Map<String, HashMap<String, List<String>>> getDeploymentViewData() { +// return deploymentViewData; + return getDeploymentViewDataFromFile(); + } + + public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR, File mainServiceTemplate) throws Exception{ + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(mainServiceTemplate); + Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile = new HashMap<String, HashMap<String, List<String>>>(); + Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups(); + List<String> keyList = groups.keySet().stream().collect(Collectors.toList()); + HashMap<String, List<String>> groupsToArtefacts = getDeploymentArtefactsMapedToGroupsFromCSAR(pathToCSAR); + for(String groupKey: keyList){ + HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>(); + tempGroupMap.put("artifacts", groupsToArtefacts.get(groupKey)); + if (groups.get(groupKey).getMembers() == null){ + tempGroupMap.put("members", Arrays.asList()); + } else { + tempGroupMap.put("members", groups.get(groupKey).getMembers()); + } + tempGroupMap.put("properties", Arrays.asList(currentProperties)); + deploymentViewDataFromFile.put(groupKey, tempGroupMap); + } + return deploymentViewDataFromFile; + } + + public static HashMap<String, List<String>> getDeploymentArtefactsMapedToGroupsFromCSAR(String pathToFile) throws Exception { + Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToFile); + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); + HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>(); + for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { + String groupName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().indexOf(".")); + if(deploymentArtifact.getType().equals("HEAT")) { + tempGroupMap.put(groupName, new ArrayList(Arrays.asList(deploymentArtifact.getFileName().trim()))); + } else { + // update current key + tempGroupMap.get(groupName).add(deploymentArtifact.getFileName().trim()); + tempGroupMap.put(groupName, tempGroupMap.get(groupName)); + } + } + return tempGroupMap; + } + + public static Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromCSAR(String pathToCsar) throws Exception { + String outputFolder = unzipCsarFile(pathToCsar); + + File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + "MainServiceTemplate.yaml"); + Map<String, HashMap<String, List<String>>> deploymentViewData = buildDeploymentViewDataFromCSAR(pathToCsar, pathToMainServiceTemplate); + cleanFolders(outputFolder); + + return deploymentViewData; + } + + public static void cleanFolders(String outputFolder) throws IOException { + System.gc(); + FileUtils.cleanDirectory(new File(outputFolder)); + FileUtils.deleteDirectory(new File(outputFolder)); + } + + public static String unzipCsarFile(String pathToCsar) { + File csarFile = new File(pathToCsar); + + + File dir = new File(csarFile.getParent() + File.separator + "output"+UUID.randomUUID() + File.separator + UUID.randomUUID()); + if(!dir.exists()) { + dir.mkdirs(); + } + + String outputFolder = dir.getPath(); + ArtifactFromCsar.unZip(pathToCsar, outputFolder); + return outputFolder; + } + + public static void validateEditPopoverFields(String expectedVNFName, String expectedHeatName, String expectedModuleName){ + String VNFname = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.RESOURCE_NAME_ON_POPOVER.getValue()).getText(); + String heatName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue()).getAttribute("value"); + String moduleName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.MODULE_NAME_ON_POPOVER.getValue()).getText(); + assertTrue(expectedVNFName.equals(VNFname), String.format("VNF name Expected: %s, Actual: %s ", expectedVNFName, VNFname)); + assertTrue(expectedHeatName.equals(heatName), String.format("HEAT name Expected: %s, Actual: %s ", expectedHeatName, heatName )); + assertTrue(expectedModuleName.equals(moduleName), String.format("Module name Expected: %s, Actual: %s ", expectedModuleName, moduleName)); + } + + public static void validateEditPopoverButtons(String newName, String invalidModuleName, String validModueName ){ + DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.X_BUTTON); + verifyComponentNameChanged(invalidModuleName, validModueName); + DeploymentPage.clickOnEditIcon(); + DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.CANCEL); + verifyComponentNameChanged(invalidModuleName, validModueName); + } + + public static void validateEditPopover() throws Exception{ + String moduleRowText = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()).get(0).getText(); + DeploymentPage.clickOnModuleName(moduleRowText); + DeploymentPage.clickOnEditIcon(); + String[] splitedModuleName = moduleRowText.split("\\.\\."); + + validateEditPopoverFields(splitedModuleName[0], splitedModuleName[1], splitedModuleName[2]); + + String newName = "kuku"; + String newModuleName = DeploymentPage.reconstructModuleName(splitedModuleName, newName); + validateEditPopoverButtons(newName, newModuleName, moduleRowText); + } + + private Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromFile() { + return deploymentViewDataFromFile; + } + + public static void validateModuleNameUpadate() throws Exception{ + List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()); + int i = 0; + for(WebElement moduleRow :moduleRowsFromTable){ + String moduleRowText = moduleRow.getText(); + String updatedName = "updatedName" + i; + DeploymentPage.updateModuleName(moduleRowText, updatedName); + String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), updatedName); + verifyComponentNameChanged(moduleRowText, updatedModuleName); + // Close module + GeneralUIUtils.clickOnElementByText(updatedModuleName); + i++; + } + } + + public static void regularDepoymentScreenVerificator(Map<String, HashMap<String, String>> metaDataFromUI, DeploymentViewVerificator verificator) throws Exception, InterruptedException { + ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen(); + List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()); + verificator.verifyDeploymentPageModules(moduleRowsFromTable); + for(WebElement moduleRow :moduleRowsFromTable){ + String moduleRowText = moduleRow.getText(); + String middleName = moduleRowText.split("\\.\\.")[1]; + verificator.verifyDeploymentPageSubElements(middleName); + if (metaDataFromUI != null){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1]))); + String groupVersion = DeploymentPage.getGroupVersion().split(":")[1].trim(); + String increasedVersion = String.valueOf(Integer.parseInt(metaDataFromUI.get(middleName).get("version")) + 1); + assertTrue(groupVersion.equals(increasedVersion)); + if ( metaDataFromUI.get(middleName).get("moduleID") != "primary"){ + String moduleID = DeploymentPage.getModuleID(); + assertFalse(moduleID.equals(metaDataFromUI.get(middleName).get("moduleID"))); + } + } + // Close module + GeneralUIUtils.clickOnElementByText(moduleRowText); + } + } + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java new file mode 100644 index 0000000000..f53bfa4e07 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.ci.tests.datatypes.ErrorMessageProperties; +import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.testng.Assert; + +import com.aventstack.extentreports.Status; + +public class ErrorMessageUIVerificator { + + private static ErrorMessageProperties getErrorByType(ActionStatus errorType){ + try{ + ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(errorType.name()); + String messageId = errorInfo.getMessageId(); + String code = errorInfo.getCode().toString(); + + return new ErrorMessageProperties(messageId, code); + } + catch(Exception e){ + return null; + } + } + + public static void validateErrorMessage(ActionStatus errorMessage) { + String errorMessageBox = null; + try{ + errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + } + catch(Exception e){ + ExtentTestActions.log(Status.INFO, "Did not find an error message popup."); + Assert.fail("Did not find an error message popup."); + } + + ExtentTestActions.log(Status.INFO, "An error message raised, validating its content."); + ErrorMessageProperties expectedResponseError = getErrorByType(errorMessage); + Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getCode()), "Error message code is not " + expectedResponseError.getCode()); + Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getMessageId()), "Error message ID is not " + expectedResponseError.getMessageId()); + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java index cbad80d344..2c133e6246 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java @@ -20,24 +20,58 @@ package org.openecomp.sdc.ci.tests.verificator; -import static org.testng.AssertJUnit.assertTrue; +import static org.testng.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.function.Predicate; +import java.util.stream.Collector; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.GroupInstanceProperty; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesPopupEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentPage; +import org.openecomp.sdc.ci.tests.pages.PropertyPopup; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; +import org.testng.SkipException; + +import com.aventstack.extentreports.Status; public class ServiceVerificator { - private ServiceVerificator() { - } + private ServiceVerificator() { + } public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC, User user) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing the number of components on the canvas; should be %s", numOfVFC)); String responseAfterDrag = null; component.setVersion(version); if (component instanceof ServiceReqDetails) { @@ -48,6 +82,45 @@ public class ServiceVerificator { JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); int size = ((JSONArray) jsonResource.get("componentInstances")).size(); assertTrue(size == numOfVFC); + ExtentTestActions.log(Status.INFO, "The number of components on the canvas was verified."); + } + + public static void verifyServiceUpdatedInUI(ServiceReqDetails service) { + assertTrue(service.getName().equals(ResourceGeneralPage.getNameText())); + assertTrue(service.getDescription().equals(ResourceGeneralPage.getDescriptionText())); + assertTrue(service.getCategory().equals(ServiceGeneralPage.getCategoryText())); + assertTrue(service.getProjectCode().equals(ServiceGeneralPage.getProjectCodeText())); + for(String tag: ServiceGeneralPage.getTags()){ + assertTrue(service.getTags().contains(tag)); + } + assertTrue(service.getContactId().equals(ResourceGeneralPage.getContactIdText())); + } + + public static void verifyServiceDeletedInUI(ServiceReqDetails service) throws InterruptedException { + Thread.sleep(1000); + List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.DASHBOARD_CARD.getValue()); + if (!(cardElements.isEmpty())){ + for (WebElement cardElement: cardElements){ + WebElement componentName = GeneralUIUtils.getElementfromElementByCSS(cardElement, + DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue()); + WebElement componentType = GeneralUIUtils.getElementfromElementByCSS(cardElement, + DataTestIdEnum.DashboardCardEnum.ASSET_TYPE_CSS.getValue()); + + String componentNameStr = componentName.getAttribute("textContent").trim(), + componentTypeStr = componentType.getAttribute("class"); + + if(componentTypeStr.equals("S")){ + assertTrue( !(componentNameStr.equals(service.getName())), "Deleted service was found !!!"); + } + } + } + } + + public static void verifyServiceLifecycle(ServiceReqDetails service, User user, LifecycleStateEnum expectedLifecycleState) { + String responseAfterDrag = RestCDUtils.getService(service, user).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + String actualLifecycleState = jsonResource.get("lifecycleState").toString(); + assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState); } public static void verifyLinkCreated(ServiceReqDetails createServiceInUI, User user, int expectedRelationsSize) { @@ -56,5 +129,213 @@ public class ServiceVerificator { assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize); } + + public static void verifyManagmentWorkflow(String expectedName, String expectedDescription){ + String actualName = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text name']")).getText(); + String actualDescription = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text description']")).getText(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing name ( should be %s ) and description ( should be %s ) ", expectedName, expectedDescription)); + assertTrue(actualName.equals(expectedName) && actualDescription.equals(expectedDescription)); + } + + public static void verifyVersionUI(String expected){ + String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText().replace("V", ""); + assertTrue(actualVersion.equals(expected), String.format( "Expected version: %s, Actual version: %s", expected, actualVersion)); + } + + public static void verifyOpenTabTitle(DataTestIdEnum.CompositionScreenEnum currentTab) throws Exception{ + List<String> expectedTitles = new ArrayList<String>(); + for(String expectedTitle: currentTab.getTitle()){ + expectedTitles.add(expectedTitle); + } + for (WebElement actualTitle: CompositionPage.getOpenTabTitle()){ + int indexOfTitle = expectedTitles.indexOf(actualTitle.getText()); + assertTrue(indexOfTitle >= 0, "Wrong title"); + expectedTitles.remove(indexOfTitle); + } + assertTrue(expectedTitles.size() == 0, "Missing titles in " + currentTab.getValue()); + } + + public static void verifyDeploymentPageSubElements(String moduleName, DeploymentViewVerificator verificatorObj) throws Exception{ + HashMap<String, List<String>> moduleProperties = verificatorObj.getDeploymentViewData().get(moduleName); + + ServiceVerificator.moveMetadataPropertiesArtifactSection(-700); + + List<WebElement> artifacts, properties; + artifacts = DeploymentPage.getArtifactNames(); + properties = DeploymentPage.getPropertyNames(); + assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size()); + assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream(). + map(e -> e.getAttribute("textContent")). + collect(Collectors.toList()))); + assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size()); + assertTrue(moduleProperties.get("properties").containsAll(properties.stream(). + map(e -> e.getAttribute("textContent")). + collect(Collectors.toList()))); + + DeploymentPage.clickOnProperties(); + DeploymentPage.clickOnArtifacts(); + ServiceVerificator.moveMetadataPropertiesArtifactSection(700); + } + + public static void verifyVFModuleCustomizationUUID(ServiceReqDetails service) throws Exception { + Predicate<String> componentInstancePredicate = e -> e.length() > 35; + List<String> customizationUUIDList = getAllVFModuleCustomizationUUIDs(service); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating vfModuleCustomizationUUID uniqness ... ")); + assertTrue(customizationUUIDList.stream().allMatch(componentInstancePredicate), "vfModuleCustomizationUUID is less then 35 chars"); + CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDList); + } + public static List<String> getAllVFModuleCustomizationUUIDs(ServiceReqDetails service) throws Exception { + Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion()); + List<String> customizationUUIDList = serviceObj.getComponentInstances().get(0).getGroupInstances().stream(). + map(e -> e.getCustomizationUUID()). + collect(Collectors.toList()); + + return customizationUUIDList; + } + + public static String getVFModulePropertieValue(ServiceReqDetails service, String propertyName, String moduleName) throws Exception { + Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion()); + List<GroupInstance> groupInstances = serviceObj.getComponentInstances().get(0).getGroupInstances(); + List<GroupInstanceProperty> groupInstancesProperties = groupInstances.stream(). + filter(e -> e.getName().equals(moduleName)). + findFirst(). + get(). + convertToGroupInstancesProperties(); + String propertieValue = groupInstancesProperties.stream(). + filter(e -> e.getName().equals(propertyName)). + findFirst(). + get(). + getValue(); + return propertieValue; + } + + public static boolean isEqualCustomizationUUIDsAfterChanges(List<String> listBefore, List<String> listAfter){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating if vfModuleCustomizationUUID changed after certification ... ")); + return (listBefore.size() == listAfter.size()) && (listBefore.containsAll(listAfter)); + } + + public static void verifyDisabledServiceProperties() throws Exception{ + List<String> propertiesForCheck = Arrays.asList("isBase", "vf_module_type", "vf_module_label", "vf_module_description"); + List<PropertiesPopupEnum> popupElementsForCheck = Arrays.asList(PropertiesPopupEnum.PROPERTY_NAME, + PropertiesPopupEnum.PROPERTY_DESCRIPTION, + PropertiesPopupEnum.PROPERTY_TYPE, + PropertiesPopupEnum.PROPERTY_VALUE); + ServiceVerificator.moveMetadataPropertiesArtifactSection(-700); + List<WebElement> properties = DeploymentPage.getPropertyNames(); + + for(WebElement property : properties){ + if (propertiesForCheck.contains(property.getAttribute("textContent"))){ + DeploymentPage.clickOnProperty(property); + Select propertTypeElement = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())); + boolean isTypeBoolean = propertTypeElement.getFirstSelectedOption().getText().contains("boolean"); + for (PropertiesPopupEnum popupElement: popupElementsForCheck){ + if (isTypeBoolean && popupElement == PropertiesPopupEnum.PROPERTY_VALUE){ + assertTrue(GeneralUIUtils.checkForDisabledAttribute(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue()), String.format("Element %s not disabled ", property.getText())); + } else { + assertTrue(GeneralUIUtils.checkForDisabledAttribute(popupElement.getValue()), String.format("Element %s not disabled ", property.getText())); + } + } + new PropertyPopup().clickCancel(); + } + } + + DeploymentPage.clickOnProperties(); + ServiceVerificator.moveMetadataPropertiesArtifactSection(700); + } + + public static void verifyEnabledServiceProperties() throws Exception{ + List<String> propertiesForCheck = Arrays.asList("initial_count", "max_vf_module_instances", "min_vf_module_instances"); + + ServiceVerificator.moveMetadataPropertiesArtifactSection(-700); + List<WebElement> properties = DeploymentPage.getPropertyNames(); + + ServiceVerificator.positiveFlow(propertiesForCheck, properties); + ServiceVerificator.negativeFlow(propertiesForCheck, properties); + + DeploymentPage.clickOnProperties(); + ServiceVerificator.moveMetadataPropertiesArtifactSection(700); + } + + public static void positiveFlow(List<String> propertiesForCheck, List<WebElement> properties) + throws InterruptedException { + int baseNumber = new Random().nextInt(100) + 2; + for(WebElement property : properties){ + String propertyName = property.getAttribute("textContent"); + if (propertiesForCheck.contains(propertyName)){ + DeploymentPage.clickOnProperty(property); + int actualNumber = 0; + if (propertyName.equals("initial_count")){ + actualNumber = baseNumber; + } else if (propertyName.equals("max_vf_module_instances")) { + actualNumber = baseNumber + 1; + } else if (propertyName.equals("min_vf_module_instances")){ + + if(true){ + throw new SkipException("Open bug 305331"); + } + + actualNumber = baseNumber - 1; + } + + new PropertyPopup().insertPropertyDefaultValue(String.valueOf(actualNumber)); + new PropertyPopup().clickSave(); + assertTrue(DeploymentPage.getPropertyValueFromPropertiesList(propertyName).equals(String.valueOf(actualNumber))); + } + } + } + + public static void negativeFlow(List<String> propertiesForCheck, List<WebElement> properties) + throws Exception { + int currentMaxValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("max_vf_module_instances")); + int currentMinValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("min_vf_module_instances")); + int currentInitialValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("initial_count")); + PropertyPopup propertyPopupObj = new PropertyPopup(); + + for(WebElement property : properties){ + String propertyName = property.getAttribute("textContent"); + if (propertiesForCheck.contains(propertyName)){ + DeploymentPage.clickOnProperty(property); + if (propertyName.equals("initial_count")){ + + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + + } else if (propertyName.equals("max_vf_module_instances")) { + + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue - 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0)); + verifyErrorPresentAndSaveDisabled(); + + } else if (propertyName.equals("min_vf_module_instances")){ + + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue + 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1)); + ServiceVerificator.verifyErrorPresentAndSaveDisabled(); + } + + new PropertyPopup().clickCancel(); + } + } + } + + public static void verifyErrorPresentAndSaveDisabled() throws Exception{ + assertTrue(DeploymentPage.isPropertySaveButtonDisabled()); + assertTrue(DeploymentPage.getPropertyErrorValidationMessdge().size() == 1); + } + + public static void moveMetadataPropertiesArtifactSection(int offset) throws InterruptedException { + WebElement dragLineElement = GeneralUIUtils.getElementByCSS("div.rg-top"); + GeneralUIUtils.dragAndDropElementByY(dragLineElement, offset); + } + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java new file mode 100644 index 0000000000..3b0b458f1e --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.lang3.text.WordUtils; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openqa.selenium.WebElement; +import org.testng.Assert; + +import com.aventstack.extentreports.Status; + +public class UserManagementVerificator { + + + + public static void validateUserCreated(String userId, UserRoleEnum role){ + + ExtentTestActions.log(Status.INFO, "Validating that a new user is created and displayed in the first row in the table."); + + final int firstRow = 0; + + WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(firstRow); + WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(firstRow); + WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(firstRow); + WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(firstRow); + WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(firstRow); + WebElement actualLastActive = AdminGeneralPage.getUserManagementTab().getLastActive(firstRow); + + + String actualFirstNameText = actualFirstName.getText(); + String actualLastNameText = actualLastName.getText(); + String actualUserIdText = actualUserId.getText(); + String actualEmailText = actualEmail.getText(); + String actualRoleText = actualRole.getText(); + String actualLastActiveText = actualLastActive.getText(); + + Assert.assertTrue(actualFirstNameText.equals("---"), "Actual first name is not '---'."); + Assert.assertTrue(actualLastNameText.equals("---"), "Actual last name is not '---'."); + Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not " + userId); + Assert.assertTrue(actualEmailText.equals("---"), "Actual email is not '---'."); + Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.name().toLowerCase())), "Actual role is not " + role.name()); + Assert.assertTrue(actualLastActiveText.equals("Waiting"), "Actual role is not 'Waiting'."); + } + + + public static void validateUserRoleUpdated(int rowIndx, UserRoleEnum updatedRole){ + ExtentTestActions.log(Status.INFO, "Validating role is updated to " + updatedRole.name() + " in UI."); + WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowIndx); + String actualRoleText = actualRole.getText(); + Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(updatedRole.name().toLowerCase())), "Actual role is not " + updatedRole.name()); + } + + public static void validateUserRoleUpdatedViaRest(User reqUser, User user, UserRoleEnum expectedUserRole){ + try{ + ExtentTestActions.log(Status.INFO, "Validating role is updated to " + expectedUserRole.name() + " in BE."); + String actualUserRole = RestCDUtils.getUserRole(reqUser, user); + Assert.assertTrue(expectedUserRole.name().toLowerCase().equals(actualUserRole.toLowerCase()), "User role is not updated."); + } + catch(Exception e){ + Assert.fail("The actual user role is null"); + } + } + + public static void validateUserNotFoundViaRest(User reqUser, User user){ + try{ + ExtentTestActions.log(Status.INFO, "Validating user " + reqUser.getUserId() + " is not found in BE."); + RestResponse getUserResp = RestCDUtils.getUser(reqUser, user); + ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.USER_INACTIVE.name(), Arrays.asList(reqUser.getUserId()), getUserResp.getResponse()); + } + catch(Exception e){ + Assert.fail("The response message does not describe the user is not found."); + } + } + + public static void validateUserIdNotFound(String userId){ + ExtentTestActions.log(Status.INFO, "Validating that user " + userId + " is not found."); + AdminGeneralPage.getUserManagementTab().searchUser(userId); + List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed(); + Assert.assertEquals(rows.size(), 0, String.format("There are %s rows instead of none.", rows.size())); + } + + public static void validateOnlySingleRowDisplayed(){ + ExtentTestActions.log(Status.INFO, "Validating that only a single row is displayed in table."); + List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed(); + Assert.assertEquals(rows.size(), 1, String.format("There are %s rows instead of %s.", rows.size(), 1)); + } + + public static void validateRowDisplayedCorrectly(User user, int rowindex){ + String role = user.getRole(); + String userId = user.getUserId(); + String firstName = user.getFirstName(); + String lastName = user.getLastName(); + String email = user.getEmail(); + + ExtentTestActions.log(Status.INFO, "Validating that the row is properly displayed."); + + WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(rowindex); + WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(rowindex); + WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(rowindex); + WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(rowindex); + WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowindex); + + + String actualFirstNameText = actualFirstName.getText(); + String actualLastNameText = actualLastName.getText(); + String actualUserIdText = actualUserId.getText(); + String actualEmailText = actualEmail.getText(); + String actualRoleText = actualRole.getText(); + + Assert.assertTrue(actualFirstNameText.equals(firstName), "Actual first name is not " + firstName); + Assert.assertTrue(actualLastNameText.equals(lastName), "Actual last name is not " + lastName); + Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not " + userId); + Assert.assertTrue(actualEmailText.contains(email), "Actual email does not contain " + email); + Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.toLowerCase())), "Actual role is not " + role); + } + + public static void validateFirstRowDisplayedCorrectly(User user){ + validateRowDisplayedCorrectly(user, 0); + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java new file mode 100644 index 0000000000..ac009c6327 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java @@ -0,0 +1,347 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VFCArtifact; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.testng.Assert; + +import com.aventstack.extentreports.Status; + +public class VFCArtifactVerificator { + + private static final String ARTIFACTS = "artifacts"; + private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts"; + private static List<VFCArtifact> vfcArtifactList = new ArrayList<VFCArtifact>(); + private static JSONObject jsonResource; + + public static void verifyVFCArtifactsNotInVFArtifactList(ResourceReqDetails resource , User user, RestResponse optionalGetResponse, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap){ + ExtentTestActions.log(Status.INFO, "Verifying that VFC artifacts are not as part of VF artifacts."); + LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS); + LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS); + + Map<String, Object> vfDepArtifacts = getVFDeploymentArtifacts(resource, user, optionalGetResponse); + for (Object artifact : vfDepArtifacts.values()){ + JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString())); + String acArtifactName = acArtifact.get("artifactName").toString(); + + for(HeatMetaFirstLevelDefinition exDepArtifact : expectedDeploymentArtifacts){ + assertTrue(!exDepArtifact.getType().equals(acArtifactName)); + } + } + + Map<String, Object> vfInfoArtifacts = getVFInforamtionalArtifacts(resource, user, optionalGetResponse); + for (Object artifact : vfInfoArtifacts.values()){ + JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString())); + if (acArtifact.containsKey("artifactName")){ + String acArtifactName = acArtifact.get("artifactName").toString(); + + for(HeatMetaFirstLevelDefinition exInfoArtifact : expectedInformationalArtifacts){ + assertTrue(!exInfoArtifact.getType().equals(acArtifactName)); + } + } + + + } + + + + } + + public static void verifyVfcArtifactUpdated(String instanceName, ResourceReqDetails resource, User user){ + ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are updated."); + List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList(); + + setVfcArtifactList(new ArrayList<VFCArtifact>()); + setActualVfcArtifactList(instanceName, resource, user); + + for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){ + String artifactnameBeforeUpdate = artifact.getArtifactname(); + for (VFCArtifact newArtifact : vfcArtifactList){ + String artifactnameAfterUpdate = newArtifact.getArtifactname(); + if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){ + String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID(); + assertTrue(!artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID())); + + int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion()); + int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion()); + assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate + 1); + + + vfcArtifactList.remove(newArtifact); + + ExtentTestActions.log(Status.INFO, "VFC artifacts are updated and verified."); + + break; + } + } + } + + + assertTrue(vfcArtifactList.size() == 0); + + } + + public static void verifyVFCArtifactNotChanged(String instanceName, ResourceReqDetails resource, User user){ + ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are not chaned after update."); + List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList(); + + setVfcArtifactList(new ArrayList<VFCArtifact>()); + setActualVfcArtifactList(instanceName, resource, user); + + for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){ + String artifactnameBeforeUpdate = artifact.getArtifactname(); + for (VFCArtifact newArtifact : vfcArtifactList){ + String artifactnameAfterUpdate = newArtifact.getArtifactname(); + if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){ + String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID(); + assertTrue(artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID())); + + int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion()); + int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion()); + assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate); + + vfcArtifactList.remove(newArtifact); + break; + } + } + } + + + assertTrue(vfcArtifactList.size() == 0); + + } + + public static void verifyNoVfcArtifacts(ResourceReqDetails resource , User user, RestResponse optionalGetResponse){ + ExtentTestActions.log(Status.INFO, "Verifying that there are no VFC artifacts at all."); + JSONArray jArr = getVFInstances(resource, user, optionalGetResponse); + for (Object instanceObj : jArr){ + JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString()); + List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance); + + assertTrue(actualDeploymentArtifacts == null || actualDeploymentArtifacts.size() == 0); + } + } + + public static void verifyVfcArtifacts(ResourceReqDetails resource , User user, String instanceName, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap, + RestResponse optionalGetResponse){ + ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts for instance named " + instanceName); + + String exCompName = instanceName.split(".vfc.")[1].toLowerCase(); + String exName = instanceName.split(".heat.")[1].toLowerCase(); + + JSONArray jArr = getVFInstances(resource, user, optionalGetResponse); + int jArrSize = jArr.size(); + + for (Object instanceObj : jArr){ + JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString()); + String componentName = instance.get("componentName").toString().toLowerCase(); + String name = instance.get("name").toString().toLowerCase(); + + if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){ + + List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance); + LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS); + checkVFCArtifactsExist(expectedDeploymentArtifacts, actualDeploymentArtifacts); + + + List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance); + LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS); + checkVFCArtifactsExist(expectedInformationalArtifacts, actualInformationalArtifacts); + + jArr.remove(instanceObj); + + ExtentTestActions.log(Status.INFO, "VFC artifacts for instance named " + instanceName + "are verified."); + + break; + } + } + + assertTrue(jArr.size() == jArrSize - 1, "Instance " + instanceName + " was not found and tested"); + + } + + + + private static JSONArray getVFInstances(ResourceReqDetails resource, User user, RestResponse response) { + + jsonResource = getVFAsJsonObject(resource, user, response); + JSONArray jArr = (JSONArray) jsonResource.get("componentInstances"); + return jArr; + } + + private static Map<String, Object> getVFDeploymentArtifacts(ResourceReqDetails resource, User user, RestResponse response) { + + jsonResource = getVFAsJsonObject(resource, user, response); + Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(DEPLOYMENT_ARTIFACTS); + return jArr; + } + + private static Map<String, Object> getVFInforamtionalArtifacts(ResourceReqDetails resource, User user, RestResponse response) { + + jsonResource = getVFAsJsonObject(resource, user, response); + Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(ARTIFACTS); + return jArr; + } + + private static JSONObject getVFAsJsonObject(ResourceReqDetails resource, User user, RestResponse response) { + if (response == null){ + resource.setUniqueId(null); + response = RestCDUtils.getResource(resource, user); + assertTrue(response.getErrorCode().intValue() == 200); + getVFAsJsonObject(resource, user, response); + } + + String responseAfterDrag = response.getResponse(); + jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + return jsonResource; + } + + + + private static List<String> getActualVfcInstanceArtifactsFromJson(String artifactKind, JSONObject instanceFromJson){ + Object actualtObject = instanceFromJson.get(artifactKind); + if (actualtObject != null){ + JSONObject actualJsonObject = (JSONObject) JSONValue.parse(actualtObject.toString()); + List<String> actualArtifacts = (List<String>) actualJsonObject.keySet().stream().map(e -> actualJsonObject.get(e).toString()).collect(Collectors.toList()); + return actualArtifacts; + } + return null; + } + + private static void checkVFCArtifactsExist(LinkedList<HeatMetaFirstLevelDefinition> expectedArtifacts, List<String> actualArtifacts) { + if (expectedArtifacts == null){ + return; + } + + if (expectedArtifacts.size() != actualArtifacts.size()){ + ExtentTestActions.log(Status.FAIL, "Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size()); + Assert.fail("Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size()); + } + + List<String> types = new ArrayList<String>(); + List<String> fileNames = new ArrayList<String>(); + for (HeatMetaFirstLevelDefinition exArtifact : expectedArtifacts){ + + fileNames.add(exArtifact.getFileName()); + types.add(exArtifact.getType()); + + } + + for (int i = 0 ; i < actualArtifacts.size() ; i++){ + String actualArtifactsString = actualArtifacts.get(i); + JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString)); + + String acArtifactFileName = acArtifact.get("artifactName").toString(); + String acArtifactType = acArtifact.get("artifactType").toString(); + + assertTrue(types.contains(acArtifactType), "List does not contain " + acArtifactType); + assertTrue(fileNames.contains(acArtifactFileName), "List does not contain " + acArtifactFileName); + + types.remove(acArtifactType); + fileNames.remove(acArtifactFileName); + + } + + assertTrue(types.size() == 0); + assertTrue(fileNames.size() == 0); + + } + + public static List<VFCArtifact> getVfcArtifactList(){ + return vfcArtifactList; + } + + + public static void setVfcArtifactList(List<VFCArtifact> vfcArtifactList) { + VFCArtifactVerificator.vfcArtifactList = vfcArtifactList; + } + + public static void setActualVfcArtifactList(String instanceName, ResourceReqDetails resource , User user) { + String exCompName = instanceName.split(".vfc.")[1].toLowerCase(); + String exName = instanceName.split(".heat.")[1].toLowerCase(); + + JSONArray jArr = getVFInstances(resource, user, null); + + for (Object instanceObj : jArr){ + JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString()); + String componentName = instance.get("componentName").toString().toLowerCase(); + String name = instance.get("name").toString().toLowerCase(); + + if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){ + List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance); + List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance); + + if (actualDeploymentArtifacts != null){ + for (int i = 0 ; i < actualDeploymentArtifacts.size() ; i++){ + String actualArtifactsString = actualDeploymentArtifacts.get(i); + JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString)); + + if (acArtifact.containsKey("artifactName")){ + String acArtifactType = acArtifact.get("artifactName").toString(); + String acArtifactFileName = acArtifact.get("artifactType").toString(); + String acArtifactUUID = acArtifact.get("artifactUUID").toString(); + String acArtifactVersion = acArtifact.get("artifactVersion").toString(); + + vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion)); + } + } + } + if (actualInformationalArtifacts != null){ + for (int i = 0 ; i < actualInformationalArtifacts.size() ; i++){ + String actualArtifactsString = actualInformationalArtifacts.get(i); + JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString)); + + if (acArtifact.containsKey("artifactName")){ + String acArtifactType = acArtifact.get("artifactName").toString(); + String acArtifactFileName = acArtifact.get("artifactType").toString(); + String acArtifactUUID = acArtifact.get("artifactUUID").toString(); + String acArtifactVersion = acArtifact.get("artifactVersion").toString(); + vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion)); + } + + + } + } + } + } + } + +} + + + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java new file mode 100644 index 0000000000..0872a3a5c3 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.AssertJUnit.assertFalse; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; + + +public class VFCverificator { + + public static void verifyVFCUpdatedInUI(ResourceReqDetails vf) { + assertFalse(vf.getName().equals(ResourceGeneralPage.getNameText())); + assertFalse(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText())); + assertFalse(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText())); + assertFalse(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText())); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java new file mode 100644 index 0000000000..7f01b86eaf --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsMetadataDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; + +import com.aventstack.extentreports.Status; + +public class VfModuleVerificator { + + private static final String [] PROPERTY_TYPES = {"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"}; + private static final String VF_MODULE_TYPE = "org.openecomp.groups.VfModule"; + + /** + * compare number of groups from HEAT.meta file vs TOSCA yaml groups generated by ASDC + * @param listTypeHeatMetaDefinition - java object created from HEAT.meta file + * @param toscaDefinition - java object created from TOSCA yaml + */ + public static void compareNumberOfVfModules(List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition, ToscaDefinition toscaDefinition) { + + int heatMetaGroupCount = 0; + int toscaDefinitionGroupCount = 0; + for (TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition) { + heatMetaGroupCount = typeHeatMetaDefinition.getGroupHeatMetaDefinition().size(); + } + toscaDefinitionGroupCount = toscaDefinition.getTopology_template().getGroups().size(); + assertEquals("Expected num of groups in HEAT.meta file is " + heatMetaGroupCount + ", but was in TOSCA yaml file " + toscaDefinitionGroupCount, heatMetaGroupCount, toscaDefinitionGroupCount); + } + + /** + * check group structure and "metadata" parameters vs data on the service object + * @param toscaDefinition + */ + public static void verifyGroupMetadata(ToscaDefinition toscaDefinition, Service service) { + + Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups(); + for (Map.Entry<String, ToscaGroupsTopologyTemplateDefinition> groupTopologyTemplateDefinition : groups.entrySet()) { + String key = groupTopologyTemplateDefinition.getKey(); + GroupInstance groupInstanceObject = getGroupInstanceByKey(key, service); + ToscaGroupsMetadataDefinition metadata = groupTopologyTemplateDefinition.getValue().getMetadata(); + assertNotNull("groupInstanceObject is null", groupInstanceObject); + assertTrue("expected vfModuleModelName " + groupInstanceObject.getGroupName() + ", actual " + metadata.getVfModuleModelName(), groupInstanceObject.getGroupName().equals(metadata.getVfModuleModelName())); + assertTrue("expected vfModuleModelInvariantUUID " + groupInstanceObject.getInvariantUUID() + ", actual " + metadata.getVfModuleModelInvariantUUID(), groupInstanceObject.getInvariantUUID().equals(metadata.getVfModuleModelInvariantUUID())); + assertTrue("expected vfModuleModelCustomizationUUID " + groupInstanceObject.getCustomizationUUID() + ", actual " + metadata.getVfModuleModelCustomizationUUID(), groupInstanceObject.getCustomizationUUID().equals(metadata.getVfModuleModelCustomizationUUID())); + assertTrue("expected vfModuleModelUUID " + groupInstanceObject.getGroupUUID() + ", actual " + metadata.getVfModuleModelUUID(), groupInstanceObject.getGroupUUID().equals(metadata.getVfModuleModelUUID())); + assertTrue("expected vfModuleModelVersion " + groupInstanceObject.getVersion() + ", actual " + metadata.getVfModuleModelVersion(), groupInstanceObject.getVersion().equals(metadata.getVfModuleModelVersion())); + } + } + + + /** + * @param key + * @param service + * @return + */ + public static GroupInstance getGroupInstanceByKey(String key, Service service) { + for(ComponentInstance componentInstance : service.getComponentInstances()){ + for(GroupInstance groupInstance : componentInstance.getGroupInstances()){ + if( key.equals(groupInstance.getName())){ + return groupInstance; + } + } + } + return null; + } + + public static void validateSpecificModulePropertiesFromRequest(Resource resource) { + List<List<PropertyDataDefinition>> allProperties = resource.getGroups().stream(). + filter(e -> e.getType().equals(VF_MODULE_TYPE)). + map(e -> e.getProperties()). + collect(Collectors.toList()); + for(String propertyType :PROPERTY_TYPES){ + int numberOfTypes = getPropertyType(allProperties, propertyType).size(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, allProperties.size(), numberOfTypes)); + assertTrue(numberOfTypes == allProperties.size()); + } + } + + public static List<PropertyDataDefinition> getPropertyType(List<List<PropertyDataDefinition>> allProperties, String propertyType) { + return allProperties.stream(). + flatMap(List::stream). + filter(e -> e.getName().equals(propertyType)). + collect(Collectors.toList()); + } + + public static void validateSpecificModulePropertiesFromFile(ToscaDefinition toscaDefinition){ + List<ToscaGroupsTopologyTemplateDefinition> vfModules = toscaDefinition.getTopology_template().getGroups().values().stream(). + filter(e -> e.getType().equals(VF_MODULE_TYPE)). + collect(Collectors.toList()); + + for(String propertyType :PROPERTY_TYPES){ + int numberOfTypes = (int) vfModules.stream(). + filter(e -> e.getProperties().containsKey(propertyType)). + count(); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, vfModules.size(), numberOfTypes)); + assertTrue(numberOfTypes == vfModules.size()); + } + } + + public static ToscaDefinition getToscaTemplate(String pathToCsar) throws Exception { + String outputFolder = DeploymentViewVerificator.unzipCsarFile(pathToCsar); + String templateFileName = VfModuleVerificator.getTemplateFilenname(pathToCsar); + + File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + templateFileName); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(pathToMainServiceTemplate); + + DeploymentViewVerificator.cleanFolders(new File(outputFolder).getParent()); + + return toscaDefinition; + } + + public static String getTemplateFilenname(String pathToCsar) { + File csarFile = new File(pathToCsar); + String templateFileName = csarFile.getName().replaceAll("-csar.csar", "-template.yml"); + return templateFileName; + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java index 1ffde75414..e877146256 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java @@ -20,9 +20,14 @@ package org.openecomp.sdc.ci.tests.verificator; -import static org.testng.AssertJUnit.assertTrue; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; -import java.util.Iterator; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.json.simple.JSONArray; @@ -31,22 +36,30 @@ import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.testng.Assert; -public final class VfVerificator { - private VfVerificator() { - } +import com.aventstack.extentreports.Status; +public final class VfVerificator { + public static void verifyNumOfComponentInstances(ResourceReqDetails createResourceInUI, int numOfVFC, User user) { - String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse(); - JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); - int size = ((JSONArray) jsonResource.get("componentInstances")).size(); - assertTrue(size == numOfVFC); + ServiceVerificator.verifyNumOfComponentInstances(createResourceInUI, createResourceInUI.getVersion(), numOfVFC, user); } public static void verifyRILocationChanged(ResourceReqDetails createResourceInUI, @@ -57,37 +70,176 @@ public final class VfVerificator { } public static void verifyLinkCreated(ResourceReqDetails createResourceInUI, User user, int expectedRelationsSize) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing that a link was created on canvas")); String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse(); JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize); + ExtentTestActions.log(Status.INFO, "The link was verified."); } - public static void verifyVFUpdatedInUI(ResourceReqDetails vf) { + public static void verifyVFMetadataInUI(ResourceReqDetails vf) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through UI ...")); assertTrue(vf.getName().equals(ResourceGeneralPage.getNameText())); assertTrue(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText())); + assertTrue(vf.getCategories().get(0).getSubcategories().get(0).getName().equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText())); assertTrue(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText())); assertTrue(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText())); - assertTrue(vf.getContactId().equals(ResourceGeneralPage.getUserIdContactText())); + assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText())); + List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable(); + assertTrue(vf.getTags().size() == tagsList.size()); + for (int i = 0 ; i < vf.getTags().size(); i ++ ){ + assertTrue(vf.getTags().contains(tagsList.get(i).getText())); + } + assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText())); } - + public static void verifyVFUpdated(ResourceReqDetails vf, User user) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through Backend ...")); String response = RestCDUtils.getResource(vf, user).getResponse(); Resource resource = ResponseParser.convertResourceResponseToJavaObject(response); assertTrue(vf.getName().equals(resource.getName())); assertTrue(vf.getDescription().equals(resource.getDescription())); - assertTrue(vf.getCategories().equals(resource.getCategories())); assertTrue(vf.getVendorName().equals(resource.getVendorName())); assertTrue(vf.getVendorRelease().equals(resource.getVendorRelease())); - assertTrue(vf.getTags().equals(resource.getTags())); assertTrue(vf.getContactId().equals(resource.getContactId())); + + assertTrue(vf.getCategories().size() == (resource.getCategories().size())); + for (int i = 0 ; i < vf.getCategories().size() ; i ++) + { + CategoryDefinition expectedCategoryDefinition = vf.getCategories().get(i); + CategoryDefinition actualCategoryDefinition = resource.getCategories().get(i); + assertTrue(expectedCategoryDefinition.getName().equals(actualCategoryDefinition.getName())); + assertTrue(expectedCategoryDefinition.getSubcategories().get(i).getName().equals(actualCategoryDefinition.getSubcategories().get(i).getName())); + } + + assertTrue(vf.getTags().size() == (resource.getTags().size())); + for (int i = 0 ; i < vf.getTags().size() ; i ++){ + List<String> expectedTags = vf.getTags(); + List<String> actualTags = resource.getTags(); + + assertTrue(actualTags.contains(expectedTags.get(i))); + + } } public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) { String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); String actualLifecycleState = jsonResource.get("lifecycleState").toString(); - assertTrue("actual: " + actualLifecycleState + "--expected: " + expectedLifecycleState, - expectedLifecycleState.name().equals(actualLifecycleState)); + assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState); + } + + public static void verifyVfLifecycleInUI(LifeCycleStateEnum lifecycleState){ + GeneralUIUtils.ultimateWait(); + assertTrue(ResourceGeneralPage.getLifeCycleState().equals(lifecycleState.getValue())); + } + + public static void verifyInstanceVersion(ResourceReqDetails vf, User user, String instanceName, String instanceVersion){ + String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + JSONArray jsonArrayResource = (JSONArray) jsonResource.get("componentInstances"); + for (int i = 0; i < jsonArrayResource.size(); i++){ + Object object = jsonArrayResource.get(i); + try{ + JSONObject jRes = (JSONObject) JSONValue.parse(object.toString()); + String componentName = jRes.get("componentName").toString(); + if (componentName.equals(instanceName)){ + String componentVersion = jRes.get("componentVersion").toString(); + assertTrue(componentVersion.equals(instanceVersion)); + } + } + catch(Exception e){ + System.out.println("Can't test object in componentInstances array"); + Assert.fail("Can't test object in componentInstances array"); + } + } + } + + public static void verifyVfDeleted(ResourceReqDetails vf, User user){ + RestResponse response = RestCDUtils.getResource(vf, user); + assertTrue(response.getErrorCode().intValue() == 404); + } + + public static void verifyPropertiesInUI(List<PropertyTypeEnum> propertyList){ + + for (PropertyTypeEnum prop : propertyList){ + String propName = prop.getName(); + + String actualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propName).getText(); + String actualType = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_TYPE.getValue() + propName).getText(); + String actualDesciprtion = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_DESCRIPTION.getValue() + propName).getText(); + + assertTrue(propName.equals(actualName), String.format("Property name is not correct. expected:%s ; actual %s", propName, actualName)); + assertTrue(prop.getType().equals(actualType), String.format("Property type is not correct. expected:%s ; actual %s", prop.getType(), actualType)); + assertTrue(prop.getDescription().equals(actualDesciprtion), String.format("Property description is not correct. expected:%s ; actual %s", prop.getDescription(), actualDesciprtion)); + + if (prop.getSchemaDefinition() != null){ + String actualSchema = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ENTRY_SCHEMA.getValue() + propName).getText(); + assertTrue(prop.getSchemaDefinition().equals(actualSchema), String.format("Property schema is not correct. expected:%s ; actual %s", prop.getSchemaDefinition(), actualSchema)); + } + } + } + + public static void verifyToscaArtifactsInfo(ResourceReqDetails vf, User user){ + String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + JSONObject toscaArtifacts = (JSONObject) jsonResource.get("toscaArtifacts"); + + assertEquals(2, toscaArtifacts.size()); + for (Object artifactObj : toscaArtifacts.keySet()){ + JSONObject artifact = (JSONObject) JSONValue.parse(toscaArtifacts.get(artifactObj).toString()); + assertFalse(artifact.get("artifactUUID").toString().isEmpty(), "artifactUUID field is empty"); + assertFalse(artifact.get("artifactChecksum").toString().isEmpty(), "artifactChecksum filed is empty"); + assertFalse(artifact.get("payloadUpdateDate").toString().isEmpty(), "payloadUpdateDate field is empty"); + assertFalse(artifact.get("artifactVersion").toString().equals("0"), "artifactVersion field is 0"); + } + } + + public static void verifyVfInputs(String instanceName, Map<String, String> instancePropertiesMapFromJson,List<WebElement> propertyRowsFromTable) { + + for (int i = 0 ; i < propertyRowsFromTable.size() ; i++){ + WebElement row = propertyRowsFromTable.get(i); + String propertyNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyName']")).getText(); + String propertyTypeFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyType']")).getText(); + String instanceNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "instanceName']")).getText(); + String propertySchemaFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertySchema']")).getText(); + + assertTrue(instancePropertiesMapFromJson.containsKey(propertyNameFromTable), "No property named : " + propertyNameFromTable + "for instance " + instanceName); + String expectedType = instancePropertiesMapFromJson.get(propertyNameFromTable); + assertTrue(expectedType.equals(propertyTypeFromTable.toLowerCase()), propertyNameFromTable + "type is incorrect"); + assertTrue(instanceName.equals(instanceNameFromTable), "Instance name of property named " + propertyNameFromTable + "is incorrect"); + } + } + + public static void verifyOnboardedVnfMetadata(String vspName, Map<String, String> vspMetadata) { + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying metadata"); + assertTrue(vspName.equals(ResourceGeneralPage.getNameText()), "VSP name is not valid."); + assertTrue(vspMetadata.get("description").equals(ResourceGeneralPage.getDescriptionText()), "VSP description is not valid."); + assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().toLowerCase().trim()), "VSP category is not valid."); + assertTrue(vspMetadata.get("vendorName").equals(ResourceGeneralPage.getVendorNameText()), "VSP vendor name is not valid."); + assertTrue("1.0".equals(ResourceGeneralPage.getVendorReleaseText()), "VSP version is not valid."); + List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable(); + assertTrue(tagsList.size() == 1, "VSP tags size is not equal to 1."); + assertTrue(vspName.equals(tagsList.get(0).getText()), "VSP tag is not its name."); + assertTrue(vspMetadata.get("attContact").equals(ResourceGeneralPage.getContactIdText()), "VSP attContact is not valid."); + } + + public static void verifyIsElementDisabled(String elementLocator, String elementName){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Checking if %s is disabled", elementName)); + assertTrue(GeneralUIUtils.isElementReadOnly(elementLocator)); + } + + public static void verifyFilesChecksum(File actual, File expected){ + try { + String actualMd5OfFile = FileHandling.getMD5OfFile(actual); + String expectedMd5OfFile = FileHandling.getMD5OfFile(expected); + Assert.assertEquals(expectedMd5OfFile, actualMd5OfFile, "File does not exist"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } diff --git a/ui-ci/src/main/resources/Files/CP.yml b/ui-ci/src/main/resources/Files/CP.yml deleted file mode 100644 index 48b592265f..0000000000 --- a/ui-ci/src/main/resources/Files/CP.yml +++ /dev/null @@ -1,65 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.cp.CP: - derived_from: tosca.nodes.Root - properties: - att-ucpe-part-number: - type: string - vendor-name: - type: string - required: true - vendor-model: - type: string - required: true - total-vcpu: - type: integer - description: number of vCPUs - total-memory: - type: integer - description: GB - total-disk: - type: integer - description: GB - base-system-image-file-name: - type: string - linux-host-vendor: - type: string - linux-host-os-version: - type: version - base-system-software: - type: string - jdm-vcpu: - type: integer - jdm-memory: - type: integer - description: GB - jdm-disk: - type: integer - description: GB - jdm-version: - type: string - jcp-vcpu: - type: integer - jcp-memory: - type: integer - description: GB - jcp-disk: - type: integer - description: GB - jcp-version: - type: version - capabilities: - vnf_hosting: - type: tosca.capabilities.Container - description: Provides hosting capability for VNFs - WAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Wan] - description: external WAN1 n/w interface - occurrences: [1,2] - LAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Lan] - description: external LAN n/w interface - occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/CPWithAttributes.yml b/ui-ci/src/main/resources/Files/CPWithAttributes.yml deleted file mode 100644 index 847181b5c9..0000000000 --- a/ui-ci/src/main/resources/Files/CPWithAttributes.yml +++ /dev/null @@ -1,78 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.cp.CP: - derived_from: tosca.nodes.Root - properties: - att-ucpe-part-number: - type: string - vendor-name: - type: string - required: true - vendor-model: - type: string - required: true - total-vcpu: - type: integer - description: number of vCPUs - total-memory: - type: integer - description: GB - total-disk: - type: integer - description: GB - base-system-image-file-name: - type: string - linux-host-vendor: - type: string - linux-host-os-version: - type: version - base-system-software: - type: string - jdm-vcpu: - type: integer - jdm-memory: - type: integer - description: GB - jdm-disk: - type: integer - description: GB - jdm-version: - type: string - jcp-vcpu: - type: integer - jcp-memory: - type: integer - description: GB - jcp-disk: - type: integer - description: GB - jcp-version: - type: version - attributes: - private_address: - type: string - public_address: - type: string - networks: - type: map - entry_schema: - type: tosca.datatypes.network.NetworkInfo - ports: - type: map - entry_schema: - type: tosca.datatypes.network.PortInfo - capabilities: - vnf_hosting: - type: tosca.capabilities.Container - description: Provides hosting capability for VNFs - WAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Wan] - description: external WAN1 n/w interface - occurrences: [1,2] - LAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Lan] - description: external LAN n/w interface - occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/CP_LAN - Copy.yml b/ui-ci/src/main/resources/Files/CP_LAN - Copy.yml deleted file mode 100644 index 5663168e4a..0000000000 --- a/ui-ci/src/main/resources/Files/CP_LAN - Copy.yml +++ /dev/null @@ -1,12 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vfc.uCPE:
derived_from: tosca.nodes.Root - properties: - type: - type: string - required: false - requirements: - - virtualLink: - capability: tosca.capabilities.network.Linkable - relationship: tosca.relationships.network.LinksTo diff --git a/ui-ci/src/main/resources/Files/CP_LAN.yml b/ui-ci/src/main/resources/Files/CP_LAN.yml deleted file mode 100644 index 3420a3cfcb..0000000000 --- a/ui-ci/src/main/resources/Files/CP_LAN.yml +++ /dev/null @@ -1,19 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.cp.LAN: - derived_from: org.openecomp.resource.cp.CP - properties: - type: - type: string - required: false - requirements: - - virtualLink_in: - capability: tosca.capabilities.network.Linkable - relationship: tosca.relationships.network.LinksTo - - virtualLink_out: - capability: tosca.capabilities.network.Linkable - relationship: tosca.relationships.network.LinksTo - - virtualbinding: - capability: tosca.capabilities.network.Bindable - relationship: tosca.relationships.network.BindsTo
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/CP_WAN.yml b/ui-ci/src/main/resources/Files/CP_WAN.yml deleted file mode 100644 index 9f21b902d9..0000000000 --- a/ui-ci/src/main/resources/Files/CP_WAN.yml +++ /dev/null @@ -1,19 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.cp1.WAN: - derived_from: org.openecomp.resource.cp.CP - properties: - type: - type: string - required: false - requirements: - - virtualLink_in: - capability: tosca.capabilities.network.Linkable - relationship: tosca.relationships.network.LinksTo - - virtualLink_out: - capability: tosca.capabilities.network.Linkable - relationship: tosca.relationships.network.LinksTo - - virtualbinding: - capability: tosca.capabilities.network.Bindable - relationship: tosca.relationships.network.BindsTo
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/DNSscaling12.8.16.zip b/ui-ci/src/main/resources/Files/DNSscaling12.8.16.zip Binary files differdeleted file mode 100644 index cadb6138e7..0000000000 --- a/ui-ci/src/main/resources/Files/DNSscaling12.8.16.zip +++ /dev/null diff --git a/ui-ci/src/main/resources/Files/Heat-File 1.yaml b/ui-ci/src/main/resources/Files/Heat-File 1.yaml deleted file mode 100644 index d332078d35..0000000000 --- a/ui-ci/src/main/resources/Files/Heat-File 1.yaml +++ /dev/null @@ -1,791 +0,0 @@ -heat_template_version: 2013-05-23 -################################# -# -# Changes in v0.2: -# - Unique availability zone for each VM -# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram -# - 2 DB VMs added -# - Images corrected -# - VM start-up order: SMP->DB->BE->FE (no error handling yet) -# - Provisioning scripts placeholders -# -################################# - -description: ASC Template - -parameters: -# availability_zone_smp0: -# type: string -# default: nova -# availability_zone_smp1: -# type: string -# default: nova -# availability_zone_fe0: -# type: string -# default: nova -# availability_zone_fe1: -# type: string -# default: nova -# availability_zone_db0: -# type: string -# default: nova -# availability_zone_db1: -# type: string -# default: nova -# availability_zone_be0: -# type: string -# default: nova -# availability_zone_be1: -# type: string -# default: nova -# availability_zone_be2: -# type: string -# default: nova -# availability_zone_be3: -# type: string -# default: nova -# availability_zone_be4: -# type: string -# default: nova - - vnf_name: - type: string - description: Unique name for this VNF instance - default: This_is_the_SCP_name - vnf_id: - type: string - description: Unique ID for this VNF instance - default: This_is_ths_SCP_id - - flavor_scp_be_id: - type: string - description: flavor type - default: a1.Small - flavor_scp_fe_id: - type: string - description: flavor type - default: a1.Small - flavor_smp_id: - type: string - description: flavor type - default: a1.Small - flavor_db_id: - type: string - description: flavor type - default: a1.Small - image_scp_be_id: - type: string - description: Image use to boot a server - default: asc_base_image_be - image_scp_fe_id: - type: string - description: Image use to boot a server - default: asc_base_image_fe - image_smp_id: - type: string - description: Image use to boot a server - default: asc_base_image_smp - image_db_id: - type: string - description: Image use to boot a server - default: asc_base_image_db - - int_vscp_fe_cluster_net_id: - type: string - description: LAN2 FE Cluster/KA - int_vscp_fe_cluster_cidr: - type: string - description: Private Network2 Address (CIDR notation) - int_vscp_cluster_net_id: - type: string - description: LAN3 Cluster - int_vscp_cluster_cidr: - type: string - description: Private Network3 Address (CIDR notation) - int_vscp_db_network_net_id: - type: string - description: LAN4 DB - int_vscp_db_network_cidr: - type: string - description: Private Network4 Address (CIDR notation) - SIGNET_vrf_A1_direct_net_id: - type: string - description: Network name for SIGTRAN_A - SIGNET_vrf_B1_direct_net_id: - type: string - description: Network name for SIGTRAN_B - Cricket_OCS_protected_net_id: - type: string - description: Network name for CRICKET_OCS - OAM_direct_net_id: - type: string - description: Network name for OAM - be0_Cricket_OCS_protected_ips: - type: string - label: be0 port 5 OAM ip address - description: be0 port 5 OAM ip address - be1_Cricket_OCS_protected_ips: - type: string - label: be1 port 5 OAM ip address - description: be1 port 5 OAM ip address - be2_Cricket_OCS_protected_ips: - type: string - label: be2 port 5 OAM ip address - description: be2 port 5 OAM ip address - be3_Cricket_OCS_protected_ips: - type: string - label: be3 port 5 OAM ip address - description: be3 port 5 OAM ip address - be4_Cricket_OCS_protected_ips: - type: string - label: be4 port 5 OAM ip address - description: be4 port 5 OAM ip address - be0_OAM_direct_ips: - type: string - label: be0 port 7 OAM ip address - description: be0 port 7 OAM ip address - be1_OAM_direct_ips: - type: string - label: be1 port 7 OAM ip address - description: be1 port 7 OAM ip address - be2_OAM_direct_ips: - type: string - label: be2 port 7 OAM ip address - description: be2 port 7 OAM ip address - be3_OAM_direct_ips: - type: string - label: be3 port 7 OAM ip address - description: be3 port 7 OAM ip address - be4_OAM_direct_ips: - type: string - label: be4 port 7 OAM ip address - description: be4 port 7 OAM ip address - fe0_SIGNET_vrf_A1_direct_ips: - type: string - label: fe0 port 0 SIGTRAN ip address - description: fe0 port 0 SIGTRAN ip address - fe0_OAM_direct_ips: - type: string - label: fe0 port 7 OAM ip address - description: fe0 port 7 OAM ip address - fe1_SIGNET_vrf_B1_direct_ips: - type: string - label: fe1 port 1 SIGTRAN ip address - description: fe1 port 1 SIGTRAN ip address - fe1_OAM_direct_ips: - type: string - label: fe1 port 7 OAM ip address - description: fe1 port 7 OAM ip address - smp0_OAM_direct_ips: - type: string - label: smp0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - smp1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: smp1 port 7 OAM ip address - db0_OAM_direct_ips: - type: string - label: db0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - db1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: db1 port 7 OAM ip address - vm_scp_be0_name: - type: string - default: vSCP_BE0 - description: name of VM - vm_scp_be1_name: - type: string - default: vSCP_BE1 - description: name of VM - vm_scp_be2_name: - type: string - default: vSCP_BE2 - description: name of VM - vm_scp_be3_name: - type: string - default: vSCP_BE3 - description: name of VM - vm_scp_be4_name: - type: string - default: vSCP_BE4 - description: name of VM - vm_scp_fe0_name: - type: string - default: vSCP_FE0 - description: name of VM - vm_scp_fe1_name: - type: string - default: vSCP_FE1 - description: name of VM - vm_smp0_name: - type: string - default: vSMP0 - description: name of VM - vm_smp1_name: - type: string - default: vSMP1 - description: name of VM - vm_db0_name: - type: string - default: vDB0 - description: name of VM - vm_db1_name: - type: string - default: vDB1 - description: name of VM - -resources: -# scp_be_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_be_wait_handle } -# count: 5 -# timeout: 300 -# scp_be_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# scp_fe_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_fe_wait_handle } -# count: 2 -# timeout: 300 -# scp_fe_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# smp_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: smp_wait_handle } -# count: 2 -# timeout: 300 -# smp_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# db_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: db_wait_handle } -# count: 2 -# timeout: 300 -# db_wait_handle: -# type: OS::Heat::WaitConditionHandle - - FE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - BE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - SMP_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - DB_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - - FE_Clustering_KA: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_fe_cluster_net_id } - - FE_Clustering_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: FE_Clustering_KA } - cidr: { get_param: int_vscp_fe_cluster_cidr } - - Clustering_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_cluster_net_id } - - Clustering_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: Clustering_Network } - cidr: { get_param: int_vscp_cluster_cidr } - - DB_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_db_network_net_id } - - DB_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: DB_Network } - cidr: { get_param: int_vscp_db_network_cidr } - - server_scp_be0: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be0_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be0 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be0_port_3 } - - port: { get_resource: be0_port_4 } - - port: { get_resource: be0_port_5 } - - port: { get_resource: be0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be0_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - be0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be0_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] - - be0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] - - server_scp_be1: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be1_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be1 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be1_port_3 } - - port: { get_resource: be1_port_4 } - - port: { get_resource: be1_port_5 } - - port: { get_resource: be1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be1_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be1_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] - - be1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] - - server_scp_be2: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be2_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be2 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be2_port_3 } - - port: { get_resource: be2_port_4 } - - port: { get_resource: be2_port_5 } - - port: { get_resource: be2_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be2_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be2_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be2_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be2_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] - - be2_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] - - server_scp_be3: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be3_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be3 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be3_port_3 } - - port: { get_resource: be3_port_4 } - - port: { get_resource: be3_port_5 } - - port: { get_resource: be3_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be3_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be3_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be3_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be3_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] - - be3_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] - - server_scp_be4: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be4_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be4 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be4_port_3 } - - port: { get_resource: be4_port_4 } - - port: { get_resource: be4_port_5 } - - port: { get_resource: be4_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be4_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be4_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be4_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be4_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] - - be4_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] - - server_scp_fe0: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe0_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe0 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe0_port_0 } - - port: { get_resource: fe0_port_2 } - - port: { get_resource: fe0_port_3 } - - port: { get_resource: fe0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe0_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe0_port_0: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_A1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] - - fe0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] - - server_scp_fe1: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe1_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe1 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe1_port_1 } - - port: { get_resource: fe1_port_2 } - - port: { get_resource: fe1_port_3 } - - port: { get_resource: fe1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe1_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe1_port_1: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_B1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] - - fe1_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] - - server_smp0: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp0_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp0 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp0_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] - - server_smp1: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp1_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp1 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp1_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] - - server_db0: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db0_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db0 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db0_port_4 } - - port: { get_resource: db0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db0_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] - - server_db1: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db1_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db1 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db1_port_4 } - - port: { get_resource: db1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db1_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/Heat-File 2.yaml b/ui-ci/src/main/resources/Files/Heat-File 2.yaml deleted file mode 100644 index d332078d35..0000000000 --- a/ui-ci/src/main/resources/Files/Heat-File 2.yaml +++ /dev/null @@ -1,791 +0,0 @@ -heat_template_version: 2013-05-23 -################################# -# -# Changes in v0.2: -# - Unique availability zone for each VM -# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram -# - 2 DB VMs added -# - Images corrected -# - VM start-up order: SMP->DB->BE->FE (no error handling yet) -# - Provisioning scripts placeholders -# -################################# - -description: ASC Template - -parameters: -# availability_zone_smp0: -# type: string -# default: nova -# availability_zone_smp1: -# type: string -# default: nova -# availability_zone_fe0: -# type: string -# default: nova -# availability_zone_fe1: -# type: string -# default: nova -# availability_zone_db0: -# type: string -# default: nova -# availability_zone_db1: -# type: string -# default: nova -# availability_zone_be0: -# type: string -# default: nova -# availability_zone_be1: -# type: string -# default: nova -# availability_zone_be2: -# type: string -# default: nova -# availability_zone_be3: -# type: string -# default: nova -# availability_zone_be4: -# type: string -# default: nova - - vnf_name: - type: string - description: Unique name for this VNF instance - default: This_is_the_SCP_name - vnf_id: - type: string - description: Unique ID for this VNF instance - default: This_is_ths_SCP_id - - flavor_scp_be_id: - type: string - description: flavor type - default: a1.Small - flavor_scp_fe_id: - type: string - description: flavor type - default: a1.Small - flavor_smp_id: - type: string - description: flavor type - default: a1.Small - flavor_db_id: - type: string - description: flavor type - default: a1.Small - image_scp_be_id: - type: string - description: Image use to boot a server - default: asc_base_image_be - image_scp_fe_id: - type: string - description: Image use to boot a server - default: asc_base_image_fe - image_smp_id: - type: string - description: Image use to boot a server - default: asc_base_image_smp - image_db_id: - type: string - description: Image use to boot a server - default: asc_base_image_db - - int_vscp_fe_cluster_net_id: - type: string - description: LAN2 FE Cluster/KA - int_vscp_fe_cluster_cidr: - type: string - description: Private Network2 Address (CIDR notation) - int_vscp_cluster_net_id: - type: string - description: LAN3 Cluster - int_vscp_cluster_cidr: - type: string - description: Private Network3 Address (CIDR notation) - int_vscp_db_network_net_id: - type: string - description: LAN4 DB - int_vscp_db_network_cidr: - type: string - description: Private Network4 Address (CIDR notation) - SIGNET_vrf_A1_direct_net_id: - type: string - description: Network name for SIGTRAN_A - SIGNET_vrf_B1_direct_net_id: - type: string - description: Network name for SIGTRAN_B - Cricket_OCS_protected_net_id: - type: string - description: Network name for CRICKET_OCS - OAM_direct_net_id: - type: string - description: Network name for OAM - be0_Cricket_OCS_protected_ips: - type: string - label: be0 port 5 OAM ip address - description: be0 port 5 OAM ip address - be1_Cricket_OCS_protected_ips: - type: string - label: be1 port 5 OAM ip address - description: be1 port 5 OAM ip address - be2_Cricket_OCS_protected_ips: - type: string - label: be2 port 5 OAM ip address - description: be2 port 5 OAM ip address - be3_Cricket_OCS_protected_ips: - type: string - label: be3 port 5 OAM ip address - description: be3 port 5 OAM ip address - be4_Cricket_OCS_protected_ips: - type: string - label: be4 port 5 OAM ip address - description: be4 port 5 OAM ip address - be0_OAM_direct_ips: - type: string - label: be0 port 7 OAM ip address - description: be0 port 7 OAM ip address - be1_OAM_direct_ips: - type: string - label: be1 port 7 OAM ip address - description: be1 port 7 OAM ip address - be2_OAM_direct_ips: - type: string - label: be2 port 7 OAM ip address - description: be2 port 7 OAM ip address - be3_OAM_direct_ips: - type: string - label: be3 port 7 OAM ip address - description: be3 port 7 OAM ip address - be4_OAM_direct_ips: - type: string - label: be4 port 7 OAM ip address - description: be4 port 7 OAM ip address - fe0_SIGNET_vrf_A1_direct_ips: - type: string - label: fe0 port 0 SIGTRAN ip address - description: fe0 port 0 SIGTRAN ip address - fe0_OAM_direct_ips: - type: string - label: fe0 port 7 OAM ip address - description: fe0 port 7 OAM ip address - fe1_SIGNET_vrf_B1_direct_ips: - type: string - label: fe1 port 1 SIGTRAN ip address - description: fe1 port 1 SIGTRAN ip address - fe1_OAM_direct_ips: - type: string - label: fe1 port 7 OAM ip address - description: fe1 port 7 OAM ip address - smp0_OAM_direct_ips: - type: string - label: smp0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - smp1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: smp1 port 7 OAM ip address - db0_OAM_direct_ips: - type: string - label: db0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - db1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: db1 port 7 OAM ip address - vm_scp_be0_name: - type: string - default: vSCP_BE0 - description: name of VM - vm_scp_be1_name: - type: string - default: vSCP_BE1 - description: name of VM - vm_scp_be2_name: - type: string - default: vSCP_BE2 - description: name of VM - vm_scp_be3_name: - type: string - default: vSCP_BE3 - description: name of VM - vm_scp_be4_name: - type: string - default: vSCP_BE4 - description: name of VM - vm_scp_fe0_name: - type: string - default: vSCP_FE0 - description: name of VM - vm_scp_fe1_name: - type: string - default: vSCP_FE1 - description: name of VM - vm_smp0_name: - type: string - default: vSMP0 - description: name of VM - vm_smp1_name: - type: string - default: vSMP1 - description: name of VM - vm_db0_name: - type: string - default: vDB0 - description: name of VM - vm_db1_name: - type: string - default: vDB1 - description: name of VM - -resources: -# scp_be_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_be_wait_handle } -# count: 5 -# timeout: 300 -# scp_be_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# scp_fe_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_fe_wait_handle } -# count: 2 -# timeout: 300 -# scp_fe_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# smp_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: smp_wait_handle } -# count: 2 -# timeout: 300 -# smp_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# db_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: db_wait_handle } -# count: 2 -# timeout: 300 -# db_wait_handle: -# type: OS::Heat::WaitConditionHandle - - FE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - BE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - SMP_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - DB_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - - FE_Clustering_KA: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_fe_cluster_net_id } - - FE_Clustering_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: FE_Clustering_KA } - cidr: { get_param: int_vscp_fe_cluster_cidr } - - Clustering_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_cluster_net_id } - - Clustering_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: Clustering_Network } - cidr: { get_param: int_vscp_cluster_cidr } - - DB_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_db_network_net_id } - - DB_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: DB_Network } - cidr: { get_param: int_vscp_db_network_cidr } - - server_scp_be0: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be0_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be0 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be0_port_3 } - - port: { get_resource: be0_port_4 } - - port: { get_resource: be0_port_5 } - - port: { get_resource: be0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be0_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - be0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be0_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] - - be0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] - - server_scp_be1: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be1_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be1 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be1_port_3 } - - port: { get_resource: be1_port_4 } - - port: { get_resource: be1_port_5 } - - port: { get_resource: be1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be1_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be1_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] - - be1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] - - server_scp_be2: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be2_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be2 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be2_port_3 } - - port: { get_resource: be2_port_4 } - - port: { get_resource: be2_port_5 } - - port: { get_resource: be2_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be2_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be2_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be2_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be2_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] - - be2_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] - - server_scp_be3: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be3_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be3 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be3_port_3 } - - port: { get_resource: be3_port_4 } - - port: { get_resource: be3_port_5 } - - port: { get_resource: be3_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be3_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be3_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be3_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be3_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] - - be3_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] - - server_scp_be4: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be4_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be4 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be4_port_3 } - - port: { get_resource: be4_port_4 } - - port: { get_resource: be4_port_5 } - - port: { get_resource: be4_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be4_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be4_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be4_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be4_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] - - be4_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] - - server_scp_fe0: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe0_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe0 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe0_port_0 } - - port: { get_resource: fe0_port_2 } - - port: { get_resource: fe0_port_3 } - - port: { get_resource: fe0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe0_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe0_port_0: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_A1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] - - fe0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] - - server_scp_fe1: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe1_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe1 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe1_port_1 } - - port: { get_resource: fe1_port_2 } - - port: { get_resource: fe1_port_3 } - - port: { get_resource: fe1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe1_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe1_port_1: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_B1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] - - fe1_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] - - server_smp0: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp0_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp0 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp0_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] - - server_smp1: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp1_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp1 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp1_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] - - server_db0: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db0_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db0 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db0_port_4 } - - port: { get_resource: db0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db0_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] - - server_db1: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db1_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db1 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db1_port_4 } - - port: { get_resource: db1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db1_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/Heat-File.yaml b/ui-ci/src/main/resources/Files/Heat-File.yaml deleted file mode 100644 index d332078d35..0000000000 --- a/ui-ci/src/main/resources/Files/Heat-File.yaml +++ /dev/null @@ -1,791 +0,0 @@ -heat_template_version: 2013-05-23 -################################# -# -# Changes in v0.2: -# - Unique availability zone for each VM -# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram -# - 2 DB VMs added -# - Images corrected -# - VM start-up order: SMP->DB->BE->FE (no error handling yet) -# - Provisioning scripts placeholders -# -################################# - -description: ASC Template - -parameters: -# availability_zone_smp0: -# type: string -# default: nova -# availability_zone_smp1: -# type: string -# default: nova -# availability_zone_fe0: -# type: string -# default: nova -# availability_zone_fe1: -# type: string -# default: nova -# availability_zone_db0: -# type: string -# default: nova -# availability_zone_db1: -# type: string -# default: nova -# availability_zone_be0: -# type: string -# default: nova -# availability_zone_be1: -# type: string -# default: nova -# availability_zone_be2: -# type: string -# default: nova -# availability_zone_be3: -# type: string -# default: nova -# availability_zone_be4: -# type: string -# default: nova - - vnf_name: - type: string - description: Unique name for this VNF instance - default: This_is_the_SCP_name - vnf_id: - type: string - description: Unique ID for this VNF instance - default: This_is_ths_SCP_id - - flavor_scp_be_id: - type: string - description: flavor type - default: a1.Small - flavor_scp_fe_id: - type: string - description: flavor type - default: a1.Small - flavor_smp_id: - type: string - description: flavor type - default: a1.Small - flavor_db_id: - type: string - description: flavor type - default: a1.Small - image_scp_be_id: - type: string - description: Image use to boot a server - default: asc_base_image_be - image_scp_fe_id: - type: string - description: Image use to boot a server - default: asc_base_image_fe - image_smp_id: - type: string - description: Image use to boot a server - default: asc_base_image_smp - image_db_id: - type: string - description: Image use to boot a server - default: asc_base_image_db - - int_vscp_fe_cluster_net_id: - type: string - description: LAN2 FE Cluster/KA - int_vscp_fe_cluster_cidr: - type: string - description: Private Network2 Address (CIDR notation) - int_vscp_cluster_net_id: - type: string - description: LAN3 Cluster - int_vscp_cluster_cidr: - type: string - description: Private Network3 Address (CIDR notation) - int_vscp_db_network_net_id: - type: string - description: LAN4 DB - int_vscp_db_network_cidr: - type: string - description: Private Network4 Address (CIDR notation) - SIGNET_vrf_A1_direct_net_id: - type: string - description: Network name for SIGTRAN_A - SIGNET_vrf_B1_direct_net_id: - type: string - description: Network name for SIGTRAN_B - Cricket_OCS_protected_net_id: - type: string - description: Network name for CRICKET_OCS - OAM_direct_net_id: - type: string - description: Network name for OAM - be0_Cricket_OCS_protected_ips: - type: string - label: be0 port 5 OAM ip address - description: be0 port 5 OAM ip address - be1_Cricket_OCS_protected_ips: - type: string - label: be1 port 5 OAM ip address - description: be1 port 5 OAM ip address - be2_Cricket_OCS_protected_ips: - type: string - label: be2 port 5 OAM ip address - description: be2 port 5 OAM ip address - be3_Cricket_OCS_protected_ips: - type: string - label: be3 port 5 OAM ip address - description: be3 port 5 OAM ip address - be4_Cricket_OCS_protected_ips: - type: string - label: be4 port 5 OAM ip address - description: be4 port 5 OAM ip address - be0_OAM_direct_ips: - type: string - label: be0 port 7 OAM ip address - description: be0 port 7 OAM ip address - be1_OAM_direct_ips: - type: string - label: be1 port 7 OAM ip address - description: be1 port 7 OAM ip address - be2_OAM_direct_ips: - type: string - label: be2 port 7 OAM ip address - description: be2 port 7 OAM ip address - be3_OAM_direct_ips: - type: string - label: be3 port 7 OAM ip address - description: be3 port 7 OAM ip address - be4_OAM_direct_ips: - type: string - label: be4 port 7 OAM ip address - description: be4 port 7 OAM ip address - fe0_SIGNET_vrf_A1_direct_ips: - type: string - label: fe0 port 0 SIGTRAN ip address - description: fe0 port 0 SIGTRAN ip address - fe0_OAM_direct_ips: - type: string - label: fe0 port 7 OAM ip address - description: fe0 port 7 OAM ip address - fe1_SIGNET_vrf_B1_direct_ips: - type: string - label: fe1 port 1 SIGTRAN ip address - description: fe1 port 1 SIGTRAN ip address - fe1_OAM_direct_ips: - type: string - label: fe1 port 7 OAM ip address - description: fe1 port 7 OAM ip address - smp0_OAM_direct_ips: - type: string - label: smp0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - smp1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: smp1 port 7 OAM ip address - db0_OAM_direct_ips: - type: string - label: db0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - db1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: db1 port 7 OAM ip address - vm_scp_be0_name: - type: string - default: vSCP_BE0 - description: name of VM - vm_scp_be1_name: - type: string - default: vSCP_BE1 - description: name of VM - vm_scp_be2_name: - type: string - default: vSCP_BE2 - description: name of VM - vm_scp_be3_name: - type: string - default: vSCP_BE3 - description: name of VM - vm_scp_be4_name: - type: string - default: vSCP_BE4 - description: name of VM - vm_scp_fe0_name: - type: string - default: vSCP_FE0 - description: name of VM - vm_scp_fe1_name: - type: string - default: vSCP_FE1 - description: name of VM - vm_smp0_name: - type: string - default: vSMP0 - description: name of VM - vm_smp1_name: - type: string - default: vSMP1 - description: name of VM - vm_db0_name: - type: string - default: vDB0 - description: name of VM - vm_db1_name: - type: string - default: vDB1 - description: name of VM - -resources: -# scp_be_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_be_wait_handle } -# count: 5 -# timeout: 300 -# scp_be_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# scp_fe_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_fe_wait_handle } -# count: 2 -# timeout: 300 -# scp_fe_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# smp_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: smp_wait_handle } -# count: 2 -# timeout: 300 -# smp_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# db_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: db_wait_handle } -# count: 2 -# timeout: 300 -# db_wait_handle: -# type: OS::Heat::WaitConditionHandle - - FE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - BE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - SMP_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - DB_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - - FE_Clustering_KA: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_fe_cluster_net_id } - - FE_Clustering_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: FE_Clustering_KA } - cidr: { get_param: int_vscp_fe_cluster_cidr } - - Clustering_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_cluster_net_id } - - Clustering_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: Clustering_Network } - cidr: { get_param: int_vscp_cluster_cidr } - - DB_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_db_network_net_id } - - DB_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: DB_Network } - cidr: { get_param: int_vscp_db_network_cidr } - - server_scp_be0: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be0_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be0 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be0_port_3 } - - port: { get_resource: be0_port_4 } - - port: { get_resource: be0_port_5 } - - port: { get_resource: be0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be0_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - be0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be0_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] - - be0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] - - server_scp_be1: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be1_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be1 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be1_port_3 } - - port: { get_resource: be1_port_4 } - - port: { get_resource: be1_port_5 } - - port: { get_resource: be1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be1_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be1_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] - - be1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] - - server_scp_be2: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be2_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be2 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be2_port_3 } - - port: { get_resource: be2_port_4 } - - port: { get_resource: be2_port_5 } - - port: { get_resource: be2_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be2_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be2_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be2_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be2_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] - - be2_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] - - server_scp_be3: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be3_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be3 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be3_port_3 } - - port: { get_resource: be3_port_4 } - - port: { get_resource: be3_port_5 } - - port: { get_resource: be3_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be3_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be3_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be3_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be3_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] - - be3_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] - - server_scp_be4: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be4_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be4 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be4_port_3 } - - port: { get_resource: be4_port_4 } - - port: { get_resource: be4_port_5 } - - port: { get_resource: be4_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be4_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be4_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be4_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be4_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] - - be4_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] - - server_scp_fe0: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe0_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe0 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe0_port_0 } - - port: { get_resource: fe0_port_2 } - - port: { get_resource: fe0_port_3 } - - port: { get_resource: fe0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe0_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe0_port_0: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_A1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] - - fe0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] - - server_scp_fe1: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe1_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe1 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe1_port_1 } - - port: { get_resource: fe1_port_2 } - - port: { get_resource: fe1_port_3 } - - port: { get_resource: fe1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe1_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe1_port_1: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_B1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] - - fe1_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] - - server_smp0: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp0_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp0 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp0_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] - - server_smp1: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp1_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp1 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp1_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] - - server_db0: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db0_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db0 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db0_port_4 } - - port: { get_resource: db0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db0_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] - - server_db1: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db1_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db1 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db1_port_4 } - - port: { get_resource: db1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db1_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/InValid_tosca_File .yml b/ui-ci/src/main/resources/Files/InValid_tosca_File .yml deleted file mode 100644 index 4eea0a15ac..0000000000 --- a/ui-ci/src/main/resources/Files/InValid_tosca_File .yml +++ /dev/null @@ -1,34 +0,0 @@ -node_types: - org.openecomp.resource.MyCompute: - derived_from: tosca.nodes.Root - attributes: - private_address: - type: string - public_address: - type: string - networks: - type: map - entry_schema: - type: tosca.datatypes.network.NetworkInfo - ports: - type: map - entry_schema: - type: tosca.datatypes.network.PortInfo - requirements: - - local_storage: - capability: tosca.capabilities.Attachment - node: tosca.nodes.BlockStorage - relationship: tosca.relationships.AttachesTo - occurrences: [0, UNBOUNDED] - capabilities: - host: - type: tosca.capabilities.Container - valid_source_types: [tosca.nodes.SoftwareComponent] - endpoint : - type: tosca.capabilities.Endpoint.Admin - os: - type: tosca.capabilities.OperatingSystem - scalable: - type: tosca.capabilities.Scalable - binding: - type: tosca.capabilities.network.Bindable diff --git a/ui-ci/src/main/resources/Files/JDM_vf.yml b/ui-ci/src/main/resources/Files/JDM_vf.yml deleted file mode 100644 index 5a7edd4aaf..0000000000 --- a/ui-ci/src/main/resources/Files/JDM_vf.yml +++ /dev/null @@ -1,57 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vf.JDM: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: string - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/JDM_vfc.yml b/ui-ci/src/main/resources/Files/JDM_vfc.yml deleted file mode 100644 index b9c9ca0c4a..0000000000 --- a/ui-ci/src/main/resources/Files/JDM_vfc.yml +++ /dev/null @@ -1,57 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vfc.JDM: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: string - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/Sample_CSAR.csar b/ui-ci/src/main/resources/Files/Sample_CSAR.csar Binary files differdeleted file mode 100644 index 3001fe8222..0000000000 --- a/ui-ci/src/main/resources/Files/Sample_CSAR.csar +++ /dev/null diff --git a/ui-ci/src/main/resources/Files/UCPE_VFC.yml b/ui-ci/src/main/resources/Files/UCPE_VFC.yml deleted file mode 100644 index ef3966b68f..0000000000 --- a/ui-ci/src/main/resources/Files/UCPE_VFC.yml +++ /dev/null @@ -1,65 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vfc.uCPE: - derived_from: tosca.nodes.Root - properties: - att-ucpe-part-number: - type: string - vendor-name: - type: string - required: true - vendor-model: - type: string - required: true - total-vcpu: - type: integer - description: number of vCPUs - total-memory: - type: integer - description: GB - total-disk: - type: integer - description: GB - base-system-image-file-name: - type: string - linux-host-vendor: - type: string - linux-host-os-version: - type: version - base-system-software: - type: string - jdm-vcpu: - type: integer - jdm-memory: - type: integer - description: GB - jdm-disk: - type: integer - description: GB - jdm-version: - type: string - jcp-vcpu: - type: integer - jcp-memory: - type: integer - description: GB - jcp-disk: - type: integer - description: GB - jcp-version: - type: version - capabilities: - vnf_hosting: - type: tosca.capabilities.Container - description: Provides hosting capability for VNFs - WAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Wan] - description: external WAN1 n/w interface - occurrences: [1,2] - LAN_connectivity: - type: tosca.capabilities.network.Bindable - valid_source_types: [org.openecomp.cp.Lan] - description: external LAN n/w interface - occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/VF.yml b/ui-ci/src/main/resources/Files/VF.yml deleted file mode 100644 index ec089900ad..0000000000 --- a/ui-ci/src/main/resources/Files/VF.yml +++ /dev/null @@ -1,17 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vf.VFF: - derived_from: tosca.nodes.Root - properties: - vendor: - type: string - required: false - vl_name: - type: string - required: false - capabilities: - virtual_linkable: - type: tosca.capabilities.network.Linkable - -
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/VFC.yml b/ui-ci/src/main/resources/Files/VFC.yml deleted file mode 100644 index 853ed35374..0000000000 --- a/ui-ci/src/main/resources/Files/VFC.yml +++ /dev/null @@ -1,77 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vfc.vRouter: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: string - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - management-v6-address: - type: string - nm-lan-v6-address: - type: string - nm-lan-v6-prefix-length: - type: string - management-v4-address: - type: string - nm-lan-v4-address: - type: string - nm-lan-v4-prefix-length: - type: string - routing-instance-name: - type: string - routing-instances: - type: map - entry_schema: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable - occurrences: [1,UNBOUNDED] -
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/VL.yml b/ui-ci/src/main/resources/Files/VL.yml deleted file mode 100644 index 72e6d2be32..0000000000 --- a/ui-ci/src/main/resources/Files/VL.yml +++ /dev/null @@ -1,18 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - org.openecomp.resource.vl.VL00: - derived_from: tosca.nodes.network.Network - properties: - vendor: - type: string - required: false - vl_name: - type: string - required: false - - capabilities: - virtual_linkable: - type: tosca.capabilities.network.Linkable - end_point: - type: tosca.capabilities.Endpoint
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/Valid xml.xml b/ui-ci/src/main/resources/Files/Valid xml.xml deleted file mode 100644 index 0d67e48340..0000000000 --- a/ui-ci/src/main/resources/Files/Valid xml.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<dirs> -<entry loc="C:\Program Files\Java\jdk1.7.0_79" stamp="1449076618518"/> -</dirs> diff --git a/ui-ci/src/main/resources/Files/Valid_tosca_Mycompute.yml b/ui-ci/src/main/resources/Files/Valid_tosca_Mycompute.yml deleted file mode 100644 index 8fac5e16a8..0000000000 --- a/ui-ci/src/main/resources/Files/Valid_tosca_Mycompute.yml +++ /dev/null @@ -1,35 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -node_types: - org.openecomp.resource.vf.Database: - derived_from: tosca.nodes.Root - attributes: - private_address: - type: string - public_address: - type: string - networks: - type: map - entry_schema: - type: tosca.datatypes.network.NetworkInfo - ports: - type: map - entry_schema: - type: tosca.datatypes.network.PortInfo - requirements: - - local_storage: - capability: tosca.capabilities.Attachment - node: tosca.nodes.BlockStorage - relationship: tosca.relationships.AttachesTo - occurrences: [0, UNBOUNDED] - capabilities: - host: - type: tosca.capabilities.Container - valid_source_types: [tosca.nodes.SoftwareComponent] - endpoint : - type: tosca.capabilities.Endpoint.Admin - os: - type: tosca.capabilities.OperatingSystem - scalable: - type: tosca.capabilities.Scalable - binding: - type: tosca.capabilities.network.Bindable diff --git a/ui-ci/src/main/resources/Files/Valid_tosca_ReplaceTest.yml b/ui-ci/src/main/resources/Files/Valid_tosca_ReplaceTest.yml deleted file mode 100644 index 90e771dab1..0000000000 --- a/ui-ci/src/main/resources/Files/Valid_tosca_ReplaceTest.yml +++ /dev/null @@ -1,35 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -node_types: - org.openecomp.resource.VF.MyCompute: - derived_from: tosca.nodes.Root - attributes: - private_address: - type: string - public_address: - type: string - networks: - type: map - entry_schema: - type: tosca.datatypes.network.NetworkInfo - ports: - type: map - entry_schema: - type: tosca.datatypes.network.PortInfo - requirements: - - local_storage: - capability: tosca.capabilities.Attachment - node: tosca.nodes.BlockStorage - relationship: tosca.relationships.AttachesTo - occurrences: [0, UNBOUNDED] - capabilities: - host: - type: tosca.capabilities.Container - valid_source_types: [tosca.nodes.SoftwareComponent] - endpoint : - type: tosca.capabilities.Endpoint.Admin - os: - type: tosca.capabilities.OperatingSystem - scalable: - type: tosca.capabilities.Scalable - binding: - type: tosca.capabilities.network.Bindable diff --git a/ui-ci/src/main/resources/Files/asc_heat 0 2.yaml b/ui-ci/src/main/resources/Files/asc_heat 0 2.yaml deleted file mode 100644 index 6835485ca1..0000000000 --- a/ui-ci/src/main/resources/Files/asc_heat 0 2.yaml +++ /dev/null @@ -1,787 +0,0 @@ -heat_template_version: 2013-05-23 -################################# -# -# Changes in v0.2: -# - Unique availability zone for each VM -# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram -# - 2 DB VMs added -# - Images corrected -# - VM start-up order: SMP->DB->BE->FE (no error handling yet) -# - Provisioning scripts placeholders -# -################################# - -description: ASC Template - -parameters: -# availability_zone_smp0: -# type: string -# default: nova -# availability_zone_smp1: -# type: string -# default: nova -# availability_zone_fe0: -# type: string -# default: nova -# availability_zone_fe1: -# type: string -# default: nova -# availability_zone_db0: -# type: string -# default: nova -# availability_zone_db1: -# type: string -# default: nova -# availability_zone_be0: -# type: string -# default: nova -# availability_zone_be1: -# type: string -# default: nova -# availability_zone_be2: -# type: string -# default: nova -# availability_zone_be3: -# type: string -# default: nova -# availability_zone_be4: -# type: string -# default: nova - - vnf_name: - type: string - description: Unique name for this VNF instance - default: This_is_the_SCP_name - vnf_id: - type: string - description: Unique ID for this VNF instance - default: This_is_ths_SCP_id - - flavor_scp_be_id: - type: string - description: flavor type - default: a1.Small - flavor_scp_fe_id: - type: string - description: flavor type - default: a1.Small - flavor_smp_id: - type: string - description: flavor type - default: a1.Small - flavor_db_id: - type: string - description: flavor type - default: a1.Small - image_scp_be_id: - type: string - description: Image use to boot a server - default: asc_base_image_be - image_scp_fe_id: - type: string - description: Image use to boot a server - default: asc_base_image_fe - image_smp_id: - type: string - description: Image use to boot a server - default: asc_base_image_smp - image_db_id: - type: string - description: Image use to boot a server - default: asc_base_image_db - - int_vscp_fe_cluster_net_id: - type: string - description: LAN2 FE Cluster/KA - int_vscp_fe_cluster_cidr: - type: string - description: Private Network2 Address (CIDR notation) - int_vscp_cluster_net_id: - type: string - description: LAN3 Cluster - int_vscp_cluster_cidr: - type: string - description: Private Network3 Address (CIDR notation) - int_vscp_db_network_net_id: - type: string - description: LAN4 DB - int_vscp_db_network_cidr: - type: string - description: Private Network4 Address (CIDR notation) - SIGNET_vrf_A1_direct_net_id: - type: string - description: Network name for SIGTRAN_A - SIGNET_vrf_B1_direct_net_id: - type: string - description: Network name for SIGTRAN_B - Cricket_OCS_protected_net_id: - type: string - description: Network name for CRICKET_OCS - OAM_direct_net_id: - type: string - description: Network name for OAM - be0_Cricket_OCS_protected_ips: - type: string - label: be0 port 5 OAM ip address - description: be0 port 5 OAM ip address - be1_Cricket_OCS_protected_ips: - type: string - label: be1 port 5 OAM ip address - description: be1 port 5 OAM ip address - be2_Cricket_OCS_protected_ips: - type: string - label: be2 port 5 OAM ip address - description: be2 port 5 OAM ip address - be3_Cricket_OCS_protected_ips: - type: string - label: be3 port 5 OAM ip address - description: be3 port 5 OAM ip address - be4_Cricket_OCS_protected_ips: - type: string - label: be4 port 5 OAM ip address - description: be4 port 5 OAM ip address - be0_OAM_direct_ips: - type: string - label: be0 port 7 OAM ip address - description: be0 port 7 OAM ip address - be1_OAM_direct_ips: - type: string - label: be1 port 7 OAM ip address - description: be1 port 7 OAM ip address - be2_OAM_direct_ips: - type: string - label: be2 port 7 OAM ip address - description: be2 port 7 OAM ip address - be3_OAM_direct_ips: - type: string - label: be3 port 7 OAM ip address - description: be3 port 7 OAM ip address - be4_OAM_direct_ips: - type: string - label: be4 port 7 OAM ip address - description: be4 port 7 OAM ip address - fe0_SIGNET_vrf_A1_direct_ips: - type: string - label: fe0 port 0 SIGTRAN ip address - description: fe0 port 0 SIGTRAN ip address - fe0_OAM_direct_ips: - type: string - label: fe0 port 7 OAM ip address - description: fe0 port 7 OAM ip address - fe1_SIGNET_vrf_B1_direct_ips: - type: string - label: fe1 port 1 SIGTRAN ip address - description: fe1 port 1 SIGTRAN ip address - fe1_OAM_direct_ips: - type: string - label: fe1 port 7 OAM ip address - description: fe1 port 7 OAM ip address - smp0_OAM_direct_ips: - type: string - label: smp0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - smp1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: smp1 port 7 OAM ip address - db0_OAM_direct_ips: - type: string - label: db0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - db1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: db1 port 7 OAM ip address - vm_scp_be0_name: - type: string - default: vSCP_BE0 - description: name of VM - vm_scp_be1_name: - type: string - default: vSCP_BE1 - description: name of VM - vm_scp_be2_name: - type: string - default: vSCP_BE2 - description: name of VM - vm_scp_be3_name: - type: string - default: vSCP_BE3 - description: name of VM - vm_scp_be4_name: - type: string - default: vSCP_BE4 - description: name of VM - vm_scp_fe0_name: - type: string - default: vSCP_FE0 - description: name of VM - vm_scp_fe1_name: - type: string - default: vSCP_FE1 - description: name of VM - vm_smp0_name: - type: string - default: vSMP0 - description: name of VM - vm_smp1_name: - type: string - default: vSMP1 - description: name of VM - vm_db0_name: - type: string - default: vDB0 - description: name of VM - vm_db1_name: - type: string - default: vDB1 - description: name of VM - -resources: -# scp_be_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_be_wait_handle } -# count: 5 -# timeout: 300 -# scp_be_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# scp_fe_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_fe_wait_handle } -# count: 2 -# timeout: 300 -# scp_fe_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# smp_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: smp_wait_handle } -# count: 2 -# timeout: 300 -# smp_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# db_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: db_wait_handle } -# count: 2 -# timeout: 300 -# db_wait_handle: -# type: OS::Heat::WaitConditionHandle - - FE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - BE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - SMP_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - DB_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - - FE_Clustering_KA: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_fe_cluster_net_id } - - FE_Clustering_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: FE_Clustering_KA } - cidr: { get_param: int_vscp_fe_cluster_cidr } - - Clustering_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_cluster_net_id } - - Clustering_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: Clustering_Network } - cidr: { get_param: int_vscp_cluster_cidr } - - DB_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_db_network_net_id } - - DB_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: DB_Network } - cidr: { get_param: int_vscp_db_network_cidr } - - server_scp_be0: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be0_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be0 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be0_port_3 } - - port: { get_resource: be0_port_4 } - - port: { get_resource: be0_port_5 } - - port: { get_resource: be0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be0_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be0_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] - - be0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] - - server_scp_be1: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be1_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be1 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be1_port_3 } - - port: { get_resource: be1_port_4 } - - port: { get_resource: be1_port_5 } - - port: { get_resource: be1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be1_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be1_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] - - be1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] - - server_scp_be2: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be2_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be2 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be2_port_3 } - - port: { get_resource: be2_port_4 } - - port: { get_resource: be2_port_5 } - - port: { get_resource: be2_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be2_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be2_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be2_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be2_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] - - be2_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] - - server_scp_be3: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be3_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be3 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be3_port_3 } - - port: { get_resource: be3_port_4 } - - port: { get_resource: be3_port_5 } - - port: { get_resource: be3_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be3_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be3_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be3_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be3_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] - - be3_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] - - server_scp_be4: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be4_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be4 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be4_port_3 } - - port: { get_resource: be4_port_4 } - - port: { get_resource: be4_port_5 } - - port: { get_resource: be4_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be4_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be4_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be4_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be4_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] - - be4_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] - - server_scp_fe0: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe0_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe0 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe0_port_0 } - - port: { get_resource: fe0_port_2 } - - port: { get_resource: fe0_port_3 } - - port: { get_resource: fe0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe0_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe0_port_0: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_A1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] - - fe0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] - - server_scp_fe1: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe1_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe1 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe1_port_1 } - - port: { get_resource: fe1_port_2 } - - port: { get_resource: fe1_port_3 } - - port: { get_resource: fe1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe1_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe1_port_1: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_B1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] - - fe1_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] - - server_smp0: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp0_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp0 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp0_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] - - server_smp1: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp1_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp1 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp1_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] - - server_db0: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db0_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db0 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db0_port_4 } - - port: { get_resource: db0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db0_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] - - server_db1: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db1_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db1 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db1_port_4 } - - port: { get_resource: db1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db1_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env b/ui-ci/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env deleted file mode 100644 index b494d8c270..0000000000 --- a/ui-ci/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env +++ /dev/null @@ -1,6 +0,0 @@ -parameters: - pcrf_oam_vol_size: 500 - pcrf_oam_volume_silver-1: Silver - pcrf_oam_volume_silver-2: Silver - pcrf_oam_vol_name_1: sde1-pcrfx01-oam001-vol-1 - pcrf_oam_vol_name_2: sde1-pcrfx01-oam001-vol-2
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.env b/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.env deleted file mode 100644 index cf7cf710ce..0000000000 --- a/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.env +++ /dev/null @@ -1,18 +0,0 @@ -parameters: - pcrf_oam_server_names: ZRDM1PCRF01OAM001,ZRDM1PCRF01OAM002 - pcrf_oam_image_name: PCRF_8.995-ATTM1.0.3.qcow2 - pcrf_oam_flavor_name: lc.4xlarge4 - availabilityzone_name: nova - pcrf_cps_net_name: int_pcrf_net_0 - pcrf_cps_net_ips: 172.26.16.111,172.26.16.112 - pcrf_arbiter_vip: 172.26.16.115 - pcrf_cps_net_mask: 255.255.255.0 - pcrf_oam_net_name: oam_protected_net_0 - pcrf_oam_net_ips: 107.239.64.117,107.239.64.118 - pcrf_oam_net_gw: 107.239.64.1 - pcrf_oam_net_mask: 255.255.248.0 - pcrf_oam_volume_id_1: a4aa05fb-fcdc-457b-8077-6845fdfc3257 - pcrf_oam_volume_id_2: 93d8fc1f-f1c3-4933-86b2-039881ee910f - pcrf_security_group_name: nimbus_security_group - pcrf_vnf_id: 730797234b4a40aa99335157b02871cd - diff --git a/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml b/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml deleted file mode 100644 index 6636eba210..0000000000 --- a/ui-ci/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml +++ /dev/null @@ -1,108 +0,0 @@ -heat_template_version: 2013-05-23 - -description: heat template that creates multiple PCRF OAM nodes stack - -parameters: - pcrf_oam_server_names: - type: comma_delimited_list - label: PCRF OAM server names - description: name of the PCRF OAM instance - pcrf_oam_image_name: - type: string - label: PCRF OAM image name - description: PCRF OAM image name - pcrf_oam_flavor_name: - type: string - label: PCRF OAM flavor name - description: flavor name of PCRF OAM instance - availabilityzone_name: - type: string - label: availabilityzone name - description: availabilityzone name - pcrf_cps_net_name: - type: string - label: CPS network name - description: CPS network name - pcrf_cps_net_ips: - type: comma_delimited_list - label: CPS network ips - description: CPS network ips - pcrf_cps_net_mask: - type: string - label: CPS network mask - description: CPS network mask - pcrf_arbiter_vip: - type: string - label: OAM Arbiter LB VIP - description: OAM Arbiter LB VIP - pcrf_oam_net_name: - type: string - label: OAM network name - description: OAM network name - pcrf_oam_net_ips: - type: comma_delimited_list - label: OAM network ips - description: OAM network ips - pcrf_oam_net_gw: - type: string - label: CPS network gateway - description: CPS network gateway - pcrf_oam_net_mask: - type: string - label: CPS network mask - description: CPS network mask - pcrf_oam_volume_id_1: - type: string - label: CPS OAM 001 Cinder Volume - description: CPS OAM 001 Cinder Volumes - pcrf_oam_volume_id_2: - type: string - label: CPS OAM 002 Cinder Volume - description: CPS OAM 002 Cinder Volumes - pcrf_security_group_name: - type: string - label: security group name - description: the name of security group - pcrf_vnf_id: - type: string - label: PCRF VNF Id - description: PCRF VNF Id - -resources: - server_pcrf_oam_001: - type: nested-oam_v0.2.yaml - properties: - pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 0] } - pcrf_oam_image_name: { get_param: pcrf_oam_image_name } - pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } - availabilityzone_name: { get_param: availabilityzone_name } - pcrf_security_group_name: { get_param: pcrf_security_group_name } - pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_1 } - pcrf_cps_net_name: { get_param: pcrf_cps_net_name } - pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } - pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } - pcrf_oam_net_name: { get_param: pcrf_oam_net_name } - pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } - pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } - pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } - pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } - pcrf_vnf_id: {get_param: pcrf_vnf_id} - - server_pcrf_oam_002: - type: nested-oam_v0.2.yaml - properties: - pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 1] } - pcrf_oam_image_name: { get_param: pcrf_oam_image_name } - pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } - availabilityzone_name: { get_param: availabilityzone_name } - pcrf_security_group_name: { get_param: pcrf_security_group_name } - pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_2 } - pcrf_cps_net_name: { get_param: pcrf_cps_net_name } - pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } - pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } - pcrf_oam_net_name: { get_param: pcrf_oam_net_name } - pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 1] } - pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } - pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } - pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } - pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/ui-ci/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml b/ui-ci/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml deleted file mode 100644 index 564104174a..0000000000 --- a/ui-ci/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml +++ /dev/null @@ -1,80 +0,0 @@ -heat_template_version: 2013-05-23 - -description: heat template that creates PCRF Cluman stack - -parameters: - pcrf_pcm_server_names: - type: comma_delimited_list - label: PCRF CM server names - description: name of the PCRF CM instance - pcrf_pcm_image_name: - type: string - label: PCRF CM image name - description: PCRF CM image name - pcrf_pcm_flavor_name: - type: string - label: PCRF CM flavor name - description: flavor name of PCRF CM instance - availabilityzone_name: - type: string - label: availabilityzone name - description: availabilityzone name - pcrf_cps_net_name: - type: string - label: CPS network name - description: CPS network name - pcrf_cps_net_ips: - type: comma_delimited_list - label: CPS network ips - description: CPS network ips - pcrf_cps_net_mask: - type: string - label: CPS network mask - description: CPS network mask - pcrf_oam_net_name: - type: string - label: OAM network name - description: OAM network name - pcrf_oam_net_ips: - type: comma_delimited_list - label: OAM network ips - description: OAM network ips - pcrf_oam_net_gw: - type: string - label: CPS network gateway - description: CPS network gateway - pcrf_oam_net_mask: - type: string - label: CPS network mask - description: CPS network mask - pcrf_pcm_volume_id_1: - type: string - label: CPS Cluman Cinder Volume - description: CPS Cluman Cinder Volume - pcrf_security_group_name: - type: string - label: security group name - description: the name of security group - pcrf_vnf_id: - type: string - label: PCRF VNF Id - description: PCRF VNF Id - -resources: - server_pcrf_pcm_001: - type: nested-pcm_v0.2.yaml - properties: - pcrf_pcm_server_name: { get_param: [pcrf_pcm_server_names, 0] } - pcrf_pcm_image_name: { get_param: pcrf_pcm_image_name } - pcrf_pcm_flavor_name: { get_param: pcrf_pcm_flavor_name } - availabilityzone_name: { get_param: availabilityzone_name } - pcrf_security_group_name: { get_param: pcrf_security_group_name } - pcrf_pcm_volume_id: { get_param: pcrf_pcm_volume_id_1 } - pcrf_cps_net_name: { get_param: pcrf_cps_net_name } - pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } - pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } - pcrf_oam_net_name: { get_param: pcrf_oam_net_name } - pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } - pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } - pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } - pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/ui-ci/src/main/resources/Files/sample-xml-alldata-1-1.xml b/ui-ci/src/main/resources/Files/sample-xml-alldata-1-1.xml deleted file mode 100644 index 1723f6b312..0000000000 --- a/ui-ci/src/main/resources/Files/sample-xml-alldata-1-1.xml +++ /dev/null @@ -1,298 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<ns2:vnf-catalog xmlns:ns2="http://com/att/co/db-definition"> - <ns2:part-number-list> - <ns2:part-number>FG-VM00*</ns2:part-number> - <ns2:vnf-type>FW</ns2:vnf-type> - <ns2:vendor-info> - <ns2:vendor-name>FORTINET</ns2:vendor-name> - <ns2:vendor-part-number>FG-VM00*</ns2:vendor-part-number> - <ns2:vendor-model>VM00</ns2:vendor-model> - </ns2:vendor-info> - <ns2:vcpu> - <ns2:vcpu-default>1</ns2:vcpu-default> - <ns2:vcpu-min>1</ns2:vcpu-min> - <ns2:vcpu-max>1</ns2:vcpu-max> - </ns2:vcpu> - <ns2:vmemory> - <ns2:vmemory-default>1</ns2:vmemory-default> - <ns2:vmemory-units>GB</ns2:vmemory-units> - <ns2:vmemory-min>1</ns2:vmemory-min> - <ns2:vmemory-max>1</ns2:vmemory-max> - </ns2:vmemory> - <ns2:vdisk> - <ns2:vdisk-default>20</ns2:vdisk-default> - <ns2:vdisk-units>GB</ns2:vdisk-units> - <ns2:vdisk-min>20</ns2:vdisk-min> - <ns2:vdisk-max>20</ns2:vdisk-max> - </ns2:vdisk> - <software-version-list> - <software-version>5.2.4</software-version> - <software-version-state>0</software-version-state> - <software-filename>fg-5.2.4.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.3</software-version> - <software-version-state>1</software-version-state> - <software-filename>fg-5.2.3.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.2</software-version> - <software-version-state>2</software-version-state> - <software-filename>fg-5.2.2.qcow</software-filename > - </software-version-list> - <vnf-features-list> - <vnf-feature>IPS-IDS</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>URLF</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>Anti-Virus</vnf-feature> - </vnf-features-list> - <supported-hardware-list> - <ucpe-model>U401</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U410</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U412</ucpe-model > - </supported-hardware-list> - </ns2:part-number-list> - <ns2:part-number-list> - <ns2:part-number>FG-VM01*</ns2:part-number> - <ns2:vnf-type>FW</ns2:vnf-type> - <ns2:vendor-info> - <ns2:vendor-name> FORTINET</ns2:vendor-name> - <ns2:vendor-part-number>FG-VM01*</ns2:vendor-part-number> - <ns2:vendor-model>VM01</ns2:vendor-model> - </ns2:vendor-info> - <ns2:vcpu> - <ns2:vcpu-default>1</ns2:vcpu-default> - <ns2:vcpu-min>1</ns2:vcpu-min> - <ns2:vcpu-max>1</ns2:vcpu-max> - </ns2:vcpu> - <ns2:vmemory> - <ns2:vmemory-default>2</ns2:vmemory-default> - <ns2:vmemory-units>GB</ns2:vmemory-units> - <ns2:vmemory-min>1</ns2:vmemory-min> - <ns2:vmemory-max>2</ns2:vmemory-max> - </ns2:vmemory> - <ns2:vdisk> - <ns2:vdisk-default>20</ns2:vdisk-default> - <ns2:vdisk-units>GB</ns2:vdisk-units> - <ns2:vdisk-min>20</ns2:vdisk-min> - <ns2:vdisk-max>20</ns2:vdisk-max> - </ns2:vdisk> - <software-version-list> - <software-version>5.2.4</software-version> - <software-version-state>0</software-version-state> - <software-filename>fg-5.2.4.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.3</software-version> - <software-version-state>1</software-version-state> - <software-filename>fg-5.2.3.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.2</software-version> - <software-version-state>2</software-version-state> - <software-filename>fg-5.2.2.qcow</software-filename > - </software-version-list> - <vnf-features-list> - <vnf-feature>IPS-IDS</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>URLF</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>Anti-Virus</vnf-feature> - </vnf-features-list> - <supported-hardware-list> - <ucpe-model>U401</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U410</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U412</ucpe-model > - </supported-hardware-list> - </ns2:part-number-list> - <ns2:part-number-list> - <ns2:part-number>FG-VM02*</ns2:part-number> - <ns2:vnf-type>FW</ns2:vnf-type> - <ns2:vendor-info> - <ns2:vendor-name> FORTINET</ns2:vendor-name> - <ns2:vendor-part-number>FG-VM02*</ns2:vendor-part-number> - <ns2:vendor-model>VM02</ns2:vendor-model> - </ns2:vendor-info> - <ns2:vcpu> - <ns2:vcpu-default>2</ns2:vcpu-default> - <ns2:vcpu-min>1</ns2:vcpu-min> - <ns2:vcpu-max>2</ns2:vcpu-max> - </ns2:vcpu> - <ns2:vmemory> - <ns2:vmemory-default>4</ns2:vmemory-default> - <ns2:vmemory-units>GB</ns2:vmemory-units> - <ns2:vmemory-min>1</ns2:vmemory-min> - <ns2:vmemory-max>4</ns2:vmemory-max> - </ns2:vmemory> - <ns2:vdisk> - <ns2:vdisk-default>20</ns2:vdisk-default> - <ns2:vdisk-units>GB</ns2:vdisk-units> - <ns2:vdisk-min>20</ns2:vdisk-min> - <ns2:vdisk-max>20</ns2:vdisk-max> - </ns2:vdisk> - <software-version-list> - <software-version>5.2.4</software-version> - <software-version-state>0</software-version-state> - <software-filename>fg-5.2.4.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.3</software-version> - <software-version-state>1</software-version-state> - <software-filename>fg-5.2.3.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.2</software-version> - <software-version-state>2</software-version-state> - <software-filename>fg-5.2.2.qcow</software-filename > - </software-version-list> - <vnf-features-list> - <vnf-feature>IPS-IDS</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>URLF</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>Anti-Virus</vnf-feature> - </vnf-features-list> - <supported-hardware-list> - <ucpe-model>U401</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U410</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U412</ucpe-model > - </supported-hardware-list> - </ns2:part-number-list> - <ns2:part-number-list> - <ns2:part-number>FG-VM04*</ns2:part-number> - <ns2:vnf-type>FW</ns2:vnf-type> - <ns2:vendor-info> - <ns2:vendor-name>FORTINET</ns2:vendor-name> - <ns2:vendor-part-number>FG-VM04*</ns2:vendor-part-number> - <ns2:vendor-model>VM04</ns2:vendor-model> - </ns2:vendor-info> - <ns2:vcpu> - <ns2:vcpu-default>4</ns2:vcpu-default> - <ns2:vcpu-min>1</ns2:vcpu-min> - <ns2:vcpu-max>4</ns2:vcpu-max> - </ns2:vcpu> - <ns2:vmemory> - <ns2:vmemory-default>6</ns2:vmemory-default> - <ns2:vmemory-units>GB</ns2:vmemory-units> - <ns2:vmemory-min>1</ns2:vmemory-min> - <ns2:vmemory-max>6</ns2:vmemory-max> - </ns2:vmemory> - <ns2:vdisk> - <ns2:vdisk-default>20</ns2:vdisk-default> - <ns2:vdisk-units>GB</ns2:vdisk-units> - <ns2:vdisk-min>20</ns2:vdisk-min> - <ns2:vdisk-max>20</ns2:vdisk-max> - </ns2:vdisk> - <software-version-list> - <software-version>5.2.4</software-version> - <software-version-state>0</software-version-state> - <software-filename>fg-5.2.4.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.3</software-version> - <software-version-state>1</software-version-state> - <software-filename>fg-5.2.3.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.2</software-version> - <software-version-state>2</software-version-state> - <software-filename>fg-5.2.2.qcow</software-filename > - </software-version-list> - <vnf-features-list> - <vnf-feature>IPS-IDS</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>URLF</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>Anti-Virus</vnf-feature> - </vnf-features-list> - <supported-hardware-list> - <ucpe-model>U401</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U410</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U412</ucpe-model > - </supported-hardware-list> - </ns2:part-number-list> - <ns2:part-number-list> - <ns2:part-number>FG-VM08*</ns2:part-number> - <ns2:vnf-type>FW</ns2:vnf-type> - <ns2:vendor-info> - <ns2:vendor-name>FORTINET</ns2:vendor-name> - <ns2:vendor-part-number>FG-VM08*</ns2:vendor-part-number> - <ns2:vendor-model>VM08</ns2:vendor-model> - </ns2:vendor-info> - <ns2:vcpu> - <ns2:vcpu-default>8</ns2:vcpu-default> - <ns2:vcpu-min>1</ns2:vcpu-min> - <ns2:vcpu-max>8</ns2:vcpu-max> - </ns2:vcpu> - <ns2:vmemory> - <ns2:vmemory-default>12</ns2:vmemory-default> - <ns2:vmemory-units>GB</ns2:vmemory-units> - <ns2:vmemory-min>1</ns2:vmemory-min> - <ns2:vmemory-max>12</ns2:vmemory-max> - </ns2:vmemory> - <ns2:vdisk> - <ns2:vdisk-default>20</ns2:vdisk-default> - <ns2:vdisk-units>GB</ns2:vdisk-units> - <ns2:vdisk-min>20</ns2:vdisk-min> - <ns2:vdisk-max>20</ns2:vdisk-max> - </ns2:vdisk> - <software-version-list> - <software-version>5.2.4</software-version> - <software-version-state>0</software-version-state> - <software-filename>fg-5.2.4.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.3</software-version> - <software-version-state>1</software-version-state> - <software-filename>fg-5.2.3.qcow</software-filename > - </software-version-list> - <software-version-list> - <software-version>5.2.2</software-version> - <software-version-state>2</software-version-state> - <software-filename>fg-5.2.2.qcow</software-filename > - </software-version-list> - <vnf-features-list> - <vnf-feature>IPS-IDS</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>URLF</vnf-feature> - </vnf-features-list> - <vnf-features-list> - <vnf-feature>Anti-Virus</vnf-feature> - </vnf-features-list> - <supported-hardware-list> - <ucpe-model>U401</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U410</ucpe-model > - </supported-hardware-list> - <supported-hardware-list> - <ucpe-model>U412</ucpe-model > - </supported-hardware-list> - </ns2:part-number-list> -</ns2:vnf-catalog>
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/vFW_8.12.16.zip b/ui-ci/src/main/resources/Files/vFW_8.12.16.zip Binary files differdeleted file mode 100644 index 006c56ca4b..0000000000 --- a/ui-ci/src/main/resources/Files/vFW_8.12.16.zip +++ /dev/null diff --git a/ui-ci/src/main/resources/Files/vFW_VF.yml b/ui-ci/src/main/resources/Files/vFW_VF.yml deleted file mode 100644 index 100883e399..0000000000 --- a/ui-ci/src/main/resources/Files/vFW_VF.yml +++ /dev/null @@ -1,58 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - - org.openecomp.resource.vf.vFW: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: version - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/vFW_VFC.yml b/ui-ci/src/main/resources/Files/vFW_VFC.yml deleted file mode 100644 index d0814c43aa..0000000000 --- a/ui-ci/src/main/resources/Files/vFW_VFC.yml +++ /dev/null @@ -1,58 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - -node_types: - - org.openecomp.resource.vfc.vFW: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: version - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/vLB12.8.16.zip b/ui-ci/src/main/resources/Files/vLB12.8.16.zip Binary files differdeleted file mode 100644 index 2f61e5ac40..0000000000 --- a/ui-ci/src/main/resources/Files/vLB12.8.16.zip +++ /dev/null diff --git a/ui-ci/src/main/resources/Files/vRouter_vfc.yml b/ui-ci/src/main/resources/Files/vRouter_vfc.yml deleted file mode 100644 index 95ffe959de..0000000000 --- a/ui-ci/src/main/resources/Files/vRouter_vfc.yml +++ /dev/null @@ -1,78 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 - - -node_types: - org.openecomp.resource.vfc.vRouter: - derived_from: tosca.nodes.Root - properties: - att-part-number: - type: string - vendor-name: - type: string - vendor-part-number: - type: string - vendor-model: - type: string - vendor-model-description: - type: string - vcpu-default: - type: integer - vcpu-min: - type: integer - vcpu-max: - type: integer - vmemory-default: - type: integer - vmemory-units: - type: string - default: "GB" - vmemory-min: - type: integer - vmemory-max: - type: integer - vdisk-default: - type: integer - vdisk-units: - type: string - default: "GB" - vdisk-min: - type: integer - vdisk-max: - type: integer - vnf-type: - type: string - software-version: - type: string - software-version-state: - type: integer - software-file-name: - type: string - vnf-feature: - type: string - management-v6-address: - type: string - nm-lan-v6-address: - type: string - nm-lan-v6-prefix-length: - type: string - management-v4-address: - type: string - nm-lan-v4-address: - type: string - nm-lan-v4-prefix-length: - type: string - routing-instance-name: - type: string - routing-instances: - type: map - entry_schema: - type: string - requirements: - - host: - capability: tosca.capabilities.Container - relationship: tosca.relationships.HostedOn - capabilities: - binding: - type: tosca.capabilities.network.Bindable - occurrences: [1,UNBOUNDED] -
\ No newline at end of file diff --git a/ui-ci/src/main/resources/Files/valid HEAT_ENV files.env b/ui-ci/src/main/resources/Files/valid HEAT_ENV files.env deleted file mode 100644 index e576c0f67d..0000000000 --- a/ui-ci/src/main/resources/Files/valid HEAT_ENV files.env +++ /dev/null @@ -1,54 +0,0 @@ -parameters: - flavor_scp_be_id: m1.small - flavor_scp_fe_id: m1.small - flavor_smp_id: m1.small - flavor_db_id: m1.small - image_scp_be_id: CCLINUX - image_scp_fe_id: CCLINUX - image_smp_id: CCLINUX - image_db_id: CCLINUX - - int_vscp_fe_cluster_net_id: int_vscp_fe_cluster_net - int_vscp_fe_cluster_cidr: 172.26.2.0/24 - int_vscp_cluster_net_id: int_vscp_cluster_net - int_vscp_cluster_cidr: 172.26.3.0/24 - int_vscp_db_network_net_id: int_vscp_db_network_net - int_vscp_db_network_cidr: 172.26.1.0/24 - - SIGNET_vrf_A1_direct_net_id: SIGNET_vrf_A1_direct_net - SIGNET_vrf_B1_direct_net_id: SIGNET_vrf_B1_direct_net - Cricket_OCS_protected_net_id: Cricket_OCS_protected_net -# OAM_direct_net_id: OAM_net -# OAM_direct_net_id: oam-direct-net - OAM_direct_net_id: Marks_OAM_direct_net - - be0_Cricket_OCS_protected_ips: 107.239.15.17 - be1_Cricket_OCS_protected_ips: 107.239.15.18 - be2_Cricket_OCS_protected_ips: 107.239.15.19 - be3_Cricket_OCS_protected_ips: 107.239.15.20 - be4_Cricket_OCS_protected_ips: 107.239.15.21 - be0_OAM_direct_ips: 10.250.10.33 - be1_OAM_direct_ips: 10.250.10.34 - be2_OAM_direct_ips: 10.250.10.35 - be3_OAM_direct_ips: 10.250.10.36 - be4_OAM_direct_ips: 10.250.10.37 - fe0_SIGNET_vrf_A1_direct_ips: 172.26.4.1 - fe0_OAM_direct_ips: 10.250.10.38 - fe1_SIGNET_vrf_B1_direct_ips: 172.26.4.5 - fe1_OAM_direct_ips: 10.250.10.39 - smp0_OAM_direct_ips: 10.250.10.40 - smp1_OAM_direct_ips: 10.250.10.41 - db0_OAM_direct_ips: 10.250.10.42 - db1_OAM_direct_ips: 10.250.10.43 - - vm_scp_be0_name: vSCP_BE0 - vm_scp_be1_name: vSCP_BE1 - vm_scp_be2_name: vSCP_BE2 - vm_scp_be3_name: vSCP_BE3 - vm_scp_be4_name: vSCP_BE4 - vm_scp_fe0_name: vSCP_FE0 - vm_scp_fe1_name: vSCP_FE1 - vm_smp0_name: vSMP0 - vm_smp1_name: vSMP1 - vm_db0_name: vDB0 - vm_db1_name: vDB1 diff --git a/ui-ci/src/main/resources/Files/validHEATfiles.yaml b/ui-ci/src/main/resources/Files/validHEATfiles.yaml deleted file mode 100644 index 6835485ca1..0000000000 --- a/ui-ci/src/main/resources/Files/validHEATfiles.yaml +++ /dev/null @@ -1,787 +0,0 @@ -heat_template_version: 2013-05-23 -################################# -# -# Changes in v0.2: -# - Unique availability zone for each VM -# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram -# - 2 DB VMs added -# - Images corrected -# - VM start-up order: SMP->DB->BE->FE (no error handling yet) -# - Provisioning scripts placeholders -# -################################# - -description: ASC Template - -parameters: -# availability_zone_smp0: -# type: string -# default: nova -# availability_zone_smp1: -# type: string -# default: nova -# availability_zone_fe0: -# type: string -# default: nova -# availability_zone_fe1: -# type: string -# default: nova -# availability_zone_db0: -# type: string -# default: nova -# availability_zone_db1: -# type: string -# default: nova -# availability_zone_be0: -# type: string -# default: nova -# availability_zone_be1: -# type: string -# default: nova -# availability_zone_be2: -# type: string -# default: nova -# availability_zone_be3: -# type: string -# default: nova -# availability_zone_be4: -# type: string -# default: nova - - vnf_name: - type: string - description: Unique name for this VNF instance - default: This_is_the_SCP_name - vnf_id: - type: string - description: Unique ID for this VNF instance - default: This_is_ths_SCP_id - - flavor_scp_be_id: - type: string - description: flavor type - default: a1.Small - flavor_scp_fe_id: - type: string - description: flavor type - default: a1.Small - flavor_smp_id: - type: string - description: flavor type - default: a1.Small - flavor_db_id: - type: string - description: flavor type - default: a1.Small - image_scp_be_id: - type: string - description: Image use to boot a server - default: asc_base_image_be - image_scp_fe_id: - type: string - description: Image use to boot a server - default: asc_base_image_fe - image_smp_id: - type: string - description: Image use to boot a server - default: asc_base_image_smp - image_db_id: - type: string - description: Image use to boot a server - default: asc_base_image_db - - int_vscp_fe_cluster_net_id: - type: string - description: LAN2 FE Cluster/KA - int_vscp_fe_cluster_cidr: - type: string - description: Private Network2 Address (CIDR notation) - int_vscp_cluster_net_id: - type: string - description: LAN3 Cluster - int_vscp_cluster_cidr: - type: string - description: Private Network3 Address (CIDR notation) - int_vscp_db_network_net_id: - type: string - description: LAN4 DB - int_vscp_db_network_cidr: - type: string - description: Private Network4 Address (CIDR notation) - SIGNET_vrf_A1_direct_net_id: - type: string - description: Network name for SIGTRAN_A - SIGNET_vrf_B1_direct_net_id: - type: string - description: Network name for SIGTRAN_B - Cricket_OCS_protected_net_id: - type: string - description: Network name for CRICKET_OCS - OAM_direct_net_id: - type: string - description: Network name for OAM - be0_Cricket_OCS_protected_ips: - type: string - label: be0 port 5 OAM ip address - description: be0 port 5 OAM ip address - be1_Cricket_OCS_protected_ips: - type: string - label: be1 port 5 OAM ip address - description: be1 port 5 OAM ip address - be2_Cricket_OCS_protected_ips: - type: string - label: be2 port 5 OAM ip address - description: be2 port 5 OAM ip address - be3_Cricket_OCS_protected_ips: - type: string - label: be3 port 5 OAM ip address - description: be3 port 5 OAM ip address - be4_Cricket_OCS_protected_ips: - type: string - label: be4 port 5 OAM ip address - description: be4 port 5 OAM ip address - be0_OAM_direct_ips: - type: string - label: be0 port 7 OAM ip address - description: be0 port 7 OAM ip address - be1_OAM_direct_ips: - type: string - label: be1 port 7 OAM ip address - description: be1 port 7 OAM ip address - be2_OAM_direct_ips: - type: string - label: be2 port 7 OAM ip address - description: be2 port 7 OAM ip address - be3_OAM_direct_ips: - type: string - label: be3 port 7 OAM ip address - description: be3 port 7 OAM ip address - be4_OAM_direct_ips: - type: string - label: be4 port 7 OAM ip address - description: be4 port 7 OAM ip address - fe0_SIGNET_vrf_A1_direct_ips: - type: string - label: fe0 port 0 SIGTRAN ip address - description: fe0 port 0 SIGTRAN ip address - fe0_OAM_direct_ips: - type: string - label: fe0 port 7 OAM ip address - description: fe0 port 7 OAM ip address - fe1_SIGNET_vrf_B1_direct_ips: - type: string - label: fe1 port 1 SIGTRAN ip address - description: fe1 port 1 SIGTRAN ip address - fe1_OAM_direct_ips: - type: string - label: fe1 port 7 OAM ip address - description: fe1 port 7 OAM ip address - smp0_OAM_direct_ips: - type: string - label: smp0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - smp1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: smp1 port 7 OAM ip address - db0_OAM_direct_ips: - type: string - label: db0 port 7 OAM ip address - description: smp0 port 7 OAM ip address - db1_OAM_direct_ips: - type: string - label: smp1 port 7 OAM ip address - description: db1 port 7 OAM ip address - vm_scp_be0_name: - type: string - default: vSCP_BE0 - description: name of VM - vm_scp_be1_name: - type: string - default: vSCP_BE1 - description: name of VM - vm_scp_be2_name: - type: string - default: vSCP_BE2 - description: name of VM - vm_scp_be3_name: - type: string - default: vSCP_BE3 - description: name of VM - vm_scp_be4_name: - type: string - default: vSCP_BE4 - description: name of VM - vm_scp_fe0_name: - type: string - default: vSCP_FE0 - description: name of VM - vm_scp_fe1_name: - type: string - default: vSCP_FE1 - description: name of VM - vm_smp0_name: - type: string - default: vSMP0 - description: name of VM - vm_smp1_name: - type: string - default: vSMP1 - description: name of VM - vm_db0_name: - type: string - default: vDB0 - description: name of VM - vm_db1_name: - type: string - default: vDB1 - description: name of VM - -resources: -# scp_be_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_be_wait_handle } -# count: 5 -# timeout: 300 -# scp_be_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# scp_fe_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: scp_fe_wait_handle } -# count: 2 -# timeout: 300 -# scp_fe_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# smp_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: smp_wait_handle } -# count: 2 -# timeout: 300 -# smp_wait_handle: -# type: OS::Heat::WaitConditionHandle -# -# db_wait_condition: -# type: OS::Heat::WaitCondition -# properties: -# handle: { get_resource: db_wait_handle } -# count: 2 -# timeout: 300 -# db_wait_handle: -# type: OS::Heat::WaitConditionHandle - - FE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - BE_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - SMP_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - DB_Affinity: - type: OS::Nova::ServerGroup - properties: - policies: ["anti-affinity"] - - FE_Clustering_KA: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_fe_cluster_net_id } - - FE_Clustering_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: FE_Clustering_KA } - cidr: { get_param: int_vscp_fe_cluster_cidr } - - Clustering_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_cluster_net_id } - - Clustering_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: Clustering_Network } - cidr: { get_param: int_vscp_cluster_cidr } - - DB_Network: - type: OS::Contrail::VirtualNetwork - properties: - name: { get_param: int_vscp_db_network_net_id } - - DB_Network_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: DB_Network } - cidr: { get_param: int_vscp_db_network_cidr } - - server_scp_be0: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be0_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be0 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be0_port_3 } - - port: { get_resource: be0_port_4 } - - port: { get_resource: be0_port_5 } - - port: { get_resource: be0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be0_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be0_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] - - be0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] - - server_scp_be1: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be1_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be1 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be1_port_3 } - - port: { get_resource: be1_port_4 } - - port: { get_resource: be1_port_5 } - - port: { get_resource: be1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be1_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be1_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] - - be1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] - - server_scp_be2: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be2_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be2 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be2_port_3 } - - port: { get_resource: be2_port_4 } - - port: { get_resource: be2_port_5 } - - port: { get_resource: be2_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be2_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be2_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be2_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be2_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] - - be2_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] - - server_scp_be3: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be3_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be3 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be3_port_3 } - - port: { get_resource: be3_port_4 } - - port: { get_resource: be3_port_5 } - - port: { get_resource: be3_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be3_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be3_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be3_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be3_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] - - be3_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] - - server_scp_be4: - type: OS::Nova::Server -# depends on: db_wait_condition - properties: - name: { get_param: vm_scp_be4_name } - image: { get_param: image_scp_be_id } -# availability_zone: { get_param: availability_zone_be4 } - flavor: { get_param: flavor_scp_be_id } - scheduler_hints: { group: { get_resource: BE_Affinity } } - networks: - - port: { get_resource: be4_port_3 } - - port: { get_resource: be4_port_4 } - - port: { get_resource: be4_port_5 } - - port: { get_resource: be4_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_be4_name} -# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } - - be4_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - be4_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - be4_port_5: - type: OS::Neutron::Port - properties: - network: { get_param: Cricket_OCS_protected_net_id } - fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] - - be4_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] - - server_scp_fe0: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe0_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe0 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe0_port_0 } - - port: { get_resource: fe0_port_2 } - - port: { get_resource: fe0_port_3 } - - port: { get_resource: fe0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe0_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe0_port_0: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_A1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] - - fe0_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe0_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] - - server_scp_fe1: - type: OS::Nova::Server -# depends on: scp_be_wait_condition - properties: - name: { get_param: vm_scp_fe1_name } - image: { get_param: image_scp_fe_id } -# availability_zone: { get_param: availability_zone_fe1 } - flavor: { get_param: flavor_scp_fe_id } - scheduler_hints: { group: { get_resource: FE_Affinity } } - networks: - - port: { get_resource: fe1_port_1 } - - port: { get_resource: fe1_port_2 } - - port: { get_resource: fe1_port_3 } - - port: { get_resource: fe1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_scp_fe1_name} -# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } - - fe1_port_1: - type: OS::Neutron::Port - properties: - network: { get_param: SIGNET_vrf_B1_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] - - fe1_port_2: - type: OS::Neutron::Port - properties: - network_id: { get_resource: FE_Clustering_KA } - - fe1_port_3: - type: OS::Neutron::Port - properties: - network_id: { get_resource: Clustering_Network } - - fe1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] - - server_smp0: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp0_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp0 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp0_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] - - server_smp1: - type: OS::Nova::Server - properties: - name: { get_param: vm_smp1_name } - image: { get_param: image_smp_id } -# availability_zone: { get_param: availability_zone_smp1 } - flavor: { get_param: flavor_smp_id } - scheduler_hints: { group: { get_resource: SMP_Affinity } } - networks: - - port: { get_resource: smp1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_smp1_name} -# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } - - smp1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] - - server_db0: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db0_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db0 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db0_port_4 } - - port: { get_resource: db0_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db0_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db0_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db0_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] - - server_db1: - type: OS::Nova::Server -# depends_on: smp_wait_condition - properties: - name: { get_param: vm_db1_name } - image: { get_param: image_db_id } -# availability_zone: { get_param: availability_zone_db1 } - flavor: { get_param: flavor_db_id } - scheduler_hints: { group: { get_resource: DB_Affinity } } - networks: - - port: { get_resource: db1_port_4 } - - port: { get_resource: db1_port_7 } - metadata: - vnf_id: { get_param: vnf_id } - user_data: - str_replace: - template: | - #!/bin/bash - #todo: provision $vm_name - wc_notify --data-binary '{"status": "SUCCESS"}' - params: - $vm_name: {get_param: vm_db1_name} -# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } - - db1_port_4: - type: OS::Neutron::Port - properties: - network_id: { get_resource: DB_Network } - - db1_port_7: - type: OS::Neutron::Port - properties: - network: { get_param: OAM_direct_net_id } - fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/conf/sdc-packages.yaml b/ui-ci/src/main/resources/ci/conf/attsdc-packages.yaml index dcb78eefc1..dcb78eefc1 100644 --- a/ui-ci/src/main/resources/ci/conf/sdc-packages.yaml +++ b/ui-ci/src/main/resources/ci/conf/attsdc-packages.yaml diff --git a/ui-ci/src/main/resources/ci/conf/sdc.yaml b/ui-ci/src/main/resources/ci/conf/attsdc.yaml index 8e84fecf3b..1ab581cada 100644 --- a/ui-ci/src/main/resources/ci/conf/sdc.yaml +++ b/ui-ci/src/main/resources/ci/conf/attsdc.yaml @@ -1,7 +1,7 @@ outputFolder: target reportName: index.html -catalogBeHost: localhost -catalogFeHost: localhost +catalogBeHost: 127.0.0.1 +catalogFeHost: fehost esHost: eshost disributionClientHost: disClient catalogFePort: 8181 @@ -10,13 +10,12 @@ disributionClientPort: 8181 esPort: 9200 neoHost: neoHost neoPort: 7474 -neoDBusername: neo4j +neoDBusername: neo4j neoDBpassword: 123456 url: http://localhost:8285/sdc1 -remoteTestingMachineIP: 1.2.3.4 -remoteTestingMachinePort: 5555 +remoteTestingMachineIP: 0.0.0.0 +remoteTestingMachinePort: 5566 remoteTesting: false - resourceConfigDir: src/test/resources/CI/tests componentsConfigDir: src/test/resources/CI/components importResourceConfigDir: src/test/resources/CI/importResource @@ -24,7 +23,14 @@ importResourceTestsConfigDir: src/test/resources/CI/importResourceTests errorConfigurationFile: ../catalog-be/src/main/resources/config/error-configuration.yaml configurationFile: ../catalog-be/src/main/resources/config/configuration.yaml importTypesConfigDir: src/test/resources/CI/importTypesTest +browser: FireFox +windowsDownloadDirectory: "c:\\apache-ftpserver-1.1.0\\res\\home\\" +systemUnderDebug: true +reportDBhost: dbhost +reportDBport: 27017 +useBrowserMobProxy: false +captureTraffic: false titanPropertiesFile: src/main/resources/ci/conf/titan.properties diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml b/ui-ci/src/main/resources/ci/conf/credentials.yaml index a30d8ce538..481b12b1e0 100644 --- a/ui-ci/src/main/resources/ci/conf/credentials.yaml +++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml @@ -1,48 +1,48 @@ designer: { - username: cs0008, - password: demo, + username: m08740, + password: 272v!suAL37, firstname: ASDC, - lastname: KASPIN + lastname: VITI } admin: { - username: jh0003, - password: demo, + username: m08741, + password: 863B@rroN27, firstname: ASDC, - lastname: KASPIN + lastname: VITI } ops: { - username: op0001, - password: demo, + username: m08742, + password: 364K!NDRed63, firstname: ASDC, - lastname: KASPIN + lastname: VITI } tester: { - username: jm0007, - password: demo, + username: m08743, + password: 373m@rBLE28, firstname: ASDC, - lastname: KASPIN + lastname: VITI } governor: { - username: gv0001, - password: demo, + username: m08744, + password: 742M!DDLE44, firstname: ASDC, - lastname: KASPIN + lastname: VITI } - product_strategist: { - username: ps0001, - password: demo, + product_strategist1: { + username: m08745, + password: 824S@Nder35, firstname: ASDC, - lastname: KASPIN + lastname: VITI } - product_manager: { - username: pm0001, - password: demo, + product_manager1: { + username: m08746, + password: 747ICK!Y99, firstname: ASDC, - lastname: KASPIN + lastname: VITI } product_local: { - username: pm0001, - password: 123123a, + username: m08747, + password: 623z!Ggy75, firstname: ASDC, - lastname: KASPIN + lastname: VITI }
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod b/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod new file mode 100644 index 0000000000..481b12b1e0 --- /dev/null +++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod @@ -0,0 +1,48 @@ + designer: { + username: m08740, + password: 272v!suAL37, + firstname: ASDC, + lastname: VITI + } + admin: { + username: m08741, + password: 863B@rroN27, + firstname: ASDC, + lastname: VITI + } + ops: { + username: m08742, + password: 364K!NDRed63, + firstname: ASDC, + lastname: VITI + } + tester: { + username: m08743, + password: 373m@rBLE28, + firstname: ASDC, + lastname: VITI + } + governor: { + username: m08744, + password: 742M!DDLE44, + firstname: ASDC, + lastname: VITI + } + product_strategist1: { + username: m08745, + password: 824S@Nder35, + firstname: ASDC, + lastname: VITI + } + product_manager1: { + username: m08746, + password: 747ICK!Y99, + firstname: ASDC, + lastname: VITI + } + product_local: { + username: m08747, + password: 623z!Ggy75, + firstname: ASDC, + lastname: VITI + }
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest b/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest new file mode 100644 index 0000000000..ab37f7bee8 --- /dev/null +++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest @@ -0,0 +1,48 @@ + designer: { + username: cs0008, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + admin: { + username: jh0003, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + ops: { + username: af0006, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + tester: { + username: kb0004, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + governor: { + username: ah0002, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + product_strategist: { + username: m99126, + password: 1910-FruitGum, + firstname: ASDC, + lastname: KASPIN + } + product_manager: { + username: m99127, + password: 747-Airplane, + firstname: ASDC, + lastname: KASPIN + } + product_local: { + username: pm0001, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + }
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/conf/extent-config.xml b/ui-ci/src/main/resources/ci/conf/extent-config.xml new file mode 100644 index 0000000000..ab04b2678a --- /dev/null +++ b/ui-ci/src/main/resources/ci/conf/extent-config.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<extentreports> + <configuration> + <!-- report theme --> + <!-- standard, dark --> + <theme>standard</theme> + + <!-- document encoding --> + <!-- defaults to UTF-8 --> + <encoding>UTF-8</encoding> + + <!-- protocol for script and stylesheets --> + <!-- defaults to https --> + <protocol>https</protocol> + + <!-- title of the document --> + <documentTitle>ASDC Automation Report</documentTitle> + + <!-- report name - displayed at top-nav --> + <reportName> ASDC Automation Report </reportName> + + <!-- report headline - displayed at top-nav, after reportHeadline --> + <reportHeadline></reportHeadline> + + <!-- global date format override --> + <!-- defaults to yyyy-MM-dd --> + <dateFormat>yyyy-MM-dd</dateFormat> + + <!-- global time format override --> + <!-- defaults to HH:mm:ss --> + <timeFormat>HH:mm:ss</timeFormat> + + <!-- custom javascript --> + <scripts> + <![CDATA[ + $(document).ready(function() { + $('.logo-container').prepend("<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 70%; height: 70%;'/></span>"); + $('.logo-content' ).remove(); + $('.charts div:nth-child(2)').remove(); + }); + ]]> + </scripts> + + <!-- custom styles --> + <styles> + <![CDATA[ + .report-name {padding-top: 1px; font-size: 15px; font-weight: bold;} + ]]> + </styles> + </configuration> +</extentreports>
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/drivers/chromedriver.exe b/ui-ci/src/main/resources/ci/drivers/chromedriver.exe Binary files differnew file mode 100644 index 0000000000..97464543e7 --- /dev/null +++ b/ui-ci/src/main/resources/ci/drivers/chromedriver.exe diff --git a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh new file mode 100644 index 0000000000..1b6f0258d6 --- /dev/null +++ b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +function help_usage () +{ + echo "$0 -ip <ip> -f <userToAdd_file>" + echo "for example: -ip 127.0.0.1 -f /var/tmp/userToAdd.txt" + exit +} + +function check_file_existance () +{ +echo "check_file_existance $1" +if [ $1 == "" ]; then + echo "Please provide full path to user file" + exit; +elif [ -f $1 ]; then + source $1 + USERS=("${USER_LIST[@]}") + echo "file exist" $1 +else + echo "Provided user file does not exist" + exit +fi +} + +function check_ip_existance () +{ +if [ $1 == "" ]; then + echo "Please provide ip address" + exit; +fi +} + +function addUser () +{ + #for user in "${USER_LIST[@]}"; do + for user in "${USERS[@]}"; do + PING=`ping -c 1 $IP > /var/tmp/ping.log` + pattern1='100% packet loss' + pattern2='Host Unreachable' + COUNT=`egrep -c "$pattern1|$pattern2" /var/tmp/ping.log` + if [ $COUNT -eq 0 ]; then + # curl -i -X post -d '{ "userId" : "kk1123", "role" : "ADMIN" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://192.168.111.9:8080/sdc2/rest/v1/user + userId=`echo $user|awk '{print $1}'` + role=`echo $user|awk '{print $2}'` + firstName=`echo $user|awk '{print $3}'` + lastName=`echo $user|awk '{print $4}'` + email=`echo $user|awk '{print $5}'` + curl --noproxy '*' -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user + else + echo "Host" $IP "Is Unreachable" + fi + done +curl --noproxy '*' -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" http://${IP}:8080/sdc2/rest/v1/consumers + +} + +#main +[ $# -eq 0 ] && help_usage +while [ $# -ne 0 ]; do + case $1 in + "-f") + USER_FILE=$2 + shift 1 + shift 1 + ;; + -ip) + IP=$2 + shift 1 + shift 1 + ;; + *) +# help_usage + ;; + esac +done + +check_file_existance $USER_FILE +check_ip_existance $IP +addUser diff --git a/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh b/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh new file mode 100644 index 0000000000..396c1aa0ac --- /dev/null +++ b/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +REPORT_NAME=$1 +VERSION=$2 +ENV=$3 +IP=$3 + +if [ -z "$REPORT_NAME" ] + then + source ExtentReport/versions.info + now=$(date +'%Y-%m-%d_%H_%M') + REPORT_NAME="${now}" + VERSION="${osVersion}" + if [[ $env == *"DEV20"* ]] + then + ENV="Nightly" + else + ENV="" + fi + + fi + +/usr/bin/expect << EOF +spawn ssh admin@${IP} mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/ + +expect { + -re ".*es.*o.*" { + exp_send "yes\r" + exp_continue + } + -re ".*sword.*" { + exp_send "Aa123456\r" + } +} + +expect eof + +spawn scp -pr ExtentReport admin@{IP}:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/ + +expect { + -re ".*es.*o.*" { + exp_send "yes\r" + exp_continue + } + -re ".*sword.*" { + exp_send "Aa123456\r" + } +} + +expect eof +EOF diff --git a/ui-ci/src/main/resources/ci/scripts/sendMail.sh b/ui-ci/src/main/resources/ci/scripts/sendMail.sh new file mode 100644 index 0000000000..794534fc8a --- /dev/null +++ b/ui-ci/src/main/resources/ci/scripts/sendMail.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +now=$(date +'%Y%-m%d%H%M') + +REPORT_NAME=$1 +VERSION=$2 +ENV=$3 + +RECIPIENTS1="dl-sdcqa@intl.att.com,ml636r@intl.att.com,bl5783intl.att.com,ak314p@intl.att.com,el489u@intl.att.com,hk096q@intl.att.com,bs5719@intl.att.com" +RECIPIENTS2="dl-asdcqa@intl.att.com" + +source ExtentReport/versions.info +if [ -z "$REPORT_NAME" ] + then + source ExtentReport/versions.info + now=$(date +'%Y-%m-%d_%H_%M') + REPORT_NAME="${now}" + VERSION="${osVersion}" + + +fi + +if [[ $env == *"DEV20"* ]] + then + ENV="Nightly" + RECIPIENTS=$RECIPIENTS1 + else + ENV="" + RECIPIENTS=$RECIPIENTS2 +fi + +#REPORT_ZIP_FILE=ExtentReport_${now}.zip +REPORT_FOLDER='ExtentReport' +REPORT_HTML_FILE=${REPORT_FOLDER}/*Report.html +BODY_MESSAGE='Hello, \n\n Please find automation results on following link: \n\n http://asdc-srv-210-45.tlv.intl.att.com/'${ENV}'/'${VERSION}'/UI/'${REPORT_NAME}'/SDC_UI_Extent_Report.html \n\nThanks, \nASDC QA Team\n\n ' + +#OLD_FILE=$(find ./ -type f -name ${REPORT_ZIP_FILE} -print) +#if [ ! -z ${OLD_FILE} ] +#then +# rm -f ${REPORT_ZIP_FILE} +# echo "Removing old zip file............" +#fi + +#echo "Creating new zip file" +#zip -r ${REPORT_ZIP_FILE} ./${REPORT_FOLDER} + + + +echo -e ${BODY_MESSAGE} | mail -s 'E2E Automation '$ENV' results - SDC '$VERSION -r 'ASDC@Automation.team' $RECIPIENTS diff --git a/ui-ci/src/main/resources/ci/scripts/startTest.sh b/ui-ci/src/main/resources/ci/scripts/startTest.sh index b4b2cb114e..737b538b01 100644 --- a/ui-ci/src/main/resources/ci/scripts/startTest.sh +++ b/ui-ci/src/main/resources/ci/scripts/startTest.sh @@ -1,22 +1,64 @@ #!/bin/bash +REMOTE_DEBUG=false +RERUN=true +JAVA_OPTION="" +debug_port=8000 +TEST_SUITES=testSuites +fileName=testng-failed.xml + +function help_usage () +{ + echo + echo "$0 (<jar_file_name> <suite file name>) [-r/rerun <true/false> -d/debug <true/false>]" + echo "nohup ./startTest.sh ui-ci-1707.0.5-SNAPSHOT-jar-with-dependencies.jar extendedSanity.xml -r false -d true &" + echo "by default rerun is true and remote debug is false." + echo + exit 2 +} -function usage { - echo "Usage: $0 <jar file>" +function isBoolean () +{ + PARAM_NAME=$1 + VALUE=$2 + if [[ ${VALUE} != "true" ]] && [[ ${VALUE} != "false" ]]; then + echo "Valid parameter" ${PARAM_NAME} "values are: true/false" + help_usage + fi } -function exitOnError() { - if [ $1 -ne 0 ] - then - echo "Failed running task $2" - exit 2 - fi +function prepareFailedXmlFile () +{ + echo "1="$1 "2="$2 "fileName="${fileName} + PATTERN=`grep -w "test name=" ${FULL_PATH}/${TEST_SUITES}/$2 | awk -F'"' '{print $2}'` + sed '/<test name="'${PATTERN}'"/,/<!-- '${PATTERN}' --/d' $1 > ${FULL_PATH}/${TEST_SUITES}/${fileName} + sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName} } -if [ $# -lt 1 ] -then - usage - exit 2 -fi +#main +[ $# -lt 2 ] && help_usage + +JAR_FILE=$1 +SUITE_FILE=$2 + +while [ $# -ne 0 ]; do + case $1 in + -r|rerun) + RERUN=$2 + isBoolean $1 ${RERUN} + shift 1 + shift 1 + ;; + -d|debug) + REMOTE_DEBUG=$2 + isBoolean $1 ${REMOTE_DEBUG} + shift 1 + shift 1 + ;; + *) + shift 1 + ;; + esac +done CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) @@ -27,70 +69,87 @@ then else FULL_PATH=$CURRENT_DIR/$BASEDIR fi - LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties ############################################# TARGET_DIR=${FULL_PATH}/target -CONF_FILE=${FULL_PATH}/conf/sdc.yaml +CONF_FILE=${FULL_PATH}/conf/attsdc.yaml DEBUG=true MainClass=org.openecomp.sdc.ci.tests.run.StartTest -JAR_FILE=$1 -SUITE_FILE=$2 -FILES_TEST=$3 - -if [ -z "$3" ] -then - FILES_TEST=${FULL_PATH}/Files - echo "$3" -fi - -#TARGET_DIR=`echo ${TARGET_DIR} | sed 's/\//\//g'` -#echo $TARGET_DIR - TESTS_DIR=/opt/app/sdc/ci/resources/tests COMPONENTS_DIR=/opt/app/sdc/ci/resources/components -#sed -i 's#\(outputFolder:\).*#\1 '${TARGET_DIR}'#g' $CONF_FILE -#sed -i 's#\(resourceConfigDir:\).*#\1 '${TESTS_DIR}'#g' $CONF_FILE -#sed -i 's#\(componentsConfigDir:\).*#\1 '${COMPONENTS_DIR}'#g' $CONF_FILE + TARGET_LOG_DIR="${TARGET_DIR}/" -# mkdir -p ${TARGET_DIR} -#if [ -d ${TARGET_DIR} ] -#then -# rm -rf ${TARGET_DIR}/* -#exitOnError $? "Failed_to_delete_target_dir" -#fi -debug_port=8800 -#JAVA_OPTION="-javaagent:/var/tmp/jacoco/lib/jacocoagent.jar=destfile=jacoco-it.exec" -JAVA_OPTION="" -case "$2" in - -debug) echo "Debug mode, Listen on port $debug_port"; JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;; - "") echo "Standard mode";; - *) echo "USAGE: startTest.sh [-debug]";; -esac +######ADD USERS################ + +BE_IP=`cat conf/attsdc.yaml | grep catalogBeHost| awk '{print $2}'` + +ADD_USERS_SCRIPT="addUsersFromList_new.sh" +USER_LIST="userList.txt" +chmod +x ${ADD_USERS_SCRIPT} +echo "add users..." +`./${ADD_USERS_SCRIPT} -ip ${BE_IP} -f ${USER_LIST}` + + -cmd="nohup java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" -#echo $cmd -#console=`$cmd` +if [ ${REMOTE_DEBUG} == "true" ]; then + echo "Debug mode, Listen on port $debug_port"; + JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ; +fi + +cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" + if [ $DEBUG == "true" ] then $cmd else $cmd >> /dev/null -fi +fi + +if [ ${RERUN} == "true" ]; then + if [ -f ${TARGET_DIR}/${fileName} ]; then + echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ..."; + prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE; + SUITE_FILE=${fileName}; + cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" + $cmd; + fi +fi + status=`echo $?` +source ExtentReport/versions.info +now=$(date +'%Y-%m-%d_%H_%M') +REPORT_NAME=${now} +VERSION=${osVersion} + +if [[ $env == *"DEV20"* ]] +then + MYENV="Nightly" +else + MYENV="" +fi + +COPY_REPORT_SCRIPT="copyToStorage.sh" +chmod +x ${COPY_REPORT_SCRIPT} +echo "copy report to storage..." +sh ./${COPY_REPORT_SCRIPT} ${REPORT_NAME} ${VERSION} ${MYENV} + + +MAILING_SCRIPT_NAME="sendMail.sh" +chmod +x ${MAILING_SCRIPT_NAME} +echo "Sending report via mail..." +`./${MAILING_SCRIPT_NAME} ${REPORT_NAME} ${VERSION} ${MYENV}` echo "##################################################" echo "################# status is ${status} #################" echo "##################################################" -exit $status - +exit $status diff --git a/ui-ci/src/main/resources/ci/scripts/userList.txt b/ui-ci/src/main/resources/ci/scripts/userList.txt new file mode 100644 index 0000000000..1a2026f291 --- /dev/null +++ b/ui-ci/src/main/resources/ci/scripts/userList.txt @@ -0,0 +1 @@ +export USER_LIST=( "m99121 DESIGNER Carlos Santana carlos@email.com" "cs0008 DESIGNER Carlos Santana carlos@email.com" "kb0004 TESTER Carlos Santana carlos@email.com" "af0006 OPS Carlos Santana carlos@email.com" "ah0002 GOVERNOR Carlos Santana carlos@email.com" "m08740 DESIGNER Carlos Santana carlos@email.com" "m99124 TESTER Carlos Santana carlos@email.com" "m08743 TESTER Carlos Santana carlos@email.com" "m99123 OPS Carlos Santana carlos@email.com" "m08742 OPS" "m99125 GOVERNOR Carlos Santana carlos@email.com" "m08744 GOVERNOR Carlos Santana carlos@email.com" "m99122 ADMIN Carlos Santana carlos@email.com" "m08741 ADMIN Carlos Santana carlos@email.com" "m99126 PRODUCT_STRATEGIST Carlos Santana carlos@email.com" "m08745 PRODUCT_STRATEGISTCarlos Santana carlos@email.com" "m99127 PRODUCT_MANAGER Carlos Santana carlos@email.com" "m08746 PRODUCT_MANAGER Carlos Santana carlos@email.com" "md9897 DESIGNER Carlos Santana carlos@email.com" "m08748 DESIGNER Carlos Santana carlos@email.com" "m08749 TESTER Carlos Santana carlos@email.com" "be0695 DESIGNER Carlos Santana carlos@email.com" "er434w DESIGNER Carlos Santana carlos@email.com" "ya107f DESIGNER Carlos Santana carlos@email.com" "ds200p DESIGNER Carlos Santana carlos@email.com" "ak0333 ADMIN Carlos Santana carlos@email.com" "th0695 DESIGNER Carlos Santana carlos@email.com" "al714h DESIGNER Carlos Santana carlos@email.com" "ys9693 DESIGNER Carlos Santana carlos@email.com" "ss8214 DESIGNER Carlos Santana carlos@email.com" "bt750h DESIGNER Carlos Santana carlos@email.com" "rp955r DESIGNER Carlos Santana carlos@email.com" "ez6451 DESIGNER Carlos Santana carlos@email.com" "ia901h DESIGNER Carlos Santana carlos@email.com" "ah7840 DESIGNER Carlos Santana carlos@email.com" "ea394r DESIGNER Carlos Santana carlos@email.com" "ms656r DESIGNER Carlos Santana carlos@email.com" "ml636r DESIGNER Carlos Santana carlos@email.com" "it1721 DESIGNER Carlos Santana carlos@email.com" "sg473v DESIGNER Carlos Santana carlos@email.com" "sa997j DESIGNER Carlos Santana carlos@email.com" "az2497 DESIGNER Carlos Santana carlos@email.com" "ys189e DESIGNER Carlos Santana carlos@email.com" "ig642y DESIGNER Carlos Santana carlos@email.com")
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml b/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml new file mode 100644 index 0000000000..f4f99db3a1 --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2"> + <test name="uiSanity"> + <classes> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/> + <!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> --> + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/ui-ci.xml b/ui-ci/src/main/resources/ci/testSuites/devOnboardSanity.xml index a6c2584a2c..5b44e68375 100644 --- a/ui-ci/src/main/resources/ci/testSuites/ui-ci.xml +++ b/ui-ci/src/main/resources/ci/testSuites/devOnboardSanity.xml @@ -6,11 +6,9 @@ <!--onboard--> <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> <methods> - <include name="onboardVNFTest"/> + <include name="onboardVNFTestSanity"/> </methods> </class> - <!--vf--> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> </classes> </test> <!-- uitests --> </suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/devSanity.xml b/ui-ci/src/main/resources/ci/testSuites/devSanity.xml new file mode 100644 index 0000000000..6c4ba547b1 --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/devSanity.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="4" data-provider-thread-count="2"> + <test name="uiSanity"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <include name="onboardVNFTestSanity"/> + </methods> + </class> + + + + + + + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml new file mode 100644 index 0000000000..da2bc98ebc --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2"> + <parameter name="makeDistribution" value="true"/> + + <test name="uiSanity"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <exclude name="onboardVNFTestSanity"/> + </methods> + </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/> + <!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> --> + + <class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/> + <class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/> + <class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/> + + <!-- <class name="org.openecomp.sdc.ci.tests.US.AddComponentInstancesArtifactsInCsar"/> --> + + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/fullCI.xml b/ui-ci/src/main/resources/ci/testSuites/fullCI.xml new file mode 100644 index 0000000000..940026d30c --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/fullCI.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2"> + <test name="uiSanity"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <exclude name="onboardVNFTestSanity"/> + </methods> + </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> + + <class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/> + <class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/> + <class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/> + + + + + + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml b/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml new file mode 100644 index 0000000000..a49c8a751c --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2"> +<parameter name="makeDistribution" value="true"/> + <test name="Onboarding"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <include name="onboardVNFTest"/> + </methods> + </class> + + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/main/resources/ci/testSuites/sanity.xml b/ui-ci/src/main/resources/ci/testSuites/sanity.xml new file mode 100644 index 0000000000..c8fd8f14b1 --- /dev/null +++ b/ui-ci/src/main/resources/ci/testSuites/sanity.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="4" data-provider-thread-count="2"> + <test name="uiSanity"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <include name="onboardVNFTestSanity"/> + </methods> + </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/> + <!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> --> + + + + + + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file diff --git a/ui-ci/src/test/Completetheform.js b/ui-ci/src/test/Completetheform.js index 13779e24b8..7e8b7572cc 100644 --- a/ui-ci/src/test/Completetheform.js +++ b/ui-ci/src/test/Completetheform.js @@ -1,23 +1,3 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - /** * New node file */ diff --git a/ui-ci/tarball.xml b/ui-ci/tarball.xml index 1413038c94..9d7d4c1022 100644 --- a/ui-ci/tarball.xml +++ b/ui-ci/tarball.xml @@ -20,14 +20,19 @@ <!--file> <source>src/main/resources/ci/scripts/postinstall</source> <outputDirectory>./</outputDirectory> <destName>postinstall</destName> </file --> <file> - <source>src/main/resources/ci/conf/sdc.yaml</source> + <source>src/main/resources/ci/conf/attsdc.yaml</source> <outputDirectory>conf</outputDirectory> - <destName>sdc.yaml</destName> + <destName>attsdc.yaml</destName> </file> <file> - <source>src/main/resources/ci/conf/sdc-packages.yaml</source> + <source>src/main/resources/ci/conf/attsdc-packages.yaml</source> <outputDirectory>conf</outputDirectory> - <destName>sdc-packages.yaml</destName> + <destName>attsdc-packages.yaml</destName> + </file> + <file> + <source>../catalog-be/src/main/resources/config/error-configuration.yaml</source> + <outputDirectory>conf</outputDirectory> + <destName>error-configuration.yaml</destName> </file> <file> <source>../asdc-tests/src/main/resources/ci/conf/log4j.properties</source> @@ -39,6 +44,11 @@ <outputDirectory>conf</outputDirectory> <destName>credentials.yaml</destName> </file> + <file> + <source>src/main/resources/ci/drivers/chromedriver.exe/</source> + <outputDirectory>drivers</outputDirectory> + <destName>chromedriver.exe</destName> + </file> </files> |