More e2e tests (create account) (#150)
This commit is contained in:
@@ -1,12 +1,27 @@
|
|||||||
/* eslint-env detox/detox */
|
/* eslint-env detox/detox */
|
||||||
|
|
||||||
describe('Example', () => {
|
describe('Example', () => {
|
||||||
async function grantAccessToUserWithValidCredentials(username) {
|
async function grantAccessToUserWithValidCredentials(
|
||||||
|
username,
|
||||||
|
{takeScreenshots} = {takeScreenshots: false},
|
||||||
|
) {
|
||||||
await element(by.id('signInButton')).tap()
|
await element(by.id('signInButton')).tap()
|
||||||
|
if (takeScreenshots) {
|
||||||
|
await device.takeScreenshot('1- opened sign-in screen')
|
||||||
|
}
|
||||||
await element(by.id('loginSelectServiceButton')).tap()
|
await element(by.id('loginSelectServiceButton')).tap()
|
||||||
|
if (takeScreenshots) {
|
||||||
|
await device.takeScreenshot('2- opened service selector')
|
||||||
|
}
|
||||||
await element(by.id('localDevServerButton')).tap()
|
await element(by.id('localDevServerButton')).tap()
|
||||||
|
if (takeScreenshots) {
|
||||||
|
await device.takeScreenshot('3- selected local dev server')
|
||||||
|
}
|
||||||
await element(by.id('loginUsernameInput')).typeText(username)
|
await element(by.id('loginUsernameInput')).typeText(username)
|
||||||
await element(by.id('loginPasswordInput')).typeText('hunter2')
|
await element(by.id('loginPasswordInput')).typeText('hunter2')
|
||||||
|
if (takeScreenshots) {
|
||||||
|
await device.takeScreenshot('4- entered username and password')
|
||||||
|
}
|
||||||
await element(by.id('loginNextButton')).tap()
|
await element(by.id('loginNextButton')).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,23 +31,47 @@ describe('Example', () => {
|
|||||||
await device.launchApp({permissions: {notifications: 'YES'}})
|
await device.launchApp({permissions: {notifications: 'YES'}})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('As a user, I can see the login screen', async () => {
|
|
||||||
await expect(element(by.id('signInButton'))).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('As Alice, I can login', async () => {
|
it('As Alice, I can login', async () => {
|
||||||
await grantAccessToUserWithValidCredentials('alice')
|
await expect(element(by.id('signInButton'))).toBeVisible()
|
||||||
await device.takeScreenshot('opened general section')
|
await grantAccessToUserWithValidCredentials('alice', {
|
||||||
|
takeScreenshots: true,
|
||||||
|
})
|
||||||
|
await device.takeScreenshot('5- opened home screen')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('As Alice, I can login, and post a text', async () => {
|
it('As Alice, I can login, and post a text', async () => {
|
||||||
await grantAccessToUserWithValidCredentials('alice')
|
await grantAccessToUserWithValidCredentials('alice')
|
||||||
await element(by.id('composePromptButton')).tap()
|
await element(by.id('composePromptButton')).tap()
|
||||||
|
await device.takeScreenshot('1- opened composer')
|
||||||
await element(by.id('composerTextInput')).typeText(
|
await element(by.id('composerTextInput')).typeText(
|
||||||
'Greetings earthlings, I come in peace... and to run some tests.',
|
'Greetings earthlings, I come in peace... and to run some tests.',
|
||||||
)
|
)
|
||||||
|
await device.takeScreenshot('2- entered text')
|
||||||
await element(by.id('composerPublishButton')).tap()
|
await element(by.id('composerPublishButton')).tap()
|
||||||
await device.takeScreenshot('opened general section')
|
await device.takeScreenshot('3- opened general section')
|
||||||
await expect(element(by.id('composePromptButton'))).toBeVisible()
|
await expect(element(by.id('composePromptButton'))).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('I can create a new account', async () => {
|
||||||
|
await element(by.id('createAccountButton')).tap()
|
||||||
|
await device.takeScreenshot('1- opened create account screen')
|
||||||
|
await element(by.id('registerSelectServiceButton')).tap()
|
||||||
|
await device.takeScreenshot('2- opened service selector')
|
||||||
|
await element(by.id('localDevServerButton')).tap()
|
||||||
|
await device.takeScreenshot('3- selected local dev server')
|
||||||
|
await element(by.id('registerEmailInput')).typeText('example@test.com')
|
||||||
|
await element(by.id('registerPasswordInput')).typeText('hunter2')
|
||||||
|
await element(by.id('registerHandleInput')).typeText('e2e-test')
|
||||||
|
await element(by.id('registerIs13Input')).tap()
|
||||||
|
await device.takeScreenshot('4- entered account details')
|
||||||
|
await element(by.id('createAccountButton')).tap()
|
||||||
|
await expect(element(by.id('onboardFeatureExplainerSkipBtn'))).toBeVisible()
|
||||||
|
await expect(element(by.id('onboardFeatureExplainerNextBtn'))).toBeVisible()
|
||||||
|
await device.takeScreenshot('5- onboard feature explainer')
|
||||||
|
await element(by.id('onboardFeatureExplainerSkipBtn')).tap()
|
||||||
|
await expect(element(by.id('onboardFollowsSkipBtn'))).toBeVisible()
|
||||||
|
await expect(element(by.id('onboardFollowsNextBtn'))).toBeVisible()
|
||||||
|
await device.takeScreenshot('6- onboard follows recommender')
|
||||||
|
await element(by.id('onboardFollowsSkipBtn')).tap()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -121,11 +121,15 @@ export const FeatureExplainer = () => {
|
|||||||
<View />
|
<View />
|
||||||
)}
|
)}
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
<TouchableOpacity onPress={onPressSkip}>
|
<TouchableOpacity
|
||||||
|
onPress={onPressSkip}
|
||||||
|
testID="onboardFeatureExplainerSkipBtn">
|
||||||
<Text style={[s.blue3, s.f18]}>Skip</Text>
|
<Text style={[s.blue3, s.f18]}>Skip</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={s.flex1} />
|
<View style={s.flex1} />
|
||||||
<TouchableOpacity onPress={onPressNext}>
|
<TouchableOpacity
|
||||||
|
onPress={onPressNext}
|
||||||
|
testID="onboardFeatureExplainerNextBtn">
|
||||||
<Text style={[s.blue3, s.f18]}>Next</Text>
|
<Text style={[s.blue3, s.f18]}>Next</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ export const Follows = observer(() => {
|
|||||||
<SuggestedFollows onNoSuggestions={onNoSuggestions} />
|
<SuggestedFollows onNoSuggestions={onNoSuggestions} />
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
<TouchableOpacity onPress={onPressNext}>
|
<TouchableOpacity onPress={onPressNext} testID="onboardFollowsSkipBtn">
|
||||||
<Text style={[s.blue3, s.f18]}>Skip</Text>
|
<Text style={[s.blue3, s.f18]}>Skip</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={s.flex1} />
|
<View style={s.flex1} />
|
||||||
<TouchableOpacity onPress={onPressNext}>
|
<TouchableOpacity onPress={onPressNext} testID="onboardFollowsNextBtn">
|
||||||
<Text style={[s.blue3, s.f18]}>Next</Text>
|
<Text style={[s.blue3, s.f18]}>Next</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user