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