setup jest-puppeteer
This commit is contained in:
parent
446fc1af0b
commit
a2a4c70cf5
17
.eslintrc.js
17
.eslintrc.js
|
@ -91,6 +91,23 @@ module.exports = {
|
|||
"rules": {
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
}
|
||||
},
|
||||
|
||||
// Override for jest puppeteer
|
||||
{
|
||||
"files": [
|
||||
"**/*.spec.js",
|
||||
"**/*.spec.jsx"
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
globals: {
|
||||
page: true,
|
||||
browser: true,
|
||||
context: true,
|
||||
jestPuppeteer: true,
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -11,3 +11,4 @@ dist-ssr
|
|||
|
||||
/private
|
||||
/out
|
||||
/tmp
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
"launch": {
|
||||
"headless": false
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
|
@ -20,6 +20,8 @@
|
|||
"start-server": "node server/server.js",
|
||||
"start-server-dev": "cross-env NODE_ENV=development node server/server.js",
|
||||
"build": "vite build",
|
||||
"prepare-test": "npm run build && node server/server.js --port=3002 --data-dir=./data/test",
|
||||
"test": "jest",
|
||||
"tsc": "tsc",
|
||||
"vite-preview-dist": "vite preview --host",
|
||||
"build-docker": "npm run build-docker-debian && npm run build-docker-alpine",
|
||||
|
@ -104,10 +106,22 @@
|
|||
"dns2": "~2.0.1",
|
||||
"eslint": "~7.32.0",
|
||||
"eslint-plugin-vue": "~7.18.0",
|
||||
"jest": "~27.2.4",
|
||||
"jest-puppeteer": "~6.0.0",
|
||||
"puppeteer": "~10.4.0",
|
||||
"sass": "~1.42.1",
|
||||
"stylelint": "~13.13.1",
|
||||
"stylelint-config-standard": "~22.0.0",
|
||||
"typescript": "~4.4.3",
|
||||
"vite": "~2.5.10"
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
"preset": "jest-puppeteer",
|
||||
"globals": {
|
||||
"__DEV__": true
|
||||
},
|
||||
"testRegex": "./test/*.spec.js",
|
||||
"rootDir": "."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ exports.startInterval = () => {
|
|||
}
|
||||
|
||||
exports.latestVersion = res.data.version;
|
||||
console.log("Latest Version: " + exports.latestVersion);
|
||||
} catch (_) { }
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
beforeAll(() => {
|
||||
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
return console.log("Cleanup");
|
||||
});
|
||||
|
||||
describe("Very Simple Test", () => {
|
||||
|
||||
const title = "Uptime Kuma";
|
||||
|
||||
beforeAll(async () => {
|
||||
await page.goto("http://127.0.0.1:3002");
|
||||
});
|
||||
|
||||
it(`should be titled "${title}"`, async () => {
|
||||
await expect(page.title()).resolves.toMatch(title);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue