提交 84e919c0 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 修复自动化测试 vue 版本兼容

上级 c7121fbc
...@@ -18,7 +18,7 @@ describe('pages/grid/grid.vue', () => { ...@@ -18,7 +18,7 @@ describe('pages/grid/grid.vue', () => {
}) })
it('点击宫格', async () => { it('点击宫格', async () => {
if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM === "app-plus") { if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM.startsWith("app")) {
const perPage = await page.$('.uni-grid-wrap') const perPage = await page.$('.uni-grid-wrap')
await perPage.callMethod('change') await perPage.callMethod('change')
} }
......
...@@ -17,23 +17,23 @@ describe('pages/ucenter/about/about.vue', () => { ...@@ -17,23 +17,23 @@ describe('pages/ucenter/about/about.vue', () => {
}) })
it('screenshot', async () => { it('screenshot', async () => {
if(isWX){
return
}
console.log("process.env.UNI_PLATFORM: ",process.env.UNI_PLATFORM); console.log("process.env.UNI_PLATFORM: ",process.env.UNI_PLATFORM);
expect.assertions(1); expect.assertions(1);
expect((await page.data('about')).appName).toBe('uni-starter') expect((await page.data('about')).appName).toBe('uni-starter')
await page.waitFor(1000)
if (process.env.UNI_PLATFORM === "app-plus") { if (process.env.UNI_PLATFORM.startsWith("app")) {
await program.screenshot({ await program.screenshot({
path: "static/screenshot/about-app.png" // 默认项目根目录 path: "static/screenshot/about-app.png" // 默认项目根目录
}) })
await page.waitFor(1000)
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: "用户服务条款"
}) })
}else if(process.env.UNI_PLATFORM === "mp-weixin"){
await program.screenshot({
path: "static/screenshot/about-weixin.png" // 默认项目根目录
})
}else if(process.env.UNI_PLATFORM === "h5"){ }else if(process.env.UNI_PLATFORM === "h5"){
await program.screenshot({ await program.screenshot({
path: "static/screenshot/about-h5.png" // 默认项目根目录 path: "static/screenshot/about-h5.png" // 默认项目根目录
......
...@@ -15,7 +15,7 @@ describe('pages/ucenter/settings/settings', () => { ...@@ -15,7 +15,7 @@ describe('pages/ucenter/settings/settings', () => {
}) })
it('settings', async () => { it('settings', async () => {
if (process.env.UNI_PLATFORM == "app-plus") { if (process.env.UNI_PLATFORM.startsWith("app")) {
await page.callMethod('clearTmp') await page.callMethod('clearTmp')
// console.log(await page.data('pushIsOn'), "pushIsOn-------------"); // console.log(await page.data('pushIsOn'), "pushIsOn-------------");
const pushRes = await page.data('pushIsOn') const pushRes = await page.data('pushIsOn')
......
...@@ -24,7 +24,7 @@ describe('pages/ucenter/ucenter.vue', () => { ...@@ -24,7 +24,7 @@ describe('pages/ucenter/ucenter.vue', () => {
it('列表', async () => { it('列表', async () => {
const getUcenterList = await page.data('ucenterList') const getUcenterList = await page.data('ucenterList')
console.log("getUcenterList: ",getUcenterList); console.log("getUcenterList: ",getUcenterList);
if(process.env.UNI_PLATFORM === "app-plus"){ if(process.env.UNI_PLATFORM.startsWith("app")){
expect(getUcenterList.length).toBe(3) expect(getUcenterList.length).toBe(3)
} }
...@@ -34,7 +34,7 @@ describe('pages/ucenter/ucenter.vue', () => { ...@@ -34,7 +34,7 @@ describe('pages/ucenter/ucenter.vue', () => {
it('普通签到', async () => { it('普通签到', async () => {
if(uniToken){ if(uniToken){
if(process.env.UNI_PLATFORM === "app-plus"){ if(process.env.UNI_PLATFORM.startsWith("app")){
console.log('app-plus----普通签到'); console.log('app-plus----普通签到');
const signInByAdRes = await page.callMethod('signInByAd') const signInByAdRes = await page.callMethod('signInByAd')
console.log("signInByAdRes: ",signInByAdRes); console.log("signInByAdRes: ",signInByAdRes);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册