Add appium test for opening the user details sheet and fix some accessibility problems

This commit is contained in:
Tobias Fella
2023-07-20 16:13:52 +02:00
parent de47597f6e
commit 5c32520c35
12 changed files with 182 additions and 29 deletions

View File

@@ -42,6 +42,8 @@
#include "trayicon_sni.h"
#endif
bool testMode = false;
using namespace Quotient;
Controller::Controller(QObject *parent)
@@ -56,9 +58,19 @@ Controller::Controller(QObject *parent)
connect(NeoChatConfig::self(), &NeoChatConfig::SystemTrayChanged, this, &Controller::setQuitOnLastWindowClosed);
#endif
QTimer::singleShot(0, this, [this] {
invokeLogin();
});
if (!testMode) {
QTimer::singleShot(0, this, [this] {
invokeLogin();
});
} else {
auto c = new NeoChatConnection(this);
c->assumeIdentity(QStringLiteral("@user:localhost:1234"), QStringLiteral("token_1234"));
connect(c, &Connection::connected, this, [c, this]() {
m_accountRegistry.add(c);
c->syncLoop();
Q_EMIT initiated();
});
}
QObject::connect(QGuiApplication::instance(), &QCoreApplication::aboutToQuit, QGuiApplication::instance(), [this] {
delete m_trayIcon;
@@ -434,3 +446,8 @@ AccountRegistry &Controller::accounts()
}
#include "moc_controller.cpp"
void Controller::setTestMode(bool test)
{
testMode = test;
}

View File

@@ -131,6 +131,8 @@ public:
Quotient::AccountRegistry &accounts();
static void setTestMode(bool testMode);
private:
explicit Controller(QObject *parent = nullptr);

View File

@@ -176,6 +176,10 @@ int main(int argc, char *argv[])
parser.addPositionalArgument(QStringLiteral("urls"), i18n("Supports matrix: url scheme"));
parser.addOption(QCommandLineOption("ignore-ssl-errors"_ls, i18n("Ignore all SSL Errors, e.g., unsigned certificates.")));
QCommandLineOption testOption("test"_ls, i18n("Only used for autotests"));
testOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(testOption);
#ifdef HAVE_KUNIFIEDPUSH
QCommandLineOption dbusActivatedOption(QStringLiteral("dbus-activated"), i18n("Internal usage only."));
dbusActivatedOption.setFlags(QCommandLineOption::Flag::HiddenFromHelp);
@@ -185,6 +189,7 @@ int main(int argc, char *argv[])
about.setupCommandLine(&parser);
parser.process(app);
about.processCommandLine(&parser);
Controller::setTestMode(parser.isSet("test"_ls));
#ifdef HAVE_KUNIFIEDPUSH
if (parser.isSet(dbusActivatedOption)) {

View File

@@ -139,20 +139,17 @@ QQC2.Control {
RowLayout {
Layout.maximumWidth: root.maxContentWidth
visible: root.showAuthor
QQC2.Label {
QQC2.AbstractButton {
Layout.fillWidth: true
text: root.author.displayName
color: root.author.color
textFormat: Text.PlainText
font.weight: Font.Bold
elide: Text.ElideRight
TapHandler {
onTapped: RoomManager.visitUser(root.author.object, "mention")
}
HoverHandler {
cursorShape: Qt.PointingHandCursor
contentItem: QQC2.Label {
text: root.author.displayName
color: root.author.color
textFormat: Text.PlainText
font.weight: Font.Bold
elide: Text.ElideRight
}
Accessible.name: contentItem.text
onClicked: RoomManager.visitUser(root.author.object, "mention")
}
QQC2.Label {
text: root.timeString

View File

@@ -7,7 +7,7 @@ import QtQuick.Layouts
import Qt.labs.qmlmodels
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
import org.kde.kirigamiaddons.components as KirigamiComponents
import org.kde.neochat
import org.kde.neochat.config
@@ -337,7 +337,7 @@ TimelineDelegate {
}
}
KirigamiComponents.Avatar {
KirigamiComponents.AvatarButton {
id: avatar
width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2: 0
height: width
@@ -355,13 +355,7 @@ TimelineDelegate {
source: root.author.avatarSource
color: root.author.color
MouseArea {
anchors.fill: parent
onClicked: {
RoomManager.visitUser(root.author.object, "mention")
}
cursorShape: Qt.PointingHandCursor
}
onClicked: RoomManager.visitUser(root.author.object, "mention")
}
Bubble {
id: bubble

View File

@@ -29,7 +29,7 @@ Kirigami.Dialog {
standardButtons: Kirigami.Dialog.NoButton
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
title: i18nc("@title:menu Account detail dialog", "Account detail")
title: i18nc("@title:menu Account details dialog", "Account Details")
contentItem: ColumnLayout {
spacing: 0