Exemplo n.º 1
0
def test_calendar_stock_date(driver):
    calendar = News_calendar(driver, url)

    with allure.step("爬取日历-美港财报页面数据"):
        nowtime = datetime.datetime.now().strftime("%Y%m%d")
        log.info("打开的日期为 {}".format(nowtime))
        allure.attach('', '打开的日期:{}'.format(nowtime),
                      allure.attachment_type.TEXT)
        # 爬页面
        calendardataList = calendar.get_calendar_data(calendartab="美港财报")

    with allure.step("请求日历-美港财报接口"):
        dataAPI_list = calendar_data_API(nowtime, stock=True)

    with allure.step("对比数据"):
        calendar.same_data(calendardataList, dataAPI_list, stock=True)
Exemplo n.º 2
0
def test_calendar_date(driver):
    calendar = News_calendar(driver, url)

    with allure.step("爬取日历-数据页面数据"):
        nowtime = datetime.datetime.now().strftime("%Y%m%d")
        log.info("打开的日期为 {}".format(nowtime))
        allure.attach('', '打开的日期:{}'.format(nowtime),
                      allure.attachment_type.TEXT)
        # 爬页面
        calendardataList = calendar.get_calendar_data(calendartime=nowtime)

    with allure.step("调用日历-数据接口"):
        # 调用接口
        dataAPI_list = calendar_data_API(nowtime)

    with allure.step("对比数据"):
        calendar.same_data(calendardataList, dataAPI_list)
Exemplo n.º 3
0
def test_calendar_after(driver):
    calendar = News_calendar(driver, url)

    with allure.step("爬取日历-数据页面数据"):
        nowtime = datetime.datetime.now()
        startTime = (
            nowtime +
            datetime.timedelta(days=random.randint(1, 15))).strftime("%Y%m%d")
        log.info("打开的日期为 {}".format(startTime))
        allure.attach('', '打开的日期:{}'.format(startTime),
                      allure.attachment_type.TEXT)
        # 爬页面
        calendardataList = calendar.get_calendar_data(calendartime=startTime)

    with allure.step("调用日历-数据接口"):
        # 调用接口
        dataAPI_list = calendar_data_API(startTime)

    with allure.step("对比数据"):
        calendar.same_data(calendardataList, dataAPI_list)
Exemplo n.º 4
0
def test_calendar_stock_before(driver):
    calendar = News_calendar(driver, url)

    with allure.step("爬取日历-美港财报页面数据"):
        nowtime = datetime.datetime.now()
        # startTime = (nowtime - datetime.timedelta(days=random.randint(1, 15))).strftime("%Y%m%d")
        # 暂时写死, 不能滑动
        startTime = (nowtime - datetime.timedelta(days=2)).strftime("%Y%m%d")
        log.info("打开的日期为 {}".format(startTime))
        allure.attach('', '打开的日期:{}'.format(startTime),
                      allure.attachment_type.TEXT)
        # 爬页面
        calendardataList = calendar.get_calendar_data(calendartab="美港财报",
                                                      calendartime=startTime)

    with allure.step("请求日历-美港财报接口"):
        # 调用接口
        dataAPI_list = calendar_data_API(startTime, stock=True)

    with allure.step("对比数据"):
        calendar.same_data(calendardataList, dataAPI_list, stock=True)