import React, { useEffect } from 'react';
import teamixTest, { productCalculate } from '@teamix/testing-capability';
import result from './data';

const InnerTest = () => {
  useEffect(() => {
    // 环境配置
    // fetch('https://uni.mixteam.alibaba-inc.com/user/checkLogin.json');
  }, []);

  useEffect(() => {
    setTimeout(async () => {
      console.log('TEAMIX_TEST_ERRORINFO', window.TEAMIX_TEST_ERRORINFO);

      const testA = await teamixTest({
        testItem: ['UI'],
        uiPrefix: ['.my-prefix-', '.your-prefix-'],
        proPrefix: ['.my-prefix-pro'],
        needElement: true,
      });
      console.log('ui测试 => ', testA);
      console.log(productCalculate(result));
    }, 2000);
  }, []);

  return (
    <section id="ui-module">
      UI覆盖率
      <p className="my-prefix-pro-table" style={{ fontSize: '13px' }}>
        ProTable-prefix
      </p>
      <p className="BannerCard" style={{ fontSize: '13px' }}>
        hybridCloud-BannerCard
      </p>
      <p className="cloud-charts-line" style={{ fontSize: '13px' }}>
        cloud-charts
      </p>
      <p className="my-prefix-tabs" style={{ fontSize: '13px' }}>
        TeamixUI-prefix
      </p>
      <p className="your-prefix-tabs" style={{ fontSize: '13px' }}>
        TeamixUI-prefix-2
      </p>
    </section>
  );
};

export default InnerTest;
