-
Notifications
You must be signed in to change notification settings - Fork 6
solution #3
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
base: main
Are you sure you want to change the base?
solution #3
Conversation
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.
Review Summary
Great job! 🎉 Your code meets all the core requirements and functionality for the task. All necessary components, pages, and tests are present and correctly structured. The minor issues mentioned—such as the use of waitForTimeout
, missing type annotations, a typo in a test name, selector details, and small ESLint or Playwright usage improvements—do not block approval, but I encourage you to address them in future updates for even better code quality and maintainability. Keep up the excellent work! 🚀
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
code: 80, | ||
comments: 80, | ||
code: 800, | ||
comments: 800, | ||
ignorePattern: 'import *', |
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.
The value for ignorePattern
in the max-len
rule is set to 'import *'
. This may not correctly match all import statements, as *
is not a valid wildcard in regular expressions. If you want to ignore all import lines, consider using a regular expression like '^import .*$'
instead. This is a minor issue but could affect the intended behavior of the rule.
|
||
return viewArticlePage.getCurrentPageUrl(); | ||
return baseViewArticlePage.getCurrentPageUrl(); |
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.
If baseViewArticlePage.getCurrentPageUrl()
is an asynchronous function (returns a Promise), you should use await
here to ensure that the resolved URL is returned rather than a Promise. Please check the implementation of getCurrentPageUrl()
and add await
if necessary.
await this.step(`Assert article title '${title}' is visible`, async () => { | ||
const articleTitle = this.page.locator('h1').filter({ | ||
hasText: title, | ||
visible: true, |
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.
The 'visible' property is not a valid option for Playwright's locator filter. If you want to ensure the element is visible, you should use Playwright's visibility assertions or the '.isVisible()' method separately.
await this.step(`Click on article title '${title}'`, async () => { | ||
const articleTitle = this.page.locator('h1').filter({ | ||
hasText: title, | ||
visible: true, |
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.
The 'visible' property is not a valid option for Playwright's locator filter. Please remove it and use Playwright's visibility checks or assertions as needed.
@@ -8,6 +8,7 @@ export class InternalHeader extends BaseHeader { | |||
super(page, userId); | |||
this.#newArticleLink = this.page.getByRole('link', { name: 'New Article' }); | |||
this.#settingsLink = this.page.getByRole('link', { name: 'Sign in' }); |
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.
The selector for the settings link uses { name: 'Sign in' }
. For an internal header (when the user is signed in), the link is usually labeled 'Settings', not 'Sign in'. Please verify and update the selector if necessary to ensure correct behavior.
@@ -13,7 +13,7 @@ test.beforeEach(async ({ page, user, logger }) => { | |||
test('Creat an article with required fields', async ({ |
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.
There is a typo in the test name: 'Creat an article with required fields'. It should be 'Create an article with required fields'.
await pages[1].waitForLoadState('domcontentloaded'); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); |
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.
There are multiple consecutive calls to waitForTimeout
and reload
. Excessive use of these can slow down your tests and may indicate a need for a more robust waiting strategy (e.g., waiting for a specific element or condition). Consider replacing these with more targeted waits if possible, or add a comment explaining why they are necessary.
await pages[1].waitForLoadState('domcontentloaded'); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); |
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.
There are multiple consecutive calls to waitForTimeout
and reload
. Excessive use of these can slow down your tests and may indicate a need for a more robust waiting strategy (e.g., waiting for a specific element or condition). Consider replacing these with more targeted waits if possible, or add a comment explaining why they are necessary.
}) => { | ||
await internalViewArticlePage.internalHeader.clickHomeLink(); | ||
await internalHomePage.popularTags.clickTag(articleWithOneTag.tags[0]); | ||
await page.waitForTimeout(3000); |
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.
The use of waitForTimeout(3000)
can slow down your tests and may indicate a need for a more robust waiting strategy (e.g., waiting for a specific element or condition). Consider replacing this with a targeted wait if possible.
}) => { | ||
await internalViewArticlePage.internalHeader.clickHomeLink(); | ||
await internalHomePage.globalFeed.open(); | ||
await page.waitForTimeout(3000); |
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.
The use of waitForTimeout(3000)
can slow down your tests and may indicate a need for a more robust waiting strategy (e.g., waiting for a specific element or condition). Consider replacing this with a targeted wait if possible.
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.
Review Summary
Thank you for your hard work! 🚧 While your solution meets most core requirements and is well-structured, there are several critical issues that need to be addressed before approval:
- Incorrect import of
expect
: Insrc/ui/components/header/BaseHeader.js
,expect
is imported fromallure-playwright
instead of your project's Playwright helper. This can cause runtime errors and must be fixed by importing from the correct path (e.g.,../../common/helpers/pw
). - Selector issue for settings link: In
src/ui/components/header/InternalHeader.js
, the settings link is assigned to the element with the name 'Sign in', but it should likely be 'Settings'. Please verify and update the selector to ensure correct functionality. - Missing TypeScript type annotations: In
tests/_fixtures/fixturesArticle.ts
, the properties in the generic type forbase.extend
are missing their types. Please specify types for all properties to ensure proper type checking and maintainability. - ESLint
max-len
rule configuration: TheignorePattern
option is not standard for themax-len
rule. Please review the ESLint documentation and update your configuration to use a valid option or regex pattern if you want to ignore import statements. - Minor issues: There are some minor issues, such as a typo in a test name ('Creat' instead of 'Create') and excessive use of
waitForTimeout
andreload
in some tests. While these do not block approval, addressing them will improve code quality and test reliability.
Once you resolve the critical issues above, your PR will be ready for approval! Keep up the great work—you're almost there! If you need help with any of the changes, feel free to ask. 😊
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review
button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor
tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
code: 80, | ||
comments: 80, | ||
code: 800, | ||
comments: 800, | ||
ignorePattern: 'import *', |
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.
The ignorePattern
option is not a standard option for the max-len
rule in ESLint. If your intention is to ignore import statements, you should use a valid regex pattern (e.g., '^import\\s.+\\sfrom\\s.+;$'
). Please check ESLint documentation for the correct usage of this option.
@@ -1,3 +1,4 @@ | |||
import { expect } from 'allure-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.
Issue: 'expect' is imported from 'allure-playwright', but it should be imported from '../../common/helpers/pw' (or your project's Playwright expect helper). This may cause runtime errors if 'expect' is not available from 'allure-playwright'. Please correct the import path.
@@ -8,6 +8,7 @@ export class InternalHeader extends BaseHeader { | |||
super(page, userId); | |||
this.#newArticleLink = this.page.getByRole('link', { name: 'New Article' }); | |||
this.#settingsLink = this.page.getByRole('link', { name: 'Sign in' }); |
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.
Issue: The settings link is being assigned to the element with the name 'Sign in'. For an internal header, this should likely be 'Settings' instead. Please verify the selector and update it to match the correct link.
articleWithoutTags; | ||
articleWithOneTag; | ||
createArticlePage; | ||
viewArticlePage; | ||
baseViewArticlePage; | ||
editArticlePage; | ||
externalViewArticlePage; | ||
internalViewArticlePage; |
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.
TypeScript issue: The properties in the generic type for base.extend
are missing their types. For example, use articleWithoutTags: Type;
instead of just articleWithoutTags;
. Please specify the types for all properties to ensure proper type checking.
@@ -13,7 +13,7 @@ test.beforeEach(async ({ page, user, logger }) => { | |||
test('Creat an article with required fields', async ({ |
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.
Typo: The test name has a typo. It should be 'Create an article with required fields' instead of 'Creat an article with required fields'.
await pages[1].waitForLoadState('domcontentloaded'); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); |
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.
Issue: There are multiple consecutive calls to waitForTimeout
and reload
on pages[1]
. Unless strictly required by the application logic or checklist, this is excessive and can make the test slow and brittle. Consider removing or reducing these calls to improve test efficiency and reliability.
await pages[1].waitForLoadState('domcontentloaded'); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); | ||
await pages[1].reload(); | ||
await pages[1].reload(); | ||
await pages[1].waitForTimeout(2000); |
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.
Issue: There are multiple consecutive calls to waitForTimeout
and reload
on pages[1]
. Unless strictly required by the application logic or checklist, this is excessive and can make the test slow and brittle. Consider removing or reducing these calls to improve test efficiency and reliability.
No description provided.