Skip to content

Commit

Permalink
LPD-49601 Fix playwright test
Browse files Browse the repository at this point in the history
  • Loading branch information
michelevigilante authored and gianmarcobrunialti committed Feb 27, 2025
1 parent 6a471c5 commit 62eb443
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,14 @@ export class CommerceAdminCurrenciesPage {
.getByTestId('management-toolbar')
.getByRole('button', {name: 'Filter'});
this.firstRowCurrencyCellName = (currencyName) =>
page
.locator('.dnd-tbody .dnd-tr')
.first()
.locator('.cell-name')
.filter({hasText: currencyName});
page.locator('tbody tr').first().filter({hasText: currencyName});
this.lastRowCurrencyCellName = (currencyName) =>
page
.locator('.dnd-tbody .dnd-tr')
.last()
.locator('.cell-name')
.filter({hasText: currencyName});
page.locator('tbody tr').last().filter({hasText: currencyName});
this.noResultsFoundText = page.getByText('No Results Found');
this.primaryMenuItem = page.getByRole('menuitem', {name: 'Primary'});
this.priorityButton = page.getByRole('button', {name: 'Priority'});
this.priorityButton = page
.getByRole('columnheader', {name: 'Priority'})
.getByRole('button');
this.resetFilterButton = page.getByRole('button', {
name: 'Reset Filters',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ test('COMMERCE-5839 As a system admin i want to be able to create / update and d
commerceAdminCurrencyDetailsPage,
page,
}) => {
test.setTimeout(180000);
await page.goto('/');
await commerceAdminCurrenciesPage.goto();

const currencyName = 'TC' + getRandomInt();

await commerceAdminCurrenciesPage.addCurrencyAddButton.click();

await commerceAdminCurrencyDetailsPage.nameInput.fill(currencyName);
await commerceAdminCurrencyDetailsPage.codeInput.fill(currencyName);
await commerceAdminCurrencyDetailsPage.saveButton.click();
Expand All @@ -48,16 +48,19 @@ test('COMMERCE-5839 As a system admin i want to be able to create / update and d
).toBeVisible();

await commerceAdminCurrenciesPage.currencyNameLink(currencyName).click();

await commerceAdminCurrencyDetailsPage.symbol.fill('&&&');
await commerceAdminCurrencyDetailsPage.priority.fill('99');
await commerceAdminCurrencyDetailsPage.saveButton.click();

await commerceAdminCurrenciesPage.currencyNameLink(currencyName).click();

await expect(commerceAdminCurrencyDetailsPage.codeInput).not.toBeEditable();
await expect(commerceAdminCurrencyDetailsPage.symbol).toHaveValue('&&&');
await expect(commerceAdminCurrencyDetailsPage.priority).toHaveValue('99.0');

await commerceAdminCurrencyDetailsPage.cancelButton.click();

await commerceAdminCurrenciesPage.priorityButton.click();

await expect(
Expand Down Expand Up @@ -143,14 +146,15 @@ test('COMMERCE-5839 As a system admin i want to be able to create / update and d
await commerceAdminCurrenciesPage.actionsButton.click();

let dialogMessage = '';

page.on('dialog', (dialog) => {
dialogMessage = dialog.message();
dialog.accept();
});

await commerceAdminCurrenciesPage.deleteMenuItem.click();

await expect(dialogMessage).toEqual(
expect(dialogMessage).toEqual(
'Are you sure you want to delete this entry?'
);

Expand Down

0 comments on commit 62eb443

Please sign in to comment.