storybook: test_mintTokensIntroPages added
This commit is contained in:
parent
a7eb8d9c77
commit
b58d6da82e
|
@ -0,0 +1,116 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import QtTest 1.15
|
||||
|
||||
import StatusQ 0.1
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
import AppLayouts.Communities.panels 1.0
|
||||
|
||||
import Models 1.0
|
||||
|
||||
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
||||
|
||||
Item {
|
||||
|
||||
id: root
|
||||
width: 600
|
||||
height: 800
|
||||
|
||||
Component {
|
||||
id: componentUnderTest
|
||||
|
||||
MintTokensSettingsPanel {
|
||||
communityId: "88"
|
||||
communityName: "SuperRare"
|
||||
communityLogo: ModelsData.icons.superRare
|
||||
communityColor: "Light pink"
|
||||
isOwner: true
|
||||
isTokenMasterOwner: true
|
||||
isAdmin: true
|
||||
referenceAssetsBySymbolModel: ListModel {
|
||||
ListElement {
|
||||
name: "eth"
|
||||
symbol: "ETH"
|
||||
}
|
||||
ListElement {
|
||||
name: "dai"
|
||||
symbol: "DAI"
|
||||
}
|
||||
ListElement {
|
||||
name: "snt"
|
||||
symbol: "SNT"
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
property MintTokensSettingsPanel mintTokensSettingsPanel
|
||||
|
||||
TestCase {
|
||||
name: "MintTokensSettingsPanel"
|
||||
when: windowShown
|
||||
|
||||
function init() {
|
||||
mintTokensSettingsPanel = createTemporaryObject(componentUnderTest,
|
||||
root)
|
||||
}
|
||||
|
||||
function htmlToPlainText(html) {
|
||||
return html.replace(/<[^>]+>/g, "")
|
||||
}
|
||||
|
||||
function test_mintTokensIntroPages() {
|
||||
|
||||
const introPanel = findChild(mintTokensSettingsPanel, "introPanel")
|
||||
const infoBoxPanel = findChild(mintTokensSettingsPanel,
|
||||
"infoBoxPanel")
|
||||
const infoBoxPanelButton = findChild(mintTokensSettingsPanel,
|
||||
"statusInfoBoxPanelButton")
|
||||
|
||||
waitForRendering(mintTokensSettingsPanel)
|
||||
compare(introPanel.title, "Community tokens")
|
||||
compare(introPanel.subtitle,
|
||||
"You can mint custom tokens and import tokens for your community")
|
||||
compare(JSON.stringify(introPanel.checkersModel), JSON.stringify(
|
||||
["Create remotely destructible soulbound tokens for admin permissions", "Reward individual members with custom tokens for their contribution", "Mint tokens for use with community and channel permissions"]))
|
||||
|
||||
compare(infoBoxPanel.title, "Get started")
|
||||
compare(infoBoxPanel.text,
|
||||
"In order to Mint, Import and Airdrop community tokens, you first need to mint your Owner token which will give you permissions to access the token management features for your community.")
|
||||
compare(infoBoxPanel.buttonText, "Mint Owner token")
|
||||
compare(infoBoxPanel.buttonVisible, true)
|
||||
|
||||
mouseClick(infoBoxPanelButton)
|
||||
|
||||
waitForRendering(mintTokensSettingsPanel)
|
||||
waitForItemPolished(mintTokensSettingsPanel)
|
||||
|
||||
tryCompare(mintTokensSettingsPanel.currentItem, "objectName",
|
||||
"ownerTokenPage")
|
||||
|
||||
var settingsPage = findChild(mintTokensSettingsPanel.currentItem,
|
||||
"welcomeView")
|
||||
|
||||
|
||||
compare(htmlToPlainText(((findChild(settingsPage,
|
||||
"introPanelText")).text).replace(/’/g, "'")),
|
||||
"Your Owner token will give you permissions to access the token management features for your community. This token is very important - only one will ever exist, and if this token gets lost then access to the permissions it enables for your community will be lost forever as well.
|
||||
Minting your Owner token also automatically mints your community's TokenMaster token. You can airdrop your community's TokenMaster token to anybody you wish to grant both Admin permissions and permission to access your community's token management functions to.
|
||||
Only the hodler of the Owner token can airdrop TokenMaster tokens. TokenMaster tokens are soulbound (meaning they can't be transferred), and you (the hodler of the Owner token) can remotely destruct a TokenMaster token at any time, to revoke TokenMaster permissions from any individual.")
|
||||
compare(JSON.stringify((findChild(
|
||||
settingsPage,
|
||||
"ownerChecklist")).checkersModel),
|
||||
JSON.stringify(
|
||||
["Only 1 will ever exist", "Hodler is the owner of the Community", "Ability to airdrop / destroy TokenMaster token", "Ability to mint and airdrop Community tokens"]))
|
||||
compare(JSON.stringify((findChild(
|
||||
settingsPage,
|
||||
"masterChecklist")).checkersModel),
|
||||
JSON.stringify(
|
||||
["Unlimited supply", "Grants full Community admin rights", "Ability to mint and airdrop Community tokens", "Non-transferrable", "Remotely destructible by the Owner token hodler"]))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -104,6 +104,8 @@ Control {
|
|||
StatusButton {
|
||||
id: button
|
||||
|
||||
objectName: "statusInfoBoxPanelButton"
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
visible: root.buttonVisible
|
||||
|
|
|
@ -199,9 +199,13 @@ StackView {
|
|||
Component {
|
||||
id: ownerTokenViewComponent
|
||||
|
||||
|
||||
SettingsPage {
|
||||
|
||||
id: ownerTokenPage
|
||||
|
||||
objectName: "ownerTokenPage"
|
||||
|
||||
title: qsTr("Mint Owner token")
|
||||
|
||||
contentItem: OwnerTokenWelcomeView {
|
||||
|
|
|
@ -115,6 +115,8 @@ StatusScrollView {
|
|||
IntroPanel {
|
||||
Layout.fillWidth: true
|
||||
|
||||
objectName: "introPanel"
|
||||
|
||||
image: Style.png("community/mint2_1")
|
||||
title: qsTr("Community tokens")
|
||||
subtitle: qsTr("You can mint custom tokens and import tokens for your community")
|
||||
|
@ -127,6 +129,8 @@ StatusScrollView {
|
|||
|
||||
StatusInfoBoxPanel {
|
||||
|
||||
objectName: "infoBoxPanel"
|
||||
|
||||
readonly property bool isAdminOnly: root.isAdmin && !root.isOwner
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -28,12 +28,16 @@ StatusScrollView {
|
|||
ColumnLayout {
|
||||
id: mainLayout
|
||||
|
||||
objectName: "welcomeView"
|
||||
|
||||
width: root.viewWidth
|
||||
spacing: 20
|
||||
|
||||
StatusBaseText {
|
||||
id: introPanel
|
||||
|
||||
objectName: "introPanelText"
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
|
@ -45,6 +49,9 @@ StatusScrollView {
|
|||
}
|
||||
|
||||
InfoPanel {
|
||||
|
||||
objectName: "ownerChecklist"
|
||||
|
||||
isOwner: true
|
||||
checkersModel: [
|
||||
qsTr("Only 1 will ever exist"),
|
||||
|
@ -55,6 +62,9 @@ StatusScrollView {
|
|||
}
|
||||
|
||||
InfoPanel {
|
||||
|
||||
objectName: "masterChecklist"
|
||||
|
||||
isOwner: false
|
||||
showTag: true
|
||||
checkersModel: [
|
||||
|
@ -176,6 +186,8 @@ StatusScrollView {
|
|||
}
|
||||
|
||||
StatusButton {
|
||||
|
||||
objectName: "welcomeViewNextButton"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.bottomMargin: Style.current.bigPadding
|
||||
|
||||
|
|
Loading…
Reference in New Issue