Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have been asked to figure out report automation testing for our analtyic reports on our internal company site.
The reports are done in Power BI.
I need to be able to search for something, drill through, get a value on the report and check it against a database.
I haven't been able to find where others are doing something like this.
I tried using the selenium IDE and recorder, Cypress, and Playwright.
I am having the most success with Playwright but continue to hit some road blocks.
I have a search button and a clear button on the report. I can 't get Playwright to click on either one of the buttons.
I have tried from the "page" and from the "frame" objects the different possible methods/events with no luck.
I am succesful in finding the frame with the following lines of code
const frame = page.frames().find(frame => frame.name() === 'visual-sandbox'); console.log(frame.name());
After typing in the search button the value to search, I tried to do a "enter" which should also trigger the search button.
I have tried so many things that I didn't keep a running list.
Examples below, I tried doing the same from the "await frame ...."
await page.click('//button[normalize-space(.)="Cear"]'); await page.dispatchEvent('button#c-glyph.search-button', 'click'); await page.click('search-button'); await page.press('#sandbox-host > div', "Enter"); const [response] = await Promise.all([ page.waitForNavigation(), // The navigation promise resolves after navigation has finished page.click('#sandbox-host > div > button.c-glyph.search-button'), //]);
I got the furthest with the following line where it looks like it knew what I was asking.
const hrefElement = await frame.$('#sandbox-host > div > button.c-glyph.search-button');
await hrefElement.click();
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
Looking at the Chrome Dev Tools inspection, this is what I get for different portions of the element for search button.
SearchButtonOutter "copy selector" #sandbox-host > div > button.c-glyph.search-button "copy JS Path" document.querySelector("#sandbox-host > div > button.c-glyph.search-button") "copy element": <button class="c-glyph search-button" name="search-button"> <span class="x-screen-reader">Search</span> </button> SearchButtonInner there isn't anything to copy for the element, but I can get this from the inspect styles section .visual-textFilter25A4896A83E0487089E2B90C9AE57C8A .text-filter-search button.search-button:before {
I could use some help on the right way to reference the click method for the buttons. I have attached screen shots to show you what I am trying to click on.
Solved! Go to Solution.
Not sure why my reply back wasn't working. Third attempt. Thanks Greg for the link to the article. No, I had not seen that. My testing needs to mimic the user's experence within the visuals. Our reports do use DAX queries but not from the original source. I can see maybe trying to incorporate the DAX Sudio to query against the original source and then verify it against the visual. It is definitely something I will check out. To mimic the user's maniuplation of the visuals I will still need to automate the objects on the report in the website.
In case someone else is trying to get the button action to happen, I did get this to work with the frame object but not the page. I did the following:
const test = await frame.evaluate(() =>
document.querySelector("#sandbox-host > div > button.c-glyph.search-button").click()
);
@wadezone Have you seen this article? https://powerpivotpro.com/2018/09/automated-testing-using-dax-for-power-bi/
Hello @Greg_Deckler ,
Thanks for sharing the link. Do you think that the approach suggested in your link would work on a report which has been authored on top of a shared dataset?
Please bear in mind that the report has DAX functions which I would like to test.
Thanks,
Sau
Not sure why my reply back wasn't working. Third attempt. Thanks Greg for the link to the article. No, I had not seen that. My testing needs to mimic the user's experence within the visuals. Our reports do use DAX queries but not from the original source. I can see maybe trying to incorporate the DAX Sudio to query against the original source and then verify it against the visual. It is definitely something I will check out. To mimic the user's maniuplation of the visuals I will still need to automate the objects on the report in the website.
In case someone else is trying to get the button action to happen, I did get this to work with the frame object but not the page. I did the following:
const test = await frame.evaluate(() =>
document.querySelector("#sandbox-host > div > button.c-glyph.search-button").click()
);
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |