Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions e2etests/pages/pools-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class PoolsPage extends BasePage {
readonly poolActionsColumn: Locator;
readonly poolExpandMoreIcon: Locator;
readonly domainOutlinedIcon: Locator;
readonly subPoolAddIcon: Locator;

readonly subPoolNameColumn: Locator;
readonly subPoolColumn2: Locator;
Expand Down Expand Up @@ -127,6 +128,7 @@ export class PoolsPage extends BasePage {
this.poolColumn4 = this.table.locator('//td[4]');
this.column4TextSpan = this.poolColumn4.locator('xpath=/span');
this.poolActionsColumn = this.table.locator('//td').last();
this.subPoolAddIcon = this.getByAnyTestId('AddCircleOutlineIcon', this.poolActionsColumn);

this.subPoolNameColumn = this.table.locator('//tr[@data-test-id="row_0"]/following-sibling::tr/td[1]');
this.subPoolColumn2 = this.table.locator('//tr[@data-test-id="row_0"]/following-sibling::tr/td[2]');
Expand Down Expand Up @@ -303,6 +305,8 @@ export class PoolsPage extends BasePage {
await this.sideModalSaveBtn.click();
await this.waitForAllProgressBarsToDisappear();
await this.waitForElementDetached(this.sideModal);
await this.waitForAllProgressBarsToDisappear();
await this.subPoolAddIcon.first().waitFor({timeout: 10000}); // Wait for the sub-pool add icon to ensure the page has fully loaded after saving
}

/**
Expand Down Expand Up @@ -330,6 +334,7 @@ export class PoolsPage extends BasePage {
await this.waitForAllProgressBarsToDisappear();
await this.waitForElementDetached(this.sideModal);
await this.waitForAllProgressBarsToDisappear();
await this.subPoolAddIcon.first().waitFor({timeout: 10000});
}
}

Expand Down
22 changes: 16 additions & 6 deletions e2etests/tests/pools-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
if ((await poolsPage.getColumnBadgeText()) !== 'All') await poolsPage.selectAllColumns();
await poolsPage.toggleExpandPool();
await poolsPage.removeAllSubPoolMonthlyLimits();
await poolsPage.waitForAllProgressBarsToDisappear();
await poolsPage.toggleExpandPool();
});

Expand Down Expand Up @@ -147,6 +148,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
if ((await poolsPage.getOrganizationLimitValue()) !== 0) {
await poolsPage.editPoolMonthlyLimit(0);
debugLog('Removed organization limit');
await poolsPage.waitForAllProgressBarsToDisappear();
}
});

Expand Down Expand Up @@ -197,6 +199,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {

const expensesThisMonth = await poolsPage.getExpensesThisMonth();
const organizationLimit = Math.ceil(expensesThisMonth / 0.91);
const forecastThisMonth = await poolsPage.getForecastThisMonth();

await test.step('Set organization limit to an integer where the expenses is more than the 90% of the limit', async () => {
await poolsPage.editPoolMonthlyLimit(organizationLimit);
Expand All @@ -207,12 +210,18 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
await expect.soft(poolsPage.exceededLimitCard).toBeHidden();
expect.soft(await poolsPage.getColorFromElement(poolsPage.expensesCard)).toBe(poolsPage.warningColor);
await expect.soft(poolsPage.expensesThisMonthWarningIcon).toBeVisible();
expect.soft(await poolsPage.getColorFromElement(poolsPage.forecastCard)).toBe(poolsPage.errorColor || poolsPage.warningColor);
//TODO: Fix the line below as border colour is not always warning color, if at the end of the month.
// expect.soft(await poolsPage.poolTableRow.getAttribute('style')).toContain(`border-left: 4px solid ${poolsPage.warningColor};`);
if(forecastThisMonth > organizationLimit){
expect.soft(await poolsPage.getColorFromElement(poolsPage.forecastCard)).toBe(poolsPage.errorColor);
await expect.soft(poolsPage.forecastThisMonthCancelIcon).toBeVisible();
expect.soft(await poolsPage.poolTableRow.getAttribute('style')).toContain(`border-left: 4px solid ${poolsPage.warningColor};`);
expect.soft(await poolsPage.getColorFromElement(poolsPage.column4TextSpan)).toBe(poolsPage.warningColor);
} else {
expect.soft(await poolsPage.getColorFromElement(poolsPage.forecastCard)).toBe(poolsPage.warningColor);
await expect.soft(poolsPage.forecastThisMonthWarningIcon).toBeVisible();
expect.soft(await poolsPage.getColorFromElement(poolsPage.column4TextSpan)).toBe(poolsPage.infoColor);
}
expect.soft((await poolsPage.poolColumn2.textContent()).replace(/\D/g, '')).toBe(organizationLimit.toString());
expect.soft(await poolsPage.getColorFromElement(poolsPage.column3TextDiv)).toBe(poolsPage.successColor);
expect.soft(await poolsPage.getColorFromElement(poolsPage.column4TextSpan)).toBe(poolsPage.warningColor);
});
});

Expand Down Expand Up @@ -249,7 +258,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
});
});

test('[230917] Verify Organisation Limit functionality - limit set lower forecast', async ({ poolsPage }) => {
test('[230917] Verify Organisation Limit functionality - limit set lower than forecast', async ({ poolsPage }) => {
const expensesThisMonth = await poolsPage.getExpensesThisMonth();
const forecastThisMonth = await poolsPage.getForecastThisMonth();
test.skip(expensesThisMonth <= 1, 'Skipping test as it requires expenses to be greater than 1');
Expand All @@ -263,7 +272,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
await test.step('Assert Pools page elements displayed correctly when limit set below forecast this month', async () => {
await expect.soft(poolsPage.exceededLimitCard).toBeHidden();
expect.soft(await poolsPage.getColorFromElement(poolsPage.forecastCard)).toBe(poolsPage.errorColor);
if (expensesThisMonth >= Math.round(organizationLimit / 0.9)) {
if (expensesThisMonth >= Math.round(organizationLimit * 0.9)) {
expect.soft(await poolsPage.getColorFromElement(poolsPage.expensesCard)).toBe(poolsPage.warningColor);
await expect.soft(poolsPage.expensesThisMonthWarningIcon).toBeVisible();
} else {
Expand Down Expand Up @@ -347,6 +356,7 @@ test.describe('[MPT-12743] Pools Tests', { tag: ['@ui', '@pools'] }, () => {
await test.step('Assert pool is exceeded when sub-pool limit set below sub-pool expenses', async () => {
subPoolLimit = Math.round(subPoolExpenses - 1);
await poolsPage.editSubPoolMonthlyLimit(subPoolLimit, true, 1, true);
await poolsPage.waitForAllProgressBarsToDisappear();
expect.soft(await poolsPage.getExceededLimitValue()).toBe(1);
expect.soft(await poolsPage.getColorFromElement(poolsPage.subPoolColumn3.first().locator('span'))).toBe(poolsPage.errorColor);
expect.soft(await poolsPage.getColorFromElement(poolsPage.subPoolColumn4.first().locator('span'))).toBe(poolsPage.warningColor);
Expand Down
4 changes: 2 additions & 2 deletions e2etests/tests/resources-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ test.describe('[MPT-11957] Resources page tests', { tag: ['@ui', '@resources'] }
});

test('[230788] Filtered Total expenses matches table itemised total', { tag: '@slow' }, async ({ resourcesPage }) => {
test.setTimeout(90000);
test.setTimeout(120000);
let initialTotalExpensesValue: number;

await test.step('Get unfiltered total expenses value', async () => {
Expand Down Expand Up @@ -224,7 +224,7 @@ test.describe('[MPT-11957] Resources page tests', { tag: ['@ui', '@resources'] }
'[230781] Total expenses matches table itemised total for date range set to last 7 days',
{ tag: '@slow' },
async ({ resourcesPage, datePicker }) => {
test.setTimeout(90000);
test.setTimeout(120000);

await test.step('Get total expenses value for last 7 days', async () => {
await datePicker.selectLast7DaysDateRange();
Expand Down