ScriptCollection 4.4.53__py3-none-any.whl → 4.4.55__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ScriptCollection/Executables.py +32 -0
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +66 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +59 -0
- ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py +47 -17
- {scriptcollection-4.4.53.dist-info → scriptcollection-4.4.55.dist-info}/METADATA +1 -1
- {scriptcollection-4.4.53.dist-info → scriptcollection-4.4.55.dist-info}/RECORD +10 -10
- {scriptcollection-4.4.53.dist-info → scriptcollection-4.4.55.dist-info}/entry_points.txt +2 -0
- {scriptcollection-4.4.53.dist-info → scriptcollection-4.4.55.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.53.dist-info → scriptcollection-4.4.55.dist-info}/top_level.txt +0 -0
ScriptCollection/Executables.py
CHANGED
|
@@ -1337,3 +1337,35 @@ def SyncXlfFiles()->int:
|
|
|
1337
1337
|
folder=GeneralUtilities.resolve_relative_path(args.folder, os.getcwd())
|
|
1338
1338
|
sc.sync_xlf2_files(args.prefix, languages, folder)
|
|
1339
1339
|
return 0
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
def TrustedRootCAToBase64() -> int:
|
|
1343
|
+
parser = argparse.ArgumentParser(description="Reads a PEM-encoded certificate-file (typically a .crt/.pem of a root-CA) and prints its content as a single base64-string. Use the result as the value of a TrustedRootCA_<name>_ContentBase64-environment-variable, which SCBuilder's container-build-mechanism installs into the trust-store of the build-container (see the \"TrustedRootCAs\"-section of the ScriptCollection-reference). The base64-form is intended for CI-secret-stores which do not support multiline values; for a plain .crt-file on disk use TrustedRootCA_<name>_Path instead.")
|
|
1344
|
+
parser.add_argument('-p', '--path', required=True, help="Path to the PEM-file.")
|
|
1345
|
+
args = parser.parse_args()
|
|
1346
|
+
if not os.path.isfile(args.path):
|
|
1347
|
+
GeneralUtilities.write_message_to_stderr(f"File '{args.path}' does not exist.")
|
|
1348
|
+
return 1
|
|
1349
|
+
with open(args.path, "rb") as pem_file:
|
|
1350
|
+
content = pem_file.read()
|
|
1351
|
+
if b"-----BEGIN CERTIFICATE-----" not in content:
|
|
1352
|
+
GeneralUtilities.write_message_to_stderr(f"File '{args.path}' does not look like a PEM-encoded certificate (missing \"-----BEGIN CERTIFICATE-----\"-header).")
|
|
1353
|
+
return 2
|
|
1354
|
+
GeneralUtilities.write_message_to_stdout(base64.b64encode(content).decode("ascii"))
|
|
1355
|
+
return 0
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
def ShowTrustedRootCAs() -> int:
|
|
1359
|
+
parser = argparse.ArgumentParser(description="Lists the trusted root-CA-certificates which were injected into this build-container through the TrustedRootCA_<name>_*-mechanism. Prints the filenames in /usr/local/share/ca-certificates/, which is the location SCBuilder's EntryPoint.sh writes injected CAs to (see the \"TrustedRootCAs\"-section of the ScriptCollection-reference). Intended to be run inside a build-container; outside a container the result is only meaningful on hosts which use the same system-wide trust-store-layout as Debian.")
|
|
1360
|
+
parser.parse_args()
|
|
1361
|
+
trusted_root_ca_folder = "/usr/local/share/ca-certificates"
|
|
1362
|
+
if not os.path.isdir(trusted_root_ca_folder):
|
|
1363
|
+
GeneralUtilities.write_message_to_stdout("No trusted root-CA-certificates are installed through the TrustedRootCA-mechanism (folder /usr/local/share/ca-certificates/ does not exist).")
|
|
1364
|
+
return 0
|
|
1365
|
+
entries = sorted(entry for entry in os.listdir(trusted_root_ca_folder) if os.path.isfile(os.path.join(trusted_root_ca_folder, entry)))
|
|
1366
|
+
if not entries:
|
|
1367
|
+
GeneralUtilities.write_message_to_stdout("No trusted root-CA-certificates are installed through the TrustedRootCA-mechanism (folder /usr/local/share/ca-certificates/ is empty).")
|
|
1368
|
+
return 0
|
|
1369
|
+
for entry in entries:
|
|
1370
|
+
GeneralUtilities.write_message_to_stdout(entry)
|
|
1371
|
+
return 0
|
|
@@ -621,6 +621,72 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
621
621
|
self.tfcps_Tools_General.calculate_entire_line_rate(coverage_file)
|
|
622
622
|
self.run_testcases_common_post_task(repository_folder, codeunit_name, True, self.get_target_environment_type())
|
|
623
623
|
|
|
624
|
+
@GeneralUtilities.check_arguments
|
|
625
|
+
def run_visual_regression_tests_in_container(self, package_name: str, update_baselines: bool, visual_regression_tests_relative_path: str = "test/visual_regression") -> None:
|
|
626
|
+
"""Runs the visual-regression-tests of a flutter-codeunit inside a sibling-container of the "SCBuilder"-image.
|
|
627
|
+
|
|
628
|
+
A rendered image depends on the operating-system (the version of the flutter-sdk and therefore of the fonts
|
|
629
|
+
it ships, the font-rendering and the antialiasing), so a baseline-image is only reproducible when the tests
|
|
630
|
+
which generate and the tests which compare it both run in the same, fixed image. The tests are therefore
|
|
631
|
+
never run directly on a developer's or build-agent's host but always in this container.
|
|
632
|
+
|
|
633
|
+
'package_name' is the name of the dart-package inside the codeunit (the folder which contains the
|
|
634
|
+
"pubspec.yaml"). 'visual_regression_tests_relative_path' is the folder - relative to that package - which
|
|
635
|
+
contains the visual-regression-tests; only that folder is passed to "flutter test" so that the normal
|
|
636
|
+
(non-visual) testcases are not re-run here. The visual-regression-tests have to be tagged with
|
|
637
|
+
"visual-regression" and skipped by default (see the "dart_test.yaml" of such a package), which is why they
|
|
638
|
+
are run explicitly with "--tags visual-regression --run-skipped".
|
|
639
|
+
|
|
640
|
+
If 'update_baselines' is true the baseline-images are (re-)generated ("--update-goldens") instead of being
|
|
641
|
+
compared against."""
|
|
642
|
+
codeunit_folder: str = self.get_codeunit_folder()
|
|
643
|
+
repository_folder: str = self.get_repository_folder()
|
|
644
|
+
image: str = self.tfcps_Tools_General.oci_image_manager.get_registry_address_for_image_with_default_tag(repository_folder, "SCBuilder")
|
|
645
|
+
image_address, image_tag = ScriptCollectionCore.split_image_address_and_tag(image)
|
|
646
|
+
self.__assert_docker_daemon_is_reachable()
|
|
647
|
+
self._protected_sc.docker_pull(image_address, image_tag)
|
|
648
|
+
# If this process already runs inside a container (for example a "scbuildcodeunits -c"-run) whose
|
|
649
|
+
# docker-socket is forwarded to the daemon of the host, a bind-mount of the codeunit-folder would be
|
|
650
|
+
# resolved by that host-daemon, where the path of this container does not exist: the daemon would silently
|
|
651
|
+
# create and mount an empty directory, so the sibling-container would find no pubspec.yaml ("Expected to
|
|
652
|
+
# find project root in current working directory."). Sharing the own volumes via "--volumes-from" instead
|
|
653
|
+
# exposes the codeunit to the sibling-container under the very same path it has here. Directly on a host the
|
|
654
|
+
# bind-mount is correct and is therefore kept. This mirrors __build_linux_in_container and
|
|
655
|
+
# TFCPS_VisualRegressionTests, which handle the identical situation the same way.
|
|
656
|
+
if self.__is_running_in_container():
|
|
657
|
+
mount_arguments: list[str] = ["--volumes-from", self.__get_own_container_id()]
|
|
658
|
+
codeunit_folder_in_container: str = codeunit_folder.replace("\\", "/")
|
|
659
|
+
else:
|
|
660
|
+
codeunit_folder_in_container = "/codeunit"
|
|
661
|
+
mount_arguments = ["-v", f"{codeunit_folder}:{codeunit_folder_in_container}"]
|
|
662
|
+
package_folder_in_container: str = f"{codeunit_folder_in_container}/{package_name}"
|
|
663
|
+
# The ".dart_tool"-folders are hidden behind own volumes, so that "flutter pub get" (which has to run inside
|
|
664
|
+
# the container, because a ".dart_tool"-folder records host-specific absolute paths into the pub-cache and
|
|
665
|
+
# the flutter-sdk) neither uses nor overwrites the ones of the host. The volumes are reused by the following
|
|
666
|
+
# runs, so only the first run has to download the packages again. The example-application (if the package has
|
|
667
|
+
# one) gets one of its own because "flutter pub get" of the package resolves it as well.
|
|
668
|
+
dart_tool_volume_name: str = f"{self.get_codeunit_name().lower()}-visual-regression-tests-dart-tool"
|
|
669
|
+
volume_arguments: list[str] = ["-v", f"{dart_tool_volume_name}:{package_folder_in_container}/.dart_tool"]
|
|
670
|
+
if os.path.isdir(os.path.join(codeunit_folder, package_name, "example")):
|
|
671
|
+
volume_arguments = volume_arguments+["-v", f"{dart_tool_volume_name}-example:{package_folder_in_container}/example/.dart_tool"]
|
|
672
|
+
command: str = "flutter pub get && flutter test"
|
|
673
|
+
if update_baselines:
|
|
674
|
+
command = f"{command} --update-goldens"
|
|
675
|
+
command = f"{command} --tags visual-regression --run-skipped {visual_regression_tests_relative_path}"
|
|
676
|
+
arguments: list[str] = ["run", "--rm"]+mount_arguments+volume_arguments+["-w", package_folder_in_container, image, "/bin/sh", "-c", command]
|
|
677
|
+
result = self._protected_sc.run_program_argsasarray("docker", arguments, throw_exception_if_exitcode_is_not_zero=False, print_live_output=True, print_errors_as_information=True)
|
|
678
|
+
if result[0] != 0:
|
|
679
|
+
verb: str = "updating the baseline-images of" if update_baselines else "running"
|
|
680
|
+
raise ValueError(f"The visual-regression-tests of the codeunit \"{self.get_codeunit_name()}\" failed while {verb} them (docker exit-code {result[0]}).")
|
|
681
|
+
|
|
682
|
+
@GeneralUtilities.check_arguments
|
|
683
|
+
def __assert_docker_daemon_is_reachable(self) -> None:
|
|
684
|
+
# Without this check an unreachable daemon would look like a failed testcase, because "docker run" returns a
|
|
685
|
+
# non-zero exit-code in both cases.
|
|
686
|
+
result = self._protected_sc.run_program_argsasarray("docker", ["version", "--format", "{{.Server.Version}}"], throw_exception_if_exitcode_is_not_zero=False, print_live_output=False)
|
|
687
|
+
if result[0] != 0:
|
|
688
|
+
raise ValueError(f"The visual-regression-tests can not be executed because the docker-daemon is not reachable (exit-code {result[0]}: {result[2].strip()}). They are executed via \"docker run\", which requires a running docker-daemon (inside a build-container its socket must be forwarded to the host-daemon). This is an infrastructure-problem and not a failed testcase.")
|
|
689
|
+
|
|
624
690
|
@GeneralUtilities.check_arguments
|
|
625
691
|
def __build_linux_in_container(self, codeunit_folder: str, src_folder: str) -> None:
|
|
626
692
|
"""Runs "flutter build linux" inside a sibling-container of the "SCBuilder"-image (see the "linux"-branch of
|
|
@@ -511,12 +511,21 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
511
511
|
if os.path.isdir(tfcps_configuration_folder):
|
|
512
512
|
mount_arguments += ["-v", f"{tfcps_configuration_folder}:{self.sc.get_tfcps_configuration_folder_in_container()}:ro"]
|
|
513
513
|
|
|
514
|
+
#install the host-declared trusted root-CA-certificates into the container (needed when the build pulls packages from a privately
|
|
515
|
+
#hosted registry whose certificate-chain is not publicly rooted - for example an internally hosted gitlab-nuget-source). The
|
|
516
|
+
#three env-var forms are detected automatically; see __collect_trusted_root_ca_arguments. _Path-variables add file-mounts, the
|
|
517
|
+
#inline forms (_Content/_ContentBase64) are returned as a name->value dict that gets merged into required_environment_variables
|
|
518
|
+
#below so their values flow through the docker-client's own environment (not through argv) just like a required secret does.
|
|
519
|
+
trusted_root_ca_mount_arguments, trusted_root_ca_inline_env_vars = self.__collect_trusted_root_ca_arguments()
|
|
520
|
+
mount_arguments += trusted_root_ca_mount_arguments
|
|
521
|
+
|
|
514
522
|
#pass the environment-variables which are declared as required in <repository>/.ScriptCollection/ProductInformation.xml into the container
|
|
515
523
|
#so they do not have to be specified explicitly on every call. Their values are resolved from the user-specific
|
|
516
524
|
#configuration-file (see TFCPS_Tools_General.get_environment_variables_configuration_file), which only exists on the host.
|
|
517
525
|
#only the names are passed as arguments; the values are given to the docker-client through its own environment, because arguments
|
|
518
526
|
#are written to the log and are visible in the process-list of this host, which must not happen for a value which is typically a secret.
|
|
519
527
|
required_environment_variables: dict[str, str] = self.tfcps_tools_general.get_required_environment_variables(self.repository)
|
|
528
|
+
required_environment_variables.update(trusted_root_ca_inline_env_vars)
|
|
520
529
|
env_arguments: list[str] = []
|
|
521
530
|
for env_variable_name in required_environment_variables:
|
|
522
531
|
env_arguments += ["-e", env_variable_name]
|
|
@@ -540,6 +549,56 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
540
549
|
stderr:str=result[2] or GeneralUtilities.empty_string
|
|
541
550
|
return (exit_code==0,f"{stdout}\n{stderr}")
|
|
542
551
|
|
|
552
|
+
@GeneralUtilities.check_arguments
|
|
553
|
+
def __collect_trusted_root_ca_arguments(self) -> tuple[list[str], dict[str, str]]:
|
|
554
|
+
"""Resolves the TrustedRootCA_<name>_Path, TrustedRootCA_<name>_Content and TrustedRootCA_<name>_ContentBase64 environment-variables
|
|
555
|
+
of the current host into docker-arguments which install those certificates into the trust-store of the build-container. Returns
|
|
556
|
+
(mount_arguments, inline_env_vars):
|
|
557
|
+
- mount_arguments: '-v <host-path>:/Workspace/RootCAs/<name>.crt:ro' entries for each _Path-variable.
|
|
558
|
+
- inline_env_vars: a name->value dict for each _Content/_ContentBase64-variable; the caller merges it into
|
|
559
|
+
required_environment_variables so the values flow through the docker-client's own environment, not through argv.
|
|
560
|
+
The actual trust-store update happens in SCBuilder's EntryPoint.sh, which scans /Workspace/RootCAs and the TrustedRootCA_*
|
|
561
|
+
environment-variables and runs update-ca-certificates once before any build-step. The <name>-part becomes the filename inside
|
|
562
|
+
/usr/local/share/ca-certificates/ and must therefore be unique across the three env-var-forms; a duplicate is rejected here with
|
|
563
|
+
a clear error, before the container is started."""
|
|
564
|
+
path_pattern = re.compile(r"^TrustedRootCA_(.+)_Path$", re.IGNORECASE)
|
|
565
|
+
content_pattern = re.compile(r"^TrustedRootCA_(.+)_Content$", re.IGNORECASE)
|
|
566
|
+
content_b64_pattern = re.compile(r"^TrustedRootCA_(.+)_ContentBase64$", re.IGNORECASE)
|
|
567
|
+
seen_names: dict[str, str] = {}#lower-case name -> originating env-var-name, used only to produce an informative error on duplicate <name>.
|
|
568
|
+
mount_arguments: list[str] = []
|
|
569
|
+
inline_env_vars: dict[str, str] = {}
|
|
570
|
+
#sorted so the log-output (and therefore the order of "-v"-/"-e"-arguments) stays deterministic across runs.
|
|
571
|
+
for env_name, env_value in sorted(os.environ.items()):
|
|
572
|
+
if not GeneralUtilities.string_has_content(env_value):
|
|
573
|
+
continue
|
|
574
|
+
path_match = path_pattern.match(env_name)
|
|
575
|
+
if path_match is not None:
|
|
576
|
+
ca_name = path_match.group(1)
|
|
577
|
+
self.__check_trusted_root_ca_name_is_unique(seen_names, ca_name, env_name)
|
|
578
|
+
host_path = env_value.strip()
|
|
579
|
+
if not os.path.isfile(host_path):
|
|
580
|
+
raise ValueError(f"Environment-variable \"{env_name}\" points to a file which does not exist on this host: \"{host_path}\".")
|
|
581
|
+
with open(host_path, "r", encoding="utf-8", errors="replace") as pem_file:
|
|
582
|
+
head = pem_file.read(64)
|
|
583
|
+
if "-----BEGIN CERTIFICATE-----" not in head:
|
|
584
|
+
raise ValueError(f"Environment-variable \"{env_name}\" (\"{host_path}\") does not look like a PEM-encoded certificate (missing \"-----BEGIN CERTIFICATE-----\"-header).")
|
|
585
|
+
mount_arguments += ["-v", f"{host_path}:/Workspace/RootCAs/{ca_name}.crt:ro"]
|
|
586
|
+
continue
|
|
587
|
+
inline_match = content_pattern.match(env_name) or content_b64_pattern.match(env_name)
|
|
588
|
+
if inline_match is not None:
|
|
589
|
+
ca_name = inline_match.group(1)
|
|
590
|
+
self.__check_trusted_root_ca_name_is_unique(seen_names, ca_name, env_name)
|
|
591
|
+
inline_env_vars[env_name] = env_value
|
|
592
|
+
continue
|
|
593
|
+
return mount_arguments, inline_env_vars
|
|
594
|
+
|
|
595
|
+
@GeneralUtilities.check_arguments
|
|
596
|
+
def __check_trusted_root_ca_name_is_unique(self, seen_names: dict[str, str], ca_name: str, env_name: str) -> None:
|
|
597
|
+
key = ca_name.lower()
|
|
598
|
+
if key in seen_names:
|
|
599
|
+
raise ValueError(f"Multiple TrustedRootCA-definitions for name \"{ca_name}\" found (\"{seen_names[key]}\" and \"{env_name}\"). The <name>-part becomes the filename in the trust-store and must therefore be unique across _Path, _Content and _ContentBase64.")
|
|
600
|
+
seen_names[key] = env_name
|
|
601
|
+
|
|
543
602
|
@GeneralUtilities.check_arguments
|
|
544
603
|
def __translate_path_into_container(self, host_path: str, container_repository_folder: str) -> str:
|
|
545
604
|
normalized_repository = os.path.normpath(self.repository)
|
|
@@ -2,6 +2,7 @@ import json
|
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
4
|
import socket
|
|
5
|
+
from typing import Callable
|
|
5
6
|
from PIL import Image, ImageChops
|
|
6
7
|
from ..GeneralUtilities import GeneralUtilities
|
|
7
8
|
from ..ScriptCollectionCore import ScriptCollectionCore
|
|
@@ -76,7 +77,7 @@ class TFCPS_VisualRegressionTests:
|
|
|
76
77
|
self.__sc.log.loglevel = tfcps_codeunit.get_verbosity()
|
|
77
78
|
|
|
78
79
|
@GeneralUtilities.check_arguments
|
|
79
|
-
def run(self, update_baselines: bool, playwright_project_folder_relative_path: str = ".", domain_of_externally_started_application: str = None, environment_variables: dict[str, str] = None, playwright_project: str = None) -> None:
|
|
80
|
+
def run(self, update_baselines: bool, playwright_project_folder_relative_path: str = ".", domain_of_externally_started_application: str = None, environment_variables: dict[str, str] = None, playwright_project: str = None, restart_application_under_test: Callable = None) -> None:
|
|
80
81
|
"""Executes the visual-regression-tests of the codeunit.
|
|
81
82
|
If 'update_baselines' is false the screenshots are compared with the baselines and a difference fails the
|
|
82
83
|
run. If 'update_baselines' is true the baseline-screenshots are regenerated instead: missing ones are
|
|
@@ -96,7 +97,17 @@ class TFCPS_VisualRegressionTests:
|
|
|
96
97
|
'playwright_project' restricts the run to one project of the playwright-configuration (which is one
|
|
97
98
|
browser). It is required by codeunits whose testcases change the state of the application under test:
|
|
98
99
|
those have to start the application newly for every browser, because otherwise the second browser would
|
|
99
|
-
find the state which the first one left behind and would therefore see other pages than the first one.
|
|
100
|
+
find the state which the first one left behind and would therefore see other pages than the first one.
|
|
101
|
+
'restart_application_under_test' is only relevant in the update-mode and only for an application which the
|
|
102
|
+
caller started itself (see the documentation of this class). That mode runs the testcases twice (see the
|
|
103
|
+
construction of the command below): once to write the baselines and once to verify that every screenshot
|
|
104
|
+
could really be produced. An application which the playwright-configuration starts itself is restarted by
|
|
105
|
+
every "npx playwright test" and therefore begins the verify-pass with a fresh state, but an application
|
|
106
|
+
which the caller started keeps its state for the lifetime of its process, so a testcase which changes that
|
|
107
|
+
state (by registering a user or by creating an entity for example) would find in the verify-pass the state
|
|
108
|
+
which it created in the update-pass and would fail although its screenshot could be produced. The caller
|
|
109
|
+
therefore passes this callback, which restarts the application between the two passes; when it is not given
|
|
110
|
+
the two passes share one application, which is correct for an application that restarts itself."""
|
|
100
111
|
codeunit_folder: str = self.__tfcps_codeunit.get_codeunit_folder()
|
|
101
112
|
repository_folder: str = self.__tfcps_codeunit.get_repository_folder()
|
|
102
113
|
playwright_project_folder: str = self.__get_folder_in_codeunit(codeunit_folder, playwright_project_folder_relative_path)
|
|
@@ -119,6 +130,21 @@ class TFCPS_VisualRegressionTests:
|
|
|
119
130
|
# contain packages for another operating-system. "--no-save" is required so that the installation does not
|
|
120
131
|
# modify "package.json" or "package-lock.json".
|
|
121
132
|
install_command: str = "npm install --no-audit --no-fund --no-save"
|
|
133
|
+
base_arguments: list[str] = ["run", "--rm"]
|
|
134
|
+
# Playwright recommends this because the default-size of the shared memory of a container is too small for
|
|
135
|
+
# chromium, which makes chromium crash on pages which are not trivial.
|
|
136
|
+
base_arguments = base_arguments+["--ipc=host"]
|
|
137
|
+
base_arguments = base_arguments+self.__get_mount_arguments(codeunit_folder, codeunit_folder_in_container, playwright_project_folder_relative_path)
|
|
138
|
+
if domain_of_externally_started_application is not None:
|
|
139
|
+
base_arguments = base_arguments+self.__get_network_arguments(domain_of_externally_started_application)
|
|
140
|
+
if environment_variables is not None:
|
|
141
|
+
for name, value in environment_variables.items():
|
|
142
|
+
base_arguments = base_arguments+["-e", f"{name}={value}"]
|
|
143
|
+
base_arguments = base_arguments+["-w", working_folder, image]
|
|
144
|
+
|
|
145
|
+
def run_in_container(command_to_run: str) -> tuple:
|
|
146
|
+
return self.__sc.run_program_argsasarray("docker", base_arguments+["/bin/sh", "-c", command_to_run], throw_exception_if_exitcode_is_not_zero=False, print_live_output=True, print_errors_as_information=True)
|
|
147
|
+
|
|
122
148
|
if update_baselines:
|
|
123
149
|
# The update-run writes the baseline-screenshots (it creates the missing ones and overwrites the
|
|
124
150
|
# changed ones). Since playwright 1.50 that run reports every testcase whose screenshot it created or
|
|
@@ -129,22 +155,26 @@ class TFCPS_VisualRegressionTests:
|
|
|
129
155
|
# captured stabilizes and therefore matches its own new baseline, while a testcase which can not
|
|
130
156
|
# produce a screenshot keeps failing (a missing baseline is regenerated by the second run and still
|
|
131
157
|
# fails it). The exit-code of the second run therefore decides about success, so the one of the
|
|
132
|
-
# update-run is discarded
|
|
133
|
-
|
|
158
|
+
# update-run is discarded.
|
|
159
|
+
update_command: str = f"{install_command} && {test_command} --update-snapshots"
|
|
160
|
+
verify_command: str = f"{install_command} && {test_command}"
|
|
161
|
+
if restart_application_under_test is None:
|
|
162
|
+
# The application restarts itself between the two passes (for example because the
|
|
163
|
+
# playwright-configuration starts it through its "webServer"-setting), so both passes can share one
|
|
164
|
+
# invocation. They are separated by ";" and not by "&&" so that the discarded exit-code of the
|
|
165
|
+
# update-run does not skip the verify-run.
|
|
166
|
+
result = run_in_container(f"{install_command} && ( {test_command} --update-snapshots ; {test_command} )")
|
|
167
|
+
else:
|
|
168
|
+
# The application was started by the caller and keeps its state for the lifetime of its process, so
|
|
169
|
+
# the two passes must not share one application: the verify-pass would otherwise find the state
|
|
170
|
+
# which a testcase created in the update-pass (a registered user or a created entity for example)
|
|
171
|
+
# and would fail although its screenshot could be produced. The passes are therefore two separate
|
|
172
|
+
# invocations and the caller restarts the application in between through the callback.
|
|
173
|
+
run_in_container(update_command)
|
|
174
|
+
restart_application_under_test()
|
|
175
|
+
result = run_in_container(verify_command)
|
|
134
176
|
else:
|
|
135
|
-
|
|
136
|
-
arguments: list[str] = ["run", "--rm"]
|
|
137
|
-
# Playwright recommends this because the default-size of the shared memory of a container is too small for
|
|
138
|
-
# chromium, which makes chromium crash on pages which are not trivial.
|
|
139
|
-
arguments = arguments+["--ipc=host"]
|
|
140
|
-
arguments = arguments+self.__get_mount_arguments(codeunit_folder, codeunit_folder_in_container, playwright_project_folder_relative_path)
|
|
141
|
-
if domain_of_externally_started_application is not None:
|
|
142
|
-
arguments = arguments+self.__get_network_arguments(domain_of_externally_started_application)
|
|
143
|
-
if environment_variables is not None:
|
|
144
|
-
for name, value in environment_variables.items():
|
|
145
|
-
arguments = arguments+["-e", f"{name}={value}"]
|
|
146
|
-
arguments = arguments+["-w", working_folder, image, "/bin/sh", "-c", command]
|
|
147
|
-
result = self.__sc.run_program_argsasarray("docker", arguments, throw_exception_if_exitcode_is_not_zero=False, print_live_output=True, print_errors_as_information=True)
|
|
177
|
+
result = run_in_container(f"{install_command} && {test_command}")
|
|
148
178
|
if result[0] != 0:
|
|
149
179
|
if update_baselines:
|
|
150
180
|
# A non-zero exit-code of the second run means a screenshot could not be produced even against its
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ScriptCollection/ArbTranslationsOrganizer.py,sha256=3TO4fjkYADcHGyUXdiQk-RtfCxtf9ojuBS3CbZtgXBE,12218
|
|
2
2
|
ScriptCollection/CertificateUpdater.py,sha256=yZc7KESc1F_Mc6HP2UfLmNHRc2MvtVqp0t60J_CqY3s,9755
|
|
3
|
-
ScriptCollection/Executables.py,sha256=
|
|
3
|
+
ScriptCollection/Executables.py,sha256=j46g6m5Xpn5Jm_qQ-4QrtOGOhAKc37veC8hGPQGB7KE,77554
|
|
4
4
|
ScriptCollection/GeneralUtilities.py,sha256=2Sf7H0cEdhvjY5gmi4QN-isasufHVIb9KltXKfxt7e4,73909
|
|
5
5
|
ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
|
|
6
6
|
ScriptCollection/ProcessesRunner.py,sha256=wtNFdmj9klETTIDUSE90vaR5ClEX4V7dgJNVbp9_wi0,1381
|
|
@@ -11,7 +11,7 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=vwKq-MOcqsgiKhSf-MBUDBC_UyaU8evP3Ro
|
|
|
11
11
|
ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
|
|
12
12
|
ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=u9141B9D-Kef-9uo3yR7BXKUMzIKLVsesnYk7H-cWm4,6157
|
|
13
13
|
ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
|
|
14
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
14
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=PuIiMubN5jksKWshA9gbrmZP_foKXaa0Zt0FqrVF0Yw,310633
|
|
15
15
|
ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
|
|
16
16
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
|
|
17
17
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -39,7 +39,7 @@ ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW
|
|
|
39
39
|
ScriptCollection/TFCPS/TFCPS_CodeSpellCheck.py,sha256=zV62O7UiGjewx1yQUIWmUJ9D-5ipkV_f28uNhp-JWUs,5306
|
|
40
40
|
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=yosafTfbB0LBMKomZvLnFJpgJpJOMHsGKLirVjG1slk,40501
|
|
41
41
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
|
|
42
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=
|
|
42
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=kQNvDuU_pPLB8cgjfF2uZVE2W0OlBvKPGiTfBQzTolw,61268
|
|
43
43
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=BVK3fpEyjcXYVHIb6YYLH7bWe6iKRaCtPrJ3tXAemYw,6582
|
|
44
44
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
|
|
45
45
|
ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
|
|
@@ -48,7 +48,7 @@ ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=Jb7AaMcJDW-gYEYBUVZAG3
|
|
|
48
48
|
ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
|
|
49
49
|
ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=2Tx5HLk1ZftBWDCTiGZdP2QiiGNyWsEuTCSt33dNQjc,23891
|
|
50
50
|
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=eGmKZSoS2EQin-qrHTewJrvm-2VzdZhw6d0LceIonF0,158891
|
|
51
|
-
ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=
|
|
51
|
+
ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=F90CF5kLCgV_M3yN696xWzF1cglWLXecau9My2ZyGxw,42230
|
|
52
52
|
ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
53
|
ScriptCollection/TFCPS/CPP/TFCPS_CodeUnitSpecific_CPP.py,sha256=BNZPMjGiWLMBH7QDtP06WEVLMnI38NLX4Dpd13bSbi4,16614
|
|
54
54
|
ScriptCollection/TFCPS/CPP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -59,7 +59,7 @@ ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=
|
|
|
59
59
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
|
|
60
60
|
ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=hvSQVK59u9dL4mqvPrAq1Z_f0NsUIBLIfR267xdZixU,63158
|
|
61
61
|
ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
-
ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=
|
|
62
|
+
ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=9PMxJFB4nyKGzl916UOCvHB5toIyLcWk-ZAM8vPdLxw,64571
|
|
63
63
|
ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=m4Pax-U6o5XuspLnLfnWjyQMtoC7zBDDNJW9EhLWjeE,9012
|
|
65
65
|
ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -73,8 +73,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
|
|
|
73
73
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
74
|
ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
|
|
75
75
|
ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
scriptcollection-4.4.
|
|
77
|
-
scriptcollection-4.4.
|
|
78
|
-
scriptcollection-4.4.
|
|
79
|
-
scriptcollection-4.4.
|
|
80
|
-
scriptcollection-4.4.
|
|
76
|
+
scriptcollection-4.4.55.dist-info/METADATA,sha256=UgU-qihSFZ52MbEHY-5kMH-5WQN_mLK0NYiXszxgh7k,8032
|
|
77
|
+
scriptcollection-4.4.55.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
78
|
+
scriptcollection-4.4.55.dist-info/entry_points.txt,sha256=--Xk3EcTa14uk1YnUD8CQ2naQjNKJFohScd1ONy4CeY,6135
|
|
79
|
+
scriptcollection-4.4.55.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
80
|
+
scriptcollection-4.4.55.dist-info/RECORD,,
|
|
@@ -76,6 +76,8 @@ scshowprojectversion = ScriptCollection.Executables:ShowProjectVersion
|
|
|
76
76
|
scshowversion = ScriptCollection.Executables:ShowVersion
|
|
77
77
|
scsigncertificate = ScriptCollection.Executables:SignCertificate
|
|
78
78
|
scsyncxlffiles = ScriptCollection.Executables:SyncXlfFiles
|
|
79
|
+
sctrustedrootcas = ScriptCollection.Executables:ShowTrustedRootCAs
|
|
80
|
+
sctrustedrootcatobase64 = ScriptCollection.Executables:TrustedRootCAToBase64
|
|
79
81
|
scupdatedependencies = ScriptCollection.Executables:UpdateDependencies
|
|
80
82
|
scupdatedependenciesc = ScriptCollection.Executables:UpdateDependenciesC
|
|
81
83
|
scupdateimagesindockercomposefile = ScriptCollection.Executables:UpdateImagesInDockerComposeFile
|
|
File without changes
|
|
File without changes
|