(page: Page, server: Server)
| 32 | |
| 33 | |
| 34 | async def test_should_upload_the_file(page: Page, server: Server) -> None: |
| 35 | await page.goto(server.PREFIX + "/input/fileupload.html") |
| 36 | file_path = os.path.relpath(FILE_TO_UPLOAD, os.getcwd()) |
| 37 | input = await page.query_selector("input") |
| 38 | assert input |
| 39 | await input.set_input_files(file_path) |
| 40 | assert await page.evaluate("e => e.files[0].name", input) == "file-to-upload.txt" |
| 41 | assert ( |
| 42 | await page.evaluate( |
| 43 | """e => { |
| 44 | reader = new FileReader() |
| 45 | promise = new Promise(fulfill => reader.onload = fulfill) |
| 46 | reader.readAsText(e.files[0]) |
| 47 | return promise.then(() => reader.result) |
| 48 | }""", |
| 49 | input, |
| 50 | ) |
| 51 | == "contents of the file\n" |
| 52 | ) |
| 53 | |
| 54 | |
| 55 | async def test_should_work(page: Page, assetdir: Path) -> None: |
nothing calls this directly
no test coverage detected