Repository: sveltejs/kit
Pull request #5943 (2022-08-16 18:37:30)

add tests to project structure
#5834, but with a corresponding entry below (I wasn't able to make the suggestion on that PR)

changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: 9151e6b3e6a8590815d3a17a0e220f79abd62ddf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/sveltejs/kit/new/add-tests-documentation?filename=.changeset/slow-cameras-stare.md&value=---%0A%0A---%0A%0Aadd%20tests%20to%20project%20structure%0A)



Patch:
diff --git a/documentation/docs/01-project-structure.md b/documentation/docs/01-project-structure.md
index dff7f3d21..2eac580f2 100644
--- a/documentation/docs/01-project-structure.md
+++ b/documentation/docs/01-project-structure.md
@@ -17,6 +17,8 @@ my-project/
 │ └ hooks.js
 ├ static/
 │ └ [your static assets]
+├ tests/
+│ └ [your tests]
 ├ package.json
 ├ svelte.config.js
 ├ tsconfig.json
@@ -48,6 +50,10 @@ You can use `.ts` files instead of `.js` files, if using TypeScript.
 
 Any static assets that should be served as-is, like `robots.txt` or `favicon.png`, go in here.
 
+#### tests
+
+If you chose to add tests to your project during `npm create svelte@latest`, they will live in this directory.
+
 #### package.json
 
 Your `package.json` file must include `@sveltejs/kit`, `svelte` and `vite` as `devDependencies`.


Test patch:
diff --git a/packages/kit/test/apps/basics/test/client.test.js b/packages/kit/test/apps/basics/test/client.test.js
index f759e94c6..c8a017c36 100644
--- a/packages/kit/test/apps/basics/test/client.test.js
+++ b/packages/kit/test/apps/basics/test/client.test.js
@@ -110,10 +110,13 @@ test.describe('Scrolling', () => {
 		const originalScrollY = /** @type {number} */ (await page.evaluate(() => scrollY));
 		await clicknav('#routing-page');
 		await page.goBack();
+		await page.waitForLoadState('networkidle');
 		expect(page.url()).toBe(baseURL + '/anchor#last-anchor-2');
 		expect(await page.evaluate(() => scrollY)).toEqual(originalScrollY);
 
 		await page.goBack();
+		await page.waitForLoadState('networkidle');
+
 		expect(page.url()).toBe(baseURL + '/anchor');
 		expect(await page.evaluate(() => scrollY)).toEqual(0);
 	});
@@ -349,6 +352,7 @@ test.describe('Load', () => {
 		await page.goto('/load/change-detection/session/used');
 		expect(await page.textContent('h2')).toBe('1');
 		await page.click('button');
+		await page.waitForLoadState('networkidle');
 		expect(await page.textContent('h2')).toBe('2');
 
 		await page.goto('/load/change-detection/session/unused');
@@ -375,6 +379,7 @@ test.describe('Load', () => {
 		await clicknav('[href="/load/layout-props/b"]');
 		expect(await page.textContent('h1')).toBe('1');
 		await page.click('button');
+		await page.waitForLoadState('networkidle');
 		expect(await page.textContent('h1')).toBe('2');
 	});
 
@@ -607,6 +612,7 @@ test.describe('Page Store', () => {
 		);
 
 		await page.click('button');
+		await page.waitForLoadState('networkidle');
 
 		expect(await page.textContent('#page-data')).toBe('{"answer":1337}');
 		expect(await page.textContent('#store-data')).toBe(
diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js
index b5dad6f1f..75f6c7a8a 100644
--- a/packages/kit/test/apps/basics/test/test.js
+++ b/packages/kit/test/apps/basics/test/test.js
@@ -1446,6 +1446,7 @@ test.describe('Routing', () => {
 		await clicknav('[href="/routing/a"]');
 
 		await page.goBack();
+		await page.waitForLoadState('networkidle');
 		expect(await page.textContent('h1')).toBe('Great success!');
 	});