Skip to content

Commit 959dffb

Browse files
Add 2e2 test
1 parent 800f910 commit 959dffb

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/main/webapp/app/lecture/manage/lecture-attachments/lecture-attachments.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ <h4 jhiTranslate="artemisApp.lecture.attachments.editAttachment"></h4>
198198
<a
199199
[routerLink]="['/course-management', lecture().course?.id, `lectures`, lecture().id, 'unit-management', 'attachment-video-units', 'create']"
200200
class="btn btn-primary me-2"
201+
id="add-attachment"
201202
>
202203
<span jhiTranslate="entity.action.addAttachment"></span>
203204
</a>

src/main/webapp/app/lecture/manage/lecture/lecture.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<div class="btn-group flex-btn-group-container">
167167
<div class="btn-group-vertical me-1 mb-1">
168168
@if (lecture.isAtLeastEditor) {
169-
<a [routerLink]="[lecture.id, 'attachments']" class="btn btn-primary mb-1 btn-sm">
169+
<a [routerLink]="[lecture.id, 'attachments']" class="btn btn-primary mb-1 btn-sm" id="attachments">
170170
<fa-icon [icon]="faFile" />
171171
<span class="d-none d-md-inline" jhiTranslate="entity.action.attachments"></span>
172172
</a>

src/test/playwright/e2e/lecture/LectureManagement.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ test.describe('Lecture management', { tag: '@fast' }, () => {
9494
await lectureManagement.addExerciseUnit(exercise.id!);
9595
await expect(page.locator('.exercise-title', { hasText: new RegExp(`^${exercise.title!}$`) })).toBeVisible();
9696
});
97+
98+
test('Can open page to add attachment unit to the lecture', async ({ exerciseAPIRequests, lectureManagement, page }) => {
99+
await exerciseAPIRequests.createModelingExercise({ course });
100+
await lectureManagement.openAttachmentUnitCreationPage(lecture.id!);
101+
await expect(page.getByText('Create Attachment Unit')).toBeVisible();
102+
});
97103
});
98104

99105
test.afterEach(async ({ courseManagementAPIRequests }) => {

src/test/playwright/support/pageobjects/lecture/LectureManagementPage.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ export class LectureManagementPage {
6868
await this.getLecture(lectureId).locator('#units').click();
6969
}
7070

71+
/**
72+
* Navigates to the attachments page of a specified lecture by its identifier.
73+
* @param lectureId - The identifier of the lecture to navigate to its attachments page.
74+
*/
75+
async openAttachmentsPage(lectureId: number) {
76+
await this.getLecture(lectureId).locator('#attachments').click();
77+
}
78+
79+
async openAttachmentUnitCreationPage(lectureId: number) {
80+
await this.openAttachmentsPage(lectureId);
81+
await this.page.locator('#add-attachment').click();
82+
}
83+
7184
/**
7285
* Opens the creation form for a new unit of the specified type.
7386
* @param type - The type of unit to create.

0 commit comments

Comments
 (0)