-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init playwright and tests #631
base: main
Are you sure you want to change the base?
Conversation
Hi, it's a useful tool for testing
Init playwright
restaurant page tests
WalkthroughThe recent changes enhance the automated testing framework for a web application using Playwright. A new configuration file sets up the testing environment, enabling parallel execution and cross-browser support. Several test files have been introduced to validate critical functionalities, including Todo management, restaurant features, home page elements, and login processes. These additions significantly improve the reliability and coverage of user interaction tests, ensuring a robust quality assurance process across the application. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
✅ Deploy Preview for cheery-zabaione-34f12e canceled.
|
✅ Deploy Preview for polite-fairy-234917 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (3)
enatega-multivendor-web/__tests__/package-lock.json
is excluded by!**/package-lock.json
,!**/*.json
enatega-multivendor-web/__tests__/package.json
is excluded by!**/*.json
enatega-multivendor-web/package-lock.json
is excluded by!**/package-lock.json
,!**/*.json
Files selected for processing (5)
- enatega-multivendor-web/tests/playwright.config.ts (1 hunks)
- enatega-multivendor-web/tests/tests-examples/demo-todo-app.spec.ts (1 hunks)
- enatega-multivendor-web/tests/tests/example.spec.ts (1 hunks)
- enatega-multivendor-web/tests/tests/new-login.spec.ts (1 hunks)
- enatega-multivendor-web/tests/tests/restaurant.spec.ts (1 hunks)
Additional comments not posted (1)
enatega-multivendor-web/__tests__/playwright.config.ts (1)
1-78
: Review and uncomment necessary sections.Some sections of the configuration are commented out, such as the
dotenv
import and thewebServer
configuration. Review these sections and uncomment them if necessary based on the project's requirements.- // import dotenv from 'dotenv'; - // dotenv.config({ path: path.resolve(__dirname, '.env') }); + import dotenv from 'dotenv'; + dotenv.config({ path: path.resolve(__dirname, '.env') }); - // webServer: { - // command: 'npm run start', - // url: 'http://127.0.0.1:3000', - // reuseExistingServer: !process.env.CI, - // }, + webServer: { + command: 'npm run start', + url: 'http://127.0.0.1:3000', + reuseExistingServer: !process.env.CI, + },
import { test, expect } from '@playwright/test'; | ||
|
||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/new-login'); | ||
|
||
await expect(page).toHaveTitle(/Enatega-Food Delivery/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider parameterizing the URL.
The URL http://localhost:3000/#/new-login
is hardcoded. It might be beneficial to parameterize this URL to make the test more flexible for different environments.
- await page.goto('http://localhost:3000/#/new-login');
+ const baseURL = process.env.BASE_URL || 'http://localhost:3000';
+ await page.goto(`${baseURL}/#/new-login`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { test, expect } from '@playwright/test'; | |
test('has title', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/new-login'); | |
await expect(page).toHaveTitle(/Enatega-Food Delivery/); | |
import { test, expect } from '@playwright/test'; | |
test('has title', async ({ page }) => { | |
const baseURL = process.env.BASE_URL || 'http://localhost:3000'; | |
await page.goto(`${baseURL}/#/new-login`); | |
await expect(page).toHaveTitle(/Enatega-Food Delivery/); |
import { test, expect } from '@playwright/test'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('https://playwright.dev/'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle(/Playwright/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider parameterizing the URL.
The URL https://playwright.dev/
is hardcoded. It might be beneficial to parameterize this URL to make the test more flexible for different environments.
- await page.goto('https://playwright.dev/');
+ const baseURL = process.env.BASE_URL || 'https://playwright.dev';
+ await page.goto(baseURL);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { test, expect } from '@playwright/test'; | |
test('has title', async ({ page }) => { | |
await page.goto('https://playwright.dev/'); | |
// Expect a title "to contain" a substring. | |
await expect(page).toHaveTitle(/Playwright/); | |
import { test, expect } from '@playwright/test'; | |
test('has title', async ({ page }) => { | |
const baseURL = process.env.BASE_URL || 'https://playwright.dev'; | |
await page.goto(baseURL); | |
// Expect a title "to contain" a substring. | |
await expect(page).toHaveTitle(/Playwright/); |
test('get started link', async ({ page }) => { | ||
await page.goto('https://playwright.dev/'); | ||
|
||
// Click the get started link. | ||
await page.getByRole('link', { name: 'Get started' }).click(); | ||
|
||
// Expects page to have a heading with the name of Installation. | ||
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider parameterizing the URL.
The URL https://playwright.dev/
is hardcoded. It might be beneficial to parameterize this URL to make the test more flexible for different environments.
- await page.goto('https://playwright.dev/');
+ const baseURL = process.env.BASE_URL || 'https://playwright.dev';
+ await page.goto(baseURL);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('get started link', async ({ page }) => { | |
await page.goto('https://playwright.dev/'); | |
// Click the get started link. | |
await page.getByRole('link', { name: 'Get started' }).click(); | |
// Expects page to have a heading with the name of Installation. | |
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); | |
test('get started link', async ({ page }) => { | |
const baseURL = process.env.BASE_URL || 'https://playwright.dev'; | |
await page.goto(baseURL); | |
// Click the get started link. | |
await page.getByRole('link', { name: 'Get started' }).click(); | |
// Expects page to have a heading with the name of Installation. | |
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/restaurant.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- enatega-multivendor-web/tests/tests/restaurant.spec.ts
Home page tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/home.spec.ts (1 hunks)
Additional comments not posted (2)
enatega-multivendor-web/__tests__/tests/home.spec.ts (2)
3-21
: LGTM!The rest of the code in this test function looks good. It correctly navigates to the homepage and verifies the presence of various elements.
71-97
: LGTM!The code in this test function looks good. It correctly navigates to the homepage and verifies the presence of various footer elements.
test('check presence of elements', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/'); | ||
|
||
// Check for the presence of the "FEATURES" text | ||
const featuresText = await page.locator('p:has-text("FEATURES")'); | ||
await expect(featuresText).toBeVisible(); | ||
|
||
// Check for the presence of Rider App section | ||
await expect(page.locator('h5:has-text("Rider App")')).toBeVisible(); | ||
await expect(page.locator('img[alt="apps"][src="/static/media/rider-app.5d2d755f.png"]')).toBeVisible(); | ||
await expect(page.getByText('• Finding address using GPS').first()).toBeVisible(); | ||
await expect(page.getByText('• Zones functionality for').first()).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'appstore Play Store' }).nth(1)).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'playstore Ios Store' })).toBeVisible(); | ||
|
||
// Check for the presence of Restaurant App section | ||
await expect(page.locator('h5:has-text("Restaurant App")')).toBeVisible(); | ||
await expect(page.locator('img[alt="apps"][src="/static/media/restaurant-app.7c194106.png"]')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Multiple Restaurant adding feature")')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Real-time order receiving updates")')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'appstore Play Store' }).nth(1)).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'playstore Ios Store' })).toBeVisible(); | ||
|
||
|
||
// Check for the presence of Customer App section | ||
await expect(page.locator('h5:has-text("Customer App")')).toBeVisible(); | ||
await expect(page.locator('img[alt="apps"][src="/static/media/cust-app.381e11da.png"]')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Different sections feature for promoting restaurants")')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Previous order history and adding favorite restaurants")')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'appstore Play Store' }).nth(1)).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'playstore Ios Store' })).toBeVisible(); | ||
|
||
// Check for the presence of Admin Dashboard section | ||
await expect(page.locator('h5:has-text("Admin Dashboard")')).toBeVisible(); | ||
await expect(page.locator('img[alt="apps"][src="/static/media/dashboard.1da8f08f.png"]')).toBeVisible(); | ||
await expect(page.getByText('• Finding address using GPS').first()).toBeVisible(); | ||
await expect(page.getByText('• Zones functionality for').first()).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'Demo Demo' }).first()).toBeVisible(); | ||
|
||
// Check for the presence of Product Page section | ||
await expect(page.locator('h5:has-text("Product Page")')).toBeVisible(); | ||
await expect(page.locator('img[alt="apps"][src="/static/media/webapp.e31445e6.png"]')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Our delivery management system is designed for the future.")')).toBeVisible(); | ||
await expect(page.locator('p:has-text("Built on community-driven principles.")')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'Demo Demo' }).first()).toBeVisible(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider refactoring to reduce repetition.
The test function is repetitive. Consider using a loop or a helper function to reduce repetition and improve readability.
- await expect(page.getByRole('button', { name: 'appstore Play Store' }).nth(1)).toBeVisible();
- await expect(page.getByRole('button', { name: 'playstore Ios Store' })).toBeVisible();
+ const buttons = [
+ { name: 'appstore Play Store', nth: 1 },
+ { name: 'playstore Ios Store', nth: 0 }
+ ];
+ for (const button of buttons) {
+ await expect(page.getByRole('button', { name: button.name }).nth(button.nth)).toBeVisible();
+ }
Committable suggestion was skipped due to low confidence.
await page.goto('http://localhost:3000/#/'); | ||
|
||
// Check if the first image with alt "fruits2" is present | ||
// await expect(page.locator('img[alt="fruits2"]')).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment or remove the test for the image with alt "fruits2".
The test for the image with alt "fruits2" is commented out. If it's no longer needed, remove it. Otherwise, uncomment it to ensure it gets executed.
- // await expect(page.locator('img[alt="fruits2"]')).toBeVisible();
+ await expect(page.locator('img[alt="fruits2"]')).toBeVisible();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// await expect(page.locator('img[alt="fruits2"]')).toBeVisible(); | |
await expect(page.locator('img[alt="fruits2"]')).toBeVisible(); |
restaurant list page tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/restaurant-list.spec.ts (1 hunks)
Additional comments not posted (1)
enatega-multivendor-web/__tests__/tests/restaurant-list.spec.ts (1)
52-78
: LGTM!The test case is well-structured and effectively checks for the presence of various footer elements.
// 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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented-out lines.
The commented-out lines of code should be removed to keep the test clean and maintainable.
- // 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();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// 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(); |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace placeholder text in locator.
The placeholder text in the locator should be replaced with the actual text to ensure the test works correctly.
- const inputLocator = page.locator('input[placeholder="Search for restaurant and cuisines"]'); // Replace with the actual placeholder text
+ const inputLocator = page.locator('input[placeholder="Actual Placeholder Text"]');
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const inputLocator = page.locator('input[placeholder="Search for restaurant and cuisines"]'); // Replace with the actual placeholder text | |
const inputLocator = page.locator('input[placeholder="Actual Placeholder Text"]'); |
enatega-multivendor-web/__tests__/tests/restaurant-list.spec.ts
Outdated
Show resolved
Hide resolved
Check for text on terms page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test('check if specific elements exist', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/terms'); | ||
|
||
const divSelector = 'div:has-text("TERMS AND CONDITIONS | ENATEGA")'; | ||
|
||
// Check if the <div> element contains the correct text | ||
const divElement = await page.getByText('TERMS AND CONDITIONS | ENATEGAPublished: 2021TERMS OF USEThese Terms of Use (“'); | ||
await expect(divElement).toBeVisible(); | ||
|
||
// Verify that the <h4> within the <div> contains the correct text | ||
const h4Text = 'TERMS AND CONDITIONS | ENATEGA'; | ||
const h4Element = divElement.locator(`h4:has-text("${h4Text}")`); | ||
await expect(h4Element).toHaveText(h4Text); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding more checks and error handling.
The test function is straightforward and checks for the presence of specific elements. However, you might want to add more checks for other elements on the page to ensure comprehensive coverage. Additionally, consider adding error handling for navigation failure.
+ // Add error handling for navigation failure
+ try {
+ await page.goto('http://localhost:3000/#/terms');
+ } catch (error) {
+ console.error('Navigation to terms page failed:', error);
+ throw error;
+ }
+
+ // Add more checks for other elements
+ const additionalElement = await page.getByText('Some additional text');
+ await expect(additionalElement).toBeVisible();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check if specific elements exist', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/terms'); | |
const divSelector = 'div:has-text("TERMS AND CONDITIONS | ENATEGA")'; | |
// Check if the <div> element contains the correct text | |
const divElement = await page.getByText('TERMS AND CONDITIONS | ENATEGAPublished: 2021TERMS OF USEThese Terms of Use (“'); | |
await expect(divElement).toBeVisible(); | |
// Verify that the <h4> within the <div> contains the correct text | |
const h4Text = 'TERMS AND CONDITIONS | ENATEGA'; | |
const h4Element = divElement.locator(`h4:has-text("${h4Text}")`); | |
await expect(h4Element).toHaveText(h4Text); | |
}); | |
test('check if specific elements exist', async ({ page }) => { | |
// Add error handling for navigation failure | |
try { | |
await page.goto('http://localhost:3000/#/terms'); | |
} catch (error) { | |
console.error('Navigation to terms page failed:', error); | |
throw error; | |
} | |
const divSelector = 'div:has-text("TERMS AND CONDITIONS | ENATEGA")'; | |
// Check if the <div> element contains the correct text | |
const divElement = await page.getByText('TERMS AND CONDITIONS | ENATEGAPublished: 2021TERMS OF USEThese Terms of Use (“'); | |
await expect(divElement).toBeVisible(); | |
// Verify that the <h4> within the <div> contains the correct text | |
const h4Text = 'TERMS AND CONDITIONS | ENATEGA'; | |
const h4Element = divElement.locator(`h4:has-text("${h4Text}")`); | |
await expect(h4Element).toHaveText(h4Text); | |
// Add more checks for other elements | |
const additionalElement = await page.getByText('Some additional text'); | |
await expect(additionalElement).toBeVisible(); | |
}); |
test('check if the text exists in h6 elements within a list item', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/terms'); | ||
|
||
// Check for the presence of the text "TERMS OF USE" | ||
const termsOfUse = await page.getByRole('heading', { name: 'TERMS OF USE', exact: true }); | ||
await expect(termsOfUse).toBeVisible(); | ||
|
||
const termsText = await page.locator('text=These Terms of Use (“Terms”) govern your use of the websites and mobile applications provided by enatega'); | ||
await expect(termsText).toBeVisible(); | ||
|
||
const platformsText = await page.locator('text=The Platforms may be used by (i) natural persons who have reached 18 years of age and (ii) corporate legal entities, e.g companies.'); | ||
await expect(platformsText).toBeVisible(); | ||
|
||
const usersText = await page.locator('text=Users below the age of 18 must obtain consent from parent(s) or legal guardian(s), who by accepting these Terms shall agree to take responsibility for your actions and any charges associated with your use of the Platforms and/or purchase of Goods.'); | ||
await expect(usersText).toBeVisible(); | ||
|
||
const changeTermsText = await page.locator('text=Enatega reserves the right to change or modify these Terms (including our policies which are incorporated into these Terms) at any time.'); | ||
await expect(changeTermsText).toBeVisible(); | ||
|
||
const enategaText = await page.getByRole('link', { name: 'Enatega' }); | ||
await expect(enategaText).toBeVisible(); | ||
|
||
// Check for the presence of the text "What we do" | ||
const whatWeDoText = await page.locator('text=What we do'); | ||
await expect(whatWeDoText).toBeVisible(); | ||
|
||
const platformsText2 = await page.locator('text=Through our Platforms, enatega links you to the vendors (“Vendors”) for you to order a variety of goods including prepared meals, non-prepared food and miscellaneous non-food items (hereinafter collectively referred to as "Goods") to be delivered to you. When you place an order for Goods from our Vendors (“Order”), enatega acts as an agent on behalf of that Vendor to facilitate, process and conclude the order and subsequently for either us or the Vendor to deliver your Order to you. Vendors may be owned and operated by third party vendors, our affiliate companies, or us.'); | ||
await expect(platformsText2).toBeVisible(); | ||
|
||
// Check for the presence of the text "How to contact us" | ||
const contactUsText = await page.locator('text=How to contact us'); | ||
await expect(contactUsText).toBeVisible(); | ||
|
||
const supportText = await page.locator('text=For customer support, you may reach out to us via email or through our in-app customer support chat feature.'); | ||
await expect(supportText).toBeVisible(); | ||
|
||
const useOfPlatformsText = await page.locator('text=Use of the Platforms and enatega Account'); | ||
await expect(useOfPlatformsText).toBeVisible(); | ||
|
||
const registerText = await page.locator('text=You will need to register for a enatega account for you to use the Platform. When you register for a enatega account we will ask you to provide your personal information including a valid email address, a mobile phone number and a unique password. To purchase an Order, depending on which payment method you opt for, you may need to provide us with your credit card details. Your unique password should not be shared with anyone and you agree to keep it secret at all times. You are solely responsible for keeping your password safe. Save for cases of fraud or abuse which are not your fault, you accept that all Orders placed under your enatega account are your sole responsibility.'); | ||
await expect(registerText).toBeVisible(); | ||
|
||
const liabilityText = await page.locator('text=enatega shall not be liable for Orders that encounter delivery issues due to incomplete, incorrect or missing information provided by you. You are obliged to provide information that is complete, accurate and truthful for the proper processing of the Order, including your delivery address and contact information.'); | ||
await expect(liabilityText).toBeVisible(); | ||
|
||
const deleteAccountText = await page.locator('text=If you wish to delete your enatega account, please send us an email requesting the same. We may restrict, suspend or terminate your enatega account and/or use of the Platforms, if we reasonably believe that:'); | ||
await expect(deleteAccountText).toBeVisible(); | ||
|
||
const someoneElseUsingAccountText = await page.locator('text=someone other than you is using your enatega account; or'); | ||
await expect(someoneElseUsingAccountText).toBeVisible(); | ||
|
||
const breachText = await page.locator('text=where you are suspected or discovered to have been involved in any activity or conduct that is in breach of these Terms, our policies and guidelines, or involved in activity or conduct which we deem in our sole discretion to be an abuse of the Platforms.'); | ||
await expect(breachText).toBeVisible(); | ||
|
||
const intellectualPropertyHeaderText = await page.getByRole('heading', { name: 'Intellectual Property', exact: true }) | ||
await expect(intellectualPropertyHeaderText).toBeVisible(); | ||
|
||
const intellectualPropertyText1 = await page.locator('text=All trademarks, logos, images, and service marks, including these Terms as displayed on the Platforms or in our marketing material, whether registered or unregistered, are the intellectual property of enatega and/or third parties who have authorised us with the use (collectively the “Trademarks”).'); | ||
await expect(intellectualPropertyText1).toBeVisible(); | ||
|
||
const intellectualPropertyText2 = await page.locator('text=You may not use, copy, reproduce, republish, upload, post, transmit, distribute, or modify these Trademarks in any way without our prior express written consent.'); | ||
await expect(intellectualPropertyText2).toBeVisible(); | ||
|
||
const intellectualPropertyText3 = await page.locator('text=The use of enatega\'s trademarks on any other website not approved by us is strictly prohibited.'); | ||
await expect(intellectualPropertyText3).toBeVisible(); | ||
|
||
const intellectualPropertyText4 = await page.locator('text=Enatega will aggressively enforce its intellectual property rights to the fullest extent of the law, including criminal prosecution.'); | ||
await expect(intellectualPropertyText4).toBeVisible(); | ||
|
||
const intellectualPropertyText5 = await page.locator('text=Enatega neither warrants nor represents that your use of materials displayed on the Platforms will not infringe rights of third parties not owned by or affiliated with enatega.'); | ||
await expect(intellectualPropertyText5).toBeVisible(); | ||
|
||
const intellectualPropertyText6 = await page.locator('text=Use of any materials on the Platforms is at your own risk.'); | ||
await expect(intellectualPropertyText6).toBeVisible(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling and more checks.
The test function is comprehensive and checks for the presence of various texts. However, you might want to add error handling for navigation failure and more checks for other elements on the page to ensure comprehensive coverage.
+ // Add error handling for navigation failure
+ try {
+ await page.goto('http://localhost:3000/#/terms');
+ } catch (error) {
+ console.error('Navigation to terms page failed:', error);
+ throw error;
+ }
+
+ // Add more checks for other elements
+ const additionalElement = await page.getByText('Some additional text');
+ await expect(additionalElement).toBeVisible();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check if the text exists in h6 elements within a list item', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/terms'); | |
// Check for the presence of the text "TERMS OF USE" | |
const termsOfUse = await page.getByRole('heading', { name: 'TERMS OF USE', exact: true }); | |
await expect(termsOfUse).toBeVisible(); | |
const termsText = await page.locator('text=These Terms of Use (“Terms”) govern your use of the websites and mobile applications provided by enatega'); | |
await expect(termsText).toBeVisible(); | |
const platformsText = await page.locator('text=The Platforms may be used by (i) natural persons who have reached 18 years of age and (ii) corporate legal entities, e.g companies.'); | |
await expect(platformsText).toBeVisible(); | |
const usersText = await page.locator('text=Users below the age of 18 must obtain consent from parent(s) or legal guardian(s), who by accepting these Terms shall agree to take responsibility for your actions and any charges associated with your use of the Platforms and/or purchase of Goods.'); | |
await expect(usersText).toBeVisible(); | |
const changeTermsText = await page.locator('text=Enatega reserves the right to change or modify these Terms (including our policies which are incorporated into these Terms) at any time.'); | |
await expect(changeTermsText).toBeVisible(); | |
const enategaText = await page.getByRole('link', { name: 'Enatega' }); | |
await expect(enategaText).toBeVisible(); | |
// Check for the presence of the text "What we do" | |
const whatWeDoText = await page.locator('text=What we do'); | |
await expect(whatWeDoText).toBeVisible(); | |
const platformsText2 = await page.locator('text=Through our Platforms, enatega links you to the vendors (“Vendors”) for you to order a variety of goods including prepared meals, non-prepared food and miscellaneous non-food items (hereinafter collectively referred to as "Goods") to be delivered to you. When you place an order for Goods from our Vendors (“Order”), enatega acts as an agent on behalf of that Vendor to facilitate, process and conclude the order and subsequently for either us or the Vendor to deliver your Order to you. Vendors may be owned and operated by third party vendors, our affiliate companies, or us.'); | |
await expect(platformsText2).toBeVisible(); | |
// Check for the presence of the text "How to contact us" | |
const contactUsText = await page.locator('text=How to contact us'); | |
await expect(contactUsText).toBeVisible(); | |
const supportText = await page.locator('text=For customer support, you may reach out to us via email or through our in-app customer support chat feature.'); | |
await expect(supportText).toBeVisible(); | |
const useOfPlatformsText = await page.locator('text=Use of the Platforms and enatega Account'); | |
await expect(useOfPlatformsText).toBeVisible(); | |
const registerText = await page.locator('text=You will need to register for a enatega account for you to use the Platform. When you register for a enatega account we will ask you to provide your personal information including a valid email address, a mobile phone number and a unique password. To purchase an Order, depending on which payment method you opt for, you may need to provide us with your credit card details. Your unique password should not be shared with anyone and you agree to keep it secret at all times. You are solely responsible for keeping your password safe. Save for cases of fraud or abuse which are not your fault, you accept that all Orders placed under your enatega account are your sole responsibility.'); | |
await expect(registerText).toBeVisible(); | |
const liabilityText = await page.locator('text=enatega shall not be liable for Orders that encounter delivery issues due to incomplete, incorrect or missing information provided by you. You are obliged to provide information that is complete, accurate and truthful for the proper processing of the Order, including your delivery address and contact information.'); | |
await expect(liabilityText).toBeVisible(); | |
const deleteAccountText = await page.locator('text=If you wish to delete your enatega account, please send us an email requesting the same. We may restrict, suspend or terminate your enatega account and/or use of the Platforms, if we reasonably believe that:'); | |
await expect(deleteAccountText).toBeVisible(); | |
const someoneElseUsingAccountText = await page.locator('text=someone other than you is using your enatega account; or'); | |
await expect(someoneElseUsingAccountText).toBeVisible(); | |
const breachText = await page.locator('text=where you are suspected or discovered to have been involved in any activity or conduct that is in breach of these Terms, our policies and guidelines, or involved in activity or conduct which we deem in our sole discretion to be an abuse of the Platforms.'); | |
await expect(breachText).toBeVisible(); | |
const intellectualPropertyHeaderText = await page.getByRole('heading', { name: 'Intellectual Property', exact: true }) | |
await expect(intellectualPropertyHeaderText).toBeVisible(); | |
const intellectualPropertyText1 = await page.locator('text=All trademarks, logos, images, and service marks, including these Terms as displayed on the Platforms or in our marketing material, whether registered or unregistered, are the intellectual property of enatega and/or third parties who have authorised us with the use (collectively the “Trademarks”).'); | |
await expect(intellectualPropertyText1).toBeVisible(); | |
const intellectualPropertyText2 = await page.locator('text=You may not use, copy, reproduce, republish, upload, post, transmit, distribute, or modify these Trademarks in any way without our prior express written consent.'); | |
await expect(intellectualPropertyText2).toBeVisible(); | |
const intellectualPropertyText3 = await page.locator('text=The use of enatega\'s trademarks on any other website not approved by us is strictly prohibited.'); | |
await expect(intellectualPropertyText3).toBeVisible(); | |
const intellectualPropertyText4 = await page.locator('text=Enatega will aggressively enforce its intellectual property rights to the fullest extent of the law, including criminal prosecution.'); | |
await expect(intellectualPropertyText4).toBeVisible(); | |
const intellectualPropertyText5 = await page.locator('text=Enatega neither warrants nor represents that your use of materials displayed on the Platforms will not infringe rights of third parties not owned by or affiliated with enatega.'); | |
await expect(intellectualPropertyText5).toBeVisible(); | |
const intellectualPropertyText6 = await page.locator('text=Use of any materials on the Platforms is at your own risk.'); | |
await expect(intellectualPropertyText6).toBeVisible(); | |
}); | |
test('check if the text exists in h6 elements within a list item', async ({ page }) => { | |
// Add error handling for navigation failure | |
try { | |
await page.goto('http://localhost:3000/#/terms'); | |
} catch (error) { | |
console.error('Navigation to terms page failed:', error); | |
throw error; | |
} | |
// Check for the presence of the text "TERMS OF USE" | |
const termsOfUse = await page.getByRole('heading', { name: 'TERMS OF USE', exact: true }); | |
await expect(termsOfUse).toBeVisible(); | |
const termsText = await page.locator('text=These Terms of Use (“Terms”) govern your use of the websites and mobile applications provided by enatega'); | |
await expect(termsText).toBeVisible(); | |
const platformsText = await page.locator('text=The Platforms may be used by (i) natural persons who have reached 18 years of age and (ii) corporate legal entities, e.g companies.'); | |
await expect(platformsText).toBeVisible(); | |
const usersText = await page.locator('text=Users below the age of 18 must obtain consent from parent(s) or legal guardian(s), who by accepting these Terms shall agree to take responsibility for your actions and any charges associated with your use of the Platforms and/or purchase of Goods.'); | |
await expect(usersText).toBeVisible(); | |
const changeTermsText = await page.locator('text=Enatega reserves the right to change or modify these Terms (including our policies which are incorporated into these Terms) at any time.'); | |
await expect(changeTermsText).toBeVisible(); | |
const enategaText = await page.getByRole('link', { name: 'Enatega' }); | |
await expect(enategaText).toBeVisible(); | |
// Check for the presence of the text "What we do" | |
const whatWeDoText = await page.locator('text=What we do'); | |
await expect(whatWeDoText).toBeVisible(); | |
const platformsText2 = await page.locator('text=Through our Platforms, enatega links you to the vendors (“Vendors”) for you to order a variety of goods including prepared meals, non-prepared food and miscellaneous non-food items (hereinafter collectively referred to as "Goods") to be delivered to you. When you place an order for Goods from our Vendors (“Order”), enatega acts as an agent on behalf of that Vendor to facilitate, process and conclude the order and subsequently for either us or the Vendor to deliver your Order to you. Vendors may be owned and operated by third party vendors, our affiliate companies, or us.'); | |
await expect(platformsText2).toBeVisible(); | |
// Check for the presence of the text "How to contact us" | |
const contactUsText = await page.locator('text=How to contact us'); | |
await expect(contactUsText).toBeVisible(); | |
const supportText = await page.locator('text=For customer support, you may reach out to us via email or through our in-app customer support chat feature.'); | |
await expect(supportText).toBeVisible(); | |
const useOfPlatformsText = await page.locator('text=Use of the Platforms and enatega Account'); | |
await expect(useOfPlatformsText).toBeVisible(); | |
const registerText = await page.locator('text=You will need to register for a enatega account for you to use the Platform. When you register for a enatega account we will ask you to provide your personal information including a valid email address, a mobile phone number and a unique password. To purchase an Order, depending on which payment method you opt for, you may need to provide us with your credit card details. Your unique password should not be shared with anyone and you agree to keep it secret at all times. You are solely responsible for keeping your password safe. Save for cases of fraud or abuse which are not your fault, you accept that all Orders placed under your enatega account are your sole responsibility.'); | |
await expect(registerText).toBeVisible(); | |
const liabilityText = await page.locator('text=enatega shall not be liable for Orders that encounter delivery issues due to incomplete, incorrect or missing information provided by you. You are obliged to provide information that is complete, accurate and truthful for the proper processing of the Order, including your delivery address and contact information.'); | |
await expect(liabilityText).toBeVisible(); | |
const deleteAccountText = await page.locator('text=If you wish to delete your enatega account, please send us an email requesting the same. We may restrict, suspend or terminate your enatega account and/or use of the Platforms, if we reasonably believe that:'); | |
await expect(deleteAccountText).toBeVisible(); | |
const someoneElseUsingAccountText = await page.locator('text=someone other than you is using your enatega account; or'); | |
await expect(someoneElseUsingAccountText).toBeVisible(); | |
const breachText = await page.locator('text=where you are suspected or discovered to have been involved in any activity or conduct that is in breach of these Terms, our policies and guidelines, or involved in activity or conduct which we deem in our sole discretion to be an abuse of the Platforms.'); | |
await expect(breachText).toBeVisible(); | |
const intellectualPropertyHeaderText = await page.getByRole('heading', { name: 'Intellectual Property', exact: true }) | |
await expect(intellectualPropertyHeaderText).toBeVisible(); | |
const intellectualPropertyText1 = await page.locator('text=All trademarks, logos, images, and service marks, including these Terms as displayed on the Platforms or in our marketing material, whether registered or unregistered, are the intellectual property of enatega and/or third parties who have authorised us with the use (collectively the “Trademarks”).'); | |
await expect(intellectualPropertyText1).toBeVisible(); | |
const intellectualPropertyText2 = await page.locator('text=You may not use, copy, reproduce, republish, upload, post, transmit, distribute, or modify these Trademarks in any way without our prior express written consent.'); | |
await expect(intellectualPropertyText2).toBeVisible(); | |
const intellectualPropertyText3 = await page.locator('text=The use of enatega\'s trademarks on any other website not approved by us is strictly prohibited.'); | |
await expect(intellectualPropertyText3).toBeVisible(); | |
const intellectualPropertyText4 = await page.locator('text=Enatega will aggressively enforce its intellectual property rights to the fullest extent of the law, including criminal prosecution.'); | |
await expect(intellectualPropertyText4).toBeVisible(); | |
const intellectualPropertyText5 = await page.locator('text=Enatega neither warrants nor represents that your use of materials displayed on the Platforms will not infringe rights of third parties not owned by or affiliated with enatega.'); | |
await expect(intellectualPropertyText5).toBeVisible(); | |
const intellectualPropertyText6 = await page.locator('text=Use of any materials on the Platforms is at your own risk.'); | |
await expect(intellectualPropertyText6).toBeVisible(); | |
// Add more checks for other elements | |
const additionalElement = await page.getByText('Some additional text'); | |
await expect(additionalElement).toBeVisible(); | |
}); |
A little more tests to check the information component of the page
Terms tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/terms.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- enatega-multivendor-web/tests/tests/terms.spec.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/restaurant-list.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- enatega-multivendor-web/tests/tests/restaurant-list.spec.ts
Add terms check, and footer links redirection
Update terms check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/terms.spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- enatega-multivendor-web/tests/tests/terms.spec.ts
Login page tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
enatega-multivendor-web/__tests__/tests/login.spec.ts (3)
4-8
: Add comments for better context.Consider adding comments to explain the purpose of the test and the expected title.
+ // Test to check if the page has the correct title test('has title', async ({ page }) => { await page.goto('http://localhost:3000/#/new-login'); + // Expect the page title to contain "Enatega-Food Delivery" await expect(page).toHaveTitle(/Enatega-Food Delivery/); });
11-43
: Add comments for better readability and improve navigation waiting mechanism.Consider adding comments to explain each step and use
await page.waitForLoadState('networkidle')
for better navigation handling.test('Check for the existence of specific elements', async ({ page }) => { await page.goto('http://localhost:3000/#/login-email'); + // Define expected texts and URLs const expectedRedirectUrl = 'http://localhost:3000/#/'; const formHeadingText = 'Sign in with your email'; const passwordInstructionText = 'Type your password'; const forgotPasswordText = 'Forgot your password?'; const continueButtonText = 'CONTINUE'; + // Check for the form heading text await expect(page.getByText(formHeadingText)).toBeVisible(); // Check for the password instruction await expect(page.getByText(passwordInstructionText)).toBeVisible(); // Check for the Email label await expect(page.getByLabel('Email')).toBeVisible(); // Check for the Password label await expect(page.getByLabel('Password', { exact: true })).toBeVisible(); // Check for the Forgot your password link text await expect(page.getByText(forgotPasswordText)).toBeVisible(); // Check for the CONTINUE button text await expect(page.getByText(continueButtonText)).toBeVisible(); // Click the CONTINUE button await page.getByText(continueButtonText).click(); // Wait for the navigation to complete - await page.waitForNavigation(); + await page.waitForLoadState('networkidle'); // Check that the new URL is correct await expect(page).toHaveURL(expectedRedirectUrl); });
47-87
: Add comments for better readability and address commented-out navigation waiting mechanism.Consider adding comments to explain each step and either remove or fix the commented-out navigation waiting mechanism.
test('Check for the existence of specific elements by text content and redirection', async ({ page }) => { await page.goto('http://localhost:3000/#/login'); + // Define expected texts and URLs const expectedRedirectUrl = 'http://localhost:3000/#/new-login'; const welcomeText = 'Welcome!'; const signUpOrLogInText = 'Sign up or log in to continue'; const continueWithGoogleText = 'CONTINUE WITH GOOGLE'; const continueWithEmailText = 'CONTINUE WITH EMAIL'; const termsAndConditionsText = 'Terms and Conditions'; const privacyPolicyText = 'Privacy Policy'; + // Check for the welcome text await expect(page.getByText(welcomeText)).toBeVisible(); // Check for the sign-up or log-in text await expect(page.getByText(signUpOrLogInText)).toBeVisible(); // Check for the CONTINUE WITH GOOGLE button text await expect(page.getByText(continueWithGoogleText)).toBeVisible(); // Check for the "or" text await expect(page.getByText('or', { exact: true })).toBeVisible(); // Check for the CONTINUE WITH EMAIL button text await expect(page.getByText(continueWithEmailText)).toBeVisible(); // Check for the Terms and Conditions link text await expect(page.getByText(termsAndConditionsText)).toBeVisible(); // Check for the Privacy Policy link text await expect(page.getByText(privacyPolicyText)).toBeVisible(); // Click the CONTINUE WITH EMAIL button await page.getByText(continueWithEmailText).click(); // Wait for the navigation to complete - //await page.waitForNavigation(); + await page.waitForLoadState('networkidle'); // Check that the new URL is correct await expect(page).toHaveURL(expectedRedirectUrl); });
Check for main components on shop page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const superPapasText = "Super Papa's"; | ||
const superPapasDescriptionText = 'Pepperoni, Italian Sausage, Mushrooms, Onions, Green Peppers, Black Olives on a ...'; | ||
const signaturePizzasTitle = 'Signature Pizzas'; | ||
const addButtonSelector = '.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary.MuiButton-sizeMedium.MuiButton-textSizeMedium.makeStyles-addContainer-504.css-1fvkalb-MuiButtonBase-root-MuiButton-root'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify selectors.
Long selectors can be brittle and hard to maintain. Consider using more specific and shorter selectors if possible.
await expect(page.locator('div:nth-child(2) > .MuiPaper-root > div > p').first()).toBeVisible(); | ||
await expect(page.locator('div:nth-child(2) > .MuiPaper-root > div > p > .MuiTypography-root').first()).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify selectors.
Long selectors can be brittle and hard to maintain. Consider using more specific and shorter selectors if possible.
// await expect(page.locator(addButtonSelector).nth(0)).toBeVisible(); | ||
// await expect(page.locator(addButtonSelector).nth(1)).toBeVisible(); | ||
// await expect(page.locator(addButtonSelector).nth(2)).toBeVisible(); | ||
// await expect(page.locator(addButtonSelector).nth(3)).toBeVisible(); | ||
// await expect(page.locator(addButtonSelector).nth(4)).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented-out code.
Commented-out code can clutter the test file and make it harder to read. If the code is not needed, it should be removed.
- // Check for the Add buttons
- // await expect(page.locator(addButtonSelector).nth(0)).toBeVisible();
- // await expect(page.locator(addButtonSelector).nth(1)).toBeVisible();
- // await expect(page.locator(addButtonSelector).nth(2)).toBeVisible();
- // await expect(page.locator(addButtonSelector).nth(3)).toBeVisible();
- // await expect(page.locator(addButtonSelector).nth(4)).toBeVisible();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// await expect(page.locator(addButtonSelector).nth(0)).toBeVisible(); | |
// await expect(page.locator(addButtonSelector).nth(1)).toBeVisible(); | |
// await expect(page.locator(addButtonSelector).nth(2)).toBeVisible(); | |
// await expect(page.locator(addButtonSelector).nth(3)).toBeVisible(); | |
// await expect(page.locator(addButtonSelector).nth(4)).toBeVisible(); |
test('Check existence of elements2', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/pizza-shop');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('Check existence of elements2', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); | |
test('Check existence of elements2', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`); |
test('check specific elements exist', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/pizza-shop');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check specific elements exist', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); | |
test('check specific elements exist', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`); |
update shop tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- enatega-multivendor-web/tests/tests/shop.spec.ts (1 hunks)
Additional comments not posted (4)
enatega-multivendor-web/__tests__/tests/shop.spec.ts (4)
3-5
: Use environment variables for URLs.Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); + await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`);
50-54
: Remove commented-out code.Commented-out code can clutter the test file and make it harder to read. If the code is not needed, it should be removed.
- // Check for the Add buttons - // await expect(page.locator(addButtonSelector).nth(0)).toBeVisible(); - // await expect(page.locator(addButtonSelector).nth(1)).toBeVisible(); - // await expect(page.locator(addButtonSelector).nth(2)).toBeVisible(); - // await expect(page.locator(addButtonSelector).nth(3)).toBeVisible(); - // await expect(page.locator(addButtonSelector).nth(4)).toBeVisible();
57-59
: Use environment variables for URLs.Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/pizza-shop'); + await page.goto(`${process.env.BASE_URL}/#/restaurant/pizza-shop`);
69-70
: Simplify selectors.Long selectors can be brittle and hard to maintain. Consider using more specific and shorter selectors if possible.
test('check for italian food east', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/italian-food-east');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check for italian food east', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); | |
test('check for italian food east', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`); |
test('check presence of footer elements', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/italian-food-east');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check presence of footer elements', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); | |
test('check presence of footer elements', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`); |
test('Verify elements and interact with them', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/italian-food-east');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('Verify elements and interact with them', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); | |
test('Verify elements and interact with them', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`); |
test('check if specific pasta items exist', async ({ page }) => { | ||
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use environment variables for URLs.
Hardcoding URLs can make tests less flexible and harder to maintain. Consider using environment variables.
- await page.goto('http://localhost:3000/#/restaurant/italian-food-east');
+ await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
test('check if specific pasta items exist', async ({ page }) => { | |
await page.goto('http://localhost:3000/#/restaurant/italian-food-east'); | |
test('check if specific pasta items exist', async ({ page }) => { | |
await page.goto(`${process.env.BASE_URL}/#/restaurant/italian-food-east`); |
Hi, this PR includes adding the playwright tool to the project and a few test files