GithubHelp home page GithubHelp logo

xrm-oss / d365-ui-test Goto Github PK

View Code? Open in Web Editor NEW
60.0 60.0 15.0 1.9 MB

An unopinionated UI testing library for Dynamics 365 CE and Dynamics Portals. Powered by TypeScript and playwright

Home Page: https://xrm-oss.github.io/D365-UI-Test/

License: MIT License

JavaScript 0.31% TypeScript 99.69%
crm d365 dynamics playwright test ui xrm

d365-ui-test's People

Contributors

digitalflow avatar imartinflores avatar julianyaman avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d365-ui-test's Issues

WebApi Usage

Hi @DigitalFlow , thats a really good feature, I've installed the latest version and having this issue when trying to create a record, I guess I might be missing something, but never used it before:

await xrmTest.WebApi.createRecord("incident",data); => where data being:

data = {"some data"}

page.evaluate: Evaluation failed: Objectpage.evaluate: Evaluation failed: Object

Do you have any suggestion what could I be missing ?

Not Able to Set Date Field

Hi @DigitalFlow ,
I m using this UI Framework for the Test Automation. But when I was trying to set the Date Value on the D365 CRM Entity Date Field then My Test Failed every time. Can you please let me know how to set the Date Field. Is there is functionality available or not.

TimeOut on different tab

Hi @DigitalFlow , would like to ask if you experimented this issue before?
I am trying to save a form (Its opened on a different page, so Im using this to switch tabs and its all working):

[MyNewPage] = await Promise.all([ context.waitForEvent('page'), await xrmTest.Button.click({ byLabel: "GDPR Review" }) ]); await MyNewPage.bringToFront();

The problem I am having, is, when saving that form, it takes quite long and its failing when running the test on the azure pipeline with a timeout:

Timeout of 30000ms exceeded.

Is there anyway to wait or increase the timeout for that new page ? I've set up the timeout on the xrmTest.Launch()

I also tried to set it on the page MyNewPage.setDefaultTimeout() but none of them worked. And I could see on the screenshots that the page still "saving". Any suggestion ?

Thanks a lot!

Controls

Hi @DigitalFlow ! Sorry to bother, just wondering what should I use as a "name" when trying to retrieve the state for a Control ?

Should I use the name of the control in the solution customisation ?
Is the locator name ?

I am getting this error when trying:
const { isVisible, isDisabled } = await xrmTest.Control.get("win_leveloptionset");

Cannot read property 'getVisible' of null

Thanks!

[QUESTION] - Authentication WEBAPI

Hi @DigitalFlow , quick question, is there any way to authenticate to the WebApi with a different user ?
Reason is, the user needs to have admin permission to create / delete cases. But the user needed to test some specific scenarios, does not have "Admin" role , so I would like to create a case for example with an Admin user, but then log in and test the scenario with the correct user role.
Not sure if there is anyway to Login to CRM with a base role user, but then use the WebAPI with an admin user to create records or delete them.
Thanks!

Contributions

Hey @DigitalFlow, this project looks exciting :) I'd love to work on it.. can you give any more suggestions for functions you would like to see added to the project? (I see you've mentioned RUI support already).

Suggestion: Creating a `waitForCRM` or `gotoCRM` function

Hello,

in some tests, I need to exit the CRM and go to another site to do test related tasks there.
When I return to the CRM (currently with await page.goto(url)) and then try to open a form in it, the test is aborted due to an error that occurs.

page.evaluate: TypeError: Cannot read properties of undefined (reading 'Navigation')
    at eval (eval at evaluate (:3:2389), <anonymous>:3:28)
    at t.default.evaluate (<anonymous>:3:2412)
      at Navigation.openCreateForm (node_modules\d365-ui-test\src\xrm\Navigation.ts:76:46)

My theory is that the methods are executing too fast and not waiting enough time for the CRM finish loading. A workaround would of course be to use page.waitForSelector() or page.waitForNavigation() for example. But I think it would be more practical to have a native function in this package.

One idea would be to create something like a helper function that combines both goto and waitForSelector.
It could be introduced as a function called waitForCRM or gotoCRM that automatically opens the CRM (or any other portal, the function name could be more general) in the same tab and waits for it to load.

It's not really a bug or something where a fix is needed, but a welcome helper function to work with (and yes, I'm also very lazy šŸ˜„)

Maybe there is already a better way of doing this, that I just missed. If this is the case, please let me know if there are better workarounds or already implemented methods.

Many greetings,
Julian

Quick create promise does not resolve

Hi!

Great framework! Thanks much for open sourcing!

I am trying to use the quick create form and the form opens successfully, however the promise never resolves. I.e.
test("Create insurance and calculate price", async () => {
await xrmTest.Navigation.openQuickCreate("account");
const id = await xrmTest.Entity.save();
});

The save never happens and Jest times out. Any help would be greatly appreciated!.

I am testing this on an instance that has Swedish as base language (and only language installed).

Google Maps location suggestions not selectable

Hello,

I would like to know if I can select an option of the Google Maps location suggestion list with this package.
You can see an example of it below:
image

Is there any way to select them? If it was possible, it would allow me to automatically enter the details of the selected location in each field that you can see in the screenshot.

Kind regards
Julian Yaman

Cannot get ID of an entity record after second test attempt (Navigation error?)

Hello, currently I have a really strange problem when trying to read values of an entity record (in my case the ID).

When I run the test for the first time, it returns the ID of the record without any problems (like it should usually do). After the first try, it no longer does.
It seems to me that any background process is preventing the Entity.getId() call from retrieving the ID.

I assumed this after I also observed that after the timeout, the next test started and right after the start an error message appeared.
Error: page.evaluate: Execution context was destroyed, most likely because of a navigation

My code is actually very simple:

Logger.info("Opening the entry"); // Will be logged
await xrmTest.Navigation.navigateTo({
  entityName: "entity",
  pageType: "entityrecord",
  entityId: "my-id"
})
Logger.debug("Opened the entry"); // Won't be logged; test will time out
const id = await xrmTest.Entity.getId();
Logger.debug(`Entry ID: ${id}`);
assert.equal(id, `{my-id}`);

(Additional observation: see #38 (comment))

What should I do?
Is there a workaround I can try?

Add Support for Connecting to an Existing Browser in Playwright Tests

In our tests, we have a requirement to connect to an existing browser instance. This is particularly useful when we need to maintain the session state across multiple tests, especially in scenarios where manual intervention is required (like entering a pin for an SSL certificate).

Currently, we're using the playwright.chromium.connectOverCDP() method to connect to an existing Chromium-based browser (Microsoft Edge) that's already running with remote debugging enabled:

beforeAll(async() => {
    jest.setTimeout(60000);
    browser = await playwright.chromium.connectOverCDP('http://localhost:9223');  
});

However, we believe it would be beneficial to have built-in support for this functionality in the d365-ui-test library. This could potentially be implemented as an option in the XrmUiTest constructor or as a separate method.

We're looking forward to your thoughts on this. Any help or guidance would be greatly appreciated.

Releases

Hi @DigitalFlow ! I Hope to not bother you. Is there any plan to merge or release more updates to the project soon?
We would like to get more used to it to start contributing, if that is the case, is there any plan to release new versions and features more often ?
Thanks a lot, appreciate your help.

Some small fixes

  • UI Test Designer by data-id: CSS Selector with * as node type
  • UI Test Designer allow recording of videos
  • Set MinHeight on actions list

Don't close browser on fail or at the end of the test

Hi,

First of all,thanks for your great job.

I want to create a test suite using D365 to run on a Dynamcis app.
I need my browser to be alive if any error occurs in my script to check from where come my problem (i can use page.pause() for that)
But in my CI I don't want to login again between each test (it take too much time considering the number of time i have)

Is there a way to avoid browser to close on fail (i know page.pause() exists) or when a test ends ?

Ribbon Flyout Buttons

Hi @DigitalFlow ,

Thanks a lot for your framework!
I've just started trying it out and I didn't find a way to call ribbon buttons that are inside a flyout.
Is there a way to call a button inside a button like in the here?
image

Thanks in advance.
Gustavo

Save entity failed

Hi.

When I run this code:

await xrmTest.Navigation.openCreateForm("contact");
await xrmTest.Attribute.setValue("lastname", "UI test");
await xrmTest.Entity.save(true);

Then gives that the following error:

Basic operations UCI ā€ŗ Create and save new contact

page.evaluate: Evaluation failed: Objectpage.evaluate: Evaluation failed: Object

  48 |         await xrmTest.Attribute.setValue("lastname", "UI Test");
  49 | 
> 50 |         await xrmTest.Entity.save(true);
     |            ^
  51 | 
  52 |         // await xrmTest.Attribute.setValue("primarycontactid", [{
  53 |         //     id: "C0A634A1-42C5-EB11-BACC-0022487FBED8",

  at Entity.save (node_modules/d365-ui-test/src/xrm/Entity.ts:91:39)
  at Object.<anonymous> (spec/demo-ui-test.spec.ts:50:9)

Is this a known error or do I something wrong?

I simply want to open a create form, set some field values and save the record.

But that fails..

Kind regards,

Henk Rademaker
D365-UI-Test error

Grid and Tabs

Hi!

What I need to use to open a Tab or interact with SubGrid ? can I use an xpath ?
I've tried the id, aria-label, data-id and no luck.

"Cannot read property 'setDisplayState' of null"
This is one tab, as example:

tabs

Thank you!

entity.save gives me an error

Hi,
First of all, thanks for sharing this implementation of Jest and D365.
I'm starting to implement some tests and i'm stucked trying to save one registry.

After setting some values iĀ”m using the xrmTest.Entity.save(); (also tried xrmTest.Entity.save(true)) instruction to save the record and it returns me this error:
image

Don't know what to do to save the record, is there any other way?

Many thanks agains for sharing this solution, in my opinion it's the best to create UI test over DataVerse, CDS or Dynamics.
Best regards.

Do not use quick create div

For the RUI Code, we waited for the quick create success message:

this._page.waitForSelector("div[id^=quickcreate_]", { timeout: this.xrmUiTest.settings.timeout })

Since RUI was deprecated and we support UCI only, we can remove this and rely on the openForm successCallback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.