Skip to content

Commit 702b92b

Browse files
committed
refactor teardown step about delete note
1 parent 806d345 commit 702b92b

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

zeppelin-web-angular/e2e/global-teardown.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ async function globalTeardown() {
1818
LoginTestUtil.resetCache();
1919
console.log('✅ Test cache cleared');
2020

21-
// Clean up based on test notebook directory configuration
21+
// Clean up test notebooks
22+
// CI: Uses ZEPPELIN_E2E_TEST_NOTEBOOK_DIR which gets cleaned up by workflow
23+
// Local: Uses API-based cleanup to avoid server restart required for directory changes
2224
if (!process.env.CI) {
23-
// Use dedicated test directory (typically in CI)
2425
await cleanupTestNotebooks();
2526
}
2627
}
@@ -35,15 +36,30 @@ async function cleanupTestNotebooks() {
3536
const response = await fetch(`${baseURL}/api/notebook`);
3637
const data = await response.json();
3738

39+
// Debug: Log the API response structure
40+
console.log('🔍 API Response structure:', JSON.stringify(data, null, 2));
41+
3842
if (!data.body || !Array.isArray(data.body)) {
3943
console.log('No notebooks found or invalid response format');
4044
return;
4145
}
4246

43-
// Filter notebooks that start with "Test Notebook" (created by createTestNotebook)
44-
const testNotebooks = data.body.filter(
45-
(notebook: { path: string }) => notebook.path && notebook.path.startsWith('/Test Notebook ')
46-
);
47+
// Debug: Log individual notebook structure
48+
if (data.body.length > 0) {
49+
console.log('🔍 Sample notebook structure:', JSON.stringify(data.body[0], null, 2));
50+
}
51+
52+
// Simple filter for test notebooks and folders with unified naming
53+
const isTestItem = (item: { id: string; path: string }) => {
54+
const path = item.path || '';
55+
// Match test items by Date.now() pattern (13-digit timestamp)
56+
const hasTimestamp = /\d{13}/.test(path);
57+
const isTestPattern =
58+
path.includes('TestNotebook_') || path.includes('TestFolder_') || path.includes('TestFolderRenamed_');
59+
return hasTimestamp && isTestPattern;
60+
};
61+
62+
const testNotebooks = data.body.filter(isTestItem);
4763

4864
if (testNotebooks.length === 0) {
4965
console.log('✅ No test notebooks to clean up via API');

zeppelin-web-angular/e2e/tests/notebook/action-bar/action-bar-functionality.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test.describe('Notebook Action Bar Functionality', () => {
4040
test('should display and allow title editing with tooltip', async ({ page }) => {
4141
// Then: Title editor should be functional with proper tooltip
4242
const actionBarUtil = new NotebookActionBarUtil(page);
43-
const notebookName = `Test Notebook ${Date.now()}`;
43+
const notebookName = `TestNotebook_${Date.now()}`;
4444
await actionBarUtil.verifyTitleEditingFunctionality(notebookName);
4545
});
4646

zeppelin-web-angular/e2e/tests/share/folder-rename/folder-rename.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test.describe.serial('Folder Rename', () => {
6262
});
6363

6464
test('Given rename modal is open, When entering new name and confirming, Then folder should be renamed', async () => {
65-
const renamedFolderName = `RenamedFolder_${test.info().project.name}_${Date.now()}`;
65+
const renamedFolderName = `TestFolderRenamed_${Date.now()}`;
6666
await folderRenameUtil.verifyFolderCanBeRenamed(testFolderName, renamedFolderName);
6767
});
6868

@@ -94,7 +94,7 @@ test.describe.serial('Folder Rename', () => {
9494
test('Given folder is renamed, When checking folder list, Then old name should not exist and new name should exist', async ({
9595
page
9696
}) => {
97-
const renamedFolderName = `RenamedFolder_${test.info().project.name}_${Date.now()}`;
97+
const renamedFolderName = `TestFolderRenamed_${Date.now()}`;
9898
await folderRenamePage.hoverOverFolder(testFolderName);
9999
await folderRenamePage.clickRenameMenuItem(testFolderName);
100100
await folderRenamePage.clearNewName();

zeppelin-web-angular/e2e/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ export async function createTestNotebook(
395395
folderPath?: string
396396
): Promise<{ noteId: string; paragraphId: string }> {
397397
const notebookUtil = new NotebookUtil(page);
398-
const baseNotebookName = `Test Notebook ${Date.now()}`;
398+
const baseNotebookName = `TestNotebook_${Date.now()}`;
399399
const notebookName = folderPath ? `${folderPath}/${baseNotebookName}` : baseNotebookName;
400400

401401
try {

0 commit comments

Comments
 (0)