Skip to content

Commit

Permalink
Get tests working locally
Browse files Browse the repository at this point in the history
  • Loading branch information
slang25 committed Sep 17, 2023
1 parent 7f9cdd8 commit 6eb8bee
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 21 deletions.
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dddsw-web",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"dev": "vite dev --host 127.0.0.1",
"build": "vite build",
"package": "svelte-kit package",
"preview": "vite preview",
Expand All @@ -17,6 +17,7 @@
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.25.0",
"@types/cookie": "^0.5.2",
"@types/node": "^20.6.2",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
Expand Down
8 changes: 6 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run dev',
port: 5173
}
url: 'http://127.0.0.1:5173',
reuseExistingServer: !process.env.CI
},
use: {
baseURL: 'http://127.0.0.1:5173/',
},
};

export default config;
18 changes: 9 additions & 9 deletions tests/navbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect, devices } from '@playwright/test';

test('Clicking nav button displays nav links dropdown', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -12,7 +12,7 @@ test('Clicking nav button displays nav links dropdown', async ({ page }) => {

test('Clicking nav button closes nav links dropdown', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -25,7 +25,7 @@ test('Clicking nav button closes nav links dropdown', async ({ page }) => {

test('Clicking nav link closes nav links dropdown', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -38,7 +38,7 @@ test('Clicking nav link closes nav links dropdown', async ({ page }) => {

test('Clicking logo closes nav links dropdown', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -51,7 +51,7 @@ test('Clicking logo closes nav links dropdown', async ({ page }) => {

test('Clicking logo does not open nav links dropdown', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click logo
await page.locator('img[class~="logo"]').click();
Expand All @@ -61,14 +61,14 @@ test('Clicking logo does not open nav links dropdown', async ({ page }) => {

test('Displays down arrow icon in unexpanded state', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

await expect(page.locator('.main-nav-button span.icon')).toContainText('expand_more');
});

test('Displays up arrow icon in expanded state', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -78,7 +78,7 @@ test('Displays up arrow icon in expanded state', async ({ page }) => {

test('Does not show current route in nav links drop down', async ({ page }) => {
// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -90,7 +90,7 @@ test('Does not show button text in smaller screens', async ({ page }) => {
await page.setViewportSize(devices['iPhone SE'].viewport);

// Go to about page (to avoid carousel weirdness)
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

await expect(page.locator('.nav-button-text')).toBeHidden();
});
6 changes: 3 additions & 3 deletions tests/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { test, expect } from '@playwright/test';
const routes = ['about', 'sponsorship', '2023', 'code-of-conduct'];
for (const route of routes) {
test(`Can navigate to ${route} page from Home via the nav bar`, async ({ page }) => {
// Go to Home
await page.goto('http://127.0.0.1:5173/');
// Go to Home page
await page.goto('/');

// Click nav drop down
await page.locator('.main-nav-button').click();
Expand All @@ -18,7 +18,7 @@ for (const route of routes) {

test('Can navigate to Home from content page by clicking logo', async ({ page }) => {
// Go to about page
await page.goto('http://127.0.0.1:5173/about');
await page.goto('/about');

// Click logo
await page.locator('img[class~="logo"]').click();
Expand Down
12 changes: 6 additions & 6 deletions tests/page-previews.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import { test, devices } from '@playwright/test';
test('Captures Home preview - mobile', async ({ page }) => {
await page.setViewportSize(devices['iPhone SE'].viewport);

// Go to Home
await page.goto('http://127.0.0.1:5173/');
// Go to Home page
await page.goto('/');

await page.screenshot({ path: 'tests/page-previews/home-mobile.png', fullPage: true });
});

test('Captures Home preview - tablet', async ({ page }) => {
await page.setViewportSize(devices['iPad Mini'].viewport);

// Go to Home
await page.goto('http://127.0.0.1:5173/');
// Go to Home page
await page.goto('/');

await page.screenshot({ path: 'tests/page-previews/home-tablet.png', fullPage: true });
});

test('Captures Home preview - desktop', async ({ page }) => {
await page.setViewportSize(devices['Desktop Chrome'].viewport);

// Go to Home
await page.goto('http://127.0.0.1:5173/');
// Go to Home page
await page.goto('/');

await page.screenshot({ path: 'tests/page-previews/home-desktop.png', fullPage: true });
});
Expand Down
Binary file modified tests/page-previews/2023-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/2023-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/2023-tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/about-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/about-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/about-tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/code-of-conduct-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/code-of-conduct-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/code-of-conduct-tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/home-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/home-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/home-tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/sponsorship-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/sponsorship-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/page-previews/sponsorship-tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import dns from 'dns'
import type { UserConfig } from 'vite';

dns.setDefaultResultOrder('verbatim')

const config: UserConfig = {
plugins: [sveltekit()]
};
Expand Down

1 comment on commit 6eb8bee

@vercel
Copy link

@vercel vercel bot commented on 6eb8bee Sep 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web-poc – ./

web-poc-the-dddsw-team.vercel.app
web-poc-git-main-the-dddsw-team.vercel.app
web-poc.vercel.app

Please sign in to comment.