Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add basic e2e test * feat: add process exit clean * feat: vitest test filter e2e * feat: add playground * ci: add jsdom dep * style: pref code * ci: update lock * ci: add e2e test * test: add log * test: prepare * test: prepare * feat: rm e2e test step * feat: add e2e test * ci: fix npm i * ci: fix npm i * style: rm useless code
- Loading branch information
1 parent
881014a
commit 3f7597e
Showing
10 changed files
with
198 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,6 @@ jobs: | |
|
||
- name: Test unit | ||
run: pnpm run test | ||
|
||
- name: Test e2e | ||
run: pnpm run e2e:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v16.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Hello World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "quick-learning", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"directories": { | ||
"doc": "docs" | ||
}, | ||
"scripts": { | ||
"dev": "island dev docs", | ||
"build": "island build docs", | ||
"preview": "island start docs" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"islandjs": "file:../.." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { PlaywrightTestConfig } from '@playwright/test'; | ||
|
||
const siteUrl = 'http://localhost:5173/'; | ||
|
||
const config: PlaywrightTestConfig = { | ||
testDir: './src/node/__tests__/e2e', | ||
timeout: 50000, | ||
webServer: { | ||
command: 'npm run e2e:prepare', | ||
url: siteUrl, | ||
timeout: 120 * 1000, | ||
reuseExistingServer: !process.env.CI | ||
}, | ||
use: { | ||
baseURL: siteUrl, | ||
headless: true, | ||
viewport: { width: 1280, height: 720 }, | ||
ignoreHTTPSErrors: true, | ||
video: 'on-first-retry' | ||
} | ||
}; | ||
export default config; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import path from 'path'; | ||
import fse from 'fs-extra'; | ||
import * as execa from 'execa'; | ||
|
||
const exampleDir = path.resolve(__dirname, '../example/quick-learning'); | ||
const defaultExecaOpts = { | ||
cwd: exampleDir, | ||
stdout: process.stdout, | ||
stdin: process.stdin, | ||
stderr: process.stderr | ||
}; | ||
|
||
async function prepareE2E() { | ||
await fse.ensureDir(exampleDir); | ||
|
||
// ensure after build | ||
if (!fse.existsSync(path.resolve(__dirname, '../dist'))) { | ||
// exec build command | ||
execa.execaCommandSync('npm run build', { | ||
cwd: path.resolve(__dirname, '../') | ||
}); | ||
} | ||
|
||
execa.execaCommandSync('npx playwright install', { | ||
cwd: path.join(__dirname, '../'), | ||
stdout: process.stdout, | ||
stdin: process.stdin, | ||
stderr: process.stderr | ||
}); | ||
|
||
// exec install | ||
execa.execaCommandSync( | ||
'npm i --registry=https://registry.npmmirror.com/', | ||
defaultExecaOpts | ||
); | ||
|
||
// exec dev command | ||
execa.execaCommandSync('npm run dev', defaultExecaOpts); | ||
} | ||
|
||
prepareE2E(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const siteUrl = 'http://localhost:5173/'; | ||
|
||
test('Verify that the page renders properly', async ({ page }) => { | ||
await page.goto(siteUrl); | ||
|
||
await page.waitForTimeout(2000); | ||
|
||
const res = await page.evaluate(async () => { | ||
const pageContent = document.body.innerText; | ||
return pageContent.includes('Hello'); | ||
}); | ||
expect(res).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
test: { | ||
environment: 'node', | ||
passWithNoTests: true, | ||
exclude: ['node_modules', 'src/node/__tests__/e2e', 'playground'], | ||
threads: true, | ||
maxThreads: 2, | ||
minThreads: 1 | ||
} | ||
}); |
3f7597e
There was a problem hiding this comment.
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:
island – ./
island-git-master-sanyuan0704.vercel.app
island-navy.vercel.app
island-sanyuan0704.vercel.app
island-vercel.sanyuan0704.top