Skip to content
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

Errors #4855

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Errors #4855

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/test.yml-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Upload HTML report(backstop data)
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: report
path: backstop_data
78 changes: 0 additions & 78 deletions backstopConfig.js

This file was deleted.

2 changes: 1 addition & 1 deletion backstop_data/engine_scripts/cookies.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"httpOnly": false,
"secure": false,
"session": false,
"sameSite": "no_restriction"
"sameSite": "Lax"
}
]
14 changes: 8 additions & 6 deletions backstop_data/engine_scripts/puppet/clickAndHoverHelper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = async (page, scenario) => {
var hoverSelector = scenario.hoverSelectors || scenario.hoverSelector;
var clickSelector = scenario.clickSelectors || scenario.clickSelector;
var keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector;
var scrollToSelector = scenario.scrollToSelector;
var postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int]
const hoverSelector = scenario.hoverSelectors || scenario.hoverSelector;
const clickSelector = scenario.clickSelectors || scenario.clickSelector;
const keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector;
const scrollToSelector = scenario.scrollToSelector;
const postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int]

if (keyPressSelector) {
for (const keyPressSelectorItem of [].concat(keyPressSelector)) {
Expand All @@ -27,7 +27,9 @@ module.exports = async (page, scenario) => {
}

if (postInteractionWait) {
await new Promise(resolve => setTimeout(resolve, postInteractionWait));
await new Promise(resolve => {
setTimeout(resolve, postInteractionWait);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that postInteractionWait is a positive integer to avoid unexpected behavior in the setTimeout function.

});
}

if (scrollToSelector) {
Expand Down
29 changes: 0 additions & 29 deletions backstop_data/engine_scripts/puppet/loadCookies.js

This file was deleted.

43 changes: 43 additions & 0 deletions javascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const products = [
{
imgSrc: 'images/imac.jpeg',
altText: 'Apple iMac',
title: 'APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)',
code: '195434',
reviews: 5,
price: '$2,199',
},
// Другие карточки
];

const productContainer = document.getElementById('product-container');

products.forEach((product) => {
const card = document.createElement('div');
card.className = 'card';
card.setAttribute('data-qa', 'card');

card.innerHTML = `
<img class="card__img" src="${product.imgSrc}" alt="${product.altText}" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling or a default image in case product.imgSrc is not a valid URL or the image fails to load.

<h2 class="card__title">${product.title}</h2>
<p class="card__text-code">Product code: ${product.code}</p>
<div class="card__review">
<div class="stars">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<p class="card__text-review">Reviews: ${product.reviews}</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of stars displayed does not currently reflect the product.reviews value. Consider implementing logic to dynamically render the correct number of filled stars based on the reviews value.

</div>
<div class="card__price">
<p class="card__text-price">Price:</p>
<p class="card__text-value">${product.price}</p>
</div>
<a href="#" class="card__button">Buy</a>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'Buy' button currently has a href attribute set to '#', which doesn't lead anywhere. Consider implementing a proper link or event handler for purchasing functionality.

`;

productContainer.appendChild(card);
});

1 change: 1 addition & 0 deletions layout_catalog
Submodule layout_catalog added at 83bec8
Loading
Loading