Skip to content

Commit 30f3ffd

Browse files
chore: test test
1 parent 22d49e0 commit 30f3ffd

File tree

2 files changed

+60
-33
lines changed

2 files changed

+60
-33
lines changed

.github/workflows/quality.yml

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,43 @@ jobs:
243243
deleted: []
244244
};
245245
246+
// Helper function to extract all tests from a suite recursively
247+
function extractTestsFromSuite(suite, parentTitle = '') {
248+
let tests = [];
249+
const fullSuiteTitle = parentTitle ? `${parentTitle} > ${suite.title}` : suite.title;
250+
251+
// Add tests from specs
252+
if (suite.specs) {
253+
tests.push(...suite.specs.map(spec => ({
254+
title: `${fullSuiteTitle} > ${spec.title}`,
255+
status: spec.ok ? 'passed' : spec.skipped ? 'skipped' : 'failed',
256+
file: suite.file
257+
})));
258+
}
259+
260+
// Recursively process nested suites
261+
if (suite.suites) {
262+
suite.suites.forEach(nestedSuite => {
263+
tests.push(...extractTestsFromSuite(nestedSuite, fullSuiteTitle));
264+
});
265+
}
266+
267+
return tests;
268+
}
269+
246270
// Read current PR test results
247271
if (fs.existsSync(testResultsPath)) {
248272
const rawData = fs.readFileSync(testResultsPath);
249273
const data = JSON.parse(rawData);
274+
const allTests = data.suites.flatMap(suite => extractTestsFromSuite(suite));
275+
250276
testResults = {
251277
total: data.stats.expected + data.stats.unexpected + data.stats.flaky + data.stats.skipped,
252278
passed: data.stats.expected,
253279
failed: data.stats.unexpected,
254280
flaky: data.stats.flaky,
255281
skipped: data.stats.skipped,
256-
tests: data.suites.flatMap(suite =>
257-
suite.specs.map(spec => ({
258-
title: `${suite.title} ${spec.title}`,
259-
status: spec.ok ? 'passed' : spec.skipped ? 'skipped' : 'failed'
260-
}))
261-
)
282+
tests: allTests
262283
};
263284
} else {
264285
console.log('Test results file not found');
@@ -269,40 +290,34 @@ jobs:
269290
if (fs.existsSync(mainTestResultsPath)) {
270291
const rawData = fs.readFileSync(mainTestResultsPath);
271292
const data = JSON.parse(rawData);
272-
mainTestResults = {
273-
tests: data.suites.flatMap(suite =>
274-
suite.specs.map(spec => ({
275-
title: `${suite.title} ${spec.title}`,
276-
status: spec.ok ? 'passed' : spec.skipped ? 'skipped' : 'failed'
277-
}))
278-
)
279-
};
293+
const allTests = data.suites.flatMap(suite => extractTestsFromSuite(suite));
294+
mainTestResults = { tests: allTests };
280295
281296
// Compare tests
282-
const currentTests = new Set(testResults.tests.map(t => t.title));
283-
const mainTests = new Set(mainTestResults.tests.map(t => t.title));
297+
const currentTests = new Map(testResults.tests.map(t => [t.title, t]));
298+
const mainTests = new Map(mainTestResults.tests.map(t => [t.title, t]));
284299
285300
// Find new tests
286-
testResults.tests.forEach(test => {
287-
if (!mainTests.has(test.title)) {
288-
testComparison.new.push(test.title);
301+
for (const [title, test] of currentTests) {
302+
if (!mainTests.has(title)) {
303+
testComparison.new.push(`${test.file}: ${title}`);
289304
}
290-
});
305+
}
291306
292307
// Find deleted tests
293-
mainTestResults.tests.forEach(test => {
294-
if (!currentTests.has(test.title)) {
295-
testComparison.deleted.push(test.title);
308+
for (const [title, test] of mainTests) {
309+
if (!currentTests.has(title)) {
310+
testComparison.deleted.push(`${test.file}: ${title}`);
296311
}
297-
});
312+
}
298313
299314
// Find newly skipped tests
300-
testResults.tests.forEach(test => {
301-
const mainTest = mainTestResults.tests.find(t => t.title === test.title);
315+
for (const [title, test] of currentTests) {
316+
const mainTest = mainTests.get(title);
302317
if (mainTest && mainTest.status !== 'skipped' && test.status === 'skipped') {
303-
testComparison.skipped.push(test.title);
318+
testComparison.skipped.push(`${test.file}: ${title}`);
304319
}
305-
});
320+
}
306321
} else {
307322
console.log('Main branch test results file not found');
308323
mainTestResults = { tests: [] };

tests/suites/tenant/queryEditor/queryEditor.test.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test.describe('Test Query Editor', async () => {
5252
await expect(explainJSON).toBeVisible({timeout: VISIBILITY_TIMEOUT});
5353
});
5454

55-
test.only('Explain button executes Scan explanation', async ({page}) => {
55+
test.skip('Explain button executes Scan explanation', async ({page}) => {
5656
const queryEditor = new QueryEditor(page);
5757
await queryEditor.explain(testQuery, QUERY_MODES.scan);
5858

@@ -66,7 +66,19 @@ test.describe('Test Query Editor', async () => {
6666
await expect(explainAST).toBeVisible({timeout: VISIBILITY_TIMEOUT});
6767
});
6868

69-
test('Run and and Explain buttons are disabled when query is empty', async ({page}) => {
69+
test('Error is displayed for invalid query', async ({page}) => {
70+
const queryEditor = new QueryEditor(page);
71+
72+
const invalidQuery = 'Select d';
73+
await queryEditor.setQuery(invalidQuery);
74+
await queryEditor.clickRunButton();
75+
76+
await expect(queryEditor.waitForStatus('Failed')).resolves.toBe(true);
77+
const errorMessage = await queryEditor.getErrorMessage();
78+
await expect(errorMessage).toContain('Column references are not allowed without FROM');
79+
});
80+
81+
test('Run and Explain buttons are disabled for empty query', async ({page}) => {
7082
const queryEditor = new QueryEditor(page);
7183

7284
await expect(queryEditor.isRunButtonEnabled()).resolves.toBe(false);
@@ -78,7 +90,7 @@ test.describe('Test Query Editor', async () => {
7890
await expect(queryEditor.isExplainButtonEnabled()).resolves.toBe(true);
7991
});
8092

81-
test('Stop and button and elapsed time label appears when query is running', async ({page}) => {
93+
test('Stop button and elapsed time label appear when query is running', async ({page}) => {
8294
const queryEditor = new QueryEditor(page);
8395

8496
await queryEditor.setQuery(longRunningQuery);
@@ -88,7 +100,7 @@ test.describe('Test Query Editor', async () => {
88100
await expect(queryEditor.isElapsedTimeVisible()).resolves.toBe(true);
89101
});
90102

91-
test('Stop button and elapsed time label disappears after query is stopped', async ({page}) => {
103+
test('Stop button and elapsed time label disappear after query is stopped', async ({page}) => {
92104
const queryEditor = new QueryEditor(page);
93105

94106
await queryEditor.setQuery(longRunningQuery);
@@ -102,7 +114,7 @@ test.describe('Test Query Editor', async () => {
102114
await expect(queryEditor.isElapsedTimeHidden()).resolves.toBe(true);
103115
});
104116

105-
test('Query execution is terminated when stop button is clicked', async ({page}) => {
117+
test.only('Query execution is terminated when stop button is clicked', async ({page}) => {
106118
const queryEditor = new QueryEditor(page);
107119

108120
await queryEditor.setQuery(longRunningQuery);

0 commit comments

Comments
 (0)