1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
react-native-pushy/Example/testHotUpdate/e2e/NativeModule.test.ts

117 lines
4.1 KiB
TypeScript
Raw Normal View History

2023-04-02 12:51:43 +08:00
import {by, device, element, expect, waitFor} from 'detox';
2023-03-15 23:27:25 +08:00
describe('测试Native模块的方法', () => {
beforeAll(async () => {
await device.launchApp();
});
it('setLocalHashInfo', async () => {
await element(by.id('testcase')).longPress();
2023-04-02 12:51:43 +08:00
await element(by.id('setLocalHashInfo')).longPress();
await element(by.id('submit')).longPress();
await expect(element(by.id('done'))).toBeVisible();
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
it('getLocalHashInfo', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('getLocalHashInfo')).longPress();
await element(by.id('submit')).longPress();
2023-03-15 23:27:25 +08:00
await expect(element(by.text('done'))).toBeVisible();
2023-04-02 12:51:43 +08:00
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
it('setUuid', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('setUuid')).longPress();
await element(by.id('submit')).longPress();
2023-03-15 23:27:25 +08:00
await expect(element(by.text('done'))).toBeVisible();
2023-04-02 12:51:43 +08:00
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
2024-03-20 21:47:44 +08:00
2023-04-02 12:51:43 +08:00
if (device.getPlatform() === 'android') {
it('reloadUpdate', async () => {
await element(by.id('reloadUpdate')).longPress();
await element(by.id('submit')).longPress();
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
});
}
2023-03-15 23:27:25 +08:00
it('setNeedUpdate', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('setNeedUpdate')).longPress();
await element(by.id('submit')).longPress();
2023-03-15 23:27:25 +08:00
await expect(element(by.text('done'))).toBeVisible();
2023-04-02 12:51:43 +08:00
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
2023-04-02 12:51:43 +08:00
if (device.getPlatform() === 'android') {
it('markSuccess', async () => {
await element(by.id('markSuccess')).longPress();
await element(by.id('submit')).longPress();
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
await element(by.id('done')).longPress();
});
}
2023-03-15 23:27:25 +08:00
it('downloadPatchFromPpk', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('downloadPatchFromPpk')).longPress();
await element(by.id('submit')).longPress();
if (device.getPlatform() === 'ios') {
await expect(element(by.text('failed to open zip file'))).toBeVisible();
} else {
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
}
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
it('downloadPatchFromPackage', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('downloadPatchFromPackage')).longPress();
await element(by.id('submit')).longPress();
if (device.getPlatform() === 'ios') {
await expect(element(by.text('failed to open zip file'))).toBeVisible();
} else {
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
}
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
it('downloadFullUpdate', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('downloadFullUpdate')).longPress();
await element(by.id('submit')).longPress();
if (device.getPlatform() === 'ios') {
await expect(element(by.text('failed to open zip file'))).toBeVisible();
} else {
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
}
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
if (device.getPlatform() === 'android') {
it('downloadAndInstallApk', async () => {
2023-04-02 12:51:43 +08:00
await element(by.id('downloadAndInstallApk')).longPress();
await element(by.id('submit')).longPress();
await waitFor(element(by.text('确认')))
.toBeVisible()
.withTimeout(10000);
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
2023-03-15 23:27:25 +08:00
});
}
});