@fluxenginejp/sftest 1.4.1 → 1.5.0
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.
- package/dist/cli/sftest.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/pages/common/DataImportWizard.js +4 -2
- package/dist/pages/common/ElementStates.d.ts +1 -1
- package/dist/pages/common/ElementStates.js +1 -1
- package/dist/pages/common/RecordData.js +1 -1
- package/dist/pages/common/RecordFields.d.ts +1 -1
- package/dist/pages/common/RecordFields.js +1 -1
- package/dist/pages/common/ScreenDialog.d.ts +27 -0
- package/dist/pages/common/ScreenDialog.js +71 -2
- package/dist/steps/common/apex.steps.js +12 -8
- package/dist/steps/common/common.steps.js +1 -1
- package/dist/steps/common/data.steps.d.ts +1 -0
- package/dist/steps/common/data.steps.js +49 -0
- package/dist/steps/common/dialog.steps.js +8 -0
- package/dist/steps/common/file.steps.js +5 -0
- package/dist/steps/common/instance.steps.d.ts +1 -0
- package/dist/steps/common/instance.steps.js +61 -0
- package/dist/steps/common/variable.steps.d.ts +1 -0
- package/dist/steps/common/variable.steps.js +76 -0
- package/dist/support/FileDownloads.d.ts +9 -0
- package/dist/support/FileDownloads.js +12 -0
- package/dist/support/apexBatch.d.ts +11 -0
- package/dist/support/apexBatch.js +1 -0
- package/dist/support/csvInsert.d.ts +77 -0
- package/dist/support/csvInsert.js +446 -0
- package/dist/support/dataRestore.d.ts +187 -0
- package/dist/support/dataRestore.js +437 -0
- package/dist/support/fixtures.d.ts +83 -0
- package/dist/support/fixtures.js +68 -0
- package/dist/support/globalSetup.js +3 -0
- package/dist/support/metadataCache.d.ts +21 -0
- package/dist/support/metadataCache.js +87 -0
- package/dist/support/outputPaths.d.ts +8 -0
- package/dist/support/outputPaths.js +12 -1
- package/dist/support/playwrightConfig.d.ts +12 -1
- package/dist/support/playwrightConfig.js +7 -1
- package/dist/support/scenarioFunctions.d.ts +244 -0
- package/dist/support/scenarioFunctions.js +588 -0
- package/dist/support/session.js +3 -0
- package/dist/support/settings.d.ts +35 -1
- package/dist/support/settings.js +80 -2
- package/dist/support/sf.d.ts +56 -1
- package/dist/support/sf.js +169 -11
- package/dist/support/sobjects.d.ts +11 -0
- package/dist/support/sobjects.js +15 -3
- package/dist/support/soqlQuery.d.ts +195 -0
- package/dist/support/soqlQuery.js +560 -0
- package/dist/support/standardFunctions.d.ts +50 -0
- package/dist/support/standardFunctions.js +195 -0
- package/dist/support/stepArguments.d.ts +1 -1
- package/dist/support/valueComparison.d.ts +22 -0
- package/dist/support/valueComparison.js +119 -0
- package/dist/support/variables.d.ts +115 -0
- package/dist/support/variables.js +211 -0
- package/docs/CHANGELOG.md +38 -4
- package/docs/EXTENSIONS.html +185 -6
- package/docs/SPEC.html +2025 -1214
- package/package.json +1 -1
- package/readme.md +9 -2
- package/scripts/backup-account.bat +1 -1
- package/sftest.config.jsonc +16 -0
- package/templates/functions/customFunctions.ts +22 -0
- package/templates/playwright.config.ts +3 -0
|
@@ -29,10 +29,15 @@ import { CreatedRecords } from './createdRecords';
|
|
|
29
29
|
import { EvidenceId } from './evidenceId';
|
|
30
30
|
import { FileDownloads } from './FileDownloads';
|
|
31
31
|
import { UploadErrors } from './UploadErrors';
|
|
32
|
+
import { ScenarioVariables } from './variables';
|
|
33
|
+
import { CustomFunctions, ScenarioFunctions } from './scenarioFunctions';
|
|
34
|
+
import { DataRestores } from './dataRestore';
|
|
32
35
|
/** 設定(playwright.config.ts の use)で指定する sfTest のオプション。 */
|
|
33
36
|
export interface SfTestOptions {
|
|
34
37
|
/** 標準と異なる画面のページクラス(キーはオブジェクトの表示ラベルまたは API 名)。sfTestConfig の customPages から設定される。 */
|
|
35
38
|
customPages: Record<string, RecordPageClass>;
|
|
39
|
+
/** シナリオから呼び出す利用者の関数(キーは名前。最後に __c を付ける)。sfTestConfig の functions から設定される(20261020-001)。 */
|
|
40
|
+
customFunctions: CustomFunctions;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* sfTest のフィクスチャを追加した test。
|
|
@@ -61,6 +66,9 @@ export declare const test: import("@playwright/test").TestType<import("@playwrig
|
|
|
61
66
|
recordFormDialog: RecordFormDialog;
|
|
62
67
|
evidence: Evidence;
|
|
63
68
|
inAppGuidance: void;
|
|
69
|
+
scenarioVariables: ScenarioVariables;
|
|
70
|
+
scenarioFunctions: ScenarioFunctions;
|
|
71
|
+
dataRestores: DataRestores;
|
|
64
72
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures>;
|
|
65
73
|
/** sfTest のフィクスチャを使うステップ定義・フックの登録関数。 */
|
|
66
74
|
declare const bdd: {
|
|
@@ -86,6 +94,9 @@ declare const bdd: {
|
|
|
86
94
|
recordFormDialog: RecordFormDialog;
|
|
87
95
|
evidence: Evidence;
|
|
88
96
|
inAppGuidance: void;
|
|
97
|
+
scenarioVariables: ScenarioVariables;
|
|
98
|
+
scenarioFunctions: ScenarioFunctions;
|
|
99
|
+
dataRestores: DataRestores;
|
|
89
100
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures>>;
|
|
90
101
|
When: import("playwright-bdd").PlaywrightStyleStepCtor<import("playwright-bdd").PlaywrightStyleStepFn<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
91
102
|
evidenceId: EvidenceId;
|
|
@@ -109,6 +120,9 @@ declare const bdd: {
|
|
|
109
120
|
recordFormDialog: RecordFormDialog;
|
|
110
121
|
evidence: Evidence;
|
|
111
122
|
inAppGuidance: void;
|
|
123
|
+
scenarioVariables: ScenarioVariables;
|
|
124
|
+
scenarioFunctions: ScenarioFunctions;
|
|
125
|
+
dataRestores: DataRestores;
|
|
112
126
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures>>;
|
|
113
127
|
Then: import("playwright-bdd").PlaywrightStyleStepCtor<import("playwright-bdd").PlaywrightStyleStepFn<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
114
128
|
evidenceId: EvidenceId;
|
|
@@ -132,6 +146,9 @@ declare const bdd: {
|
|
|
132
146
|
recordFormDialog: RecordFormDialog;
|
|
133
147
|
evidence: Evidence;
|
|
134
148
|
inAppGuidance: void;
|
|
149
|
+
scenarioVariables: ScenarioVariables;
|
|
150
|
+
scenarioFunctions: ScenarioFunctions;
|
|
151
|
+
dataRestores: DataRestores;
|
|
135
152
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures>>;
|
|
136
153
|
Step: import("playwright-bdd").PlaywrightStyleStepCtor<import("playwright-bdd").PlaywrightStyleStepFn<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
137
154
|
evidenceId: EvidenceId;
|
|
@@ -155,6 +172,9 @@ declare const bdd: {
|
|
|
155
172
|
recordFormDialog: RecordFormDialog;
|
|
156
173
|
evidence: Evidence;
|
|
157
174
|
inAppGuidance: void;
|
|
175
|
+
scenarioVariables: ScenarioVariables;
|
|
176
|
+
scenarioFunctions: ScenarioFunctions;
|
|
177
|
+
dataRestores: DataRestores;
|
|
158
178
|
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures>>;
|
|
159
179
|
BeforeAll: (...args: [(fixtures: import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
160
180
|
name?: string;
|
|
@@ -188,6 +208,9 @@ declare const bdd: {
|
|
|
188
208
|
recordFormDialog: RecordFormDialog;
|
|
189
209
|
evidence: Evidence;
|
|
190
210
|
inAppGuidance: void;
|
|
211
|
+
scenarioVariables: ScenarioVariables;
|
|
212
|
+
scenarioFunctions: ScenarioFunctions;
|
|
213
|
+
dataRestores: DataRestores;
|
|
191
214
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
192
215
|
evidenceId: EvidenceId;
|
|
193
216
|
evidenceDir: string;
|
|
@@ -210,6 +233,9 @@ declare const bdd: {
|
|
|
210
233
|
recordFormDialog: RecordFormDialog;
|
|
211
234
|
evidence: Evidence;
|
|
212
235
|
inAppGuidance: void;
|
|
236
|
+
scenarioVariables: ScenarioVariables;
|
|
237
|
+
scenarioFunctions: ScenarioFunctions;
|
|
238
|
+
dataRestores: DataRestores;
|
|
213
239
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
214
240
|
name?: string;
|
|
215
241
|
tags?: string;
|
|
@@ -236,6 +262,9 @@ declare const bdd: {
|
|
|
236
262
|
recordFormDialog: RecordFormDialog;
|
|
237
263
|
evidence: Evidence;
|
|
238
264
|
inAppGuidance: void;
|
|
265
|
+
scenarioVariables: ScenarioVariables;
|
|
266
|
+
scenarioFunctions: ScenarioFunctions;
|
|
267
|
+
dataRestores: DataRestores;
|
|
239
268
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
240
269
|
After: (...args: [(this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
241
270
|
evidenceId: EvidenceId;
|
|
@@ -259,6 +288,9 @@ declare const bdd: {
|
|
|
259
288
|
recordFormDialog: RecordFormDialog;
|
|
260
289
|
evidence: Evidence;
|
|
261
290
|
inAppGuidance: void;
|
|
291
|
+
scenarioVariables: ScenarioVariables;
|
|
292
|
+
scenarioFunctions: ScenarioFunctions;
|
|
293
|
+
dataRestores: DataRestores;
|
|
262
294
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
263
295
|
evidenceId: EvidenceId;
|
|
264
296
|
evidenceDir: string;
|
|
@@ -281,6 +313,9 @@ declare const bdd: {
|
|
|
281
313
|
recordFormDialog: RecordFormDialog;
|
|
282
314
|
evidence: Evidence;
|
|
283
315
|
inAppGuidance: void;
|
|
316
|
+
scenarioVariables: ScenarioVariables;
|
|
317
|
+
scenarioFunctions: ScenarioFunctions;
|
|
318
|
+
dataRestores: DataRestores;
|
|
284
319
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
285
320
|
name?: string;
|
|
286
321
|
tags?: string;
|
|
@@ -307,6 +342,9 @@ declare const bdd: {
|
|
|
307
342
|
recordFormDialog: RecordFormDialog;
|
|
308
343
|
evidence: Evidence;
|
|
309
344
|
inAppGuidance: void;
|
|
345
|
+
scenarioVariables: ScenarioVariables;
|
|
346
|
+
scenarioFunctions: ScenarioFunctions;
|
|
347
|
+
dataRestores: DataRestores;
|
|
310
348
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
311
349
|
BeforeWorker: (...args: [(fixtures: import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
312
350
|
name?: string;
|
|
@@ -340,6 +378,9 @@ declare const bdd: {
|
|
|
340
378
|
recordFormDialog: RecordFormDialog;
|
|
341
379
|
evidence: Evidence;
|
|
342
380
|
inAppGuidance: void;
|
|
381
|
+
scenarioVariables: ScenarioVariables;
|
|
382
|
+
scenarioFunctions: ScenarioFunctions;
|
|
383
|
+
dataRestores: DataRestores;
|
|
343
384
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
344
385
|
evidenceId: EvidenceId;
|
|
345
386
|
evidenceDir: string;
|
|
@@ -362,6 +403,9 @@ declare const bdd: {
|
|
|
362
403
|
recordFormDialog: RecordFormDialog;
|
|
363
404
|
evidence: Evidence;
|
|
364
405
|
inAppGuidance: void;
|
|
406
|
+
scenarioVariables: ScenarioVariables;
|
|
407
|
+
scenarioFunctions: ScenarioFunctions;
|
|
408
|
+
dataRestores: DataRestores;
|
|
365
409
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
366
410
|
name?: string;
|
|
367
411
|
tags?: string;
|
|
@@ -388,6 +432,9 @@ declare const bdd: {
|
|
|
388
432
|
recordFormDialog: RecordFormDialog;
|
|
389
433
|
evidence: Evidence;
|
|
390
434
|
inAppGuidance: void;
|
|
435
|
+
scenarioVariables: ScenarioVariables;
|
|
436
|
+
scenarioFunctions: ScenarioFunctions;
|
|
437
|
+
dataRestores: DataRestores;
|
|
391
438
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
392
439
|
AfterScenario: (...args: [(this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
393
440
|
evidenceId: EvidenceId;
|
|
@@ -411,6 +458,9 @@ declare const bdd: {
|
|
|
411
458
|
recordFormDialog: RecordFormDialog;
|
|
412
459
|
evidence: Evidence;
|
|
413
460
|
inAppGuidance: void;
|
|
461
|
+
scenarioVariables: ScenarioVariables;
|
|
462
|
+
scenarioFunctions: ScenarioFunctions;
|
|
463
|
+
dataRestores: DataRestores;
|
|
414
464
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
415
465
|
evidenceId: EvidenceId;
|
|
416
466
|
evidenceDir: string;
|
|
@@ -433,6 +483,9 @@ declare const bdd: {
|
|
|
433
483
|
recordFormDialog: RecordFormDialog;
|
|
434
484
|
evidence: Evidence;
|
|
435
485
|
inAppGuidance: void;
|
|
486
|
+
scenarioVariables: ScenarioVariables;
|
|
487
|
+
scenarioFunctions: ScenarioFunctions;
|
|
488
|
+
dataRestores: DataRestores;
|
|
436
489
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
437
490
|
name?: string;
|
|
438
491
|
tags?: string;
|
|
@@ -459,6 +512,9 @@ declare const bdd: {
|
|
|
459
512
|
recordFormDialog: RecordFormDialog;
|
|
460
513
|
evidence: Evidence;
|
|
461
514
|
inAppGuidance: void;
|
|
515
|
+
scenarioVariables: ScenarioVariables;
|
|
516
|
+
scenarioFunctions: ScenarioFunctions;
|
|
517
|
+
dataRestores: DataRestores;
|
|
462
518
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
463
519
|
BeforeStep: (...args: [(this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
464
520
|
evidenceId: EvidenceId;
|
|
@@ -482,6 +538,9 @@ declare const bdd: {
|
|
|
482
538
|
recordFormDialog: RecordFormDialog;
|
|
483
539
|
evidence: Evidence;
|
|
484
540
|
inAppGuidance: void;
|
|
541
|
+
scenarioVariables: ScenarioVariables;
|
|
542
|
+
scenarioFunctions: ScenarioFunctions;
|
|
543
|
+
dataRestores: DataRestores;
|
|
485
544
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
486
545
|
evidenceId: EvidenceId;
|
|
487
546
|
evidenceDir: string;
|
|
@@ -504,6 +563,9 @@ declare const bdd: {
|
|
|
504
563
|
recordFormDialog: RecordFormDialog;
|
|
505
564
|
evidence: Evidence;
|
|
506
565
|
inAppGuidance: void;
|
|
566
|
+
scenarioVariables: ScenarioVariables;
|
|
567
|
+
scenarioFunctions: ScenarioFunctions;
|
|
568
|
+
dataRestores: DataRestores;
|
|
507
569
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
508
570
|
name?: string;
|
|
509
571
|
tags?: string;
|
|
@@ -530,6 +592,9 @@ declare const bdd: {
|
|
|
530
592
|
recordFormDialog: RecordFormDialog;
|
|
531
593
|
evidence: Evidence;
|
|
532
594
|
inAppGuidance: void;
|
|
595
|
+
scenarioVariables: ScenarioVariables;
|
|
596
|
+
scenarioFunctions: ScenarioFunctions;
|
|
597
|
+
dataRestores: DataRestores;
|
|
533
598
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
534
599
|
AfterStep: (...args: [(this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
535
600
|
evidenceId: EvidenceId;
|
|
@@ -553,6 +618,9 @@ declare const bdd: {
|
|
|
553
618
|
recordFormDialog: RecordFormDialog;
|
|
554
619
|
evidence: Evidence;
|
|
555
620
|
inAppGuidance: void;
|
|
621
|
+
scenarioVariables: ScenarioVariables;
|
|
622
|
+
scenarioFunctions: ScenarioFunctions;
|
|
623
|
+
dataRestores: DataRestores;
|
|
556
624
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
557
625
|
evidenceId: EvidenceId;
|
|
558
626
|
evidenceDir: string;
|
|
@@ -575,6 +643,9 @@ declare const bdd: {
|
|
|
575
643
|
recordFormDialog: RecordFormDialog;
|
|
576
644
|
evidence: Evidence;
|
|
577
645
|
inAppGuidance: void;
|
|
646
|
+
scenarioVariables: ScenarioVariables;
|
|
647
|
+
scenarioFunctions: ScenarioFunctions;
|
|
648
|
+
dataRestores: DataRestores;
|
|
578
649
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
579
650
|
name?: string;
|
|
580
651
|
tags?: string;
|
|
@@ -601,6 +672,9 @@ declare const bdd: {
|
|
|
601
672
|
recordFormDialog: RecordFormDialog;
|
|
602
673
|
evidence: Evidence;
|
|
603
674
|
inAppGuidance: void;
|
|
675
|
+
scenarioVariables: ScenarioVariables;
|
|
676
|
+
scenarioFunctions: ScenarioFunctions;
|
|
677
|
+
dataRestores: DataRestores;
|
|
604
678
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
605
679
|
};
|
|
606
680
|
export declare const BeforeStep: (...args: [(this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
@@ -625,6 +699,9 @@ export declare const BeforeStep: (...args: [(this: null, fixtures: import("@play
|
|
|
625
699
|
recordFormDialog: RecordFormDialog;
|
|
626
700
|
evidence: Evidence;
|
|
627
701
|
inAppGuidance: void;
|
|
702
|
+
scenarioVariables: ScenarioVariables;
|
|
703
|
+
scenarioFunctions: ScenarioFunctions;
|
|
704
|
+
dataRestores: DataRestores;
|
|
628
705
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [string, (this: null, fixtures: import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & import("playwright-bdd").BddTestFixtures & SfTestOptions & {
|
|
629
706
|
evidenceId: EvidenceId;
|
|
630
707
|
evidenceDir: string;
|
|
@@ -647,6 +724,9 @@ export declare const BeforeStep: (...args: [(this: null, fixtures: import("@play
|
|
|
647
724
|
recordFormDialog: RecordFormDialog;
|
|
648
725
|
evidence: Evidence;
|
|
649
726
|
inAppGuidance: void;
|
|
727
|
+
scenarioVariables: ScenarioVariables;
|
|
728
|
+
scenarioFunctions: ScenarioFunctions;
|
|
729
|
+
dataRestores: DataRestores;
|
|
650
730
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown] | [{
|
|
651
731
|
name?: string;
|
|
652
732
|
tags?: string;
|
|
@@ -673,6 +753,9 @@ export declare const BeforeStep: (...args: [(this: null, fixtures: import("@play
|
|
|
673
753
|
recordFormDialog: RecordFormDialog;
|
|
674
754
|
evidence: Evidence;
|
|
675
755
|
inAppGuidance: void;
|
|
756
|
+
scenarioVariables: ScenarioVariables;
|
|
757
|
+
scenarioFunctions: ScenarioFunctions;
|
|
758
|
+
dataRestores: DataRestores;
|
|
676
759
|
} & import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & import("playwright-bdd").BddWorkerFixtures) => unknown]) => void;
|
|
677
760
|
export declare const Given: typeof bdd.Given;
|
|
678
761
|
export declare const When: typeof bdd.When;
|
package/dist/support/fixtures.js
CHANGED
|
@@ -35,6 +35,9 @@ const UploadErrors_1 = require("./UploadErrors");
|
|
|
35
35
|
const mismatch_1 = require("./mismatch");
|
|
36
36
|
const executionControl_1 = require("./executionControl");
|
|
37
37
|
const startupTiming_1 = require("./startupTiming");
|
|
38
|
+
const variables_1 = require("./variables");
|
|
39
|
+
const scenarioFunctions_1 = require("./scenarioFunctions");
|
|
40
|
+
const dataRestore_1 = require("./dataRestore");
|
|
38
41
|
// SFTEST_STARTUP_TIMING=1 の場合、ワーカー以外のプロセス(BDD の生成・テストの探索)とワーカー(シナリオの実行の準備)がステップ定義を読み込んだ時点を表示する。
|
|
39
42
|
(0, startupTiming_1.startupNote)(process.env.TEST_WORKER_INDEX ? 'ステップ定義の読み込み(ワーカーの準備)' : 'ステップ定義の読み込み(BDD の生成・テストの探索)');
|
|
40
43
|
/**
|
|
@@ -91,6 +94,35 @@ exports.test = playwright_bdd_1.test.extend({
|
|
|
91
94
|
],
|
|
92
95
|
/** 標準と異なる画面のページクラス。設定で指定されていなければ空(すべて共通の RecordPage で操作する)。 */
|
|
93
96
|
customPages: [{}, { option: true }],
|
|
97
|
+
/** 利用者の関数。設定で指定されていなければ空(標準の関数だけを使える)。 */
|
|
98
|
+
customFunctions: [{}, { option: true }],
|
|
99
|
+
/**
|
|
100
|
+
* シナリオの変数(20261020-001)。すべてのシナリオで作り(auto)、ステップの引数と表の {{名前}} の置き換えに使う。
|
|
101
|
+
*
|
|
102
|
+
* 置き換えは、ステップがこのフィクスチャを使わなくても行うため、シナリオの TestInfo に結び付けて登録する(support/variables.ts)。
|
|
103
|
+
* シナリオの終わりに捨て、別のシナリオへ引き継がない。
|
|
104
|
+
*/
|
|
105
|
+
scenarioVariables: [
|
|
106
|
+
async ({}, use, testInfo) => {
|
|
107
|
+
const variables = new variables_1.ScenarioVariables();
|
|
108
|
+
(0, variables_1.registerScenarioVariables)(testInfo, variables);
|
|
109
|
+
await use(variables);
|
|
110
|
+
},
|
|
111
|
+
{ auto: true },
|
|
112
|
+
],
|
|
113
|
+
/**
|
|
114
|
+
* 標準の関数と利用者の関数の呼び出し。クラスのインスタンス(名前を付けて作ったものを含む)を、このシナリオの間だけ保持する。
|
|
115
|
+
*
|
|
116
|
+
* {{名前::引数}}(既定のメソッドの呼び出し)の置き換えに使うため、すべてのシナリオで作り(auto)、シナリオの変数と結び付ける(20261021-001・20261021-002)。
|
|
117
|
+
*/
|
|
118
|
+
scenarioFunctions: [
|
|
119
|
+
async ({ customFunctions, scenarioVariables }, use) => {
|
|
120
|
+
const functions = new scenarioFunctions_1.ScenarioFunctions(customFunctions);
|
|
121
|
+
scenarioVariables.setDefaultMethodCaller(async (ownerName, argument, usage) => (await functions.callDefault(ownerName, argument, usage)).value);
|
|
122
|
+
await use(functions);
|
|
123
|
+
},
|
|
124
|
+
{ auto: true },
|
|
125
|
+
],
|
|
94
126
|
/** エビデンス名の先頭に付ける ID(「ID "…"」のステップで設定する)。 */
|
|
95
127
|
evidenceId: async ({}, use) => { await use(new evidenceId_1.EvidenceId()); },
|
|
96
128
|
/** シナリオのエビデンスのファイルを保存するフォルダ(results/evidence/<実行日時>/<機能ファイル名>/<シナリオ名>)。 */
|
|
@@ -103,6 +135,12 @@ exports.test = playwright_bdd_1.test.extend({
|
|
|
103
135
|
*/
|
|
104
136
|
createdRecords: async ({ $tags }, use, testInfo) => {
|
|
105
137
|
const createdRecords = new createdRecords_1.CreatedRecords();
|
|
138
|
+
if ($tags.includes(createdRecords_1.CLEANUP_TAG)) {
|
|
139
|
+
// @片付け は非推奨とした(20261021-003、PO の決定)。動きは変えず、レポートと実行中の表示で、移行を案内する。
|
|
140
|
+
const warning = `${createdRecords_1.CLEANUP_TAG} は非推奨です。次のメジャーの版で廃止する予定です。「"<オブジェクト>" の "<条件>" の状態を記憶し、シナリオの終わりに戻す」に書き換えてください(仕様書「データを記憶して戻す」)`;
|
|
141
|
+
testInfo.annotations.push({ type: '警告', description: warning });
|
|
142
|
+
process.stdout.write(` 警告: ${warning}\n`);
|
|
143
|
+
}
|
|
106
144
|
await use(createdRecords);
|
|
107
145
|
if (!$tags.includes(createdRecords_1.CLEANUP_TAG))
|
|
108
146
|
return;
|
|
@@ -117,6 +155,24 @@ exports.test = playwright_bdd_1.test.extend({
|
|
|
117
155
|
throw new executionControl_1.ExecutionFailure('runtime-error', `テストデータの片付けに失敗しました: ${failed.map((r) => `${r.sobject} ${r.id}`).join(', ')}`);
|
|
118
156
|
});
|
|
119
157
|
},
|
|
158
|
+
/**
|
|
159
|
+
* 「"…" の "…" の状態を記憶し、シナリオの終わりに戻す」で記憶したデータを持ち、シナリオの終わり(失敗した場合も)に戻す(20261021-003)。
|
|
160
|
+
*
|
|
161
|
+
* 戻した結果をレポートに添付し、戻せなかったレコードがある場合は、シナリオを失敗にする(実行時エラー)。
|
|
162
|
+
* @片付け の削除(createdRecords)より先に行うため、createdRecords を使う(フィクスチャは使う側から先に片付けられる)。
|
|
163
|
+
*/
|
|
164
|
+
dataRestores: async ({ createdRecords: _createdRecords }, use, testInfo) => {
|
|
165
|
+
const restores = new dataRestore_1.DataRestores();
|
|
166
|
+
await use(restores);
|
|
167
|
+
if (restores.isEmpty)
|
|
168
|
+
return;
|
|
169
|
+
const outcome = restores.restoreAll();
|
|
170
|
+
await testInfo.attach(dataRestore_1.DATA_RESTORE_CLASS, { body: outcome.lines.join('\n'), contentType: 'text/plain' });
|
|
171
|
+
(0, executionControl_1.runRequired)('scenario-teardown', () => {
|
|
172
|
+
if (outcome.failures.length)
|
|
173
|
+
throw new executionControl_1.ExecutionFailure('runtime-error', `データを元に戻せませんでした:\n${outcome.failures.join('\n')}`);
|
|
174
|
+
});
|
|
175
|
+
},
|
|
120
176
|
/**
|
|
121
177
|
* 保存エラー(入力規則など)を記録する。
|
|
122
178
|
*
|
|
@@ -252,6 +308,9 @@ exports.Then = controlledDefinition(bdd.Then, true);
|
|
|
252
308
|
/**
|
|
253
309
|
* 登録関数を包み、利用者の関数のfixture検出・引数数を維持して共通方針へ接続する。
|
|
254
310
|
*
|
|
311
|
+
* ステップの関数を呼ぶ直前に、引数と表の {{名前}} をシナリオの変数の値に置き換える(20261020-001。標準・利用者のすべてのステップが対象)。
|
|
312
|
+
* 置き換えた場合は、置き換えた後の引数と表をレポートに添付する。置き換えの誤りはシナリオ不正として、ステップの失敗と同じ方針で扱う。
|
|
313
|
+
*
|
|
255
314
|
* @param define - playwright-bddの登録関数。
|
|
256
315
|
* @param acceptsExpectNg - 素のexpectの失敗をNGとして受け取る既存の互換指定。方針の切替ではない。
|
|
257
316
|
* @returns 元の登録関数と同じ型の登録関数。
|
|
@@ -261,6 +320,15 @@ function controlledDefinition(define, acceptsExpectNg) {
|
|
|
261
320
|
const fn = args[args.length - 1];
|
|
262
321
|
const wrapped = async function (...fnArgs) {
|
|
263
322
|
await (0, executionControl_1.runControlled)('step', async () => {
|
|
323
|
+
// 1つ目の引数はフィクスチャ。2つ目以降(ステップの文言の引数と表)を置き換える。
|
|
324
|
+
const testInfo = exports.test.info();
|
|
325
|
+
const variables = (0, variables_1.scenarioVariablesOf)(testInfo);
|
|
326
|
+
if (variables) {
|
|
327
|
+
const expanded = await (0, variables_1.expandStepArguments)(variables, fnArgs.slice(1));
|
|
328
|
+
fnArgs = [fnArgs[0], ...expanded.args];
|
|
329
|
+
if (expanded.report)
|
|
330
|
+
await testInfo.attach('変数の置き換え', { body: expanded.report, contentType: 'text/plain' });
|
|
331
|
+
}
|
|
264
332
|
try {
|
|
265
333
|
await fn.apply(this, fnArgs);
|
|
266
334
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = globalSetup;
|
|
4
4
|
const session_1 = require("./session");
|
|
5
5
|
const sf_1 = require("./sf");
|
|
6
|
+
const metadataCache_1 = require("./metadataCache");
|
|
6
7
|
const startupTiming_1 = require("./startupTiming");
|
|
7
8
|
const executionControl_1 = require("./executionControl");
|
|
8
9
|
/**
|
|
@@ -21,6 +22,8 @@ async function globalSetup(config) {
|
|
|
21
22
|
throw new executionControl_1.ExecutionFailure('scenario-invalid', 'SF_BASE_URL が設定されていません。プロジェクト直下の .env に書いてください');
|
|
22
23
|
// 今回の実行の ID を決める。強制終了などで残った前回の接続情報(組織や CLI のユーザが今と異なる可能性がある)は使わない。
|
|
23
24
|
(0, sf_1.startConnectionRun)();
|
|
25
|
+
// 前回の実行で残ったメタデータのキャッシュは使わない(実行の ID でも区別するが、開始時に消しておく。20261021-005)。
|
|
26
|
+
(0, metadataCache_1.clearMetadataCache)();
|
|
24
27
|
(0, startupTiming_1.startStartupClock)();
|
|
25
28
|
(0, startupTiming_1.startupNote)('前処理(ログイン)の開始');
|
|
26
29
|
try {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* キャッシュのフォルダの絶対パスを返す。
|
|
3
|
+
*
|
|
4
|
+
* @returns 出力の基準フォルダの .auth/metadata。
|
|
5
|
+
*/
|
|
6
|
+
export declare function metadataCacheDir(): string;
|
|
7
|
+
/**
|
|
8
|
+
* メタデータをキャッシュから返す。なければ取得し、このプロセスと、今回の実行のほかのプロセスのために保存する。
|
|
9
|
+
*
|
|
10
|
+
* 実行の ID がない場合(テスト全体の前処理を通らない呼び出し)は、このプロセスのメモリにだけ持つ。
|
|
11
|
+
* ファイルは一時ファイルに書いてから名前を変えるため、ほかのプロセスが書きかけのファイルを読むことはない。
|
|
12
|
+
*
|
|
13
|
+
* @param key - キャッシュのキー。メタデータの種類とオブジェクトを区別する(例: describe-Account)。
|
|
14
|
+
* @param fetch - キャッシュにない場合に、メタデータを取得する処理。
|
|
15
|
+
* @returns メタデータ。
|
|
16
|
+
*/
|
|
17
|
+
export declare function cachedMetadata<T>(key: string, fetch: () => T): T;
|
|
18
|
+
/**
|
|
19
|
+
* キャッシュを消す(このプロセスのメモリと、ファイル)。テスト全体の開始時と終了時に呼ぶ。
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearMetadataCache(): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.metadataCacheDir = metadataCacheDir;
|
|
7
|
+
exports.cachedMetadata = cachedMetadata;
|
|
8
|
+
exports.clearMetadataCache = clearMetadataCache;
|
|
9
|
+
/**
|
|
10
|
+
* Salesforce のメタデータ(オブジェクトの一覧・オブジェクトの情報(describe))を、テストの実行全体でキャッシュする(20261021-005)。
|
|
11
|
+
*
|
|
12
|
+
* メタデータは、1回のテストの実行の中では変わらない(2026-10-21、PO の決定)。そのため、最初に取得したものを、シナリオ・機能・
|
|
13
|
+
* シナリオを実行するプロセスをまたいで使う。プロセスの中ではメモリに持ち、プロセスの間ではファイル(出力の基準フォルダの .auth/metadata/)で共有する。
|
|
14
|
+
* ファイルには実行ごとの ID(support/sf.ts の接続情報と同じ SFTEST_CONNECTION_ID)を付け、同じ実行のものだけを読む(強制終了などで残った前回のファイルは使わない)。
|
|
15
|
+
* キャッシュは、テスト全体の開始時と終了時(support/session.ts の removeSession)に消す。
|
|
16
|
+
*
|
|
17
|
+
* @author Fluxengine.co.jp
|
|
18
|
+
*/
|
|
19
|
+
const node_crypto_1 = require("node:crypto");
|
|
20
|
+
const node_fs_1 = require("node:fs");
|
|
21
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
22
|
+
const outputPaths_1 = require("./outputPaths");
|
|
23
|
+
/** 実行の ID を渡す環境変数(support/sf.ts の CONNECTION_ID_ENV と同じ)。 */
|
|
24
|
+
const RUN_ID_ENV = 'SFTEST_CONNECTION_ID';
|
|
25
|
+
/** このプロセスのキャッシュ(キー → 値)。 */
|
|
26
|
+
const memory = new Map();
|
|
27
|
+
/**
|
|
28
|
+
* キャッシュのフォルダの絶対パスを返す。
|
|
29
|
+
*
|
|
30
|
+
* @returns 出力の基準フォルダの .auth/metadata。
|
|
31
|
+
*/
|
|
32
|
+
function metadataCacheDir() {
|
|
33
|
+
return (0, outputPaths_1.outputPath)('.auth', 'metadata');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* キーのファイルの絶対パスを返す(キーの文字のうち、ファイル名に使えない文字を置き換える)。
|
|
37
|
+
*
|
|
38
|
+
* @param key - キャッシュのキー(例: sobjects、describe-Account)。
|
|
39
|
+
* @returns ファイルの絶対パス。
|
|
40
|
+
*/
|
|
41
|
+
function cacheFile(key) {
|
|
42
|
+
return node_path_1.default.join(metadataCacheDir(), `${key.replace(/[^\w.-]/g, '_')}.json`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* メタデータをキャッシュから返す。なければ取得し、このプロセスと、今回の実行のほかのプロセスのために保存する。
|
|
46
|
+
*
|
|
47
|
+
* 実行の ID がない場合(テスト全体の前処理を通らない呼び出し)は、このプロセスのメモリにだけ持つ。
|
|
48
|
+
* ファイルは一時ファイルに書いてから名前を変えるため、ほかのプロセスが書きかけのファイルを読むことはない。
|
|
49
|
+
*
|
|
50
|
+
* @param key - キャッシュのキー。メタデータの種類とオブジェクトを区別する(例: describe-Account)。
|
|
51
|
+
* @param fetch - キャッシュにない場合に、メタデータを取得する処理。
|
|
52
|
+
* @returns メタデータ。
|
|
53
|
+
*/
|
|
54
|
+
function cachedMetadata(key, fetch) {
|
|
55
|
+
if (memory.has(key))
|
|
56
|
+
return memory.get(key);
|
|
57
|
+
const runId = process.env[RUN_ID_ENV];
|
|
58
|
+
const file = cacheFile(key);
|
|
59
|
+
if (runId && (0, node_fs_1.existsSync)(file)) {
|
|
60
|
+
try {
|
|
61
|
+
const saved = JSON.parse((0, node_fs_1.readFileSync)(file, 'utf-8'));
|
|
62
|
+
if (saved.runId === runId) {
|
|
63
|
+
memory.set(key, saved.value);
|
|
64
|
+
return saved.value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// 読めないファイル(別の実行の残りなど)は使わず、取得し直して上書きする。
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const value = fetch();
|
|
72
|
+
memory.set(key, value);
|
|
73
|
+
if (runId) {
|
|
74
|
+
(0, node_fs_1.mkdirSync)(metadataCacheDir(), { recursive: true });
|
|
75
|
+
const temporary = `${file}.${(0, node_crypto_1.randomUUID)()}.tmp`;
|
|
76
|
+
(0, node_fs_1.writeFileSync)(temporary, JSON.stringify({ runId, value }));
|
|
77
|
+
(0, node_fs_1.renameSync)(temporary, file);
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* キャッシュを消す(このプロセスのメモリと、ファイル)。テスト全体の開始時と終了時に呼ぶ。
|
|
83
|
+
*/
|
|
84
|
+
function clearMetadataCache() {
|
|
85
|
+
memory.clear();
|
|
86
|
+
(0, node_fs_1.rmSync)(metadataCacheDir(), { recursive: true, force: true });
|
|
87
|
+
}
|
|
@@ -13,3 +13,11 @@ export declare function outputRoot(): string;
|
|
|
13
13
|
* @returns 絶対パス。
|
|
14
14
|
*/
|
|
15
15
|
export declare function outputPath(...segments: string[]): string;
|
|
16
|
+
/** 「… に CSV … のデータを登録する」の CSV を置くフォルダの絶対パスを、設定からほかのプロセスに引き継ぐ環境変数(20261021-005)。 */
|
|
17
|
+
export declare const TEST_DATA_DIR_ENV = "SFTEST_TESTDATA_DIR";
|
|
18
|
+
/**
|
|
19
|
+
* CSV の登録で、CSV を探すフォルダの絶対パスを返す(20261021-005)。
|
|
20
|
+
*
|
|
21
|
+
* @returns 環境変数 SFTEST_TESTDATA_DIR の値。設定されていない(または空の)場合は、作業フォルダの testdata。
|
|
22
|
+
*/
|
|
23
|
+
export declare function testDataRoot(): string;
|
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OUTPUT_DIR_ENV = void 0;
|
|
6
|
+
exports.TEST_DATA_DIR_ENV = exports.OUTPUT_DIR_ENV = void 0;
|
|
7
7
|
exports.outputRoot = outputRoot;
|
|
8
8
|
exports.outputPath = outputPath;
|
|
9
|
+
exports.testDataRoot = testDataRoot;
|
|
9
10
|
/**
|
|
10
11
|
* テストの出力(テストの成果物・HTML レポート・JUnit 形式の結果・エビデンス・セッションと接続情報のファイル)の基準フォルダを扱う。
|
|
11
12
|
*
|
|
@@ -36,3 +37,13 @@ function outputRoot() {
|
|
|
36
37
|
function outputPath(...segments) {
|
|
37
38
|
return node_path_1.default.join(outputRoot(), ...segments);
|
|
38
39
|
}
|
|
40
|
+
/** 「… に CSV … のデータを登録する」の CSV を置くフォルダの絶対パスを、設定からほかのプロセスに引き継ぐ環境変数(20261021-005)。 */
|
|
41
|
+
exports.TEST_DATA_DIR_ENV = 'SFTEST_TESTDATA_DIR';
|
|
42
|
+
/**
|
|
43
|
+
* CSV の登録で、CSV を探すフォルダの絶対パスを返す(20261021-005)。
|
|
44
|
+
*
|
|
45
|
+
* @returns 環境変数 SFTEST_TESTDATA_DIR の値。設定されていない(または空の)場合は、作業フォルダの testdata。
|
|
46
|
+
*/
|
|
47
|
+
function testDataRoot() {
|
|
48
|
+
return process.env[exports.TEST_DATA_DIR_ENV] || node_path_1.default.join(process.cwd(), 'testdata');
|
|
49
|
+
}
|
|
@@ -2,6 +2,7 @@ import 'dotenv/config';
|
|
|
2
2
|
import { PlaywrightTestConfig } from '@playwright/test';
|
|
3
3
|
import type { RecordPageClass } from '../pages/common/RecordPage';
|
|
4
4
|
import type { SfTestOptions } from './fixtures';
|
|
5
|
+
import { CustomFunctions } from './scenarioFunctions';
|
|
5
6
|
/** シナリオの場所、生成するテストコードの出力先、利用者の拡張の指定。 */
|
|
6
7
|
export interface SfTestConfigOptions {
|
|
7
8
|
/** シナリオ(.feature)のパターン。作業フォルダからの相対パスで指定する。 */
|
|
@@ -14,6 +15,11 @@ export interface SfTestConfigOptions {
|
|
|
14
15
|
steps?: string;
|
|
15
16
|
/** 標準と異なる画面のページクラス(キーはオブジェクトの表示ラベルまたは API 名)。省略時は、すべてのオブジェクトを共通の RecordPage で操作する。 */
|
|
16
17
|
customPages?: Record<string, RecordPageClass>;
|
|
18
|
+
/**
|
|
19
|
+
* シナリオから呼び出す利用者の関数(キーは名前で、最後に __c を付ける。20261020-001)。省略時は、標準の関数だけを使える。
|
|
20
|
+
* 登録の誤り(__c のない名前、形の誤り、引数の名前の空・重複)は、シナリオを実行する前に止める。
|
|
21
|
+
*/
|
|
22
|
+
functions?: CustomFunctions;
|
|
17
23
|
/**
|
|
18
24
|
* テストの出力(成果物・HTML レポート・JUnit 形式の結果・エビデンス・セッションと接続情報のファイル)の基準フォルダ。作業フォルダからの相対パスで指定する。
|
|
19
25
|
* 省略時は作業フォルダ(利用者の既定)。開発元の内部検証が develop/tests/output を指定するための開発用の指定であり、利用者向けの仕様書には載せない(20261012-006)。
|
|
@@ -24,6 +30,11 @@ export interface SfTestConfigOptions {
|
|
|
24
30
|
* 開発元の内部検証が npm run report:dev を示すための開発用の指定であり、利用者向けの仕様書には載せない(20261015-011)。
|
|
25
31
|
*/
|
|
26
32
|
reportCommand?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 「… に CSV … のデータを登録する」の CSV を置くフォルダ。作業フォルダからの相対パスで指定する。省略時は testdata(利用者の既定)。
|
|
35
|
+
* 開発元の内部検証が develop/tests/testdata を指定するための開発用の指定であり、利用者向けの仕様書には載せない(20261021-005)。
|
|
36
|
+
*/
|
|
37
|
+
testDataDir?: string;
|
|
27
38
|
}
|
|
28
39
|
/**
|
|
29
40
|
* sfTest の Playwright の設定を作る。
|
|
@@ -33,6 +44,6 @@ export interface SfTestConfigOptions {
|
|
|
33
44
|
*
|
|
34
45
|
* @param options - シナリオの場所、生成するテストコードの出力先、利用者の拡張。
|
|
35
46
|
* @returns Playwright の設定。
|
|
36
|
-
* @throws .env
|
|
47
|
+
* @throws .env の必須の値が設定されていない場合、利用者の関数(functions)の登録が正しくない場合。
|
|
37
48
|
*/
|
|
38
49
|
export declare function sfTestConfig(options: SfTestConfigOptions): PlaywrightTestConfig<SfTestOptions>;
|
|
@@ -25,6 +25,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
25
25
|
const outputPaths_1 = require("./outputPaths");
|
|
26
26
|
const session_1 = require("./session");
|
|
27
27
|
const settings_1 = require("./settings");
|
|
28
|
+
const scenarioFunctions_1 = require("./scenarioFunctions");
|
|
28
29
|
/**
|
|
29
30
|
* ツール本体のルートの絶対パス。
|
|
30
31
|
*
|
|
@@ -61,7 +62,7 @@ function toGlob(absolute) {
|
|
|
61
62
|
*
|
|
62
63
|
* @param options - シナリオの場所、生成するテストコードの出力先、利用者の拡張。
|
|
63
64
|
* @returns Playwright の設定。
|
|
64
|
-
* @throws .env
|
|
65
|
+
* @throws .env の必須の値が設定されていない場合、利用者の関数(functions)の登録が正しくない場合。
|
|
65
66
|
*/
|
|
66
67
|
function sfTestConfig(options) {
|
|
67
68
|
// .env の設定値を確認する。設定されていなければ、テストを始める前にエラーにする。
|
|
@@ -69,9 +70,13 @@ function sfTestConfig(options) {
|
|
|
69
70
|
if (missing.length) {
|
|
70
71
|
throw new executionControl_1.ExecutionFailure('scenario-invalid', `${missing.join('、')} が設定されていません。プロジェクト直下の .env に書いてください`);
|
|
71
72
|
}
|
|
73
|
+
// 利用者の関数の登録を確かめる。誤りがあれば、テストを始める前にエラーにする(20261020-001)。
|
|
74
|
+
const functions = (0, scenarioFunctions_1.validateCustomFunctions)(options.functions ?? {});
|
|
72
75
|
// テストの出力の基準フォルダを決め、環境変数でテスト全体の前後処理とワーカーに引き継ぐ(support/outputPaths.ts)。
|
|
73
76
|
// 設定ファイルは実行の最初と各ワーカーで読み込まれ、どちらも同じ指定から同じ値を設定する。
|
|
74
77
|
process.env[outputPaths_1.OUTPUT_DIR_ENV] = fromProject(options.outputDir ?? '.');
|
|
78
|
+
// CSV の登録で、CSV を探すフォルダを、同じく環境変数でワーカーに引き継ぐ(support/outputPaths.ts の testDataRoot。20261021-005)。
|
|
79
|
+
process.env[outputPaths_1.TEST_DATA_DIR_ENV] = fromProject(options.testDataDir ?? 'testdata');
|
|
75
80
|
// エビデンスのファイルを保存するフォルダ名(results/evidence/<実行日時>)を決める。
|
|
76
81
|
// 設定ファイルは実行の最初と各ワーカーで読み込まれるため、最初に決めた値を環境変数でワーカーに引き継ぐ。
|
|
77
82
|
if (!process.env.SFTEST_RUN_ID) {
|
|
@@ -118,6 +123,7 @@ function sfTestConfig(options) {
|
|
|
118
123
|
trace: 'retain-on-failure',
|
|
119
124
|
screenshot: 'on', // エビデンスとして、成功時もテスト終了時の画面を残す。
|
|
120
125
|
customPages: options.customPages ?? {},
|
|
126
|
+
customFunctions: functions,
|
|
121
127
|
},
|
|
122
128
|
});
|
|
123
129
|
}
|