Skip to content

Commit

Permalink
update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Apr 1, 2024
1 parent 827b18b commit eb826be
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ web-build/

# Detox
artifacts/
.artifacts/

# Diagnostic reports (https://nodejs.org/api/report.html)
report/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function TxtButton({ txt, onPress, icon, disabled, style, txtColor }: ITx
style={[styles.copyTxt, ...(style || [])]}
onPress={onPress}
disabled={disabled}
testID={`${txt}-pin-button`}
testID={`${txt}-button`}
>
<Txt
txt={txt}
Expand Down
38 changes: 0 additions & 38 deletions src/components/InitialModal.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/components/Toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function Toaster() {
<TouchableOpacity
onPress={closePrompt}
style={styles.txtWrap}
testID={`${prompt.success ? 'success' : 'error'}-toaster`}
>
<Txt txt={prompt.msg} styles={[styles.txt]} />
</TouchableOpacity>
Expand Down
1 change: 1 addition & 0 deletions src/components/TxtInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function TxtInput({
multiline={multiline}
numberOfLines={numberOfLines}
style={[globals(color).input, { marginBottom: vs(20) }, style]}
testID={`${placeholder}-input`}
/>
)
}
37 changes: 30 additions & 7 deletions test/e2e/1-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { expect } from 'detox'
* 4. Add the first default mint
*/

describe('Add the default mint', () => {
describe('Add the testnut mint', () => {
beforeAll(async () => {
await device.launchApp()
})

const testmint = 'testnut.cashu.space'

it('should go through the 3 onboarding screens', async () => {
const header1 = element(by.text('eNuts & Ecash'))
const header2 = element(by.text('Cashu & Mints'))
Expand All @@ -39,21 +41,42 @@ describe('Add the default mint', () => {
})

it('should skip PIN setup', async () => {
const skipBtn = element(by.id('Skip-pin-button'))
const skipBtn = element(by.id('Skip-button'))
await expect(skipBtn).toBeVisible()
await skipBtn.tap()
})

it('should add the first default mint', async () => {
it('should navigate to mint screen and press "Add a new mint"', async () => {
const header1 = element(by.text('No transactions yet'))
await expect(header1).toBeVisible()
const addMintBtn = element(by.id('Mint-btn'))
await expect(addMintBtn).toBeVisible()
await addMintBtn.tap()
const initialModalHeader = element(by.id('initial-modal-header'))
await expect(initialModalHeader).toBeVisible()
const addMintUrlBtn = element(by.id('Use the eNuts mint-modal-button'))
await addMintUrlBtn.tap()
const addNewMintBtn = element(by.id('Add a new mint-button'))
await expect(addNewMintBtn).toBeVisible()
await addNewMintBtn.tap()
})

it('BAD CASE: open the text input and type an invalid mint url', async () => {
const input = element(by.id('Mint URL-input'))
const submitBtn = element(by.id('Add mint-modal-button'))
await expect(input).toBeVisible()
await expect(submitBtn).toBeVisible()
await input.typeText('invalid-mint-url')
await submitBtn.tap()
const errorToaster = element(by.id('error-toaster'))
await expect(errorToaster).toBeVisible()
await errorToaster.tap()
await input.clearText()
})

it('should type the valid testnut url and submit', async () => {
const input = element(by.id('Mint URL-input'))
const submitBtn = element(by.id('Add mint-modal-button'))
await expect(input).toBeVisible()
await expect(submitBtn).toBeVisible()
await input.typeText(testmint)
await submitBtn.tap()
const successModalHeader = element(by.id('new-mint-success'))
await expect(successModalHeader).toBeVisible()
})
Expand Down

0 comments on commit eb826be

Please sign in to comment.