Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #401

Merged
merged 7 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/feditest/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def create_session_template_from_tests(args: Namespace) -> TestPlanSession:
for constellation_role_name in constellation_role_names:
constellation_roles[constellation_role_name] = None

session = TestPlanSession(TestPlanConstellation(constellation_roles), test_plan_specs)
session = TestPlanSession(TestPlanConstellation(constellation_roles), test_plan_specs, args.name)
return session


Expand Down
6 changes: 4 additions & 2 deletions src/feditest/nodedrivers/mastodon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def actor_has_received_object(self, object_uri: str) -> dict[str, Any]:
response = find_first_in_array(elements, lambda s: s['uri'] == object_uri)
if not response:
# Home timeline second case: an announce/boost was created by an account we follow -- need to look for the original URI
if reblog_response := find_first_in_array(elements, lambda s: 'reblog' in s and s['reblog']['uri'] == object_uri) :
if reblog_response := find_first_in_array(elements, lambda s: 'reblog' in s and s['reblog'] and 'uri' in s['reblog'] and s['reblog']['uri'] == object_uri) :
response = reblog_response['reblog']
if not response:
# Check for it in notifications: mentions arrive here
Expand Down Expand Up @@ -458,7 +458,7 @@ def _find_account_dict_by_other_actor_acct_uri(self, other_actor_acct_uri: str)
raise ValueError(f'Unexpected type: { ret }')


def _find_note_dict_by_uri(self, uri: str) -> dict[str,Any]:
def _find_note_dict_by_uri(self, uri: str) -> dict[str,Any] | None:
"""
Find a the dict for a status, or None.
"""
Expand All @@ -470,6 +470,8 @@ def _find_note_dict_by_uri(self, uri: str) -> dict[str,Any]:
results = self.http_get('/api/v2/search?' + urlencode(args))

ret = find_first_in_array(results.get('statuses'), lambda b: b['uri'] == uri)
if ret is None:
return None
if isinstance(ret, dict):
return cast(dict[str,Any], ret)
raise ValueError(f'Unexpected type: { ret }')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header class="feditest title">
<h1><span class="prefix"><a href="https://feditest.org/">Feditest</a> Report:</span> {{ run.plan.name }}</h1>
<h1><span class="prefix"><a href="https://feditest.org/">Feditest</a> Summary Report:</span> {{ run.plan.name }}</h1>
<p class="id">{{ run.id }}</p>
</header>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% if role_name in run_session.constellation.nodes %}
{%- set session_node = run_session.constellation.nodes[role_name] %}
<div class="role">
<div class="name">{{ role_name }}</div>
<h3 class="name">{{ role_name }}</h3>
<div class="driver">{{ local_name_with_tooltip(node.nodedriver) }}</div>
<div class="app">{{ session_node.appdata['app'] }}</div>
<div class="appversion">{{ session_node.appdata['app_version'] or '?'}}</div>
Expand Down Expand Up @@ -45,8 +45,8 @@
{%- if test_meta.description %}
<div class="description">{{ test_meta.description}}</div>
{%- endif %}
<p class="when">Started {{ format_timestamp(run_test.started) }}, ended {{ format_timestamp(run_test.ended) }}</p>
{%- with result=run_test.worst_result %}
<p class="when">Started {{ format_timestamp(run_test.started) }}, ended {{ format_timestamp(run_test.ended) }} (duration: {{ format_duration(run_test.ended - run_test.started) }})</p>
{%- with result=run_test.worst_result %}
{%- include "partials/test_session/testresult.jinja2" %}
{%- endwith %}
{%- for test_step_index, run_step in enumerate(run_test.run_steps or []) %}
Expand All @@ -56,8 +56,7 @@
{%- if test_step_meta.description %}
<div class="description">{{ test_step_meta.description}}</div>
{%- endif %}
<p class="when">Started {{ format_timestamp(run_step.started) }}, ended {{ format_timestamp(run_step.ended) }}</p>

<p class="when">Started {{ format_timestamp(run_test.started) }}, ended {{ format_timestamp(run_test.ended) }} (duration: {{ format_duration(run_test.ended - run_test.started) }})</p>
{%- with result=run_step.result, idmod='step' %}
{%- include "partials/test_session/testresult.jinja2" %}
{%- endwith %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<div class="status {{ result.css_classes() }} moreinfo">
<label for="details-{{ result.id() }}{{ idmod }}">{{ result.short_title() }}</label>
<input id="details-{{ result.id() }}{{ idmod }}" type="checkbox">
<pre class="stacktrace">{{ result }}</pre>
<pre class="stacktrace">{{ html_escape(result) }}</pre>
</div>
{%- else %}
<div class="status passed">Passed</div>
<div class="status passed">
<div>Passed</div>
</div>
{%- endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set plan_session = run.plan.sessions[run_session.plan_session_index] %}
<header class="feditest title" style="text-align: center">
<h1><span class="prefix"><a href="https://feditest.org/">Feditest</a>:</span> {{ plan_session.name }}</h1>
<p class="id">{{ run.id }} [<a href="{{ matrix_file_path }}">Test Matrix</a>] </p>
<h1><span class="prefix"><a href="https://feditest.org/">Feditest</a> Session Report:</span> {{ plan_session.name }}</h1>
<p class="id">{{ run.id }} [<a href="{{ matrix_file_path }}">Summary</a>] </p>
</header>
9 changes: 2 additions & 7 deletions src/feditest/templates/default/static/feditest.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ footer {
font-size: smaller;
}

div.feditest.title {
div.title {
text-align: center;
}
div.feditest span.prefix,
Expand Down Expand Up @@ -131,11 +131,7 @@ div.feditest.session > h3::before {
border-color: var(--pico-table-border-color);
}

.feditest div.role > div.name {
font-weight: bold;
}

.feditest div.role > div.name::before {
.feditest div.role > h3.name::before {
content: "Role: ";
}

Expand Down Expand Up @@ -422,7 +418,6 @@ nav.matrix {

nav.matrix ul {
display: block;
font-size: 1.4rem;
}

div.feditest.mobile {
Expand Down
2 changes: 1 addition & 1 deletion src/feditest/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ class TestRun(HasStartEndResults):
def __init__(self, plan: TestPlan, record_who: bool = False):
super().__init__()
self.plan = plan
self.id : str = 'feditest-run-' + datetime.now(timezone.utc).strftime("%Y-%m-%dT%H-%M-%S.%fZ")
self.id : str = 'feditest-run-' + datetime.now(timezone.utc).strftime("%Y%m%d-%H%M%S")
self.platform : str = platform.platform()
self.run_sessions : list[TestRunSession] = []
self.username : str | None = None
Expand Down
6 changes: 4 additions & 2 deletions src/feditest/testruntranscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import traceback
from abc import ABC, abstractmethod
from datetime import datetime
import html
from typing import IO, Iterator, Optional

import jinja2
Expand Down Expand Up @@ -560,9 +561,10 @@ def session_file_path(plan_session):
r"(\.|::)", r"<wbr>\1", s
),
local_name_with_tooltip=lambda n: f'<span title="{ n }">{ n.split(".")[-1] }</span>',
format_timestamp=lambda ts: ts.isoformat() if ts else "",
format_timestamp=lambda ts: ts.strftime("%Y:%m:%d-%H:%M:%S.%fZ") if ts else "",
format_duration=lambda s: str(s), # makes it easier to change in the future
len=len
len=len,
html_escape=lambda s: html.escape(str(s))
)

try:
Expand Down
Loading