mirror of
https://github.com/status-im/desktop-ui-tests.git
synced 2025-02-06 01:43:27 +00:00
Merge pull request #29 from status-im/chat_info_button_refactor
refactor(tst_statusChatInfoButton.qml): refactoring test
This commit is contained in:
commit
3b7f990c61
@ -3,79 +3,75 @@ import QtQuick.Window 2.14
|
|||||||
import QtTest 1.14
|
import QtTest 1.14
|
||||||
|
|
||||||
import "base"
|
import "base"
|
||||||
import "status-desktop/ui/StatusQ/src/StatusQ/Controls" as DesktopControls
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Popups 0.1
|
||||||
|
|
||||||
WindowTestCase {
|
WindowTestCase {
|
||||||
name: "statusChatInfoButton"
|
name: "statusChatInfoButton test"
|
||||||
when: windowShown
|
|
||||||
|
|
||||||
Helpers { id: helpers }
|
Helpers { id: helpers }
|
||||||
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: popupComponent
|
|
||||||
DesktopControls.StatusChatInfoButton {
|
|
||||||
id: statusChatInfoButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SignalSpy {
|
SignalSpy {
|
||||||
id: statusChatInfoButtonClickedSpy
|
id: clickedSpy
|
||||||
|
target: chatInfoButton
|
||||||
signalName: "clicked"
|
signalName: "clicked"
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalSpy {
|
SignalSpy {
|
||||||
id: statusChatInfoButtonUnmuteSpy
|
id: unmuteSpy
|
||||||
|
target: chatInfoButton
|
||||||
signalName: "unmute"
|
signalName: "unmute"
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalSpy {
|
SignalSpy {
|
||||||
id: pinnedMessagesClickedSpy
|
id: pinnedCounterSpy
|
||||||
|
target: chatInfoButton
|
||||||
signalName: "pinnedMessagesCountClicked"
|
signalName: "pinnedMessagesCountClicked"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusChatInfoButton {
|
||||||
function test_case1_statusChatInfoButton_clicked() {
|
id: chatInfoButton
|
||||||
|
parent: windowContent
|
||||||
var statusChatInfoButton = popupComponent.createObject(window)
|
title: "#public-chat"
|
||||||
statusChatInfoButton.title = "Status-Chat-Info-Button"
|
subTitle: "chat-about-everything"
|
||||||
wait(2000)
|
muted: true
|
||||||
statusChatInfoButtonClickedSpy.target = statusChatInfoButton
|
pinnedMessagesCount: 3
|
||||||
compare(statusChatInfoButtonClickedSpy.count, 0)
|
|
||||||
mouseClick(statusChatInfoButton, 1, 1, Qt.LeftButton)
|
|
||||||
wait(2000)
|
|
||||||
compare(statusChatInfoButtonClickedSpy.count, 1, "Status Chat info button was not clicked")
|
|
||||||
statusChatInfoButton.destroy()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_case2_statusChatInfoButton_unmuted() {
|
function test_case1_statusChatInfoButton_signals_valid() {
|
||||||
var statusChatInfoButton = popupComponent.createObject(window)
|
|
||||||
statusChatInfoButton.title = "#public"
|
// checking if signals are present
|
||||||
statusChatInfoButton.muted = true
|
verify(clickedSpy.valid, "Signal " + clickedSpy.signalName + "is not found")
|
||||||
wait(2000)
|
verify(unmuteSpy.valid, "Signal " + unmuteSpy.signalName + "is not found")
|
||||||
var mutedButton = helpers.getObjectByObjectName(statusChatInfoButton, "mutedIcon")
|
verify(pinnedCounterSpy.valid, "Signal " + pinnedCounterSpy.signalName + "is not found")
|
||||||
statusChatInfoButtonUnmuteSpy.target = statusChatInfoButton
|
}
|
||||||
compare(statusChatInfoButtonUnmuteSpy.count, 0)
|
|
||||||
|
function test_case2_statusChatInfoButton_clicked() {
|
||||||
|
|
||||||
|
compare(clickedSpy.count, 0)
|
||||||
|
mouseClick(chatInfoButton, 1, 1, Qt.LeftButton)
|
||||||
|
wait(10000)
|
||||||
|
compare(clickedSpy.count, 1, "Status Chat info button was not clicked")
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_case3_statusChatInfoButton_unmuted() {
|
||||||
|
|
||||||
|
unmuteSpy.clear()
|
||||||
|
var mutedButton = helpers.getObjectByObjectName(chatInfoButton, "mutedIcon")
|
||||||
|
verify(mutedButton)
|
||||||
|
compare(unmuteSpy.count, 0)
|
||||||
mouseClick(mutedButton, 2, 2, Qt.LeftButton)
|
mouseClick(mutedButton, 2, 2, Qt.LeftButton)
|
||||||
wait(2000)
|
compare(unmuteSpy.count, 1, "Muted button is not clicked")
|
||||||
compare(statusChatInfoButtonUnmuteSpy.count, 1, "Muted button is not clicked")
|
|
||||||
statusChatInfoButton.destroy()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_case3_statusChatInfoButton_pinned() {
|
function test_case4_statusChatInfoButton_pinned() {
|
||||||
|
|
||||||
var statusChatInfoButton = popupComponent.createObject(window)
|
pinnedCounterSpy.clear()
|
||||||
statusChatInfoButton.title = "#community-channel"
|
var pinButtonCounter = helpers.getObjectByObjectName(chatInfoButton, "pinMessagesCounterSensor")
|
||||||
statusChatInfoButton.pinnedMessagesCount = 2
|
verify(pinButtonCounter)
|
||||||
wait(2000)
|
compare(pinnedCounterSpy.count, 0)
|
||||||
var pinButtonCounter = helpers.getObjectByObjectName(statusChatInfoButton, "pinMessagesCounterSensor")
|
|
||||||
pinnedMessagesClickedSpy.target = statusChatInfoButton
|
|
||||||
compare(pinnedMessagesClickedSpy.count, 0)
|
|
||||||
mouseClick(pinButtonCounter, 1, 1, Qt.LeftButton)
|
mouseClick(pinButtonCounter, 1, 1, Qt.LeftButton)
|
||||||
wait(2000)
|
compare(pinnedCounterSpy.count, 1, "Pin counter is not clicked")
|
||||||
compare(pinnedMessagesClickedSpy.count, 1, "Pin counter is not clicked")
|
|
||||||
statusChatInfoButton.destroy()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user