fix: upload e2e file path

This commit is contained in:
Dan Ribbens
2022-07-15 13:39:02 -04:00
parent 3a4657e368
commit a664b627f6

View File

@@ -1,5 +1,6 @@
import type { Page } from '@playwright/test'; import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test'; import { expect, test } from '@playwright/test';
import path from 'path';
import { AdminUrlUtil } from '../../helpers/adminUrlUtil'; import { AdminUrlUtil } from '../../helpers/adminUrlUtil';
import { initPayloadE2E } from '../../helpers/configHelpers'; import { initPayloadE2E } from '../../helpers/configHelpers';
import { login, saveDocAndAssert } from '../helpers'; import { login, saveDocAndAssert } from '../helpers';
@@ -57,14 +58,12 @@ describe('uploads', () => {
test('should create file upload', async () => { test('should create file upload', async () => {
await page.goto(mediaURL.create); await page.goto(mediaURL.create);
await page.setInputFiles('input[type="file"]', './image.png'); await page.setInputFiles('input[type="file"]', path.resolve(__dirname, './image.png'));
const filename = page.locator('.file-field__filename'); const filename = page.locator('.file-field__filename');
await expect(filename).toContainText('.png'); await expect(filename).toContainText('.png');
await page.locator('.form-submit button').click();
await saveDocAndAssert(page); await saveDocAndAssert(page);
}); });