提交 52796e55 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uni-app-x into dev

// 自动化测试
// 自动化测试
module.exports = {
testTimeout: 30000,
reporters: ['default'],
......@@ -6,11 +6,12 @@ module.exports = {
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/pages/API/download-file/download-file.test.js',
'<rootDir>/pages/API/upload-file/upload-file.test.js',
'<rootDir>/pages/API/get-battery-info/get-battery-info.test.js'
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/pages/API/download-file/download-file.test.js',
'<rootDir>/pages/API/upload-file/upload-file.test.js',
'<rootDir>/pages/API/get-battery-info/get-battery-info.test.js',
'<rootDir>/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js'
],
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
}
{
"name": "hello-uniapp x",
"name": "Hello uni-app x",
"appid": "__UNI__3584C99",
"description": "",
"versionName": "1.0.23",
......
......@@ -3,7 +3,7 @@
describe('API-loading', () => {
let page;
const isAndroid = process.env.UNI_OS_NAME === "android";
const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios";
beforeAll(async () => {
page = await program.reLaunch('/pages/API/action-sheet/action-sheet')
......@@ -12,7 +12,7 @@ describe('API-loading', () => {
it("onload-action-sheet-test", async () => {
if (isAndroid) {
if (isApp) {
await page.waitFor(500);
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
......@@ -57,7 +57,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -99,7 +99,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -140,7 +140,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -181,7 +181,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -222,7 +222,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -266,7 +266,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -307,7 +307,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -348,7 +348,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -389,7 +389,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -431,7 +431,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -472,7 +472,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......@@ -513,7 +513,7 @@ describe('API-loading', () => {
await btnToastDurationButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const image = await program.screenshot({
deviceShot: true,
area: {
......
......@@ -3,7 +3,7 @@
describe('API-loading', () => {
let page;
const isAndroid = process.env.UNI_OS_NAME === "android";
const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios";
beforeAll(async () => {
page = await program.reLaunch('/pages/API/modal/modal')
......@@ -13,7 +13,7 @@ describe('API-loading', () => {
it("onload-modal-test", async () => {
if (isAndroid) {
if (isApp) {
await page.waitFor(500);
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
......@@ -54,7 +54,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -95,7 +95,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -136,7 +136,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -177,7 +177,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -218,7 +218,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -258,7 +258,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -298,7 +298,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -338,7 +338,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -378,7 +378,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -419,7 +419,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -460,7 +460,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -501,7 +501,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -542,7 +542,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -583,7 +583,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -625,7 +625,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -665,7 +665,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -706,7 +706,7 @@ describe('API-loading', () => {
await btnModalButton.tap()
await page.waitFor(500);
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......
......@@ -17,7 +17,8 @@
max: 0
}
},
onLoad() {
onReady() {
uni.startPullDownRefresh();
this.initData();
},
onReachBottom() {
......@@ -47,7 +48,7 @@
}
this.data = this.data.concat(data);
uni.stopPullDownRefresh();
}, 300);
}, 1000);
},
setListData() {
let data:Array<number> = [];
......
......@@ -3,7 +3,7 @@
describe('API-toast', () => {
let page;
const isAndroid = process.env.UNI_OS_NAME === "android";
const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios";
beforeAll(async () => {
......@@ -16,7 +16,7 @@ describe('API-toast', () => {
it("onload-toast-test", async () => {
if (isAndroid) {
if (isApp) {
await page.waitFor(500);
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
......@@ -47,7 +47,7 @@ describe('API-toast', () => {
const btnToastDefaultButton = await page.$('#btn-toast-default')
await btnToastDefaultButton.tap()
await page.waitFor(200)
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
......@@ -78,7 +78,7 @@ describe('API-toast', () => {
const btnToastDurationButton = await page.$('#btn-toast-duration')
await btnToastDurationButton.tap()
await page.waitFor(2000)
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -105,7 +105,7 @@ describe('API-toast', () => {
const btnToastErrorIconButton = await page.$('#btn-toast-errorIcon')
await btnToastErrorIconButton.tap()
await page.waitFor(200)
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -138,7 +138,7 @@ describe('API-toast', () => {
await btnToastHideButton.tap()
await page.waitFor(1000)
if (isAndroid) {
if (isApp) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
......@@ -166,7 +166,7 @@ describe('API-toast', () => {
// const btnToastButton = await page.$('#btn-toast-postion-bottom')
// await btnToastButton.tap()
// await page.waitFor(200)
// if (isAndroid) {
// if (isApp) {
// const windowHeight = uni.getWindowInfo().windowHeight;
// const windowWidth = uni.getWindowInfo().windowWidth;
// const image = await program.screenshot({
......
describe('background-image-test', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/CSS/background/background-image');
await page.waitFor(600);
});
it('background-image-screenshot', async () => {
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
});
it('background-image-select', async () => {
await page.callMethod('updateBackgroundSelect')
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
});
});
......@@ -6,7 +6,7 @@
<text>不支持背景图片,仅支持linear-gradient方法</text>
<view v-for="(direction) in directionData">
<text>background-image: linear-gradient({{direction}}, red, yellow)</text>
<view class="common" :style="{'background-image': 'linear-gradient('+direction+', red, yellow)'}"></view>
<view class="common" :style="{'background-image': backgroundSelect ?'linear-gradient('+direction+', red, yellow)':''}"></view>
</view>
</view>
<!-- #ifdef APP -->
......@@ -18,8 +18,15 @@
export default {
data(){
return {
backgroundSelect : true,
directionData: ['to right', 'to left', 'to bottom', 'to top', 'to bottom left', 'to bottom right', 'to top left', 'to top right']
}
},
methods: {
//供自动化测试使用
updateBackgroundSelect() {
this.backgroundSelect = !this.backgroundSelect
}
}
}
</script>
......
......@@ -26,7 +26,7 @@ describe('component-native-list-view', () => {
})
//检测横向scrollLeft属性赋值
//检测横向scrollLeft属性赋值 备注:iOS不支持list-view横向滚动
it('check_scroll_left', async () => {
if(await page.data('scroll_x_boolean') === false) {
await page.callMethod('change_scroll_x_boolean', true)
......@@ -44,8 +44,12 @@ describe('component-native-list-view', () => {
if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
return
}
if(process.env.uniTestPlatformInfo.startsWith('IOS_SIMULATOR')) {
return
}
//检测横向可滚动区域
//检测横向可滚动区域 备注:iOS不支持list-view横向滚动
it('check_scroll_width', async () => {
if(await page.data('scroll_x_boolean') === false) {
await page.callMethod('change_scroll_x_boolean', true)
......@@ -59,7 +63,7 @@ describe('component-native-list-view', () => {
expect(value).toBe(true)
})
//检测下拉刷新
//检测下拉刷新 备注:iOS本地测试结果正确,但是自动化测试结果错误
it('check_refresher', async () => {
if(await page.data('scroll_y_boolean') === false) {
await page.callMethod('change_scroll_y_boolean', true)
......@@ -74,7 +78,7 @@ describe('component-native-list-view', () => {
expect(await page.data('refresherrefresh')).toBe(true)
})
//检测竖向scroll_into_view属性赋值
//检测竖向scroll_into_view属性赋值 备注:iOS本地测试结果正确,但是自动化测试结果错误
it('check_scroll_into_view_top', async () => {
if(await page.data('scroll_y_boolean') === false) {
await page.callMethod('change_scroll_y_boolean', true)
......@@ -90,7 +94,7 @@ describe('component-native-list-view', () => {
expect(scrollTop-690).toBeGreaterThanOrEqual(0)
})
//检测横向scroll_into_view属性赋值
//检测横向scroll_into_view属性赋值 备注:iOS不支持list-view横向滚动
it('check_scroll_into_view_left', async () => {
if(await page.data('scroll_x_boolean') === false) {
await page.callMethod('change_scroll_x_boolean', true)
......
......@@ -23,7 +23,7 @@ describe('component-native-sticky-section', () => {
await page.setData({
scrolling: 'true'
})
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
//跳转到id为C的StickyHeader位置
await page.callMethod('gotoStickyHeader', 'C')
}
......
......@@ -38,7 +38,6 @@ const pages = [
// CSS
'/pages/CSS/background/background-color',
'/pages/CSS/background/background-image',
'/pages/CSS/border/complex-border/complex-border',
'/pages/CSS/border/border-bottom',
'/pages/CSS/border/border-color',
......
......@@ -134,7 +134,7 @@
this.halfNode?.style?.setProperty('transition-duration', 0);
this.halfNode?.style?.setProperty('transform', '');
}
this.halfNode?.style?.setProperty('transition-property', '');
this.halfNode?.style?.setProperty('transition-property', 'none');
this.bAnimation = false;
}, time)
this.bAnimation = true;
......@@ -157,7 +157,7 @@
this.halfOffset = 0;
setTimeout(() => {
this.bAnimation = false;
this.halfNode?.style?.setProperty('transition-property', '');
this.halfNode?.style?.setProperty('transition-property', 'none');
}, time)
this.bAnimation = true;
}
......
......@@ -237,13 +237,13 @@ const PAGE_PATH =
describe("shot-compare", () => {
let shouldCompareScreenShot = false
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
const uniTestPlatformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
if (uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
version = parseInt(uniTestPlatformInfo.split(" ")[1])
shouldCompareScreenShot = version > 9
}
if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
if(uniTestPlatformInfo.startsWith('ios') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
shouldCompareScreenShot = true
}
......
......@@ -235,13 +235,13 @@ const PAGE_PATH =
describe("shot-compare", () => {
let shouldCompareScreenShot = false
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
const uniTestPlatformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
if (uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
version = parseInt(uniTestPlatformInfo.split(" ")[1])
shouldCompareScreenShot = version > 9
}
if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
if(uniTestPlatformInfo.startsWith('ios') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
shouldCompareScreenShot = true
}
......@@ -275,7 +275,6 @@ describe("shot-compare", () => {
});
beforeEach(async () => {
page = await program.reLaunch(PAGE_PATH);
await page.waitFor(500);
});
afterEach(() => {
......
{}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册