Skip to content

Commit

Permalink
Merge pull request #39 from shopcanal/alex-whitaker.pause-more
Browse files Browse the repository at this point in the history
test: pause requests tests
  • Loading branch information
alex-whitaker committed Nov 30, 2021
2 parents 5b9dc39 + 43dd8b2 commit 2e0dfed
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions tests/shopkeep/requests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,49 +32,49 @@ test.describe('Shopkeep Requests', () => {
await logout(context);
});

test('displays two requests and tabs for filtering requests by status', async ({ page }) => {
// Check that there are two list items
const requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
expect(requestLineItems.length).toBe(2);

// Check that we have all four filtering buttons - All, Approved, Pending, Rejected
await page.waitForSelector(ALL_TAB_SELECTOR);
await page.waitForSelector(APPROVED_TAB_SELECTOR);
await page.waitForSelector(PENDING_TAB_SELECTOR);
await page.waitForSelector(REJECTED_TAB_SELECTOR);
});

test('clicking the Pending tab shows only one pending request', async ({ page }) => {
// Click the "Pending" tab and make sure it is selected
await page.click(PENDING_TAB_SELECTOR);

// Wait for the request data to load before continuing
await page.waitForSelector('text=Showing 1 product request');

// Check that there is one list item
const requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
expect(requestLineItems.length).toBe(1);
});

test('clicking the Rejected tab shows no requests, then clicking All shows two requests', async ({
page,
}) => {
// Click the "Rejected" tab and wait for the empty state to appear
await page.click(REJECTED_TAB_SELECTOR);
await page.waitForSelector("text=This is where you'll view your requests");

// Check that there are no list items
let requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
expect(requestLineItems.length).toBe(0);

// Click the "All" tab
await page.click(ALL_TAB_SELECTOR);
await page.waitForSelector('text=Showing 2 product requests');

// Check that there are two list items
requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
expect(requestLineItems.length).toBe(2);
});
// test('displays two requests and tabs for filtering requests by status', async ({ page }) => {
// // Check that there are two list items
// const requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
// expect(requestLineItems.length).toBe(2);

// // Check that we have all four filtering buttons - All, Approved, Pending, Rejected
// await page.waitForSelector(ALL_TAB_SELECTOR);
// await page.waitForSelector(APPROVED_TAB_SELECTOR);
// await page.waitForSelector(PENDING_TAB_SELECTOR);
// await page.waitForSelector(REJECTED_TAB_SELECTOR);
// });

// test('clicking the Pending tab shows only one pending request', async ({ page }) => {
// // Click the "Pending" tab and make sure it is selected
// await page.click(PENDING_TAB_SELECTOR);

// // Wait for the request data to load before continuing
// await page.waitForSelector('text=Showing 1 product request');

// // Check that there is one list item
// const requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
// expect(requestLineItems.length).toBe(1);
// });

// test('clicking the Rejected tab shows no requests, then clicking All shows two requests', async ({
// page,
// }) => {
// // Click the "Rejected" tab and wait for the empty state to appear
// await page.click(REJECTED_TAB_SELECTOR);
// await page.waitForSelector("text=This is where you'll view your requests");

// // Check that there are no list items
// let requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
// expect(requestLineItems.length).toBe(0);

// // Click the "All" tab
// await page.click(ALL_TAB_SELECTOR);
// await page.waitForSelector('text=Showing 2 product requests');

// // Check that there are two list items
// requestLineItems = await page.$$(LIST_ITEM_SELECTOR);
// expect(requestLineItems.length).toBe(2);
// });

// TODO: click on the line item action buttons and test the request response pages
});

0 comments on commit 2e0dfed

Please sign in to comment.