Skip to content

Commit 2eaf76a

Browse files
added playwright
Co-authored-by: Jack Shelton <[email protected]>
1 parent 3e43f7c commit 2eaf76a

File tree

24 files changed

+1094
-1365
lines changed

24 files changed

+1094
-1365
lines changed

.env

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Nx 18 enables using plugins to infer targets by default
2+
# This is disabled for existing workspaces to maintain compatibility
3+
# For more info, see: https://nx.dev/concepts/inferred-tasks
4+
NX_ADD_PLUGINS=false
5+
6+
# Nx 18 enables using plugins to infer targets by default
7+
# This is disabled for existing workspaces to maintain compatibility
8+
# For more info, see: https://nx.dev/concepts/inferred-tasks
9+
NX_ADD_PLUGINS=false
10+
11+
# Nx 18 enables using plugins to infer targets by default
12+
# This is disabled for existing workspaces to maintain compatibility
13+
# For more info, see: https://nx.dev/concepts/inferred-tasks
14+
NX_ADD_PLUGINS=false
15+
16+
# Nx 18 enables using plugins to infer targets by default
17+
# This is disabled for existing workspaces to maintain compatibility
18+
# For more info, see: https://nx.dev/concepts/inferred-tasks
19+
NX_ADD_PLUGINS=false
20+
21+
# Nx 18 enables using plugins to infer targets by default
22+
# This is disabled for existing workspaces to maintain compatibility
23+
# For more info, see: https://nx.dev/concepts/inferred-tasks
24+
NX_ADD_PLUGINS=false
25+
26+
# Nx 18 enables using plugins to infer targets by default
27+
# This is disabled for existing workspaces to maintain compatibility
28+
# For more info, see: https://nx.dev/concepts/inferred-tasks
29+
NX_ADD_PLUGINS=false
30+
31+
# Nx 18 enables using plugins to infer targets by default
32+
# This is disabled for existing workspaces to maintain compatibility
33+
# For more info, see: https://nx.dev/concepts/inferred-tasks
34+
NX_ADD_PLUGINS=false
35+
36+
# Nx 18 enables using plugins to infer targets by default
37+
# This is disabled for existing workspaces to maintain compatibility
38+
# For more info, see: https://nx.dev/concepts/inferred-tasks
39+
NX_ADD_PLUGINS=false

apps/website-e2e/project.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
},
2020
"lint": {
2121
"executor": "@nx/eslint:lint",
22-
"outputs": ["{options.outputFile}"],
23-
"options": {
24-
"lintFilePatterns": ["apps/website-e2e/**/*.{js,ts}"]
25-
}
22+
"outputs": ["{options.outputFile}"]
2623
}
2724
},
2825
"tags": [],

apps/website/.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"extends": [
3+
"plugin:playwright/recommended",
34
"../../.eslintrc.json",
45
"eslint:recommended",
56
"plugin:@typescript-eslint/recommended",
@@ -28,6 +29,10 @@
2829
{
2930
"files": ["*.js", "*.jsx"],
3031
"rules": {}
32+
},
33+
{
34+
"files": ["e2e/**/*.{ts,js,tsx,jsx}"],
35+
"rules": {}
3136
}
3237
]
3338
}

apps/website/adapters/cloudflare-pages/vite.config.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

apps/website/e2e/example.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('/');
5+
6+
// Expect h1 to contain a substring.
7+
expect(await page.locator('h1').innerText()).toContain('Qwik UI');
8+
});

apps/website/playwright.config.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { nxE2EPreset } from '@nx/playwright/preset';
2+
import { defineConfig, devices } from '@playwright/test';
3+
4+
import { workspaceRoot } from '@nx/devkit';
5+
6+
// For CI, you may want to set BASE_URL to the deployed application.
7+
const baseURL = process.env['BASE_URL'] || 'http://localhost:5173';
8+
9+
/**
10+
* Read environment variables from file.
11+
* https://github.com/motdotla/dotenv
12+
*/
13+
// require('dotenv').config();
14+
15+
/**
16+
* See https://playwright.dev/docs/test-configuration.
17+
*/
18+
export default defineConfig({
19+
...nxE2EPreset(__filename, { testDir: './e2e' }),
20+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
21+
use: {
22+
baseURL,
23+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
24+
trace: 'on-first-retry',
25+
},
26+
/* Run your local dev server before starting the tests */
27+
webServer: {
28+
command: 'pnpm dev',
29+
url: 'http://localhost:5173',
30+
reuseExistingServer: !process.env.CI,
31+
cwd: workspaceRoot,
32+
// timeout: 120000,
33+
},
34+
projects: [
35+
{
36+
name: 'chromium',
37+
use: { ...devices['Desktop Chrome'] },
38+
},
39+
40+
{
41+
name: 'firefox',
42+
use: { ...devices['Desktop Firefox'] },
43+
},
44+
45+
{
46+
name: 'webkit',
47+
use: { ...devices['Desktop Safari'] },
48+
},
49+
50+
// Uncomment for mobile browsers support
51+
/* {
52+
name: 'Mobile Chrome',
53+
use: { ...devices['Pixel 5'] },
54+
},
55+
{
56+
name: 'Mobile Safari',
57+
use: { ...devices['iPhone 12'] },
58+
}, */
59+
60+
// Uncomment for branded browsers
61+
/* {
62+
name: 'Microsoft Edge',
63+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
64+
},
65+
{
66+
name: 'Google Chrome',
67+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68+
} */
69+
],
70+
});

apps/website/src/components/code-copy/code-copy.tsx

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
import { cn } from '@qwik-ui/utils';
21
import { PropsOf, component$, useSignal } from '@builder.io/qwik';
32
import { Button } from '@qwik-ui/fluffy';
3+
import { cn } from '@qwik-ui/utils';
44
import copy from 'clipboard-copy';
55

66
export type CodeCopyProps = PropsOf<typeof Button> & {
77
code?: string;
88
};
99

10-
export const CodeCopy = component$(({ code = '', class: outsideClass, ...props }) => {
11-
const copied = useSignal(false);
10+
export const CodeCopy = component$<CodeCopyProps>(
11+
({ code = '', class: outsideClass, ...props }) => {
12+
const copied = useSignal(false);
1213

13-
return (
14-
<Button
15-
look="ghost"
16-
intent="basic"
17-
animation={!copied.value ? 'bouncy' : 'none'}
18-
{...props}
19-
title={copied.value ? 'Copied to Clipboard' : 'Copy to Clipboard'}
20-
class={cn(outsideClass)}
21-
onClick$={async () => {
22-
await copy(code);
23-
copied.value = true;
14+
return (
15+
<Button
16+
look="ghost"
17+
intent="basic"
18+
animation={!copied.value ? 'bouncy' : 'none'}
19+
{...props}
20+
title={copied.value ? 'Copied to Clipboard' : 'Copy to Clipboard'}
21+
class={cn(outsideClass)}
22+
onClick$={async () => {
23+
await copy(code);
24+
copied.value = true;
2425

25-
setTimeout(() => {
26-
copied.value = false;
27-
}, 4000);
28-
}}
29-
>
30-
{!copied.value ? <CopyIcon /> : <ClipboardCheck />}
31-
</Button>
32-
);
33-
});
26+
setTimeout(() => {
27+
copied.value = false;
28+
}, 4000);
29+
}}
30+
>
31+
{!copied.value ? <CopyIcon /> : <ClipboardCheck />}
32+
</Button>
33+
);
34+
},
35+
);
3436

3537
export function CopyIcon(props: PropsOf<'svg'>, key: string) {
3638
return (

apps/website/src/components/icons/AstroLogo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { component$ } from '@builder.io/qwik';
1+
import { component$, type PropsOf } from '@builder.io/qwik';
22

3-
export default component$((props) => {
3+
export type AstroLogoProps = PropsOf<'svg'>;
4+
5+
export default component$<AstroLogoProps>((props) => {
46
return (
57
<svg {...props} viewBox="0 0 57 72" fill="none" xmlns="http://www.w3.org/2000/svg">
68
<path

apps/website/src/components/icons/QwikLogo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { component$ } from '@builder.io/qwik';
1+
import { component$, type PropsOf } from '@builder.io/qwik';
22

3-
export default component$((props) => {
3+
export type QwikLogoProps = PropsOf<'svg'>;
4+
5+
export default component$<QwikLogoProps>((props) => {
46
return (
57
<svg viewBox="0 0 500 506" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
68
<path

apps/website/vite.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ export default defineConfig(async () => {
1010
const { visit } = await import('unist-util-visit');
1111

1212
return {
13+
root: __dirname,
14+
build: {
15+
outDir: '../../dist/apps/website',
16+
reportCompressedSize: true,
17+
commonjsOptions: {
18+
transformMixedEsModules: true,
19+
},
20+
},
1321
plugins: [
1422
qwikNxVite(),
1523
qwikCity({
@@ -101,13 +109,5 @@ export default defineConfig(async () => {
101109
'Cache-Control': 'public, max-age=600',
102110
},
103111
},
104-
test: {
105-
globals: true,
106-
cache: {
107-
dir: '../../node_modules/.vitest',
108-
},
109-
environment: 'node',
110-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
111-
},
112112
};
113113
});

0 commit comments

Comments
 (0)