Add logged out e2e ctrl, fix login test
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
/* eslint-env detox/detox */
|
/* eslint-env detox/detox */
|
||||||
|
|
||||||
|
import {describe, beforeAll, it} from '@jest/globals'
|
||||||
|
import {expect} from 'detox'
|
||||||
import {openApp, login, createServer} from '../util'
|
import {openApp, login, createServer} from '../util'
|
||||||
|
|
||||||
describe('Login', () => {
|
describe('Login', () => {
|
||||||
@@ -10,6 +12,8 @@ describe('Login', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('As Alice, I can login', async () => {
|
it('As Alice, I can login', async () => {
|
||||||
|
await element(by.id('e2eOpenLoggedOutView')).tap()
|
||||||
|
|
||||||
await expect(element(by.id('signInButton'))).toBeVisible()
|
await expect(element(by.id('signInButton'))).toBeVisible()
|
||||||
await login(service, 'alice', 'hunter2', {
|
await login(service, 'alice', 'hunter2', {
|
||||||
takeScreenshots: true,
|
takeScreenshots: true,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {useModalControls} from '#/state/modals'
|
|||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
import {useSessionApi} from '#/state/session'
|
import {useSessionApi} from '#/state/session'
|
||||||
import {useSetFeedViewPreferencesMutation} from '#/state/queries/preferences'
|
import {useSetFeedViewPreferencesMutation} from '#/state/queries/preferences'
|
||||||
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This utility component is only included in the test simulator
|
* This utility component is only included in the test simulator
|
||||||
@@ -19,6 +20,7 @@ export function TestCtrls() {
|
|||||||
const {logout, login} = useSessionApi()
|
const {logout, login} = useSessionApi()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {mutate: setFeedViewPref} = useSetFeedViewPreferencesMutation()
|
const {mutate: setFeedViewPref} = useSetFeedViewPreferencesMutation()
|
||||||
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
const onPressSignInAlice = async () => {
|
const onPressSignInAlice = async () => {
|
||||||
await login({
|
await login({
|
||||||
service: 'http://localhost:3000',
|
service: 'http://localhost:3000',
|
||||||
@@ -95,6 +97,12 @@ export function TestCtrls() {
|
|||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
style={BTN}
|
style={BTN}
|
||||||
/>
|
/>
|
||||||
|
<Pressable
|
||||||
|
testID="e2eOpenLoggedOutView"
|
||||||
|
onPress={() => setShowLoggedOut(true)}
|
||||||
|
accessibilityRole="button"
|
||||||
|
style={BTN}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user