Browse Source

add playwright-large test runner

Добавляем тест-раннер для playwright-large
commit_hash:6e409a792b3ea208d086602118f0f70ec6646726
vturov 5 months ago
parent
commit
7f4c79dc8e
2 changed files with 45 additions and 2 deletions
  1. 32 0
      build/conf/ts/ts_test.conf
  2. 13 2
      build/plugins/nots.py

+ 32 - 0
build/conf/ts/ts_test.conf

@@ -113,6 +113,38 @@ module TS_TEST_PLAYWRIGHT_FOR: _TS_TEST_BASE {
     _TS_TEST_FOR_CONFIGURE(playwright playwright.config.ts workspace_node_modules.tar)
 }
 
+TS_TEST_PLAYWRIGHT_LARGE_CMD=$TOUCH_UNIT \
+    && ${cwd:BINDIR} $MOVE_FILE ${input:TS_TEST_NM} ${output:"workspace_node_modules.tar"} \
+    ${kv;hide:"p TSPW"} ${kv;hide:"pc magenta"}
+
+### @usage: TS_TEST_PLAYWRIGHT_LARGE_FOR(Path)
+###
+### Defines testing module with playwright test runner.
+###
+### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_TEST_PLAYWRIGHT_FOR
+###
+### @example
+###
+###     TS_TEST_PLAYWRIGHT_LARGE_FOR(path/to/module)
+###         TS_TEST_SRCS(../src)
+###         TS_TEST_CONFIG(../playwright.config.js)
+###     END()
+###
+module TS_TEST_PLAYWRIGHT_LARGE_FOR: _TS_TEST_BASE {
+    .CMD=TS_TEST_PLAYWRIGHT_LARGE_CMD
+
+    # for multimodule peers we should choose TS
+    SET(PEERDIR_TAGS TS)
+
+    # compatibility with old TS_TEST_SRCS
+    SET(TS_TEST_EXTENSION (playwright|spec).(ts|js))
+
+    TS_TEST_DEPENDS_ON_BUILD()
+    _DEPENDS_ON_MOD()
+    _PEERDIR_TS_RESOURCE(nodejs playwright)
+    _TS_TEST_FOR_CONFIGURE(playwright_large playwright.config.ts workspace_node_modules.tar)
+}
+
 ### # internal
 module _TS_TEST_BASE: _BARE_UNIT {
     # ignore SRCS macro

+ 13 - 2
build/plugins/nots.py

@@ -43,6 +43,7 @@ class TsTestType(StrEnum):
     HERMIONE = auto()
     JEST = auto()
     PLAYWRIGHT = auto()
+    PLAYWRIGHT_LARGE = auto()
     TSC_TYPECHECK = auto()
     TS_STYLELINT = auto()
 
@@ -100,6 +101,16 @@ TS_TEST_SPECIFIC_FIELDS = {
         df.TsResources.value,
         df.TsTestForPath.value,
     ),
+    TsTestType.PLAYWRIGHT_LARGE: (
+        df.ConfigPath.value,
+        df.Size.from_unit,
+        df.Tag.from_unit_fat_external_no_retries,
+        df.Requirements.from_unit_with_full_network,
+        df.TsResources.value,
+        df.TsTestDataDirs.value,
+        df.TsTestDataDirsRename.value,
+        df.TsTestForPath.value,
+    ),
     TsTestType.TSC_TYPECHECK: (
         df.Size.from_unit,
         df.TestCwd.moddir,
@@ -797,7 +808,7 @@ def on_ts_test_for_configure(unit, test_runner, default_config, node_modules_fil
     unit.on_setup_extract_node_modules_recipe([for_mod_path])
     unit.on_setup_extract_output_tars_recipe([for_mod_path])
 
-    build_root = "$B" if test_runner == TsTestType.HERMIONE else "$(BUILD_ROOT)"
+    build_root = "$B" if test_runner in [TsTestType.HERMIONE, TsTestType.PLAYWRIGHT_LARGE] else "$(BUILD_ROOT)"
     unit.set(["TS_TEST_NM", os.path.join(build_root, for_mod_path, node_modules_filename)])
 
     config_path = unit.get("TS_TEST_CONFIG_PATH")
@@ -834,7 +845,7 @@ def on_ts_test_for_configure(unit, test_runner, default_config, node_modules_fil
 
     extra_deps = df.CustomDependencies.test_depends_only(unit, (), {})[df.CustomDependencies.KEY].split()
     dart_record[df.CustomDependencies.KEY] = " ".join(sort_uniq(deps + extra_deps))
-    if test_runner == TsTestType.HERMIONE:
+    if test_runner in [TsTestType.HERMIONE, TsTestType.PLAYWRIGHT_LARGE]:
         dart_record[df.Size.KEY] = "LARGE"
 
     data = ytest.dump_test(unit, dart_record)