diff --git a/src/test/playwright/e2e/course/CourseMessages.spec.ts b/src/test/playwright/e2e/course/CourseMessages.spec.ts index 8a3026a9a931..b75773522eaf 100644 --- a/src/test/playwright/e2e/course/CourseMessages.spec.ts +++ b/src/test/playwright/e2e/course/CourseMessages.spec.ts @@ -32,7 +32,7 @@ test.describe('Course messages', () => { test.describe('Create channel', () => { test('Check for pre-created channels', async ({ login, courseMessages }) => { await login(instructor, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('generalChannels').click(); + await courseMessages.browseChannelsButton(); await courseMessages.checkChannelsExists('tech-support'); await courseMessages.checkChannelsExists('organization'); await courseMessages.checkChannelsExists('random'); @@ -107,16 +107,16 @@ test.describe('Course messages', () => { await login(admin); await courseManagementAPIRequests.createLecture(course, 'Test Lecture'); await login(instructor, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('lectureChannels').click(); - await courseMessages.checkChannelsExists('lecture-test-lecture'); + await courseMessages.browseChannelsButton(); + await courseMessages.checkChannelsExists('test-lecture'); }); test('Check that channel is created when an exercise is created', async ({ login, courseMessages, exerciseAPIRequests }) => { await login(admin); await exerciseAPIRequests.createTextExercise({ course }, 'Test Exercise'); await login(instructor, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('exerciseChannels').click(); - await courseMessages.checkChannelsExists('exercise-test-exercise'); + await courseMessages.browseChannelsButton(); + await courseMessages.checkChannelsExists('test-exercise'); }); test('Check that channel is created when an exam is created', async ({ login, courseMessages, examAPIRequests }) => { @@ -124,7 +124,7 @@ test.describe('Course messages', () => { const examTitle = 'exam' + generateUUID(); await examAPIRequests.createExam({ course, title: examTitle }); await login(instructor, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('examChannels').click(); + await courseMessages.browseChannelsButton(); await courseMessages.checkChannelsExists(titleLowercase(examTitle)); }); }); @@ -163,7 +163,7 @@ test.describe('Course messages', () => { test('Student should be joined into pre-created channels automatically', async ({ login, courseMessages }) => { await login(studentOne, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('generalChannels').click(); + await courseMessages.browseChannelsButton(); const techSupportChannelId = Number(await courseMessages.getChannelIdByName('tech-support')); const techSupportJoinedBadge = courseMessages.getJoinedBadge(techSupportChannelId); await expect(techSupportJoinedBadge).toBeVisible(); @@ -187,7 +187,7 @@ test.describe('Course messages', () => { test('Student should be able to join a public channel', async ({ login, courseMessages }) => { await login(studentOne, `/courses/${course.id}/communication`); - await courseMessages.browseChannelsButton('generalChannels').click(); + await courseMessages.browseChannelsButton(); await courseMessages.joinChannel(channel.id!); const joinedBadge = courseMessages.getJoinedBadge(channel.id!); await expect(joinedBadge).toBeVisible(); @@ -197,7 +197,7 @@ test.describe('Course messages', () => { test('Student should be able to leave a public channel', async ({ login, courseMessages, communicationAPIRequests }) => { await login(studentOne, `/courses/${course.id}/communication`); await communicationAPIRequests.joinUserIntoChannel(course, channel.id!, studentOne); - await courseMessages.browseChannelsButton('generalChannels').click(); + await courseMessages.browseChannelsButton(); await courseMessages.leaveChannel(channel.id!); await expect(courseMessages.getJoinedBadge(channel.id!)).toBeHidden(); }); diff --git a/src/test/playwright/support/pageobjects/course/CourseMessagesPage.ts b/src/test/playwright/support/pageobjects/course/CourseMessagesPage.ts index 49f5f3854db8..5102f126c235 100644 --- a/src/test/playwright/support/pageobjects/course/CourseMessagesPage.ts +++ b/src/test/playwright/support/pageobjects/course/CourseMessagesPage.ts @@ -18,15 +18,16 @@ export class CourseMessagesPage { * Clicks the button to initiate channel creation. */ async createChannelButton() { - await this.page.locator('#plusButton-generalChannels').click(); - await this.page.locator('.modal-content #createChannel').click(); + await this.page.click('.square-button > .ng-fa-icon'); + await this.page.click('text=Create channel'); } /** * Navigates to the channel overview section. */ - browseChannelsButton(channelGroup: string) { - return this.page.locator(`#plusButton-${channelGroup}`); + async browseChannelsButton() { + await this.page.locator('.btn-primary.btn-sm.square-button').click(); + await this.page.locator('button', { hasText: 'Browse Channels' }).click(); } /** @@ -288,7 +289,8 @@ export class CourseMessagesPage { * Clicks the button to initiate group chat creation. */ async createGroupChatButton() { - await this.page.locator('#plusButton-groupChats').click(); + await this.page.locator('.btn-primary.btn-sm.square-button').click(); + await this.page.locator('button', { hasText: 'Create Group Chat' }).click(); } /**