Skip to content

Commit 211761f

Browse files
authored
Merge pull request #652 from gemini-testing/TESTPLANE-516.fix_pwt
fix: do not require testplane when use report with other tools
2 parents 6091618 + 6e146d8 commit 211761f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/adapters/event-handling/testplane/snapshots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const finalizeSnapshotsForTest = async ({testResult, attempt, reportPath,
8787
return [];
8888
}
8989

90-
const shouldSave = recordConfig.mode !== RecordMode.LastFailedRun || (eventName === events.TEST_FAIL);
90+
const shouldSave = RecordMode && (recordConfig.mode !== RecordMode.LastFailedRun || (eventName === events.TEST_FAIL));
9191
if (!shouldSave) {
9292
return [];
9393
}

lib/gui/server.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import {ServerReadyData} from './api';
1414
import {BrowserFeature, ToolName} from '../constants';
1515
import type {TestplaneToolAdapter} from '../adapters/tool/testplane';
1616
import {ToolRunnerTree} from './tool-runner';
17-
import {
18-
getSnapshotHashWithoutAttempt,
19-
snapshotsInProgress,
20-
TestContext
21-
} from '../adapters/event-handling/testplane/snapshots';
2217

2318
interface CustomGuiError {
2419
response: {
@@ -149,8 +144,13 @@ export const start = async (args: ServerArgs): Promise<ServerReadyData> => {
149144
});
150145

151146
server.get('/running-test-data', async (req, res): Promise<void> => {
147+
if (toolAdapter.toolName !== ToolName.Testplane) {
148+
res.status(500).json({error: `Getting running test data supports only in Testplane tool`});
149+
}
150+
152151
try {
153152
const {testPath, browserId} = req.query;
153+
const {getSnapshotHashWithoutAttempt, snapshotsInProgress} = await import('../adapters/event-handling/testplane/snapshots');
154154

155155
if (!testPath || !browserId) {
156156
res.status(400).json({error: `Missing one of the required GET parameters: testPath or browserId. Received testPath: ${testPath}, browserId: ${browserId}`});
@@ -169,7 +169,7 @@ export const start = async (args: ServerArgs): Promise<ServerReadyData> => {
169169
return;
170170
}
171171

172-
const context: TestContext = {testPath: parsedTestPath, browserId: browserId as string};
172+
const context = {testPath: parsedTestPath, browserId: browserId as string};
173173
const snapshotKey = getSnapshotHashWithoutAttempt(context);
174174

175175
const snapshots = snapshotsInProgress[snapshotKey] || [];

0 commit comments

Comments
 (0)