Filter S01153ff2→

4 0 0

Tests (8)

A

Filter price from low to high T333a70ff→

Description
Code
  test("Filter price from low to high", async ({ page, loginPage }) => {
    const filter = new FilterPrice(page);
    filter.selectLowToHigh();

    await expect(page.locator(".product_sort_container")).toHaveValue("lohi");

    const prices = await filter.getPrices();

    const sorted = [...prices].sort((a, b) => a - b);
    expect(prices).toEqual(sorted);
  });

A

Filter price from high to low T08629715→

Description
Code
  test("Filter price from high to low", async ({ page, loginPage }) => {
    const filter = new FilterPrice(page);
    filter.selectHighToLow();

    await expect(page.locator(".product_sort_container")).toHaveValue("hilo");

    const prices = await filter.getPrices();

    const sorted = [...prices].sort((a, b) => a + b);
    expect(prices).toEqual(sorted);
  });

A

Filter product Name (A to Z) T4185f2e1→

Description
Code
  test("Filter product Name (A to Z)", async ({ page, loginPage }) => {
    const filter = new FilterPrice(page);
    filter.selectNameAtoZ();

    await expect(page.locator(".product_sort_container")).toHaveValue("az");

    const names = await filter.getProductNames();

    const sorted = [...names].sort((a, b) => a.localeCompare(b));
    expect(names).toEqual(sorted);
  });

A

Filter product Name (Z to A) T2d771162→

Description
Code
  test("Filter product Name (Z to A)", async ({ page, loginPage }) => {
    const filter = new FilterPrice(page);
    filter.selectNameZtoA();

    await expect(page.locator(".product_sort_container")).toHaveValue("za");

    const names = await filter.getProductNames();

    const sorted = [...names].sort((a, b) => b.localeCompare(a));
    expect(names).toEqual(sorted);
  });

M

Filter price from low to high T6cc6ea8e→

Description
### Description
Verify that items are correctly sorted from low to high price.

### Preconditions
User is logged in. User is on [https://www.saucedemo.com/inventory.html](https://www.saucedemo.com/inventory.html). 


### Steps

| # | Action | Test Data | Expected Result |
|---|---------|------------|----------------|
| 1 | Click on the Sort dropdown located on the products page | - | Sort menu is opened |
| 2 | Select Price (low to high) option | - | Items are sorted by price in ascending order |
| 3 | Verify that the first item has the lowest price | - | The first listed item shows the lowest price |
| 4 | Verify that the last item has the highest price | - | The last listed item shows the highest price |


![](/attachments/ZT7OgMUPd7.png)

### Expected Result
Items are displayed in ascending order — from the lowest priced item to the highest priced item
Attachments
M

Filter price from high to low Tfda5ecd7→

Description
### Description
Verify that items are correctly sorted from high to low price

### Preconditions
User is logged in. User is on [https://www.saucedemo.com/inventory.html](https://www.saucedemo.com/inventory.html). 


### Steps

| # | Action | Test Data | Expected Result |
|---|---------|------------|----------------|
| 1 | Click on the Sort dropdown located on the products page | - | Sort menu is opened |
| 2 | Select Price (high to low) option | - | Items are sorted by price in descending order |
| 3 | Verify that the first item has the highest price | - | The first listed item shows the highest price |
| 4 | Verify that the last item has the lowest price | - | The last listed item shows the lowest price |

![](/attachments/SiPctIszOM.png)

### Expected Result
Items are displayed in descending order — from the highest priced item to the lowest priced item
Attachments
M

Filter product Name (A to Z) T116fb12c→

Description
### Description
Verify that items are correctly sorted by product name from A to Z

### Preconditions
User is logged in. User is on [https://www.saucedemo.com/inventory.html](https://www.saucedemo.com/inventory.html). 


### Steps

| # | Action | Test Data | Expected Result |
|---|---------|------------|----------------|
| 1 | Click on the Sort dropdown located on the products page | - | Sort menu is opened |
| 2 | Select Name (A to Z) option | - | Items are sorted alphabetically in ascending order |
| 3 | Verify that the first item starts with a letter closer to A | - | The first listed items name starts with the earliest letter in the alphabet |
| 4 | Verify that the last item starts with a letter closer to Z | - | The last listed item’s name starts with the latest letter in the alphabet |

![](/attachments/LsRgFpHOn6.png)

### Expected Result
Items are displayed in alphabetical order — from A to Z.
Attachments
M

Filter product Name (Z to A) Te9f29177→

Description
### Description
Verify that items are correctly sorted by product name from Z to A

### Preconditions
User is logged in. User is on [https://www.saucedemo.com/inventory.html](https://www.saucedemo.com/inventory.html). 


### Steps

| # | Action | Test Data | Expected Result |
|---|---------|------------|----------------|
| 1 | Click on the Sort dropdown located on the products page | - | Sort menu is opened |
| 2 | Select Name (Z to A) option | - | Items are sorted alphabetically in descending order |
| 3 | Verify that the first item starts with a letter closer to Z | - | The first listed items name starts with the latest letter in the alphabet |
| 4 | Verify that the last item starts with a letter closer to A | - | The last listed items name starts with the earliest letter in the alphabet |

![](/attachments/KegXp5Q8YF.png)

### Expected Result
Items are displayed in alphabetical order — from Z to A.
Attachments