Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

serhiiananiev
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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

  1. Rate AI review example

code: 80,
comments: 80,
code: 800,
comments: 800,
ignorePattern: 'import *',

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();

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,

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,

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' });

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 ({

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'.

Comment on lines +22 to +31
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);

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.

Comment on lines +20 to +29
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);

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);

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);

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.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. Incorrect import of expect: In src/ui/components/header/BaseHeader.js, expect is imported from allure-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).
  2. 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.
  3. Missing TypeScript type annotations: In tests/_fixtures/fixturesArticle.ts, the properties in the generic type for base.extend are missing their types. Please specify types for all properties to ensure proper type checking and maintainability.
  4. ESLint max-len rule configuration: The ignorePattern option is not standard for the max-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.
  5. Minor issues: There are some minor issues, such as a typo in a test name ('Creat' instead of 'Create') and excessive use of waitForTimeout and reload 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

code: 80,
comments: 80,
code: 800,
comments: 800,
ignorePattern: 'import *',

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';

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' });

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.

Comment on lines 10 to +16
articleWithoutTags;
articleWithOneTag;
createArticlePage;
viewArticlePage;
baseViewArticlePage;
editArticlePage;
externalViewArticlePage;
internalViewArticlePage;

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 ({

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'.

Comment on lines +22 to +31
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);

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.

Comment on lines +20 to +29
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);

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants