DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 672 forks source link

Getting architecture error while running scripts in Mac book with Apple M1 Pro chip #7709

Closed Anusha66v closed 1 year ago

Anusha66v commented 1 year ago

What is your Scenario?

Executing testcafe scripts in Macbook(Apple M1 Pro chip) in Chrome/firefox/Safari browser

What is the Current behavior?

Getting below error when trying to execute scripts.

Error: dlopen(/Users/XXXXX/Documents/node_modules/canvas/build/Release/canvas.node, 0x0001): tried: '/Users/XXXXX/Documents/node_modules/canvas/build/Release/canvas.node' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) at Object. (/Users/XXXX/Documents/node_modules/canvas/lib/bindings.js:3:18) at Object. (/Users/XXXX/Documents/node_modules/canvas/lib/canvas.js:9:18) at Object. (/Users/XXXX/Documents/node_modules/node_modules/canvas/index.js:1:16) at /Users/XXXX/Documents/node_modules/resemblejs/resemble.js:67:18 at /Users/XXXX/Documents/node_modules/node_modules/resemblejs/resemble.js:55:26 at Object. (/Users/amalka547/Documents/UEX/dotcom2-automation/node_modules/resemblejs/resemble.js:59:3) at Object. (/Users/XXXX/Documents/node_modules/testcafe-D2-vrt-reporter/util.js:2:1) at Object. (/Users/XXXX/Documents/node_modules/automation/pages/components/polarisHeaderAndFooter.js:3:1) at Object. (/Users/XXXX/Documents/node_modules/automation/utils/pageFactory.js:16:1) at Object. (//Users/XXXX/Documents/node_modules/automation/pages/Archive/subnavTests.js:2:1)

What is the Expected behavior?

Scripts should get executed in Apple M1 Pro chip

What is your public website URL? (or attach your complete example)

https://customer.xfinity.com/

What is your TestCafe test code?

test("TC_Account_Communications_Landing_Page_Primary_User", async (tn) => { const page = new PageFactory(tD, tn); await page.url.launchUrl(); await page.jssAccountCommunications.addContactsApiLogger(); await page.jssAccountCommunications.addSsmUserLogger(); await page.jssAccountCommunications.addSettingsPageUserLogger(); await page.url.cimaSignIn(); await page.url.clickapp(); var response = await page.sitecore.getSitecoreValueSettings( "settingsAccountCommunicationsSc" ); await page.url.relogin(); //await page.settings.navigateToSettingsPage(); await page.jssSettings.clickAccountCommunicationsLink(); /await page.url.relogin(); await page.jssUserManagment.verifyBackCloseButton(response); await page.jssSettings.clickAccountCommunicationsLink();/ await page.jssSettings.verifyPageHeader(response); var mockedResponses = await page.jssAccountCommunications.mockContactsAndUserApi( contactType5, "both_unverified" ); //await page.url.relogin(); await page.jssAccountCommunications.checkVerifyCard( response, "Mobile", mockedResponses.get("contactsApiResponse") ); await page.jssAccountCommunications.checkVerifyCard( response, "Email", mockedResponses.get("contactsApiResponse") ); await page.jssAccountCommunications.checkUserNotificationsComponentIsDisplayed(); await page.jssSettings.verifyHeader(response, "ContactMethods"); }).meta({ progression: "false", settings: "true", accountCommunications: "true", settingsLanding: "true", });

test( "TC_Account_Communications_Landing_page_ContactMethods" + contactType1 + "_Primary_user", async (tn) => { const page = new PageFactory(tD, tn); await page.url.launchUrl(); await page.url.cimaSignIn(); await page.url.clickapp(); await page.jssAccountCommunications.addSsmUserLogger(); await page.jssAccountCommunications.addContactsApiLogger(); await page.jssAccountCommunications.addSettingsPageUserLogger(); var response = await page.sitecore.getSitecoreValueSettings( "settingsAccountCommunicationsSc" ); //await page.settings.navigateToSettingsPage(); await page.url.relogin(); await page.jssSettings.clickAccountCommunicationsLink(); //await page.url.relogin(); var mockedResponses = await page.jssAccountCommunications.mockContactsAndUserApi( contactType1 ); //await page.url.relogin(); await page.jssAccountCommunications.verifyContactMethods( response, mockedResponses.get("userResponse"), mockedResponses.get("contactsApiResponse"), mockedResponses.get("accountResponse") ); await page.jssXid.verifyAddCta(response, "Email"); await page.jssXid.verifyAddCta(response, "Mobile"); } ).meta({ progression: "false", settings: "true", accountCommunications: "true", settingsLanding: "true", });

Your complete configuration file

No response

Your complete test report

No response

Screenshots

Screen Shot 2023-05-17 at 10 57 18 PM

Steps to Reproduce

  1. Execute testcafe script in Macbook with Apple M1 Pro chip in any browser

TestCafe version

1.18.0

Node.js version

v18.15.0

Command-line arguments

"smoke": "npm run remove:automation:report && testcafe --test-meta smoke=true firefox automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'",

Browser name(s) and version(s)

No response

Platform(s) and version(s)

macOS Monterey Version 12.6 Apple M1 Pro Chip

Other

No response

Artem-Babich commented 1 year ago

Hi, according to the error message, the issue is related to some "canvas" module, which is not used in TestCafe. Also, you didn't share the page model, so I cannot repeat the exact actions you execute on the page. Please share a simple working project illustrating the issue and the exact steps to reproduce it.

I look forward to your reply.

Anusha66v commented 1 year ago

Hi,

PFA for the framework.I have tagged 1 testcase which can be executed to reproduce the issue: 1.Navigate to package.json and this 19th line and you can right click and run script. check "smoke": "npm run remove:automation:report && testcafe --test-meta smoke1=true chrome automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'",

  1. Please execute the script in latest Mac machine with M1 chip configuration. [image: image.png]

Thanks, Anusha dotcom2-automation.zip https://drive.google.com/file/d/1xtm-bZ1AOQAPaEGoCj4wpzW9ChesH9iO/view?usp=drive_web

On Mon, May 22, 2023 at 4:56 AM Artem-Babich @.***> wrote:

Hi, according to the error message, the issue is related to some "canvas" module, which is not used in TestCafe. Also, you didn't share the page model, so I cannot repeat the exact actions you execute on the page. Please share a simple working project illustrating the issue and the exact steps to reproduce it.

I look forward to your reply.

— Reply to this email directly, view it on GitHub https://github.com/DevExpress/testcafe/issues/7709#issuecomment-1556819431, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7NSPVPJE5K7OGVL7WK3QGDXHMS4RANCNFSM6AAAAAAYF4TXR4 . You are receiving this because you authored the thread.Message ID: @.***>

Artem-Babich commented 1 year ago

Hello @Anusha66v

The link you shared requires access approval. I just sent this request. Please accept it or share your project in another way.

Regards, Artem

Anusha66v commented 1 year ago

Hello,

I gave access. You can try any automation test case in Macbook M1 chip,I am suspecting testcafe is not supporting M1 chop architecture Mac book.

Thanks

On Fri, Jun 2, 2023, 4:48 AM Artem-Babich @.***> wrote:

Hello @Anusha66v https://github.com/Anusha66v

The link you shared requires access approval. I just sent this request. Please accept it or share your project in another way.

Regards, Artem

— Reply to this email directly, view it on GitHub https://github.com/DevExpress/testcafe/issues/7709#issuecomment-1573381996, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7NSPVOYAKRUFFJBFG3EBSTXJGSF5ANCNFSM6AAAAAAYF4TXR4 . You are receiving this because you were mentioned.Message ID: @.***>

Anusha66v commented 1 year ago

Hello,

I gave access. Not just this framework,You can try to run any other available automation test case in Macbook M1 chip,I am suspecting testcafe is not supporting M1 chop architecture Mac book.

Thanks

On Fri, Jun 2, 2023, 7:21 AM Anusha vm @.***> wrote:

Hello,

I gave access. You can try any automation test case in Macbook M1 chip,I am suspecting testcafe is not supporting M1 chop architecture Mac book.

Thanks

On Fri, Jun 2, 2023, 4:48 AM Artem-Babich @.***> wrote:

Hello @Anusha66v https://github.com/Anusha66v

The link you shared requires access approval. I just sent this request. Please accept it or share your project in another way.

Regards, Artem

— Reply to this email directly, view it on GitHub https://github.com/DevExpress/testcafe/issues/7709#issuecomment-1573381996, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7NSPVOYAKRUFFJBFG3EBSTXJGSF5ANCNFSM6AAAAAAYF4TXR4 . You are receiving this because you were mentioned.Message ID: @.***>

Artem-Babich commented 1 year ago

Hello @Anusha66v

Thank you for sharing your project. In order to start it, I had to do the following:

  1. Remove your custom registry URL due to the download error.
  2. Remove the eslint-config dependency, since it is not available via the default npm registry URL.
  3. Install packages via npm i.
  4. Run "npm run smoke".
  5. After this I got an error message that states: Cannot find module "canvas".

According to the "Require stack", this module is used by the "resemble" module, which is used in your "***D2***/util.js" file. As I already mentioned, the error you encountered was produced by this module. After I removed the "canvas" folder from node_modules and added this module to package.json, I was able to run the smoke script.

So, we are closing this issue since it is not related to TestCafe.