Spaces:
Running
Running
Commit ·
3ff248f
1
Parent(s): f9ff81a
fix: e2e actions
Browse files
frontend/e2e/pages/dashboard-page.ts
CHANGED
|
@@ -15,12 +15,12 @@ export class DashboardPage {
|
|
| 15 |
|
| 16 |
async startTest(testName: string) {
|
| 17 |
// Find the gate-card containing the test name and click its "Start Test" button
|
| 18 |
-
const testCard = this.page.
|
| 19 |
await testCard.getByRole('link', { name: 'Start Test' }).click();
|
| 20 |
}
|
| 21 |
|
| 22 |
async viewResult(testName: string) {
|
| 23 |
-
const testCard = this.page.
|
| 24 |
await testCard.getByRole('link', { name: 'View Result' }).click();
|
| 25 |
}
|
| 26 |
}
|
|
|
|
| 15 |
|
| 16 |
async startTest(testName: string) {
|
| 17 |
// Find the gate-card containing the test name and click its "Start Test" button
|
| 18 |
+
const testCard = this.page.getByTestId('test-card').filter({ hasText: testName });
|
| 19 |
await testCard.getByRole('link', { name: 'Start Test' }).click();
|
| 20 |
}
|
| 21 |
|
| 22 |
async viewResult(testName: string) {
|
| 23 |
+
const testCard = this.page.getByTestId('test-card').filter({ hasText: testName });
|
| 24 |
await testCard.getByRole('link', { name: 'View Result' }).click();
|
| 25 |
}
|
| 26 |
}
|
frontend/e2e/tests/core-flow.spec.ts
CHANGED
|
@@ -10,7 +10,7 @@ test.describe('Core Test Execution Flow', () => {
|
|
| 10 |
await expect(dashboardPage.availableTestsHeading).toBeVisible();
|
| 11 |
|
| 12 |
// There should be at least one gate-card visible
|
| 13 |
-
const testCards = page.
|
| 14 |
await expect(testCards.first()).toBeVisible();
|
| 15 |
});
|
| 16 |
|
|
@@ -18,7 +18,7 @@ test.describe('Core Test Execution Flow', () => {
|
|
| 18 |
await dashboardPage.goto();
|
| 19 |
|
| 20 |
// Start the first available test
|
| 21 |
-
const testCards = page.
|
| 22 |
|
| 23 |
// If no tests are available to start, skip or fail the test.
|
| 24 |
// We expect the seeding/database to have at least one test.
|
|
|
|
| 10 |
await expect(dashboardPage.availableTestsHeading).toBeVisible();
|
| 11 |
|
| 12 |
// There should be at least one gate-card visible
|
| 13 |
+
const testCards = page.getByTestId('test-card');
|
| 14 |
await expect(testCards.first()).toBeVisible();
|
| 15 |
});
|
| 16 |
|
|
|
|
| 18 |
await dashboardPage.goto();
|
| 19 |
|
| 20 |
// Start the first available test
|
| 21 |
+
const testCards = page.getByTestId('test-card').filter({ hasText: 'Start Test' });
|
| 22 |
|
| 23 |
// If no tests are available to start, skip or fail the test.
|
| 24 |
// We expect the seeding/database to have at least one test.
|
frontend/src/pages/Dashboard.jsx
CHANGED
|
@@ -83,7 +83,7 @@ export default function Dashboard() {
|
|
| 83 |
const done = attempt?.status === 'submitted'
|
| 84 |
const pct = done && attempt?.total_marks ? Math.round(attempt.score / attempt.total_marks * 100) : null
|
| 85 |
return (
|
| 86 |
-
<Card key={t.id} className="flex flex-col hover:border-primary/50 transition-colors border-border">
|
| 87 |
<CardHeader className="p-5 pb-3">
|
| 88 |
<div className="flex items-start justify-between gap-2">
|
| 89 |
<CardTitle className="text-base leading-snug">{t.title}</CardTitle>
|
|
|
|
| 83 |
const done = attempt?.status === 'submitted'
|
| 84 |
const pct = done && attempt?.total_marks ? Math.round(attempt.score / attempt.total_marks * 100) : null
|
| 85 |
return (
|
| 86 |
+
<Card key={t.id} data-testid="test-card" className="flex flex-col hover:border-primary/50 transition-colors border-border">
|
| 87 |
<CardHeader className="p-5 pb-3">
|
| 88 |
<div className="flex items-start justify-between gap-2">
|
| 89 |
<CardTitle className="text-base leading-snug">{t.title}</CardTitle>
|