Skip to content

Commit

Permalink
Update e2e tests with fix for occupied ports
Browse files Browse the repository at this point in the history
  • Loading branch information
RoelLeijser committed Jan 29, 2025
1 parent ba32738 commit b5779ff
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 274 deletions.
9 changes: 4 additions & 5 deletions browser/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
},
"devDependencies": {
"@playwright/test": "^1.48.1",
"@types/kill-port": "^2.0.3"
"@types/kill-port": "^2.0.3",
"@axe-core/playwright": "^4.10.1",
"kill-port": "^2.0.1"
},
"scripts": {
"playwright-install": "playwright install chromium",
Expand All @@ -24,8 +26,5 @@
"test-new": "playwright codegen http://localhost:5173",
"test-query": "PWDEBUG=1 DELETE_PREVIOUS_TEST_DRIVES=false playwright test \"e2e.spec.ts\" \"tables.spec.ts\" \"documents.spec.ts\" \"ontology.spec.ts\" \"search.spec.ts\" -g"
},
"dependencies": {
"@axe-core/playwright": "^4.10.1",
"kill-port": "^2.0.1"
}
"dependencies": {}
}
20 changes: 14 additions & 6 deletions browser/e2e/tests/template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ const waitForServer = (
childProcess.stdout?.on('data', data => {
const message = data.toString();

log(message);

const match = message.match(/http:\/\/localhost:\d+/);

if (match) {
Expand Down Expand Up @@ -160,6 +158,13 @@ test.describe('Create Next.js Template', () => {
await expect(page.locator('body')).not.toContainText('coffee');
} finally {
child.kill();
kill(3000)
.then(() => {
log('Next.js server shut down successfully');
})
.catch(err => {
console.error('Failed to shut down Next.js server:', err);
});
}
});

Expand All @@ -176,8 +181,6 @@ test.describe('Create Next.js Template', () => {
} catch (error) {
console.error(`Failed to delete ${TEMPLATE_DIR_NAME}:`, error);
}

await kill(3000);
});
});

Expand Down Expand Up @@ -240,6 +243,13 @@ test.describe('Create SvelteKit Template', () => {
await expect(page.locator('body')).not.toContainText('coffee');
} finally {
child.kill();
kill(4174)
.then(() => {
log('SvelteKit server shut down successfully');
})
.catch(err => {
console.error('Failed to shut down SvelteKit server:', err);
});
}
});

Expand All @@ -256,7 +266,5 @@ test.describe('Create SvelteKit Template', () => {
} catch (error) {
console.error(`Failed to delete ${TEMPLATE_DIR_NAME}:`, error);
}

await kill(4173);
});
});
Loading

0 comments on commit b5779ff

Please sign in to comment.