mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
cypress tests: connections
This commit is contained in:
parent
f19784f6fe
commit
3e36fdf359
7 changed files with 69 additions and 89 deletions
|
|
@ -1,82 +0,0 @@
|
|||
describe('Configuring nodes', () => {
|
||||
|
||||
it('Configures the bitcoin-node in Specter', () => {
|
||||
cy.viewport(1200,660)
|
||||
cy.visit('/')
|
||||
cy.get('#node-switch-icon').click()
|
||||
cy.get('[href="/nodes/node/default/"]').first().click()
|
||||
cy.get('#autodetect').uncheck()
|
||||
cy.get('#username').clear()
|
||||
cy.get('#username').type("bitcoin")
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("wrongPassword") // wrong Password
|
||||
cy.get('#host').clear()
|
||||
// This is hopefully correct for some longer time. If the connection fails, check the
|
||||
// output of python3 -m cryptoadvance.specter bitcoind (in the CI-output !!) for a better ip-address.
|
||||
// AUtomating that is probably simply not worth it.
|
||||
cy.readFile('btcd-conn.json').then((conn) => {
|
||||
cy.get('#host').type("http://"+conn["host"])
|
||||
cy.get('#port').clear()
|
||||
cy.get('#port').type(conn["port"])
|
||||
})
|
||||
cy.get('[value="test"]').click()
|
||||
// cy.get(':nth-child(2) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // connectable: green
|
||||
// cy.get(':nth-child(5) > button > div').should('have.css', 'color', 'rgb(255, 0, 0)') // Credentials: red
|
||||
cy.get('message-box').shadow().find('div.error > a').click()
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("secret")
|
||||
cy.get('[value="test"]').click()
|
||||
// cy.get(':nth-child(2) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // connectable: green
|
||||
// cy.get(':nth-child(5) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Credentials: green
|
||||
// cy.get(':nth-child(8) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Version green
|
||||
// cy.get(':nth-child(11) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Walletsenabled green
|
||||
cy.get('message-box').shadow().find('div#main > a').click()
|
||||
cy.get('[value="save"]').click()
|
||||
|
||||
})
|
||||
|
||||
it('Configures the elements-node in Specter', () => {
|
||||
cy.viewport(1200,660)
|
||||
cy.visit('/')
|
||||
cy.get('#node-switch-icon').click()
|
||||
cy.get('#btn_new_node').click()
|
||||
cy.get('[href="/nodes/new_node/"]').click()
|
||||
cy.get('#name').clear()
|
||||
cy.get('#name').type("Elements Node")
|
||||
cy.get('#autodetect').uncheck()
|
||||
cy.readFile('elmd-conn.json').then((conn) => {
|
||||
cy.get('#username').clear()
|
||||
cy.get('#username').type("liquid")
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("wrongPassword") // wrong Password
|
||||
cy.get('#host').clear()
|
||||
cy.get('#host').type("http://"+conn["host"])
|
||||
cy.get('#port').clear()
|
||||
cy.get('#port').type(conn["port"])
|
||||
cy.get('[value="test"]').click()
|
||||
// cy.get(':nth-child(2) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // connectable: green
|
||||
// cy.get(':nth-child(5) > button > div').should('have.css', 'color', 'rgb(255, 0, 0)') // Credentials: red
|
||||
cy.get('message-box').shadow().find('div.error > a').click()
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("secret")
|
||||
cy.get('[value="test"]').click()
|
||||
// cy.get(':nth-child(2) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // connectable: green
|
||||
// cy.get(':nth-child(5) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Credentials: green
|
||||
// cy.get(':nth-child(8) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Version green
|
||||
// cy.get(':nth-child(11) > button > div').should('have.css', 'color', 'rgb(0, 128, 0)') // Walletsenabled green
|
||||
cy.get('message-box').shadow().find('div#main > a').click()
|
||||
cy.get('[value="save"]').click()
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
it('Choose Bitcoin Core Node', () => {
|
||||
// switch back to bitcoin-node
|
||||
cy.viewport(1200,660)
|
||||
cy.visit('/')
|
||||
cy.get('#node-switch-icon').click()
|
||||
cy.get('#default-select-node-form #node_item').click()
|
||||
})
|
||||
|
||||
})
|
||||
61
cypress/integration/spec_connections.js
Normal file
61
cypress/integration/spec_connections.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
describe('Connecting nodes', () => {
|
||||
before(() => {
|
||||
Cypress.config('includeShadowDom', true)
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.visit('/')
|
||||
cy.viewport(1200,660)
|
||||
})
|
||||
|
||||
it('Connect with Bitcoin Core node', () => {
|
||||
// Starting from the welcome page
|
||||
cy.get('[data-cy="core-connection-btn"]').click()
|
||||
cy.get('#cancel-icon').click()
|
||||
// Using a wrong RPC password
|
||||
cy.get('#name').type('Bitcoin Core')
|
||||
cy.get('#username').clear()
|
||||
cy.get('#username').type('bitcoin')
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("wrong")
|
||||
cy.get('#host').clear()
|
||||
cy.get('#host').type('http://localhost')
|
||||
cy.get('#port').clear()
|
||||
cy.get('#port').type(15443)
|
||||
cy.get('[data-cy="connect-btn"]').click()
|
||||
cy.contains('Connection attempt failed')
|
||||
cy.contains('Credentials')
|
||||
cy.get('#cancel-icon').click()
|
||||
// Now connect with the correct password
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type("secret")
|
||||
cy.get('[data-cy="connect-btn"]').click()
|
||||
cy.contains('New connection saved')
|
||||
})
|
||||
|
||||
it('Connect with Liquid node', () => {
|
||||
cy.get('#node-switch-icon').click()
|
||||
cy.get('[data-cy="new-connection-btn"]').click()
|
||||
cy.get('#cancel-icon').click()
|
||||
cy.get('#name').clear()
|
||||
cy.get('#name').type("Liquid")
|
||||
cy.get('#username').clear()
|
||||
cy.get('#username').type('liquid')
|
||||
cy.get('#password').clear()
|
||||
cy.get('#password').type('secret')
|
||||
cy.get('#host').clear()
|
||||
cy.get('#host').type('http://localhost')
|
||||
cy.get('#port').clear()
|
||||
cy.get('#port').type(8040)
|
||||
cy.get('[data-cy="connect-btn"]').click()
|
||||
})
|
||||
|
||||
// TODO: For testing the deletion we could delete the Liquid connection here if we don't run the Liquid tests
|
||||
|
||||
it('Select Bitcoin Core connection', () => {
|
||||
cy.get('#node-switch-icon').click()
|
||||
cy.contains('Bitcoin Core').click()
|
||||
cy.contains('Switched to use Bitcoin Core as connection')
|
||||
})
|
||||
|
||||
})
|
||||
|
|
@ -259,6 +259,7 @@ class CypressTestConfig(TestConfig):
|
|||
)
|
||||
BITCOIN_RPC_TIMEOUT = 30
|
||||
LIQUID_RPC_TIMEOUT = 40
|
||||
SERVICES_DEVSTATUS_THRESHOLD = os.getenv("SERVICES_DEVSTATUS_THRESHOLD", "alpha")
|
||||
|
||||
|
||||
class ProductionConfig(BaseConfig):
|
||||
|
|
|
|||
|
|
@ -502,12 +502,12 @@ def switch_node():
|
|||
node = app.specter.node_manager.get_by_alias(node_alias)
|
||||
if node.is_running:
|
||||
app.specter.update_active_node(node_alias)
|
||||
flash(_(f"Switched to use {node.name} as node."))
|
||||
flash(_(f"Switched to use {node.name} as connection"))
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
flash(
|
||||
_(
|
||||
f"Can't select {node.name} as node (no connection). Try a different configuration."
|
||||
f"Can't select {node.name} (no connection). Try a different configuration."
|
||||
),
|
||||
"error",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
</form>
|
||||
{% endfor %}
|
||||
|
||||
<a class="pl-4 py-3 text-base text-dark-200 font-medium hover:bg-dark-700 border-t-[1px] border-dark-700" href="{{ url_for('nodes_endpoint.node_settings')}}" id="btn_new_node">+ Add Connection</a>
|
||||
<a class="pl-4 py-3 text-base text-dark-200 font-medium hover:bg-dark-700 border-t-[1px] border-dark-700" href="{{ url_for('nodes_endpoint.node_settings')}}" id="btn_new_node" data-cy="new-connection-btn">+ Add Connection</a>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
{% if specter.node_manager.nodes | length > 1 and node_alias %}
|
||||
<button type="submit" name="action" value="delete" class="button">{{ _("Delete") }}</button>
|
||||
{% endif %}
|
||||
<button type="submit" class="button bg-accent text-white" name="action" value="connect">{{ _("Connect") }}</button>
|
||||
<button type="submit" class="button bg-accent text-white" name="action" value="connect" data-cy="connect-btn">{{ _("Connect") }}</button>
|
||||
</div>
|
||||
|
||||
{% if failed_test %}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
<div class="mb-8 grid grid-cols-2 gap-5">
|
||||
<div class="main-description-box p-5 bg-dark-800 flex flex-col items-center border-2 border-dark-700 rounded-lg">
|
||||
<h2 class="text-center">{{ _("Spectrum connection") }}</h2>
|
||||
<h2 class="text-center">{{ _("Using an Electrum server") }}</h2>
|
||||
<p class="mb-12 text-center flex grow">{{ _("This is the easiest way to get started since you can connect to a third-party server. However, it exposes your financial activity. You can also choose your own server.") }}</p>
|
||||
<a href="{{url_for('spectrum_endpoint.index')}}" class="mb-0 button bg-accent text-white w-full">{{ _('Configure Connection') }}</a>
|
||||
<a href="{{url_for('spectrum_endpoint.index')}}" class="mb-0 button bg-accent text-white w-full" data-cy="spectrum-connection-btn">{{ _('Spectrum Connection') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="main-description-box p-5 bg-dark-800 flex flex-col items-center border-2 border-dark-700 rounded-lg">
|
||||
<h2 class="text-center">{{ _("Connect to your own Bitcoin Core node") }}</h2>
|
||||
<p class="mb-12 text-center flex grow">{{ _("The classic Specter setup for total privacy and self-sovereignty.") }}</p>
|
||||
<a href="{{ url_for('nodes_endpoint.node_settings')}}" class="mb-0 button bg-accent text-white w-full">{{ _('Configure Connection') }}</a>
|
||||
<a href="{{ url_for('nodes_endpoint.node_settings')}}" class="mb-0 button bg-accent text-white w-full" data-cy="core-connection-btn">{{ _('Bitcoin Core Connection') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue