Skip to content

Commit

Permalink
Merge pull request #4 from sharma-shray/rest-list-tests
Browse files Browse the repository at this point in the history
restaurant list page tests
  • Loading branch information
sharma-shray authored Jul 26, 2024
2 parents a0f8c63 + 69d78a9 commit 7214551
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions enatega-multivendor-web/__tests__/tests/restaurant-list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { test, expect } from '@playwright/test';

test('Check for All Restaurants', async ({ page }) => {
await page.goto('http://localhost:3000/#/restaurant-list');

const inputLocator = page.locator('input[placeholder="Search for restaurant and cuisines"]'); // Replace with the actual placeholder text

// input field is visible on the page
await expect(inputLocator).toBeVisible();

// input field is enabled
await expect(inputLocator).toBeEnabled();

// Check if the heading exists
const targetHeader = 'All Restaurants'
await expect(page.getByText(targetHeader).first()).toBeVisible();

// Check if the heading exists
const TimeText = '20'
await expect(page.getByText(TimeText).first()).toBeVisible();

// const svgElement = await page.$('//svg[contains(@class, "MuiSvgIcon-root") and contains(@class, "MuiSvgIcon-fontSizeSmall") and contains(@class, "makeStyles-icon-481") and contains(@class, "css-ptiqhd-MuiSvgIcon-root") and @data-testid="FavoriteBorderIcon"]');
// expect(svgElement).not.toBeNull();


// const spanLocator = page.getByText(':has-text("Rice,Gravy,Soups")').first();
// await expect(spanLocator).toBeVisible();


// Check if the restaurant name exists
const Juiceheading = await page.locator('h6:has-text("Juice Bar-East")');
expect(Juiceheading).not.toBeNull();

const Chineseheading = await page.locator('h6:has-text("Chinese Food-East")');
expect(Chineseheading).not.toBeNull();

const IceCreameheading = await page.locator('h6:has-text("Ice-Cream Shop-East")');
expect(IceCreameheading).not.toBeNull();

const Italianheading = await page.locator('h6:has-text("Italian Food-East")');
expect(Italianheading).not.toBeNull();

const Probaheading = await page.locator(':has-text("Proba")');
expect(Probaheading).not.toBeNull();

const Popularheading = await page.locator(':has-text("Popular this week")');
expect(Popularheading).not.toBeNull();

});


test('check presence of footer elements', async ({ page }) => {
await page.goto('http://localhost:3000/#/restaurant-list');

// Check for the presence of "Enatega" header and description
const header = page.locator('h4:has-text("Enatega")');
const description = page.locator('p:has-text("Enatega is an open-source delivery management platform for the future.")');

await expect(header).toBeVisible();
await expect(description).toBeVisible();

// Check for the presence of "Links" section
await expect(page.locator('p:has-text("Links")')).toBeVisible();
await expect(page.locator('a:has-text("Home")')).toBeVisible();
await expect(page.locator('a:has-text("Privacy Policy")')).toBeVisible();
await expect(page.locator('a:has-text("Terms and Conditions")')).toBeVisible();

// Check for the presence of social media icons in the "Follow Us" section
await expect(page.locator('svg[data-testid="FacebookIcon"]')).toBeVisible();
await expect(page.locator('svg[data-testid="TwitterIcon"]')).toBeVisible();
await expect(page.locator('svg[data-testid="InstagramIcon"]')).toBeVisible();
await expect(page.locator('svg[data-testid="LinkedInIcon"]')).toBeVisible();
await expect(page.locator('svg[data-testid="GitHubIcon"]')).toBeVisible();

// Check for the presence of "Powered By" section with "ninjascode"
await expect(page.locator('p:has-text("Powered By")')).toBeVisible();
await expect(page.locator('p:has-text("ninjascode")')).toBeVisible();
});

0 comments on commit 7214551

Please sign in to comment.