def view_issue(locust):
    raise_if_login_failed(locust)
    params = BrowseIssue()
    issue_key = random.choice(jira_dataset['issues'])[0]
    project_key = random.choice(jira_dataset['issues'])[2]

    r = locust.get(f'/browse/{issue_key}', catch_response=True)
    content = r.content.decode('utf-8')
    issue_id = fetch_by_re(params.issue_id_pattern, content)
    project_avatar_id = fetch_by_re(params.project_avatar_id_pattern, content)
    edit_allowed = fetch_by_re(params.edit_allow_pattern, content, group_no=0)
    locust.get(f'/secure/projectavatar?avatarId={project_avatar_id}',
               catch_response=True)
    # Assertions
    if not (f'<meta name="ajs-issue-key" content="{issue_key}">' in content):
        logger.error(f'Issue {issue_key} not found: {content}')
    assert f'<meta name="ajs-issue-key" content="{issue_key}">' in content, 'Issue not found'
    logger.locust_info(
        f"{params.action_name}: Issue {issue_key} is opened successfully")

    logger.locust_info(
        f'{params.action_name}: Issue key - {issue_key}, issue_id - {issue_id}'
    )
    if edit_allowed:
        url = f'/secure/AjaxIssueEditAction!default.jspa?decorator=none&issueId={issue_id}&_={timestamp_int()}'
        locust.get(url, catch_response=True)
    locust.client.put(f'/rest/projects/1.0/project/{project_key}/lastVisited',
                      params.browse_project_payload,
                      catch_response=True)
def view_issue(locust):
    raise_if_login_failed(locust)
    params = BrowseIssue()
    issue_key = random.choice(jira_dataset['issues'])[0]
    project_key = random.choice(jira_dataset['issues'])[2]

    # 400 /browse
    r = locust.get(f'/browse/{issue_key}', catch_response=True)

    content = r.content.decode('utf-8')
    issue_id = fetch_by_re(params.issue_id_pattern, content)
    project_avatar_id = fetch_by_re(params.project_avatar_id_pattern, content)
    edit_allowed = fetch_by_re(params.edit_allow_pattern, content, group_no=0)

    # 405 /rest/webResources/1.0/resources
    locust.post('/rest/webResources/1.0/resources',
                json=params.resources_body.get("405"),
                headers=RESOURCE_HEADERS,
                catch_response=True)

    # 410 /rest/webResources/1.0/resources
    locust.post('/rest/webResources/1.0/resources',
                json=params.resources_body.get("410"),
                headers=RESOURCE_HEADERS,
                catch_response=True)

    # 415 /rest/analytics/1.0/publish/bulk
    locust.post('/rest/analytics/1.0/publish/bulk',
                json=params.resources_body.get("415"),
                headers=RESOURCE_HEADERS,
                catch_response=True)

    # 420 /rest/webResources/1.0/resources
    locust.post('/rest/webResources/1.0/resources',
                json=params.resources_body.get("420"),
                headers=RESOURCE_HEADERS,
                catch_response=True)

    # 425 /rest/analytics/1.0/publish/bulk
    locust.post('/rest/analytics/1.0/publish/bulk',
                json=params.resources_body.get("425"),
                headers=RESOURCE_HEADERS,
                catch_response=True)

    # 430 /secure/projectavatar
    locust.get(f'/secure/projectavatar?avatarId={project_avatar_id}', catch_response=True)

    # Assertions
    if not (f'<meta name="ajs-issue-key" content="{issue_key}">' in content):
        logger.error(f'Issue {issue_key} not found: {content}')
    assert f'<meta name="ajs-issue-key" content="{issue_key}">' in content, 'Issue not found'
    logger.locust_info(f"{params.action_name}: Issue {issue_key} is opened successfully")
    logger.locust_info(f'{params.action_name}: Issue key - {issue_key}, issue_id - {issue_id}')

    # 435 /secure/AjaxIssueEditAction!default.jspa
    if edit_allowed:
        url = f'/secure/AjaxIssueEditAction!default.jspa?decorator=none&issueId={issue_id}&_={timestamp_int()}'
        locust.get(url, catch_response=True)

    # 440 /rest/projects/1.0/project/<project_key>/lastVisited
    locust.client.put(f'/rest/projects/1.0/project/{project_key}/lastVisited',
                      params.browse_project_payload,
                      catch_response=True)