Skip to content

Commit 22d49e0

Browse files
chore: test test
1 parent ff09297 commit 22d49e0

File tree

2 files changed

+90
-17
lines changed

2 files changed

+90
-17
lines changed

.github/workflows/quality.yml

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,29 @@ jobs:
221221
name: playwright-artifacts
222222
path: playwright-artifacts
223223

224+
- name: Fetch gh-pages branch
225+
run: |
226+
git fetch origin gh-pages:gh-pages
227+
mkdir gh-pages
228+
git --work-tree=gh-pages checkout gh-pages -- .
229+
224230
- name: Update PR description
225231
uses: actions/github-script@v6
226232
with:
227233
github-token: ${{secrets.GITHUB_TOKEN}}
228234
script: |
229235
const fs = require('fs');
230236
const testResultsPath = 'playwright-artifacts/test-results.json';
237+
const mainTestResultsPath = 'gh-pages/main/test-results.json';
231238
let testResults;
239+
let mainTestResults;
240+
let testComparison = {
241+
new: [],
242+
skipped: [],
243+
deleted: []
244+
};
232245
246+
// Read current PR test results
233247
if (fs.existsSync(testResultsPath)) {
234248
const rawData = fs.readFileSync(testResultsPath);
235249
const data = JSON.parse(rawData);
@@ -238,11 +252,60 @@ jobs:
238252
passed: data.stats.expected,
239253
failed: data.stats.unexpected,
240254
flaky: data.stats.flaky,
241-
skipped: data.stats.skipped
255+
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+
)
242262
};
243263
} else {
244264
console.log('Test results file not found');
245-
testResults = { total: 0, passed: 0, failed: 0, flaky: 0, skipped: 0 };
265+
testResults = { total: 0, passed: 0, failed: 0, flaky: 0, skipped: 0, tests: [] };
266+
}
267+
268+
// Read main branch test results
269+
if (fs.existsSync(mainTestResultsPath)) {
270+
const rawData = fs.readFileSync(mainTestResultsPath);
271+
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+
};
280+
281+
// Compare tests
282+
const currentTests = new Set(testResults.tests.map(t => t.title));
283+
const mainTests = new Set(mainTestResults.tests.map(t => t.title));
284+
285+
// Find new tests
286+
testResults.tests.forEach(test => {
287+
if (!mainTests.has(test.title)) {
288+
testComparison.new.push(test.title);
289+
}
290+
});
291+
292+
// Find deleted tests
293+
mainTestResults.tests.forEach(test => {
294+
if (!currentTests.has(test.title)) {
295+
testComparison.deleted.push(test.title);
296+
}
297+
});
298+
299+
// Find newly skipped tests
300+
testResults.tests.forEach(test => {
301+
const mainTest = mainTestResults.tests.find(t => t.title === test.title);
302+
if (mainTest && mainTest.status !== 'skipped' && test.status === 'skipped') {
303+
testComparison.skipped.push(test.title);
304+
}
305+
});
306+
} else {
307+
console.log('Main branch test results file not found');
308+
mainTestResults = { tests: [] };
246309
}
247310
248311
const reportUrl = `https://${context.repo.owner}.github.io/${context.repo.repo}/${context.issue.number}/`;
@@ -274,6 +337,28 @@ jobs:
274337
|:-----:|:------:|:------:|:-----:|:-------:|
275338
| ${testResults.total} | ${testResults.passed} | ${testResults.failed} | ${testResults.flaky} | ${testResults.skipped} |
276339
340+
<details>
341+
<summary>Test Changes Summary</summary>
342+
343+
${testComparison.new.length > 0 ? `
344+
#### 🆕 New Tests:
345+
${testComparison.new.map(test => `- ${test}`).join('\n')}
346+
` : ''}
347+
348+
${testComparison.skipped.length > 0 ? `
349+
#### ⏭️ Newly Skipped Tests:
350+
${testComparison.skipped.map(test => `- ${test}`).join('\n')}
351+
` : ''}
352+
353+
${testComparison.deleted.length > 0 ? `
354+
#### 🗑️ Deleted Tests:
355+
${testComparison.deleted.map(test => `- ${test}`).join('\n')}
356+
` : ''}
357+
358+
${testComparison.new.length === 0 && testComparison.skipped.length === 0 && testComparison.deleted.length === 0 ?
359+
'✅ No test changes detected' : ''}
360+
</details>
361+
277362
### Bundle Size: ${bundleStatus}
278363
Current: ${formatSize(currentSize)} | Main: ${formatSize(mainSize)}
279364
Diff: ${diff > 0 ? '+' : ''}${formatSize(Math.abs(diff))} (${percent === 'N/A' ? 'N/A' : `${percent}%`})

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

Lines changed: 3 additions & 15 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('Explain button executes Scan explanation', async ({page}) => {
55+
test.only('Explain button executes Scan explanation', async ({page}) => {
5656
const queryEditor = new QueryEditor(page);
5757
await queryEditor.explain(testQuery, QUERY_MODES.scan);
5858

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

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 when query is empty', async ({page}) => {
69+
test('Run and and Explain buttons are disabled when query is empty', async ({page}) => {
8270
const queryEditor = new QueryEditor(page);
8371

8472
await expect(queryEditor.isRunButtonEnabled()).resolves.toBe(false);
@@ -90,7 +78,7 @@ test.describe('Test Query Editor', async () => {
9078
await expect(queryEditor.isExplainButtonEnabled()).resolves.toBe(true);
9179
});
9280

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

9684
await queryEditor.setQuery(longRunningQuery);

0 commit comments

Comments
 (0)