| 
									
										
										
										
											2025-01-17 10:36:41 -06:00
										 |  |  | // Copyright 2025 Signal Messenger, LLC
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import createDebug from 'debug'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 00:07:41 -06:00
										 |  |  | import { expect } from 'playwright/test'; | 
					
						
							| 
									
										
										
										
											2025-01-17 10:36:41 -06:00
										 |  |  | import type { App } from '../playwright'; | 
					
						
							|  |  |  | import { Bootstrap } from '../bootstrap'; | 
					
						
							|  |  |  | import { MINUTE } from '../../util/durations'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { SIGNAL_ACI } from '../../types/SignalConversation'; | 
					
						
							| 
									
										
										
										
											2025-01-29 00:07:41 -06:00
										 |  |  | import { | 
					
						
							|  |  |  |   clickOnConversationWithAci, | 
					
						
							|  |  |  |   getTimelineMessageWithText, | 
					
						
							|  |  |  | } from '../helpers'; | 
					
						
							| 
									
										
										
										
											2025-01-17 10:36:41 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const debug = createDebug('mock:test:releaseNotes'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('release notes', function (this: Mocha.Suite) { | 
					
						
							|  |  |  |   let bootstrap: Bootstrap; | 
					
						
							|  |  |  |   let app: App; | 
					
						
							|  |  |  |   let nextApp: App; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   this.timeout(MINUTE); | 
					
						
							|  |  |  |   beforeEach(async () => { | 
					
						
							|  |  |  |     bootstrap = new Bootstrap(); | 
					
						
							|  |  |  |     await bootstrap.init(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = await bootstrap.link(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   afterEach(async function (this: Mocha.Context) { | 
					
						
							|  |  |  |     if (!bootstrap) { | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (nextApp) { | 
					
						
							|  |  |  |       await bootstrap.maybeSaveLogs(this.currentTest, nextApp); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     await nextApp?.close(); | 
					
						
							|  |  |  |     await bootstrap.teardown(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 00:07:41 -06:00
										 |  |  |   it('shows release notes with an image', async () => { | 
					
						
							| 
									
										
										
										
											2025-01-17 10:36:41 -06:00
										 |  |  |     const firstWindow = await app.getWindow(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await firstWindow.evaluate('window.SignalCI.resetReleaseNotesFetcher()'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await app.close(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     nextApp = await bootstrap.startApp(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const secondWindow = await nextApp.getWindow(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const leftPane = secondWindow.locator('#LeftPane'); | 
					
						
							|  |  |  |     const releaseNoteConversation = leftPane.getByTestId(SIGNAL_ACI); | 
					
						
							|  |  |  |     await releaseNoteConversation.waitFor(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 00:07:41 -06:00
										 |  |  |     await expect(releaseNoteConversation).toBeVisible(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await clickOnConversationWithAci(secondWindow, SIGNAL_ACI); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const timelineMessage = await getTimelineMessageWithText( | 
					
						
							|  |  |  |       secondWindow, | 
					
						
							|  |  |  |       'Call links' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await expect( | 
					
						
							|  |  |  |       timelineMessage.locator('img.module-image__image') | 
					
						
							|  |  |  |     ).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-01-17 10:36:41 -06:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |