Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion KeychainExample/.detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = {
type: 'android.emulator',
headless: Boolean(process.env.CI),
device: {
avdName: 'TestingAVD',
avdName: 'Medium_Phone_API_36.1',
},
},
},
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion KeychainExample/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ allprojects {
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

ndk {
abiFilters 'arm64-v8a', 'x86', 'x86_64'
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}

Expand Down
52 changes: 52 additions & 0 deletions KeychainExample/e2e/testCases/knoxTest.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { by, element, expect, device } from 'detox';
import { enterBiometrics, waitForAuthValidity } from '../utils/authHelpers';

import {
expectCredentialsLoadedMessage,
expectCredentialsSavedMessage,
} from '../utils/statusMessageHelpers';

describe(':android:Knox Storage', () => {
beforeEach(async () => {
await device.launchApp({ newInstance: true });
});

it(':android:should save with Knox storage', async () => {
// Check if Knox option is available
const isKnoxAvailable = await element(by.text('Knox')).atIndex(0).exists();

if (!isKnoxAvailable) {
console.warn('Knox option not found, skipping test.');
return; // Skip the test if Knox is not available
}

await expect(element(by.text('Keychain Example'))).toExist();
await element(by.id('usernameInput')).typeText('testUsernameKnox');
await element(by.id('passwordInput')).typeText('testPasswordKnox');
// Hide keyboard
await element(by.text('Keychain Example')).tap();

// Select Knox Storage
await element(by.text('Knox')).tap();

await expect(element(by.text('Save'))).toBeVisible();
await element(by.text('Save')).tap();

// Knox usually requires auth, so we might need to enter biometrics depending on implementation
// But based on App.tsx, we are using the default Access Control (Biometry + Passcode)
// which requires auth.
await enterBiometrics();

await expectCredentialsSavedMessage();
await waitForAuthValidity();

await element(by.text('Load')).tap();
await enterBiometrics();

await expectCredentialsLoadedMessage(
'testUsernameKnox',
'testPasswordKnox',
'KnoxAES'
);
});
});
Loading