Errors in running e2e tests locally on fedora

@dhruv glad everything is working for you now! When you get a chance, could you share how you resolved the earlier error (connect ECONNREFUSED 127.0.0.1:37655)? It could be helpful for others who might run into the same issue. Thanks!

I installed Java and google chrome for ubuntu.

1 Like

Hi @Lorena_Rodriguez , npm run wdio-visual-mobile running this command I am getting the same error. Can you guide me to solve this?

[0-0] RUNNING in chrome - file:///tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[0-0] Error: Failed to sync
[0-0]     at syncAndWaitForSuccess (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:413:13)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[0-0]     at async Object.sync (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:439:3)
[0-0]     at async Object.updateSettings (/home/dhruv11p/cht-core/tests/utils/index.js:602:5)
[0-0]     at async updateContactSummarySettings (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/contact-user-management.wdio-spec.js:20:5)
[0-0]     at async Context.<anonymous> (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/contact-user-management.wdio-spec.js:46:5)
[0-0]     at async Context.executeAsync (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:286:24)
[0-0]     at async Context.testFrameworkFnWrapper (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:51:18)
[0-0] Error: waitUntil condition timed out after 15000ms
[0-0]     at file:///home/dhruv11p/cht-core/node_modules/webdriverio/build/commands/browser/waitUntil.js:41:19
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[0-0]     at async Browser.wrapCommandFn (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:90:29)
[0-0]     at async openHamburgerMenu (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:77:3)
[0-0]     at async syncAndWaitForSuccess (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:400:5)
[0-0]     at async Object.sync (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:439:3)
[0-0]     at async updateSettings (/home/dhruv11p/cht-core/tests/utils/index.js:602:5)
[0-0]     at async Object.updatePermissions (/home/dhruv11p/cht-core/tests/utils/index.js:1573:3)
[0-0]     at async Context.<anonymous> (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/contact-user-management.wdio-spec.js:134:7)
[0-0]     at async Context.executeAsync (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:286:24)
[0-0]     at async Context.testFrameworkFnWrapper (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:51:18)
[0-0] PASSED in chrome - file:///tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[0-1] RUNNING in chrome - file:///tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
[0-1] Error: Failed to sync
[0-1]     at syncAndWaitForSuccess (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:413:13)
[0-1]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[0-1]     at async Object.sync (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:439:3)
[0-1]     at async updateSettings (/home/dhruv11p/cht-core/tests/utils/index.js:602:5)
[0-1]     at async Object.updatePermissions (/home/dhruv11p/cht-core/tests/utils/index.js:1573:3)
[0-1]     at async Context.<anonymous> (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js:63:5)
[0-1]     at async Context.executeAsync (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:286:24)
[0-1]     at async Context.testFrameworkFnWrapper (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:51:18)
[0-1] PASSED in chrome - file:///tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
docker compose -f /home/dhruv11p/cht-core/tests/cht-core-test.yml -f /home/dhruv11p/cht-core/tests/cht-couchdb-cluster-test.yml -p cht-e2e down -t 0 --remove-orphans --volumes
 Container cht-e2e-couchdb-2.local-1  Stopping
 Container cht-e2e-couchdb-3.local-1  Stopping
 Container cht-e2e-sentinel-1  Stopping
 Container cht-e2e-healthcheck-1  Stopping
 Container cht-e2e-nginx-1  Stopping
 Container cht-e2e-couchdb-1.local-1  Stopping
 Container cht-e2e-couchdb-3.local-1  Stopped
 Container cht-e2e-couchdb-3.local-1  Removing
 Container cht-e2e-couchdb-3.local-1  Removed
 Container cht-e2e-couchdb-2.local-1  Stopped
 Container cht-e2e-couchdb-2.local-1  Removing
 Container cht-e2e-couchdb-2.local-1  Removed
 Container cht-e2e-sentinel-1  Stopped
 Container cht-e2e-sentinel-1  Removing
 Container cht-e2e-sentinel-1  Removed
 Container cht-e2e-healthcheck-1  Stopped
 Container cht-e2e-healthcheck-1  Removing
 Container cht-e2e-healthcheck-1  Removed
 Container cht-e2e-couchdb-1.local-1  Stopped
 Container cht-e2e-couchdb-1.local-1  Removing
 Container cht-e2e-couchdb-1.local-1  Removed
 Container cht-e2e-nginx-1  Stopped
 Container cht-e2e-nginx-1  Removing
 Container cht-e2e-nginx-1  Removed
 Container cht-e2e-api-1  Stopping
 Container cht-e2e-api-1  Stopped
 Container cht-e2e-api-1  Removing
 Container cht-e2e-api-1  Removed
 Container cht-e2e-haproxy-1  Stopping
 Container cht-e2e-haproxy-1  Stopped
 Container cht-e2e-haproxy-1  Removing
 Container cht-e2e-haproxy-1  Removed
 Volume cht-e2e_cht-credentials  Removing
 Volume cht-e2e_cht-ssl  Removing
 Volume cht-e2e_cht-ssl  Removed
 Network cht-net-e2e  Removing
 Volume cht-e2e_cht-credentials  Removed
 Network cht-net-e2e  Removed


Report successfully generated to allure-report
Allure report successfully generated

 "spec" Reporter:
------------------------------------------------------------------
[chrome 136.0.7103.59 linux #0-0] Running: chrome (v136.0.7103.59) on linux
[chrome 136.0.7103.59 linux #0-0] Session ID: 9232c2ff5851e1e235c696fd49980612
[chrome 136.0.7103.59 linux #0-0]
[chrome 136.0.7103.59 linux #0-0] » /tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[chrome 136.0.7103.59 linux #0-0] Contact and User Management
[chrome 136.0.7103.59 linux #0-0]     Contact and user overview
[chrome 136.0.7103.59 linux #0-0]        ✓ should show contacts list, search, profiles (person and family), contact summary
[chrome 136.0.7103.59 linux #0-0]        ✓ should show condition cards
[chrome 136.0.7103.59 linux #0-0]        ✓ should show profiles (area and branch)
[chrome 136.0.7103.59 linux #0-0]        ✓ should show UHC sort
[chrome 136.0.7103.59 linux #0-0]        ✓ should show cares guides
[chrome 136.0.7103.59 linux #0-0]
[chrome 136.0.7103.59 linux #0-0] 5 passing (3m 13.5s)
------------------------------------------------------------------
[chrome 136.0.7103.59 linux #0-1] Running: chrome (v136.0.7103.59) on linux
[chrome 136.0.7103.59 linux #0-1] Session ID: 727803791c12f4380d63ffd3e689859c
[chrome 136.0.7103.59 linux #0-1]
[chrome 136.0.7103.59 linux #0-1] » /tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
[chrome 136.0.7103.59 linux #0-1] Contact List Page
[chrome 136.0.7103.59 linux #0-1]    ✓ should show contacts page tab when can_view_contact and can_view_contacts_tab permissions are enabled
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as tab and from menu option when can_view_contacts_tab permissions is enable but can_view_contact permission is not
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as tab, show from menu option when can_view_contact permissions is enable but can_view_contact permission is not
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as a tab and from menu option when can_view_contact and can_view_contact permissions are disable
[chrome 136.0.7103.59 linux #0-1]
[chrome 136.0.7103.59 linux #0-1] 4 passing (2m 27.9s)


Spec Files:      2 passed, 2 total (100% completed) in 00:07:42

@dhruv, the same here, it looks like the Failed to sync error is a timing issue. Since the test still passed, it doesn’t seem to be affecting the outcome for now. Are the screenshots being generated in the /image folder?

I’ll create a separate ticket to address the Failed to sync error in the contacts visual tests, but this shouldn’t block your work.

1 Like

Yes Screenshots are generated.

2 Likes

Hi @Lorena_Rodriguez, I made few changes to the code of syncAndWaitForSuccess and it worked.

const syncAndWaitForSuccess = async (expectReload, timeout = RELOAD_SYNC_TIMEOUT, retry = 10) => {
  if (retry < 0) {
    throw new Error('Failed to sync after 10 retries');
  }
  try {
    console.log(`Starting sync attempt. Retry count: ${10 - retry}`);
    await openHamburgerMenu();

    const syncInProgress = await hamburgerMenuSelectors.syncInProgress();
    if (!await syncInProgress.isDisplayedInViewport()) {
      console.log('No sync in progress. Clicking sync button...');
      await (await hamburgerMenuSelectors.syncButton()).click();
    }

    console.log('Waiting for sync to complete...');
    await syncInProgress.waitForDisplayed({ timeout, reverse: true });

    console.log('Checking for sync success or modal...');
    await browser.waitUntil(async () => {
      const isSuccess = await (await hamburgerMenuSelectors.syncSuccess()).isDisplayedInViewport();
      const isModalDisplayed = await modalPage.isDisplayed();
      console.log(`Sync Success: ${isSuccess}, Modal Displayed: ${isModalDisplayed}`);
      return isSuccess || isModalDisplayed;
    }, { timeout });

    await openHamburgerMenu();
    if (!await (await hamburgerMenuSelectors.syncSuccess()).isDisplayedInViewport()) {
      throw new Error('Failed to sync');
    }

    console.log('Sync completed successfully.');
  } catch (err) {
    console.error('Error during sync:', err);
    return await syncAndWaitForSuccess(expectReload, timeout, retry - 1);
  }
};

Logs–

[0-0] RUNNING in chrome - file:///tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[0-0] Starting sync attempt. Retry count: 0
[0-0] No sync in progress. Clicking sync button...
[0-0] Waiting for sync to complete...
[0-0] Checking for sync success or modal...
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: true
[0-0] Error during sync: Error: Failed to sync
[0-0]     at syncAndWaitForSuccess (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:448:13)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[0-0]     at async Object.sync (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:477:3)
[0-0]     at async Object.updateSettings (/home/dhruv11p/cht-core/tests/utils/index.js:602:5)
[0-0]     at async updateContactSummarySettings (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/contact-user-management.wdio-spec.js:20:5)
[0-0]     at async Context.<anonymous> (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/contact-user-management.wdio-spec.js:46:5)
[0-0]     at async Context.executeAsync (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:286:24)
[0-0]     at async Context.testFrameworkFnWrapper (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:51:18)
[0-0] Starting sync attempt. Retry count: 1
[0-0] No sync in progress. Clicking sync button...
[0-0] Waiting for sync to complete...
[0-0] Checking for sync success or modal...
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: true, Modal Displayed: false
[0-0] Sync completed successfully.
[0-0] Starting sync attempt. Retry count: 0
[0-0] No sync in progress. Clicking sync button...
[0-0] Waiting for sync to complete...
[0-0] Checking for sync success or modal...
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: false
[0-0] Sync Success: false, Modal Displayed: true
[0-0] Sync completed successfully.
[0-0] Starting sync attempt. Retry count: 0
[0-0] No sync in progress. Clicking sync button...
[0-0] Waiting for sync to complete...
[0-0] Checking for sync success or modal...
[0-0] Sync Success: false, Modal Displayed: true
[0-0] Sync completed successfully.
[0-0] PASSED in chrome - file:///tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[0-1] RUNNING in chrome - file:///tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
[0-1] Starting sync attempt. Retry count: 0
[0-1] No sync in progress. Clicking sync button...
[0-1] Waiting for sync to complete...
[0-1] Checking for sync success or modal...
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: true
[0-1] Error during sync: Error: Failed to sync
[0-1]     at syncAndWaitForSuccess (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:448:13)
[0-1]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[0-1]     at async Object.sync (/home/dhruv11p/cht-core/tests/page-objects/default/common/common.wdio.page.js:477:3)
[0-1]     at async updateSettings (/home/dhruv11p/cht-core/tests/utils/index.js:602:5)
[0-1]     at async Object.updatePermissions (/home/dhruv11p/cht-core/tests/utils/index.js:1573:3)
[0-1]     at async Context.<anonymous> (/home/dhruv11p/cht-core/tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js:63:5)
[0-1]     at async Context.executeAsync (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/shim.js:286:24)
[0-1]     at async Context.testFrameworkFnWrapper (file:///home/dhruv11p/cht-core/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:51:18)
[0-1] Starting sync attempt. Retry count: 1
[0-1] No sync in progress. Clicking sync button...
[0-1] Waiting for sync to complete...
[0-1] Checking for sync success or modal...
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: true, Modal Displayed: false
[0-1] Sync completed successfully.
[0-1] Starting sync attempt. Retry count: 0
[0-1] No sync in progress. Clicking sync button...
[0-1] Waiting for sync to complete...
[0-1] Checking for sync success or modal...
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: true
[0-1] Sync completed successfully.
[0-1] Starting sync attempt. Retry count: 0
[0-1] No sync in progress. Clicking sync button...
[0-1] Waiting for sync to complete...
[0-1] Checking for sync success or modal...
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: false
[0-1] Sync Success: false, Modal Displayed: true
[0-1] Sync completed successfully.
[0-1] PASSED in chrome - file:///tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
docker compose -f /home/dhruv11p/cht-core/tests/cht-core-test.yml -f /home/dhruv11p/cht-core/tests/cht-couchdb-cluster-test.yml -p cht-e2e down -t 0 --remove-orphans --volumes
 Container cht-e2e-nginx-1  Stopping
 Container cht-e2e-healthcheck-1  Stopping
 Container cht-e2e-couchdb-3.local-1  Stopping
 Container cht-e2e-couchdb-2.local-1  Stopping
 Container cht-e2e-sentinel-1  Stopping
 Container cht-e2e-couchdb-1.local-1  Stopping
 Container cht-e2e-couchdb-2.local-1  Stopped
 Container cht-e2e-couchdb-2.local-1  Removing
 Container cht-e2e-couchdb-2.local-1  Removed
 Container cht-e2e-sentinel-1  Stopped
 Container cht-e2e-sentinel-1  Removing
 Container cht-e2e-sentinel-1  Removed
 Container cht-e2e-couchdb-3.local-1  Stopped
 Container cht-e2e-couchdb-3.local-1  Removing
 Container cht-e2e-couchdb-3.local-1  Removed
 Container cht-e2e-healthcheck-1  Stopped
 Container cht-e2e-healthcheck-1  Removing
 Container cht-e2e-healthcheck-1  Removed
 Container cht-e2e-couchdb-1.local-1  Stopped
 Container cht-e2e-couchdb-1.local-1  Removing
 Container cht-e2e-nginx-1  Stopped
 Container cht-e2e-nginx-1  Removing
 Container cht-e2e-couchdb-1.local-1  Removed
 Container cht-e2e-nginx-1  Removed
 Container cht-e2e-api-1  Stopping
 Container cht-e2e-api-1  Stopped
 Container cht-e2e-api-1  Removing
 Container cht-e2e-api-1  Removed
 Container cht-e2e-haproxy-1  Stopping
 Container cht-e2e-haproxy-1  Stopped
 Container cht-e2e-haproxy-1  Removing
 Container cht-e2e-haproxy-1  Removed
 Volume cht-e2e_cht-ssl  Removing
 Volume cht-e2e_cht-credentials  Removing
 Network cht-net-e2e  Removing
 Volume cht-e2e_cht-ssl  Removed
 Volume cht-e2e_cht-credentials  Removed
 Network cht-net-e2e  Removed


Report successfully generated to allure-report
Allure report successfully generated

 "spec" Reporter:
------------------------------------------------------------------
[chrome 136.0.7103.59 linux #0-0] Running: chrome (v136.0.7103.59) on linux
[chrome 136.0.7103.59 linux #0-0] Session ID: 1ec4bdb62cd723554ebdecead80e8746
[chrome 136.0.7103.59 linux #0-0]
[chrome 136.0.7103.59 linux #0-0] » /tests/e2e/visual/contacts/contact-user-management.wdio-spec.js
[chrome 136.0.7103.59 linux #0-0] Contact and User Management
[chrome 136.0.7103.59 linux #0-0]     Contact and user overview
[chrome 136.0.7103.59 linux #0-0]        ✓ should show contacts list, search, profiles (person and family), contact summary
[chrome 136.0.7103.59 linux #0-0]        ✓ should show condition cards
[chrome 136.0.7103.59 linux #0-0]        ✓ should show profiles (area and branch)
[chrome 136.0.7103.59 linux #0-0]        ✓ should show UHC sort
[chrome 136.0.7103.59 linux #0-0]        ✓ should show cares guides
[chrome 136.0.7103.59 linux #0-0]
[chrome 136.0.7103.59 linux #0-0] 5 passing (3m 33s)
------------------------------------------------------------------
[chrome 136.0.7103.59 linux #0-1] Running: chrome (v136.0.7103.59) on linux
[chrome 136.0.7103.59 linux #0-1] Session ID: ef0e8da6fcf108fdfb5be28ff2056a90
[chrome 136.0.7103.59 linux #0-1]
[chrome 136.0.7103.59 linux #0-1] » /tests/e2e/visual/contacts/list-view-login-visual.wdio-spec.js
[chrome 136.0.7103.59 linux #0-1] Contact List Page
[chrome 136.0.7103.59 linux #0-1]    ✓ should show contacts page tab when can_view_contact and can_view_contacts_tab permissions are enabled
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as tab and from menu option when can_view_contacts_tab permissions is enable but can_view_contact permission is not
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as tab, show from menu option when can_view_contact permissions is enable but can_view_contact permission is not
[chrome 136.0.7103.59 linux #0-1]    ✓ should hide contacts page as a tab and from menu option when can_view_contact and can_view_contact permissions are disable
[chrome 136.0.7103.59 linux #0-1]
[chrome 136.0.7103.59 linux #0-1] 4 passing (2m 37.8s)


Spec Files:      2 passed, 2 total (100% completed) in 00:08:06

Great! Can’t wait to see your work!.

1 Like