| 
									
										
										
										
											2023-05-09 17:53:01 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Copyright (c) Microsoft Corporation. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 11:28:28 -07:00
										 |  |  | import { test, expect, retries } from './ui-mode-fixtures'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test.describe.configure({ mode: 'parallel', retries }); | 
					
						
							| 
									
										
										
										
											2023-05-09 17:53:01 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-11 16:32:32 -07:00
										 |  |  | test('should contain file attachment', async ({ runUITest }) => { | 
					
						
							| 
									
										
										
										
											2023-05-09 17:53:01 -07:00
										 |  |  |   const { page } = await runUITest({ | 
					
						
							|  |  |  |     'a.test.ts': `
 | 
					
						
							|  |  |  |       import { test } from '@playwright/test'; | 
					
						
							|  |  |  |       test('attach test', async () => { | 
					
						
							|  |  |  |         await test.info().attach('note', { path: __filename }); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     `,
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   await page.getByText('attach test').click(); | 
					
						
							|  |  |  |   await page.getByTitle('Run all').click(); | 
					
						
							|  |  |  |   await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)'); | 
					
						
							|  |  |  |   await page.getByText('Attachments').click(); | 
					
						
							| 
									
										
										
										
											2023-05-11 16:32:32 -07:00
										 |  |  |   await page.getByText('attach "note"', { exact: true }).click(); | 
					
						
							| 
									
										
										
										
											2023-05-09 17:53:01 -07:00
										 |  |  |   const popupPromise = page.waitForEvent('popup'); | 
					
						
							|  |  |  |   await page.getByRole('link', { name: 'note' }).click(); | 
					
						
							|  |  |  |   const popup = await popupPromise; | 
					
						
							|  |  |  |   await popup.waitForLoadState(); | 
					
						
							|  |  |  |   const content = await popup.content(); | 
					
						
							|  |  |  |   expect(content).toContain('attach test'); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2023-05-11 16:32:32 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | test('should contain string attachment', async ({ runUITest }) => { | 
					
						
							|  |  |  |   const { page } = await runUITest({ | 
					
						
							|  |  |  |     'a.test.ts': `
 | 
					
						
							|  |  |  |       import { test } from '@playwright/test'; | 
					
						
							|  |  |  |       test('attach test', async () => { | 
					
						
							|  |  |  |         await test.info().attach('note', { body: 'text42' }); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     `,
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   await page.getByText('attach test').click(); | 
					
						
							|  |  |  |   await page.getByTitle('Run all').click(); | 
					
						
							|  |  |  |   await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)'); | 
					
						
							|  |  |  |   await page.getByText('Attachments').click(); | 
					
						
							|  |  |  |   await page.getByText('attach "note"', { exact: true }).click(); | 
					
						
							|  |  |  |   const popupPromise = page.waitForEvent('popup'); | 
					
						
							|  |  |  |   await page.getByRole('link', { name: 'note' }).click(); | 
					
						
							|  |  |  |   const popup = await popupPromise; | 
					
						
							|  |  |  |   await popup.waitForLoadState(); | 
					
						
							|  |  |  |   const content = await popup.content(); | 
					
						
							|  |  |  |   expect(content).toContain('text42'); | 
					
						
							|  |  |  | }); |