Skip to content

Commit a4585d7

Browse files
committed
chore: update cypress
1 parent f57dd4e commit a4585d7

File tree

5 files changed

+48
-149
lines changed

5 files changed

+48
-149
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"country-list-json": "1.1.0",
5656
"cypress": "^12.9.0",
5757
"cypress-axe": "1.4.0",
58-
"cypress-ct-qwik": "0.0.9",
58+
"cypress-ct-qwik": "0.3.0",
5959
"cz-conventional-changelog": "^3.3.0",
6060
"daisyui": "^2.50.1",
6161
"danger": "11.2.4",

packages/headless/cypress.config.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import { defineConfig } from 'cypress';
2-
import { mergeConfig } from 'vite';
3-
import viteConfig from './vite.config';
42

5-
const cypressConfig = {
3+
export default defineConfig({
64
component: {
75
specPattern: '**/*.spec.{js,jsx,ts,tsx}',
86
devServer: {
7+
framework: 'cypress-ct-qwik',
98
bundler: 'vite',
10-
viteConfig,
119
},
1210
},
13-
};
14-
15-
export default defineConfig(
16-
cypressConfig as Cypress.ConfigOptions<typeof cypressConfig>
17-
);
11+
});

packages/headless/cypress/support/component-index.html

Lines changed: 1 addition & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -4,124 +4,9 @@
44
<meta charset="utf-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
7-
<title>headless Components App</title>
7+
<title>Headless Components App</title>
88
</head>
99
<body>
1010
<div data-cy-root></div>
11-
<script type="text/javascript">
12-
((e, t) => {
13-
const n = '__q_context__',
14-
o = window,
15-
i = new Set(),
16-
s = (t) => e.querySelectorAll(t),
17-
r = (e, t, n = t.type) => {
18-
s('[on' + e + '\\:' + n + ']').forEach((o) => f(o, e, t, n));
19-
},
20-
a = (e, t) => e.getAttribute(t),
21-
l = (t) => {
22-
if (void 0 === t._qwikjson_) {
23-
let n = (t === e.documentElement ? e.body : t).lastElementChild;
24-
for (; n; ) {
25-
if ('SCRIPT' === n.tagName && 'qwik/json' === a(n, 'type')) {
26-
t._qwikjson_ = JSON.parse(
27-
n.textContent.replace(/\\x3C(\/?script)/g, '<$1')
28-
);
29-
break;
30-
}
31-
n = n.previousElementSibling;
32-
}
33-
}
34-
},
35-
c = (e, t) => new CustomEvent(e, { detail: t }),
36-
f = async (t, o, i, s = i.type) => {
37-
const r = 'on' + o + ':' + s;
38-
t.hasAttribute('preventdefault:' + s) && i.preventDefault();
39-
const c = t._qc_,
40-
f = null == c ? void 0 : c.li.filter((e) => e[0] === r);
41-
if (f && f.length > 0) {
42-
for (const e of f)
43-
await e[1].getFn([t, i], () => t.isConnected)(i, t);
44-
return;
45-
}
46-
const d = a(t, r);
47-
if (d) {
48-
const o = t.closest('[q\\:container]'),
49-
s = new URL(a(o, 'q:base'), e.baseURI);
50-
for (const r of d.split('\n')) {
51-
const a = new URL(r, s),
52-
c = a.hash.replace(/^#?([^?[|]*).*$/, '$1') || 'default',
53-
f = performance.now(),
54-
d = import(a.href.split('#')[0]);
55-
l(o);
56-
const p = b(await d, c),
57-
w = e[n];
58-
if (t.isConnected)
59-
try {
60-
(e[n] = [t, i, a]),
61-
u('qsymbol', { symbol: c, element: t, reqTime: f }),
62-
await p(i, t);
63-
} finally {
64-
e[n] = w;
65-
}
66-
}
67-
}
68-
},
69-
u = (t, n) => {
70-
e.dispatchEvent(c(t, n));
71-
},
72-
b = (e, t) => {
73-
if (t in e) return e[t];
74-
for (const n of Object.values(e))
75-
if ('object' == typeof n && n && t in n) return n[t];
76-
},
77-
d = (e) => e.replace(/([A-Z])/g, (e) => '-' + e.toLowerCase()),
78-
p = async (e) => {
79-
let t = d(e.type),
80-
n = e.target;
81-
for (r('-document', e, t); n && n.getAttribute; )
82-
await f(n, '', e, t),
83-
(n =
84-
e.bubbles && !0 !== e.cancelBubble ? n.parentElement : null);
85-
},
86-
w = (e) => {
87-
r('-window', e, d(e.type));
88-
},
89-
q = () => {
90-
var n;
91-
const r = e.readyState;
92-
if (
93-
!t &&
94-
('interactive' == r || 'complete' == r) &&
95-
((t = 1),
96-
u('qinit'),
97-
(null != (n = o.requestIdleCallback) ? n : o.setTimeout).bind(o)(
98-
() => u('qidle')
99-
),
100-
i.has('qvisible'))
101-
) {
102-
const e = s('[on\\:qvisible]'),
103-
t = new IntersectionObserver((e) => {
104-
for (const n of e)
105-
n.isIntersecting &&
106-
(t.unobserve(n.target),
107-
f(n.target, '', c('qvisible', n)));
108-
});
109-
e.forEach((e) => t.observe(e));
110-
}
111-
},
112-
v = (e, t, n, o = !1) => e.addEventListener(t, n, { capture: o }),
113-
y = (t) => {
114-
for (const n of t)
115-
i.has(n) || (v(e, n, p, !0), v(o, n, w), i.add(n));
116-
};
117-
if (!e.qR) {
118-
const t = o.qwikevents;
119-
Array.isArray(t) && y(t),
120-
(o.qwikevents = { push: (...e) => y(e) }),
121-
v(e, 'readystatechange', q),
122-
q();
123-
}
124-
})(document);
125-
</script>
12611
</body>
12712
</html>

packages/headless/cypress/support/component.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@
1313
// https://on.cypress.io/configuration
1414
// ***********************************************************
1515

16+
import { addQwikLoader, mount } from 'cypress-ct-qwik';
17+
18+
addQwikLoader();
19+
1620
// Import commands.ts using ES2015 syntax:
1721
import './commands';
1822
import 'cypress-axe';
23+
24+
// Augment the Cypress namespace to include type definitions for
25+
// your custom command.
26+
// Alternatively, can be defined in cypress/support/component.d.ts
27+
// with a <reference path="./component" /> at the top of your spec.
28+
declare global {
29+
// eslint-disable-next-line @typescript-eslint/no-namespace
30+
namespace Cypress {
31+
interface Chainable {
32+
mount: typeof mount;
33+
}
34+
}
35+
}
36+
37+
Cypress.Commands.add('mount', mount);
38+
39+
// Example use:
40+
// cy.mount(MyComponent)

pnpm-lock.yaml

Lines changed: 21 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)