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

add login-screen.spec.js to oauth2 #1792

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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: 3 additions & 0 deletions generators/react-native/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2595,6 +2595,9 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket
"babel.config.js": {
"stateCleared": "modified",
},
"e2e/account/login-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
Expand Down
9 changes: 5 additions & 4 deletions generators/react-native/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,23 @@ const files = {
],
detox: [
{
condition: context => context.detox === true,
condition: context => context.detox,
templates: [
'.detoxrc.cjs',
'e2e/jest.config.cjs',
'e2e/home-screen.spec.js',
'e2e/utils.js',
'e2e/scripts/download-expo.sh',
'e2e/scripts/setup.sh',
'e2e/account/login-screen.spec.js',
],
},
{
condition: context => context.detox === true && !context.skipUserManagement,
templates: ['e2e/account/change-password-screen.spec.js', 'e2e/account/login-screen.spec.js', 'e2e/account/settings-screen.spec.js'],
condition: context => context.detox && !context.skipUserManagement,
templates: ['e2e/account/change-password-screen.spec.js', 'e2e/account/settings-screen.spec.js'],
},
{
condition: context => context.detox === true && !(context.websocket === 'no'),
condition: context => context.detox && context.websocket && context.websocket !== 'no',
templates: ['e2e/websockets/chat-screen.spec.js'],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function LoginScreen(props) {

return (
<KeyboardAwareScrollView contentContainerStyle={styles.container} keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag">
<Button title={'Login'} onPress={attemptLogin} disabled={fetchingAuthInfo || fetchingAccount} />
<Button testID="loginScreenLoginButton" title={'Login'} onPress={attemptLogin} disabled={fetchingAuthInfo || fetchingAccount} />
{authInfoError ? <Text style={styles.errorText}>Error fetching auth info from backend.</Text> : null}
{loginError ? <Text style={styles.errorText}>{loginError}</Text> : null}
{(fetchingAuthInfo || fetchingAccount) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ describe('Login Screen Tests', () => {

it('should show an alert on log in failure', async () => {
await navigateToLoginScreen();
<%_ if (authenticationTypeOauth2) { _%>
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like JWT logic rather than OAuth logic.

await waitThenTapButton('loginScreenLoginButton');
await web.element(by.id('loginScreenUsername')).replaceText('invalid');
await web.element(by.id('loginScreenPassword')).replaceText('invalid');
await web.element(by.id('loginScreenPassword')).tap();
<%_ } else { _%>
await element(by.id('loginScreenUsername')).replaceText('invalid');
await element(by.id('loginScreenPassword')).replaceText('invalid');
await waitThenTapButton('loginScreenLoginButton')
await waitThenTapButton('loginScreenLoginButton');
<%_ } _%>
await waitForElementToBeVisibleById('loginErrorMessage');
await expect(element(by.id('loginErrorMessage'))).toBeVisible();
});
Expand Down
6 changes: 1 addition & 5 deletions test/expected-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ const expectedFiles = {
'e2e/scripts/setup.sh',
],
detoxAndWebsockets: ['e2e/websockets/chat-screen.spec.js'],
detoxAndNotOauth: [
'e2e/account/change-password-screen.spec.js',
'e2e/account/login-screen.spec.js',
'e2e/account/settings-screen.spec.js',
],
detoxAndNotOauth: ['e2e/account/change-password-screen.spec.js', 'e2e/account/settings-screen.spec.js'],
oauth: [
'app/shared/fixtures/get-oauth-info.json',
'app/shared/sagas/auth-info.saga.js',
Expand Down
Loading