Skip to content

Commit

Permalink
Fix UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkleiner committed Dec 19, 2024
1 parent f73ed92 commit bc58b67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
18 changes: 5 additions & 13 deletions plugins/Live/tests/UI/Live_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("Live", function () {
await page.evaluate(() => $('.dataTableVizVisitorLog .repeat.icon-refresh').click());
await page.mouse.move(-10, -10);

var report = await page.$('.dataTableVizVisitorLog .card.row:eq(1)');
const report = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(1)');
expect(await report.screenshot()).to.matchImage('visitor_log_expand_actions');
});

Expand Down Expand Up @@ -64,9 +64,7 @@ describe("Live", function () {
const prevlink = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(2) .collapsed-contents:visible');
await prevlink.click();

await page.evaluate(function(){
$('.card:first-child .visitor-log-visitor-profile-link').click();
});
await (await page.jQuery('.card:eq(0) .visitor-log-visitor-profile-link')).click();

await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
Expand All @@ -86,9 +84,7 @@ describe("Live", function () {
});

it('should hide all action details', async function() {
await page.evaluate(function(){
$('.visitor-profile-toggle-actions').click();
});
await (await page.jQuery('.visitor-profile-toggle-actions')).click();

await page.mouse.move(0, 0);

Expand All @@ -97,9 +93,7 @@ describe("Live", function () {
});

it('should show visit details', async function() {
await page.evaluate(function(){
$('.visitor-profile-visit-title')[0].click();
});
await (await page.jQuery('.visitor-profile-visit-title:eq(0)')).click();

var dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('visitor_profile_visit_details');
Expand Down Expand Up @@ -128,9 +122,7 @@ describe("Live", function () {
testEnvironment.save();

await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2010-01-03#?idSite=1&period=year&date=2010-01-03&category=General_Visitors&subcategory=Live_VisitorLog");
await page.evaluate(function(){
$('.card:first-child .visitor-log-visitor-profile-link').click();
});
await (await page.jQuery('.card:eq(0) .visitor-log-visitor-profile-link')).click();

await page.waitForSelector('.ui-dialog', {visible: true});
await page.waitForNetworkIdle();
Expand Down
4 changes: 2 additions & 2 deletions tests/UI/specs/EvolutionGraph_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe("EvolutionGraph", function () {
});
await page.reload();
await page.waitForNetworkIdle();
await page.click('.activatePeriodsSelection:last');
await (await page.jQuery('.activatePeriodsSelection:last')).click();

await page.mouse.move(-10, -10);
await page.waitForTimeout(500); // wait for animation
Expand All @@ -192,7 +192,7 @@ describe("EvolutionGraph", function () {
});

it("should be possible to change period", async function () {
await page.click('.dataTablePeriods [data-period=month]');
await (await page.jQuery('[data-period=month]:last')).click();
await page.waitForNetworkIdle();

expect(await page.screenshot({ fullPage: true })).to.matchImage('periods_selected');
Expand Down

0 comments on commit bc58b67

Please sign in to comment.