@letsrunit/mcp-server 0.10.0 → 0.11.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/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/tools/diff.ts +12 -12
- package/src/tools/run.ts +1 -8
package/dist/index.js
CHANGED
|
@@ -7,14 +7,14 @@ import { MemorySink, Journal } from '@letsrunit/journal';
|
|
|
7
7
|
import { join, dirname, resolve, isAbsolute } from 'path';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { loadConfiguration } from '@cucumber/cucumber/api';
|
|
10
|
-
import { locatorParameter, valueParameter, keysParameter, booleanParameter, enumParameter, sanitizeStepDefinition,
|
|
10
|
+
import { locatorParameter, valueParameter, keysParameter, booleanParameter, enumParameter, sanitizeStepDefinition, scenarioIdFromGherkin } from '@letsrunit/gherkin';
|
|
11
11
|
import { scrubHtml, screenshotElement, screenshot, unifiedHtmlDiff, fuzzyLocator, suppressInterferences, waitForIdle, waitAfterInteraction, setFieldValue } from '@letsrunit/playwright';
|
|
12
12
|
import { expect } from '@playwright/test';
|
|
13
13
|
import { eventually, splitUrl, pathRegexp, sleep, textToHtml, asFilename, clean } from '@letsrunit/utils';
|
|
14
14
|
import { readFileSync, existsSync } from 'fs';
|
|
15
15
|
import { mkdir, writeFile, glob } from 'fs/promises';
|
|
16
16
|
import { pathToFileURL } from 'url';
|
|
17
|
-
import { openStore,
|
|
17
|
+
import { openStore, findLastTest, findArtifacts } from '@letsrunit/store';
|
|
18
18
|
import { execSync } from 'child_process';
|
|
19
19
|
|
|
20
20
|
var __create = Object.create;
|
|
@@ -74933,7 +74933,7 @@ function expectOrNot(actual, toBe) {
|
|
|
74933
74933
|
// ../bdd/src/steps/assert.ts
|
|
74934
74934
|
var WAIT_TIMEOUT = 5e3;
|
|
74935
74935
|
Then(
|
|
74936
|
-
"
|
|
74936
|
+
"the page {contains|does not contain} {locator}",
|
|
74937
74937
|
async function(visible, selector) {
|
|
74938
74938
|
const el = await fuzzyLocator(this.page, selector);
|
|
74939
74939
|
await expectOrNot(el, visible).toBeVisible({ timeout: WAIT_TIMEOUT });
|
|
@@ -79358,11 +79358,11 @@ function registerDiff(server2, sessions2) {
|
|
|
79358
79358
|
server2.registerTool(
|
|
79359
79359
|
"letsrunit_diff",
|
|
79360
79360
|
{
|
|
79361
|
-
description: "Diff the current live page against the HTML snapshot from the last passing
|
|
79361
|
+
description: "Diff the current live page against the HTML snapshot from the last passing test of a scenario. Pass the scenarioId returned by letsrunit_run. Returns a unified HTML diff and paths to baseline screenshots. By default only considers baseline tests from the current git ancestry (gitTreeOnly: true).",
|
|
79362
79362
|
inputSchema: {
|
|
79363
79363
|
sessionId: z.string().describe("Session ID returned by letsrunit_session_start"),
|
|
79364
79364
|
scenarioId: z.string().describe("Scenario UUID returned by letsrunit_run"),
|
|
79365
|
-
gitTreeOnly: z.boolean().optional().describe("Restrict baseline to
|
|
79365
|
+
gitTreeOnly: z.boolean().optional().describe("Restrict baseline to tests from the current git ancestry (default: true)")
|
|
79366
79366
|
}
|
|
79367
79367
|
},
|
|
79368
79368
|
async (input) => {
|
|
@@ -79376,16 +79376,16 @@ function registerDiff(server2, sessions2) {
|
|
|
79376
79376
|
return err("Could not open the letsrunit store. Run cucumber with the store formatter first.");
|
|
79377
79377
|
}
|
|
79378
79378
|
const allowedCommits = input.gitTreeOnly ?? true ? resolveAllowedCommits() : void 0;
|
|
79379
|
-
const
|
|
79380
|
-
if (!
|
|
79379
|
+
const test = findLastTest(db, input.scenarioId, "passed", allowedCommits ?? void 0);
|
|
79380
|
+
if (!test) {
|
|
79381
79381
|
return err(
|
|
79382
|
-
allowedCommits ? "No passing
|
|
79382
|
+
allowedCommits ? "No passing test found for this scenario in the current git ancestry. Try gitTreeOnly: false or run cucumber first." : "No passing test found for this scenario."
|
|
79383
79383
|
);
|
|
79384
79384
|
}
|
|
79385
|
-
const artifacts = findArtifacts(db,
|
|
79385
|
+
const artifacts = findArtifacts(db, test.id);
|
|
79386
79386
|
const htmlArtifact = [...artifacts].reverse().find((a) => a.filename.endsWith(".html"));
|
|
79387
79387
|
if (!htmlArtifact) {
|
|
79388
|
-
return err("No HTML snapshot found in the baseline
|
|
79388
|
+
return err("No HTML snapshot found in the baseline test. Ensure the store formatter is configured.");
|
|
79389
79389
|
}
|
|
79390
79390
|
const storedHtml = readFileSync(join(artifactDir, htmlArtifact.filename), "utf-8");
|
|
79391
79391
|
const session = sessions2.get(input.sessionId);
|
|
@@ -79396,8 +79396,8 @@ function registerDiff(server2, sessions2) {
|
|
|
79396
79396
|
JSON.stringify({
|
|
79397
79397
|
diff,
|
|
79398
79398
|
baseline: {
|
|
79399
|
-
|
|
79400
|
-
commit:
|
|
79399
|
+
testId: test.id,
|
|
79400
|
+
commit: test.gitCommit,
|
|
79401
79401
|
screenshots
|
|
79402
79402
|
}
|
|
79403
79403
|
})
|
|
@@ -79468,11 +79468,6 @@ Scenario: Steps
|
|
|
79468
79468
|
}
|
|
79469
79469
|
|
|
79470
79470
|
// src/tools/run.ts
|
|
79471
|
-
function scenarioIdFromGherkin(gherkin) {
|
|
79472
|
-
const { steps } = parseFeature(gherkin);
|
|
79473
|
-
const stepIds = steps.map((s) => computeStepId(s));
|
|
79474
|
-
return computeScenarioId(stepIds);
|
|
79475
|
-
}
|
|
79476
79471
|
function registerRun(server2, sessions2) {
|
|
79477
79472
|
server2.registerTool(
|
|
79478
79473
|
"letsrunit_run",
|