tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_browse_encrypted.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 15 Nov 2022 14:04:10 +0100
branchwxPython4
changeset 3676 2f79540660f6
parent 3672 tests/ide_tests/opcua_browse.sikuli/opcua_browse.py@230c8b90f3dc
child 3679 b6bca75bf3fa
permissions -rw-r--r--
Tests: add encrypted OPCUA browsing test.
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
     1
""" This test opens, modifies, builds and runs exemple project named "python".
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
Test succeeds if runtime's stdout behaves as expected
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
"""
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
import os
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
import time
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
# allow module import from current test directory's parent
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
addImportPath(os.path.dirname(getBundlePath()))
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
# common test definitions module
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    12
from sikuliberemiz import run_test, AuxiliaryProcess
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    14
def test(app):
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    16
    server = AuxiliaryProcess(app, ["/bin/bash",os.path.join(getBundlePath(),"opcua_service.bash")])
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    17
    #server = AuxiliaryProcess(app, ["/bin/bash","-c","echo $PWD"])
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    18
3676
2f79540660f6 Tests: add encrypted OPCUA browsing test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3672
diff changeset
    19
    server.waitPatternInStdout("CERTS READY", 5)
2f79540660f6 Tests: add encrypted OPCUA browsing test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3672
diff changeset
    20
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    21
    app.doubleClick("opcua_node.png")
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    23
    app.WaitIdleUI()
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    24
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    25
    # app.click("Browse Server") # OCR didn't work because of gradient in button...
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    26
    app.click("opcua_browse_server.png")
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    27
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    28
    app.WaitIdleUI()
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    29
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    30
    app.doubleClick("Objects")
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    31
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    32
    app.WaitIdleUI()
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    33
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    34
    app.doubleClick("TestObject")
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    35
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    36
    app.dragNdrop("TestIn", "output variables")
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    37
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    38
    app.wait(1)
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    39
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    40
    app.dragNdrop("TestOut", "input variables")
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    41
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    42
    app.wait(3)
3436
ccaabb9da623 Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3424
diff changeset
    43
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    44
    app.k.Clean()
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    45
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    46
    app.waitForChangeAndIdleStdout()
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    47
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    48
    app.k.Build()
3437
ce366d67a5b7 Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3436
diff changeset
    49
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    50
    app.waitForChangeAndIdleStdout()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    51
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    52
    app.k.Connect()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    53
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    54
    app.waitForChangeAndIdleStdout()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    56
    app.k.Transfer()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    58
    app.waitForChangeAndIdleStdout()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    60
    app.k.Run()
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    61
3447
65c5f66e9298 Tests: add HTML report generation and a workaround to bad exception handling in sikuli.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3446
diff changeset
    62
    # wait 10 seconds for 10 patterns
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    63
    res = app.waitPatternInStdout("6.8", 10)
3424
7db96e011fe7 Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    64
3672
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    65
    server.close()
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    66
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    67
    return res
230c8b90f3dc Tests: Add OPC-UA server browsing and veriable picking UI test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3545
diff changeset
    68
3676
2f79540660f6 Tests: add encrypted OPCUA browsing test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3672
diff changeset
    69
run_test(test, testproject="opcua_browse_encrypted")