提交 89b492f1 编写于 作者: study夏羽's avatar study夏羽

screenshot test

上级 1016a3ac
...@@ -8,10 +8,11 @@ module.exports = { ...@@ -8,10 +8,11 @@ module.exports = {
moduleFileExtensions: ['js', 'json'], moduleFileExtensions: ['js', 'json'],
rootDir: __dirname, rootDir: __dirname,
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"], testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
// testMatch: ["<rootDir>/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.test.js"], // testMatch: ["<rootDir>/pages/ucenter/about/about.test.js"],
testPathIgnorePatterns: ['/node_modules/'], testPathIgnorePatterns: ['/node_modules/'],
testSequencer:path.join(__dirname, "testSequencer.js") testSequencer:path.join(__dirname, "testSequencer.js")
//pages/ucenter/userinfo/userinfo.test.js //pages/ucenter/userinfo/userinfo.test.js
//pages/ucenter/login-page/pwd-login/pwd-login.test.js //pages/ucenter/login-page/pwd-login/pwd-login.test.js
} }
...@@ -9,11 +9,6 @@ describe('pages/grid/grid.vue', () => { ...@@ -9,11 +9,6 @@ describe('pages/grid/grid.vue', () => {
}) })
it('检测宫格', async () => { it('检测宫格', async () => {
// expect.assertions(1);
// const perPage = await page.$('.warp')
// const getData = await perPage.data('gridList')
// console.log("getData: ",getData);
// expect(getData.length).toBe(9)
expect.assertions(1); expect.assertions(1);
const getData = await page.data('gridList') const getData = await page.data('gridList')
console.log("getData: ",getData); console.log("getData: ",getData);
...@@ -26,13 +21,7 @@ describe('pages/grid/grid.vue', () => { ...@@ -26,13 +21,7 @@ describe('pages/grid/grid.vue', () => {
const perPage = await page.$('.warp') const perPage = await page.$('.warp')
const uGrid = await perPage.$('.uni-grid-box') const uGrid = await perPage.$('.uni-grid-box')
console.log("uGrid-----------: ",uGrid); console.log("uGrid-----------: ",uGrid);
// await uGrid.callMethod('change') // await uGrid.callMethod('change')
// const tapRes = await uGrid.tap()
// const tapRes = await uGrid.callMethod('change')
// await page.waitFor(300)
// console.log("tapRes: ",tapRes);
}) })
......
...@@ -8,13 +8,15 @@ describe('pages/list/search/search.vue', () => { ...@@ -8,13 +8,15 @@ describe('pages/list/search/search.vue', () => {
await page.waitFor(500) await page.waitFor(500)
}) })
it('搜索发现-显示-影藏', async () => { it('搜索发现-显示-影藏', async () => {
expect.assertions(2); // expect.assertions(2);
await page.callMethod('searchHotRefresh') await page.callMethod('searchHotRefresh')
await page.waitFor(300) await page.waitFor(300)
const getShow = await page.data('netHotListIsHide') const getShow = await page.data('netHotListIsHide')
console.log(getShow,"0000000000000");
expect(getShow).toBeFalsy() expect(getShow).toBeFalsy()
if(!getShow){ if(!getShow){
await page.setData({netHotListIsHide: true}) await page.setData({netHotListIsHide: true})
console.log(await page.data('netHotListIsHide'),"1111111111");
expect(await page.data('netHotListIsHide')).toBeTruthy() expect(await page.data('netHotListIsHide')).toBeTruthy()
} }
}) })
......
...@@ -8,21 +8,23 @@ describe('pages/ucenter/about/about.vue', () => { ...@@ -8,21 +8,23 @@ describe('pages/ucenter/about/about.vue', () => {
await page.waitFor(500) await page.waitFor(500)
}) })
it('检测标题', async () => { it('about', async () => {
// expect.assertions(1); expect.assertions(2);
// const perPage = await page.$('.about')
// await page.waitFor(500)
const getData = await page.data('about') const getData = await page.data('about')
console.log("getData-----------: ", getData); console.log("getData-----------: ", getData);
// expect(getData.appName).toBe('uni-starter') expect(getData.appName).toBe('uni-starter')
// expect(getData.slogan).toBe('云端一体应用快速开发模版') expect(getData.slogan).toBe('云端一体应用快速开发模版')
}) })
it('隐私政策协议-点击跳转', async () => { it('screenshot', async () => {
// expect.assertions(1); var image = await program.screenshot({
const elAgree = await page.$('.agreement') path: "static/screenshot/about.png" // 默认项目根目录
// console.log("elAgree: ", elAgree); })
console.log(image,"image--------------------")
})
it('隐私政策协议-点击跳转', async () => {
await page.callMethod('navigateTo', { await page.callMethod('navigateTo', {
url: "https://ask.dcloud.net.cn/protocol.html", url: "https://ask.dcloud.net.cn/protocol.html",
title: "用户服务条款" title: "用户服务条款"
......
...@@ -18,15 +18,27 @@ describe('pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue', () => { ...@@ -18,15 +18,27 @@ describe('pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue', () => {
} }
}) })
if (process.env.UNI_PLATFORM === "h5") { // if (process.env.UNI_PLATFORM === "h5") {
const submitRes = await page.callMethod('submit')
console.log("submitRes: ",submitRes); // }
// expect(submitRes.msg).toBe('密码重置成功')
await page.waitFor(500)
}
console.log(await program.currentPage()); console.log(await program.currentPage());
// expect((await program.currentPage()).path).toBe('/pages/ucenter/settings/settings') // expect((await program.currentPage()).path).toBe('/pages/ucenter/settings/settings')
const submitRes = await page.callMethod('submit')
console.log("submitRes: ",submitRes);
if(submitRes){
switch (submitRes.code){
case 0:
expect(submitRes.msg).toBe('密码重置成功')
break;
case 10202:
expect(submitRes.msg).toBe('此手机号尚未注册')
break;
default:
break;
}
}
}) })
}) })
...@@ -9,6 +9,43 @@ describe('pages/ucenter/settings/settings', () => { ...@@ -9,6 +9,43 @@ describe('pages/ucenter/settings/settings', () => {
await page.waitFor(500) await page.waitFor(500)
}) })
it('切换语言', async () => {
console.log(await page.data('uniToken'),'uniToken-------------------------');
// await page.callMethod('changeLanguage') 弹框不支持点击
console.log((await program.currentPage()).path);
if (process.env.UNI_PLATFORM === "app-plus") {
//清理缓存
await page.callMethod('clearTmp')
console.log("clearTmp: -------------");
console.log(await page.data('pushIsOn'),"pushIsOn-------------");
const pushRes = await page.data('pushIsOn')
if(pushRes == "wait"){
await page.callMethod('pushServer.off')
console.log("pushServer---------");
}
}
})
it('退出登录', async () => { it('退出登录', async () => {
const perPage = await page.$('.content') const perPage = await page.$('.content')
const uList = await perPage.$('.userInfo-class') const uList = await perPage.$('.userInfo-class')
......
...@@ -14,7 +14,6 @@ describe('pages/ucenter/userinfo/bind-mobile/bind-mobile.vue', () => { ...@@ -14,7 +14,6 @@ describe('pages/ucenter/userinfo/bind-mobile/bind-mobile.vue', () => {
"phone":phone "phone":phone
} }
}) })
// console.log(await page.data("formData"));
expect(phone).toMatch(/^1\d{10}$/); expect(phone).toMatch(/^1\d{10}$/);
if (process.env.UNI_PLATFORM === "mp-weixin") { if (process.env.UNI_PLATFORM === "mp-weixin") {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册