socketTask.test.js 742 B

123456789101112131415161718192021222324252627
  1. const PAGE_PATH = '/pages/API/websocket/socketTask'
  2. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  3. const isMP = platformInfo.startsWith('mp')
  4. describe('ExtApi-WebSocket', () => {
  5. if(isMP) {
  6. it('skip', async () => {
  7. // 小程序平台开发工具只允许两个socket连接,uni-push、自动化测试个占据一个,此示例必然失败
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page;
  13. let res;
  14. beforeAll(async () => {
  15. page = await program.reLaunch(PAGE_PATH)
  16. await page.waitFor(600);
  17. await page.callMethod('jest_connectSocket');
  18. await page.waitFor(1500);
  19. res = await page.data('jest_result');
  20. });
  21. it('Check ', async () => {
  22. expect(res).toBe(2);
  23. });
  24. });