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

[DEV] E2E chat opening #18

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0bcf5ea
wip: adding adb commands
hannojg Oct 24, 2023
947b43e
remove branch args
hannojg Oct 24, 2023
51d2ffc
add package scripts to help run in dev mode
hannojg Oct 24, 2023
4347739
fix docs
hannojg Oct 24, 2023
951c92a
update documentation
hannojg Oct 24, 2023
e16b218
doc: improve wording
hannojg Oct 24, 2023
3762292
remove note
hannojg Oct 24, 2023
8351917
wip adding test
hannojg Oct 25, 2023
abeb8f1
add missing config entry
hannojg Oct 25, 2023
dad3957
fix api mock not returning data when none onyx request
hannojg Oct 25, 2023
47f7e73
wip: navigate to report
hannojg Oct 25, 2023
e35656b
add more mock data
hannojg Oct 25, 2023
8816307
add mock for read newest action
hannojg Oct 25, 2023
9655acd
add mock for ReconnectToReport
hannojg Oct 25, 2023
8dfd4ab
wip: having a .e2e.js component
hannojg Oct 27, 2023
337bc06
implemented typing into composer
hannojg Oct 27, 2023
953b91d
send rerender results to client
hannojg Oct 27, 2023
602bdbd
remove the connotation of "duration"
hannojg Oct 27, 2023
8152008
add clearing of input
hannojg Oct 27, 2023
9ea214d
fix warnings thrown
hannojg Oct 27, 2023
9c66879
Merge branch 'e2e/add-typing-tests' of https://github.com/margelo/exp…
perunt Oct 27, 2023
31b677e
remove unused native ID
hannojg Oct 27, 2023
8ea9e07
Merge branch 'main' of github.com:Expensify/App into e2e/add-typing-t…
hannojg Oct 27, 2023
d8416c1
add index file
hannojg Oct 27, 2023
e01cf4f
add test
hannojg Oct 27, 2023
eda60a3
create chat opening test
perunt Oct 27, 2023
79e0621
add timers
perunt Oct 27, 2023
8b5a3e3
remove PAGES_CONST
perunt Oct 27, 2023
b4df74a
Merge branch 'main' of github.com:Expensify/App into e2e/add-typing-t…
hannojg Oct 30, 2023
d3d2102
fix e2e tests after eslint/prettier import changes
hannojg Oct 30, 2023
347d2a7
fix eslint warnings
hannojg Oct 30, 2023
d486d32
fix imports
hannojg Oct 30, 2023
ad214b9
Merge branch 'main' of github.com:Expensify/App into e2e/add-typing-t…
hannojg Oct 30, 2023
d9780d1
Merge branch 'main' of https://github.com/Expensify/App into perunt/e…
perunt Oct 30, 2023
56128e8
Merge branch 'main' of https://github.com/Expensify/App into perunt/e…
perunt Oct 30, 2023
d2c6d8e
end timing in ReportScreen
perunt Oct 31, 2023
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
11 changes: 7 additions & 4 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ require('dotenv').config();

const defaultConfig = getDefaultConfig(__dirname);

const isUsingMockAPI = process.env.E2E_TESTING === 'true';
const isE2ETesting = process.env.E2E_TESTING === 'true';

if (isUsingMockAPI) {
if (isE2ETesting) {
// eslint-disable-next-line no-console
console.log('⚠️⚠️⚠️⚠️ Using mock API ⚠️⚠️⚠️⚠️');
}

const e2eSourceExts = ['e2e.js', 'e2e.ts'];

/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
Expand All @@ -22,10 +24,11 @@ if (isUsingMockAPI) {
const config = {
resolver: {
assetExts: _.filter(defaultAssetExts, (ext) => ext !== 'svg'),
sourceExts: [...defaultSourceExts, 'jsx', 'svg'],
// When we run the e2e tests we want files that have the extension e2e.js to be resolved as source files
sourceExts: [...(isE2ETesting ? e2eSourceExts : []), ...defaultSourceExts, 'jsx', 'svg'],
resolveRequest: (context, moduleName, platform) => {
const resolution = context.resolveRequest(context, moduleName, platform);
if (isUsingMockAPI && moduleName.includes('/API')) {
if (isE2ETesting && moduleName.includes('/API')) {
const originalPath = resolution.filePath;
const mockPath = originalPath.replace('src/libs/API.ts', 'src/libs/E2E/API.mock.js').replace('/src/libs/API.js/', 'src/libs/E2E/API.mock.js');
// eslint-disable-next-line no-console
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
"analyze-packages": "ANALYZE_BUNDLE=true webpack --config config/webpack/webpack.common.js --env envFile=.env.production",
"symbolicate:android": "npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map",
"symbolicate:ios": "npx metro-symbolicate main.jsbundle.map",
"test:e2e:main": "node tests/e2e/testRunner.js --development --branch main --skipCheckout",
"test:e2e:delta": "node tests/e2e/testRunner.js --development --branch main --label delta --skipCheckout",
"test:e2e:dev": "node tests/e2e/testRunner.js --development --skipCheckout --config ./config.dev.js --buildMode skip --skipInstallDeps",
"test:e2e:main": "node tests/e2e/testRunner.js --development --skipCheckout",
"test:e2e:delta": "node tests/e2e/testRunner.js --development --label delta --skipCheckout --skipInstallDeps",
"test:e2e:compare": "node tests/e2e/merge.js",
"gh-actions-unused-styles": "./.github/scripts/findUnusedKeys.sh",
"workflow-test": "./workflow_tests/scripts/runWorkflowTests.sh",
Expand Down
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ const CONST = {
TIMING: {
CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action',
SEARCH_RENDER: 'search_render',
CHAT_RENDER: 'chat_render',
HOMEPAGE_INITIAL_RENDER: 'homepage_initial_render',
REPORT_INITIAL_RENDER: 'report_initial_render',
SWITCH_REPORT: 'switch_report',
Expand Down
13 changes: 10 additions & 3 deletions src/libs/E2E/API.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import mockAuthenticatePusher from './apiMocks/authenticatePusher';
import mockBeginSignin from './apiMocks/beginSignin';
import mockOpenApp from './apiMocks/openApp';
import mockOpenReport from './apiMocks/openReport';
import mockReadNewestAction from './apiMocks/readNewestAction';
import mockSigninUser from './apiMocks/signinUser';

/**
Expand All @@ -20,17 +21,23 @@ const mocks = {
OpenApp: mockOpenApp,
ReconnectApp: mockOpenApp,
OpenReport: mockOpenReport,
ReconnectToReport: mockOpenReport,
AuthenticatePusher: mockAuthenticatePusher,
ReadNewestAction: mockReadNewestAction,
};

function mockCall(command, apiCommandParameters, tag) {
const mockResponse = mocks[command] && mocks[command](apiCommandParameters);
if (!mockResponse || !_.isArray(mockResponse.onyxData)) {
Log.warn(`[${tag}] for command ${command} is not mocked yet!`);
if (!mockResponse) {
Log.warn(`[${tag}] for command ${command} is not mocked yet! ⚠️`);
return;
}

return Onyx.update(mockResponse.onyxData);
if (_.isArray(mockResponse.onyxData)) {
return Onyx.update(mockResponse.onyxData);
}

return Promise.resolve(mockResponse);
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/libs/E2E/actions/waitForKeyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {Keyboard} from 'react-native';

export default function waitForKeyboard() {
return new Promise((resolve) => {
function checkKeyboard() {
if (Keyboard.isVisible()) {
resolve();
} else {
console.debug(`[E2E] Waiting for keyboard to appear…`);
setTimeout(checkKeyboard, 1000);
}
}
checkKeyboard();
});
}
Loading
Loading