Quellcode durchsuchen

Add webview tests

Implement basic tests for forms using the sandbox.
master
TheoryOfNekomata vor 1 Jahr
Ursprung
Commit
9450a68258
4 geänderte Dateien mit 49 neuen und 22 gelöschten Zeilen
  1. +36
    -17
      packages/iceform-next/cypress.config.ts
  2. +5
    -1
      packages/iceform-next/cypress/e2e/form.cy.ts
  3. +1
    -0
      packages/iceform-next/package.json
  4. +7
    -4
      pnpm-lock.yaml

+ 36
- 17
packages/iceform-next/cypress.config.ts Datei anzeigen

@@ -1,26 +1,45 @@
import { defineConfig } from "cypress";
import { resolve } from 'path';
import { defineConfig } from 'cypress';
import { mkdir, rm, writeFile } from 'fs/promises';

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
on('task', {
async resetDb() {
console.log(resolve('../iceform-next-sandbox/.db'));
await rm('../iceform-next-sandbox/.db', { force: true, recursive: true });
await mkdir('../iceform-next-sandbox/.db');
await writeFile('../iceform-next-sandbox/.db/notes.jsonl', '');
return null;
}
});
},
},
component: {
devServer: {
framework: 'next',
bundler: 'webpack',
on('task', {
async 'db:reset'() {
try {
await rm('../iceform-next-sandbox/.db', {
force: true,
recursive: true,
});
} catch {
// noop
}

try {
await mkdir('../iceform-next-sandbox/.db');
await writeFile('../iceform-next-sandbox/.db/notes.jsonl', '');
return null;
} catch {
// noop
}

return undefined;
},
async 'db:shutdown'() {
try {
await rm('../iceform-next-sandbox/.db', {
force: true,
recursive: true,
});
return null;
} catch {
// noop
}

return undefined;
},
});
},
},
});

+ 5
- 1
packages/iceform-next/cypress/e2e/form.cy.ts Datei anzeigen

@@ -1,6 +1,10 @@
describe('form', () => {
beforeEach(() => {
cy.task('resetDb');
cy.task('db:reset');
});

after(() => {
cy.task('db:shutdown');
});

describe('script', () => {


+ 1
- 0
packages/iceform-next/package.json Datei anzeigen

@@ -35,6 +35,7 @@
"react-test-renderer": "^18.2.0",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vite": "^4.4.11",
"vitest": "^0.34.1"
},
"peerDependencies": {


+ 7
- 4
pnpm-lock.yaml Datei anzeigen

@@ -87,6 +87,9 @@ importers:
typescript:
specifier: ^4.9.5
version: 4.9.5
vite:
specifier: ^4.4.11
version: 4.4.11(@types/node@18.14.1)
vitest:
specifier: ^0.34.1
version: 0.34.1(jsdom@21.1.0)
@@ -6152,7 +6155,7 @@ packages:
mlly: 1.4.2
pathe: 1.1.1
picocolors: 1.0.0
vite: 4.4.9(@types/node@18.14.1)
vite: 4.4.11(@types/node@18.14.1)
transitivePeerDependencies:
- '@types/node'
- less
@@ -6164,8 +6167,8 @@ packages:
- terser
dev: true

/vite@4.4.9(@types/node@18.14.1):
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
/vite@4.4.11(@types/node@18.14.1):
resolution: {integrity: sha512-ksNZJlkcU9b0lBwAGZGGaZHCMqHsc8OpgtoYhsQ4/I2v5cnpmmmqe5pM4nv/4Hn6G/2GhTdj0DhZh2e+Er1q5A==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
@@ -6253,7 +6256,7 @@ packages:
strip-literal: 1.3.0
tinybench: 2.5.1
tinypool: 0.7.0
vite: 4.4.9(@types/node@18.14.1)
vite: 4.4.11(@types/node@18.14.1)
vite-node: 0.34.1(@types/node@18.14.1)
why-is-node-running: 2.2.2
transitivePeerDependencies:


Laden…
Abbrechen
Speichern