forked from zuiidea/antd-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a simple e2e test and enable pwa
- Loading branch information
Showing
5 changed files
with
89 additions
and
3 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
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,3 @@ | ||
module.exports = { | ||
testURL: 'http://localhost:8000', | ||
} |
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,41 @@ | ||
import puppeteer from 'puppeteer' | ||
|
||
describe('Login', () => { | ||
let browser | ||
let page | ||
|
||
beforeAll(async () => { | ||
browser = await puppeteer.launch({ args: ['--no-sandbox'] }) | ||
}) | ||
|
||
beforeEach(async () => { | ||
page = await browser.newPage() | ||
await page.goto('http://localhost:8000/en/login', { | ||
waitUntil: 'networkidle2', | ||
}) | ||
}) | ||
|
||
afterEach(() => page.close()) | ||
|
||
it('should login with failure', async () => { | ||
await page.waitFor(selector => !!document.querySelector('#username'), { | ||
timeout: 3000, | ||
}) | ||
await page.type('#username', 'wrong_user') | ||
await page.type('#password', 'wrong_password') | ||
await page.click('button[type="button"]') | ||
await page.waitForSelector('.anticon-close-circle') // should display error | ||
}) | ||
|
||
it('should login successfully', async () => { | ||
await page.waitForSelector('#username', { timeout: 3000 }) | ||
await page.type('#username', 'admin') | ||
await page.type('#password', 'admin') | ||
await page.click('button[type="button"]') | ||
await page.waitForSelector('.ant-layout-footer') | ||
const text = await page.evaluate(() => document.body.innerHTML) | ||
expect(text).toContain('Ant Design Admin') | ||
}) | ||
|
||
afterAll(() => browser.close()) | ||
}) |
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 |
---|---|---|
|
@@ -2917,7 +2917,7 @@ [email protected]: | |
readable-stream "~2.0.0" | ||
typedarray "~0.0.5" | ||
|
||
concat-stream@^1.5.0: | ||
concat-stream@1.6.2, concat-stream@^1.5.0: | ||
version "1.6.2" | ||
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" | ||
dependencies: | ||
|
@@ -4704,6 +4704,15 @@ extglob@^2.0.2, extglob@^2.0.4: | |
snapdragon "^0.8.1" | ||
to-regex "^3.0.1" | ||
|
||
extract-zip@^1.6.6: | ||
version "1.6.7" | ||
resolved "http://registry.npm.taobao.org/extract-zip/download/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" | ||
dependencies: | ||
concat-stream "1.6.2" | ||
debug "2.6.9" | ||
mkdirp "0.5.1" | ||
yauzl "2.4.1" | ||
|
||
[email protected]: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" | ||
|
@@ -4777,6 +4786,12 @@ fbjs@^0.8.0, fbjs@^0.8.15, fbjs@^0.8.16, fbjs@^0.8.3, fbjs@^0.8.9: | |
setimmediate "^1.0.5" | ||
ua-parser-js "^0.7.18" | ||
|
||
fd-slicer@~1.0.1: | ||
version "1.0.1" | ||
resolved "http://registry.npm.taobao.org/fd-slicer/download/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" | ||
dependencies: | ||
pend "~1.2.0" | ||
|
||
fecha@~2.3.3: | ||
version "2.3.3" | ||
resolved "https://registry.yarnpkg.com/fecha/-/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd" | ||
|
@@ -7868,7 +7883,7 @@ mixin-deep@^1.2.0: | |
for-in "^1.0.2" | ||
is-extendable "^1.0.1" | ||
|
||
[email protected], mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: | ||
[email protected].1, [email protected].x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: | ||
version "0.5.1" | ||
resolved "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" | ||
dependencies: | ||
|
@@ -8756,6 +8771,10 @@ pbkdf2@^3.0.3: | |
safe-buffer "^5.0.1" | ||
sha.js "^2.4.8" | ||
|
||
pend@~1.2.0: | ||
version "1.2.0" | ||
resolved "http://registry.npm.taobao.org/pend/download/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" | ||
|
||
performance-now@^2.1.0: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" | ||
|
@@ -9492,6 +9511,19 @@ punycode@^1.2.4, punycode@^1.4.1: | |
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" | ||
|
||
puppeteer@^1.6.0: | ||
version "1.8.0" | ||
resolved "http://registry.npm.taobao.org/puppeteer/download/puppeteer-1.8.0.tgz#9e8bbd2f5448cc19cac220efc0512837104877ad" | ||
dependencies: | ||
debug "^3.1.0" | ||
extract-zip "^1.6.6" | ||
https-proxy-agent "^2.2.1" | ||
mime "^2.0.3" | ||
progress "^2.0.0" | ||
proxy-from-env "^1.0.0" | ||
rimraf "^2.6.1" | ||
ws "^5.1.1" | ||
|
||
q@^1.1.2: | ||
version "1.5.1" | ||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" | ||
|
@@ -13370,7 +13402,7 @@ ws@^4.0.0: | |
async-limiter "~1.0.0" | ||
safe-buffer "~5.1.0" | ||
|
||
ws@^5.2.0: | ||
ws@^5.1.1, ws@^5.2.0: | ||
version "5.2.2" | ||
resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" | ||
dependencies: | ||
|
@@ -13495,6 +13527,12 @@ yargs@~3.10.0: | |
decamelize "^1.0.0" | ||
window-size "0.1.0" | ||
|
||
[email protected]: | ||
version "2.4.1" | ||
resolved "http://registry.npm.taobao.org/yauzl/download/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" | ||
dependencies: | ||
fd-slicer "~1.0.1" | ||
|
||
yeoman-environment@^2.0.5: | ||
version "2.3.3" | ||
resolved "https://registry.yarnpkg.com/yeoman-environment/-/yeoman-environment-2.3.3.tgz#1bd9720714cc49036e901503a789d809df8f51bf" | ||
|