Repository: sveltejs/kit
Pull request #8988 (2023-02-10 13:10:42)

fix: use new locator api for demo tests
using new locator apis new from version 1.27

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.



Patch:
diff --git a/.changeset/lucky-toys-help.md b/.changeset/lucky-toys-help.md
new file mode 100644
index 000000000..24b3b3fd6
--- /dev/null
+++ b/.changeset/lucky-toys-help.md
@@ -0,0 +1,5 @@
+---
+'create-svelte': patch
+---
+
+fix: use new locator API to improve demo test


Test patch:
diff --git a/packages/create-svelte/shared/+playwright+default/tests/test.ts b/packages/create-svelte/shared/+playwright+default/tests/test.ts
index 38b7f95bd..09d2c0346 100644
--- a/packages/create-svelte/shared/+playwright+default/tests/test.ts
+++ b/packages/create-svelte/shared/+playwright+default/tests/test.ts
@@ -2,5 +2,5 @@ import { expect, test } from '@playwright/test';
 
 test('about page has expected h1', async ({ page }) => {
 	await page.goto('/about');
-	await expect(page.locator('h1')).toHaveText('About this app');
+	await expect(page.getByRole('heading', { name: 'About this app' })).toBeVisible();
 });
diff --git a/packages/create-svelte/shared/+playwright+skeleton/tests/test.ts b/packages/create-svelte/shared/+playwright+skeleton/tests/test.ts
index 4e579377e..5816be413 100644
--- a/packages/create-svelte/shared/+playwright+skeleton/tests/test.ts
+++ b/packages/create-svelte/shared/+playwright+skeleton/tests/test.ts
@@ -2,5 +2,5 @@ import { expect, test } from '@playwright/test';
 
 test('index page has expected h1', async ({ page }) => {
 	await page.goto('/');
-	expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');
+	await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible();
 });
diff --git a/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts b/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts
index 4e579377e..5816be413 100644
--- a/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts
+++ b/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts
@@ -2,5 +2,5 @@ import { expect, test } from '@playwright/test';
 
 test('index page has expected h1', async ({ page }) => {
 	await page.goto('/');
-	expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');
+	await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible();
 });