From 3a4657e3685bcae84a331c836951d33e9e8a9f9b Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Fri, 15 Jul 2022 10:02:09 -0700 Subject: [PATCH] test: fix bad file ref and update locators --- test/e2e/fields/index.spec.ts | 14 ++++---------- test/e2e/localization/index.spec.ts | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/test/e2e/fields/index.spec.ts b/test/e2e/fields/index.spec.ts index 7f998f9e4..0916041aa 100644 --- a/test/e2e/fields/index.spec.ts +++ b/test/e2e/fields/index.spec.ts @@ -1,9 +1,9 @@ import type { Page } from '@playwright/test'; import { expect, test } from '@playwright/test'; import { AdminUrlUtil } from '../../helpers/adminUrlUtil'; -import { initPayloadTest } from '../../helpers/configHelpers'; +import { initPayloadE2E } from '../../helpers/configHelpers'; import { login } from '../helpers'; -import { textDoc } from './shared'; +import { textDoc } from './collections/Text'; const { beforeAll, describe } = test; @@ -12,13 +12,7 @@ let url: AdminUrlUtil; describe('fields', () => { beforeAll(async ({ browser }) => { - const { serverURL } = await initPayloadTest({ - __dirname, - init: { - local: false, - }, - }); - + const { serverURL } = await initPayloadE2E(__dirname); url = new AdminUrlUtil(serverURL, 'text-fields'); const context = await browser.newContext(); @@ -30,7 +24,7 @@ describe('fields', () => { describe('text', () => { test('should display field in list view', async () => { await page.goto(url.list); - const textCell = await page.locator('table tr:first-child td:first-child a'); + const textCell = page.locator('table tr:first-child td:first-child a'); await expect(textCell).toHaveText(textDoc.text); }); }); diff --git a/test/e2e/localization/index.spec.ts b/test/e2e/localization/index.spec.ts index 615304711..a12177fb7 100644 --- a/test/e2e/localization/index.spec.ts +++ b/test/e2e/localization/index.spec.ts @@ -66,16 +66,16 @@ describe('Localization', () => { await changeLocale('es'); // Localized field should not be populated - await expect(page.locator('#title')).toBeEmpty(); - await expect(page.locator('#description')).toHaveValue(description); + await expect(page.locator('#field-title')).toBeEmpty(); + await expect(page.locator('#field-description')).toHaveValue(description); await fillValues({ title: spanishTitle, description }); await saveDocAndAssert(page); await changeLocale(defaultLocale); // Expect english title - await expect(page.locator('#title')).toHaveValue(title); - await expect(page.locator('#description')).toHaveValue(description); + await expect(page.locator('#field-title')).toHaveValue(title); + await expect(page.locator('#field-description')).toHaveValue(description); }); test('create spanish post, add english', async () => { @@ -93,8 +93,8 @@ describe('Localization', () => { await changeLocale(defaultLocale); // Localized field should not be populated - await expect(page.locator('#title')).toBeEmpty(); - await expect(page.locator('#description')).toHaveValue(description); + await expect(page.locator('#field-title')).toBeEmpty(); + await expect(page.locator('#field-description')).toHaveValue(description); // Add English @@ -102,8 +102,8 @@ describe('Localization', () => { await saveDocAndAssert(page); await saveDocAndAssert(page); - await expect(page.locator('#title')).toHaveValue(title); - await expect(page.locator('#description')).toHaveValue(description); + await expect(page.locator('#field-title')).toHaveValue(title); + await expect(page.locator('#field-description')).toHaveValue(description); }); }); }); @@ -119,8 +119,8 @@ async function clearDocs(): Promise { async function fillValues(data: Partial>) { const { title: titleVal, description: descVal } = data; - if (titleVal) await page.locator('#title').fill(titleVal); - if (descVal) await page.locator('#description').fill(descVal); + if (titleVal) await page.locator('#field-title').fill(titleVal); + if (descVal) await page.locator('#field-description').fill(descVal); } async function changeLocale(newLocale: string) {