-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #958 from stakwork/setup/complete-e2e
Setup/complete e2e
- Loading branch information
Showing
19 changed files
with
331 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe('Admin Login', () => { | ||
it('Admin uses the enable function', () => { | ||
cy.visit('http://localhost:3000', { | ||
onBeforeLoad(win) { | ||
win['CYPRESS_USER'] = 'alice' | ||
}, | ||
}) | ||
let title = `Testing NavFiber` | ||
cy.wait(30000) | ||
cy.get('div[data-testid="settings-modal"]').click() | ||
// cy.get('[data-testid="setting-label"]').should('have.text', 'Settings') | ||
cy.get('[data-testid="setting-label"]').should('have.text', 'Admin Settings') | ||
// .invoke('text') | ||
// .then((value) => { | ||
// console.log(value) | ||
// }) | ||
cy.get('#cy-about-title-id').click() | ||
cy.get('#cy-about-title-id').type('{selectAll}') | ||
cy.get('#cy-about-title-id').type(title) | ||
|
||
cy.get('#add-node-submit-cta').click() | ||
cy.wait(200) | ||
cy.get('div[data-testid="close-modal"]').click() | ||
|
||
cy.get('.title').should('have.text', title) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getCurrentUser } from './helper' | ||
|
||
export function enableSphinx() { | ||
const user = getCurrentUser() | ||
|
||
if (!user) { | ||
return null | ||
} | ||
|
||
return { budget: 0, pubkey: user.pubkey } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { getCurrentUser } from './helper' | ||
|
||
export async function getLsatSphinx(host: string) { | ||
try { | ||
const user = getCurrentUser() | ||
|
||
if (user) { | ||
const result = await fetch(`${user.external_ip}/active_lsat?issuer=${host}`, { | ||
headers: { 'x-user-token': user.authToken }, | ||
}) | ||
|
||
const res = await result.json() | ||
|
||
if (res.success) { | ||
const { lsat } = res.response | ||
|
||
return { | ||
paymentRequest: lsat.paymentRequest, | ||
macaroon: lsat.macaroon, | ||
issuer: lsat.issuer, | ||
identifier: lsat.identifier, | ||
preimage: lsat.preimage, | ||
paths: lsat.paths, | ||
status: lsat.status, | ||
success: false, | ||
} | ||
} | ||
|
||
return { | ||
paymentRequest: '', | ||
macaroon: '', | ||
issuer: '', | ||
identifier: '', | ||
preimage: '', | ||
paths: '', | ||
status: '', | ||
success: false, | ||
} | ||
} | ||
|
||
return null | ||
} catch (error) { | ||
console.log(JSON.stringify(error)) | ||
|
||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { RelayUser } from '~/types' | ||
import nodes from '../../relay/nodes.json' | ||
|
||
export function getCurrentUser(): RelayUser | null { | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
if ((window as any).CYPRESS_USER) { | ||
const user = (window as any).CYPRESS_USER | ||
|
||
let userNode | ||
|
||
for (let i = 0; i < nodes.length; i += 1) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
if (nodes[i].alias === user) { | ||
userNode = nodes[i] | ||
|
||
break | ||
} | ||
} | ||
|
||
if (!userNode) { | ||
return null | ||
} | ||
|
||
return userNode | ||
} | ||
|
||
return null | ||
} |
Oops, something went wrong.