Open swiftinitdotcom opened 2 years ago
This sample is already two years old. I cannot say if it will still work, but I believe it should. Just give it a try.
thanks, is there anything better than this for sharepoint online automated testing?
I wouldn't say better, it's just a preference. I like Cypress, but you can also check Playwright, Selenium, ...
This sample is already two years old. I cannot say if it will still work, but I believe it should. Just give it a try.
I am struggling with this sample and seems not working
Yes i am struggling with this sample and all others :), my biggest achievement was when i logged successfully into microsoft.login but anyway after call cy.visit("sharepoint") its nothing happen just a after long time load failed .. I already ask in anothers topics but noone probably use cypress nowdays for sharepoint online...
@necik11 @sinnitesh I've recently switched to Playwright because its testing tools got a lot better and they introduced a test UI similar to what Cypress offers.
I'll write and share an example of it in the coming weeks.
The biggest advantage of using Playwright is that it doesn't have the iframe issues from Cypress.
Thank you for a tip Playwright and if there come some samples it will be great. I have some SPFx components / extensions and i wanted make some trivials tests for my CI / CD. I have feeling e2e tests could be better for testing after deploy on develop tenant. But with Cypress seems more problems come(iframe, some experimental configs) then some income.
Just uploaded my Playwright template: https://github.com/estruyf/testing-microsoft365-playwright-template
I am not sure if i am doing something wrong but firstly i got error:
"NODE_ENV" is not recognized as an internal or external command, operable command or batch file
npm install -g win-node-env
this work well
but after npm test
i have got error:
with npm run test:ui
i have got same error.
After rename .env.sample -> .env
npm test
-> still not working
but difference with npm run test:ui
:
i am stucked at this:
Could be a problem npm test cache wrong environments? And second problem can only think of with Cypress sometimes show i am logged with my "windows authentication" can not be the same problem?
@necik11 did you create the .env
file with the PAGE_URL
, USERNAME
, and PASSWORD
variables?
Yes of course - it was 1st stuff what am i did: "To get started, you need to configure the following environment variables" so i fill values: .env.sample but what I wrote is what followed.
Did some updates to the environment variables, it should now work on Windows as well.
It works great Thank you! You just need to rename the configuration file .env.sample -> .env
Hello, is there a solution that could also be used for production deployment? Since there is two-phase verification on the production servers... So via a simple post E.g. via appId + clientServer/ cert? Do you include the graph library? Or at least login in Windows credentials, which would be saved for some time, and take this session? Or is this unrealistic and is only suitable for testing environments?
@necik11 It becomes tricky if there is 2FA involved. E2E tests should be run on QA/Test environments. That said, a couple of months ago, I spoke to somebody who told me there could be a way, but it would mean you generate an access token and use it in your CI/CD until it expires.
Another approach could be to log in locally with Playwright (not running in headless mode), let it create the auth file, and use that in your CI/CD as a secret.
@necik11 I just updated the Playwright template to support MFA as well. Here you can see the automated login flow:
https://github.com/user-attachments/assets/def67313-deaf-4de6-a784-20c311c44e19
Template: https://github.com/estruyf/testing-microsoft365-playwright-template
Hi we want to do automated testing for sharepoint online based workflow forms is it possible to do it using cypress the html forms are mostly javascript based html forms and 20 workflows similar forms 4 stage workflows currently doing manual testing