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

Chore: Refactor_wallet_manager #1667

Merged
merged 21 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 14 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
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"spec_wallet_utxo.js",
"spec_plugins.js",
"spec_elm_single_segwit_wallet.js",
"spec_elm_multi_segwit_wallet.js"
"spec_elm_multi_segwit_wallet.js",
"spec_multiuser_sessions.js"
],
"baseUrl": "http://localhost:25444",
"env": {
Expand Down
92 changes: 92 additions & 0 deletions cypress/integration/spec_multiuser_sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
describe('Test the actions in UTXO list', () => {
k9ert marked this conversation as resolved.
Show resolved Hide resolved
// See https://github.com/cypress-io/cypress/issues/21138
if (Cypress.env("CI")) {
const login = (name,password) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I am overlooking sth. but where is the name variable set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's defining a function and the name is the parameter here. It's initialized with the arguments at call time, e.g. in line 39.

if (!password) {
password = name+"pass"
}
cy.session([name, password], () => {
cy.visit('/auth/login')
cy.get('#username').type(name)
cy.get('#password').type(password)
cy.get('#login-btn').click()
cy.url().should('contain', '/welcome/about')
},
{
validate() {
cy.visit("/welcome/about")
cy.url().should('contain', '/welcome/about')
}
}
)
}

before(() => {
Cypress.config('experimentalSessionSupport',true)
cy.viewport(1200,660)
cy.visit('/')
cy.get('body').then(($body) => {
if ($body.text().includes('Login to Specter')) {
cy.get('#username').type("admin")
cy.get('#password').type("admin")
cy.get('#login-btn').click()
}
})
cy.get('[href="/settings/"] > .svg-white').click()
cy.get('[href="/settings/auth"]').click()
cy.get('select').select("usernamepassword")
cy.get('#submit-btn').click()
login("admin","admin")

cy.get('body').then(($body) => {
if (! $body.text().includes('user1')) {
cy.visit("/settings/auth")
cy.get('#generateregistrationlink > .btn').click({timeout:60000})
cy.get('message-box').then(($msgbox) => {
//expect($msgbox.text()).to.match(/New user link generated (expires in 1 hour):.*/)
let matches = $msgbox.text().match(/http:\/\/.*/)
cy.log(matches)
cy.visit(matches[0])
cy.get('[placeholder="Username"]').type("user1")
cy.get('[placeholder="Password"]').type("user1pass")
cy.get('.row > .btn').click()
//cy.wait(500)
cy.get('message-box').contains("You have registered successfully")

})
}
if (! $body.text().includes('user2')) {
cy.visit("/settings/auth")
cy.get('#generateregistrationlink > .btn').click({timeout:60000})
cy.get('message-box').then(($msgbox) => {
cy.log($msgbox)
cy.log($msgbox.text())
//expect($msgbox.text()).to.match(/New user link generated (expires in 1 hour):.*/)
let matches = $msgbox.text().match(/http:\/\/.*/)
cy.log(matches)
cy.visit(matches[0])
cy.get('[placeholder="Username"]').type("user2")
cy.get('[placeholder="Password"]').type("user2pass")
cy.get('.row > .btn').click()
//cy.wait(500)
cy.get('message-box').contains("You have registered successfully")

})
}
cy.get('[href="/auth/logout"] > .svg-white').click()
})


})

it('First Session Login', () => {

cy.visit("/")
login("user1")
cy.visit("/welcome")



})
}
})
Loading