Skip to content

Commit

Permalink
added await constructions for some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fellan-91 committed Aug 21, 2024
1 parent dcd5ee6 commit 6ac360a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 1 addition & 3 deletions tests/e2e/specs/archive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ test.describe('archive pages', () => {
while (currentCount < pageCounts) {
const archivePagination = [];

await page.waitForTimeout(1000);
await page.waitForTimeout(2000);

const archiveItems = await getArchiveItems(page);

Expand Down Expand Up @@ -482,8 +482,6 @@ test.describe('archive pages', () => {
'.vp-pagination__item.vp-pagination__item-next > a'
)
.click();

await page.waitForTimeout(700);
}
}

Expand Down
26 changes: 16 additions & 10 deletions tests/e2e/specs/click-action-images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ test.describe('click action gallery images', () => {

await page.waitForTimeout(2000);

const galleryImages = page
const galleryImages = await page
.frame('vpf-preview-1')
.locator('.vp-portfolio__items .vp-portfolio__item-wrap');

Expand All @@ -293,7 +293,7 @@ test.describe('click action gallery images', () => {
const popup = await galleryImage
.locator('.vp-portfolio__item-popup')
.count();
const title = galleryImage.locator(
const title = await galleryImage.locator(
'.vp-portfolio__item-meta-title > a'
);
const titleText = await title.innerText();
Expand Down Expand Up @@ -321,8 +321,10 @@ test.describe('click action gallery images', () => {
.first()
.click();

await page.waitForTimeout(2000);

// Check Frontend.
const galleryFrontendImages = page.locator(
const galleryFrontendImages = await page.locator(
'.vp-portfolio__items .vp-portfolio__item-wrap'
);

Expand All @@ -332,7 +334,7 @@ test.describe('click action gallery images', () => {
const popup = await galleryImage
.locator('.vp-portfolio__item-popup')
.count();
const title = galleryImage.locator(
const title = await galleryImage.locator(
'.vp-portfolio__item-meta-title > a'
);
const titleText = await title.innerText();
Expand Down Expand Up @@ -434,7 +436,7 @@ test.describe('click action gallery images', () => {
async (x) => x.title === object.title
);

expectedPopupPreset[key].imageUrl = foundImage.imgUrl;
expectedPopupPreset[key].imageUrl = await foundImage.imgUrl;

const match = foundImage.imgUrl.match(/(\d+x\d+)/);

Expand Down Expand Up @@ -466,7 +468,7 @@ test.describe('click action gallery images', () => {

await page.waitForTimeout(3000);

const galleryImages = page
const galleryImages = await page
.frame('vpf-preview-1')
.locator('.vp-portfolio__items .vp-portfolio__item-wrap');

Expand All @@ -477,14 +479,16 @@ test.describe('click action gallery images', () => {
/**
* Check the layout and collect an array with information about items.
*/
const popup = galleryImage.locator('.vp-portfolio__item-popup');
const popup = await galleryImage.locator(
'.vp-portfolio__item-popup'
);
const isVideoPopup = await galleryImage
.locator('[data-vp-popup-video]')
.count();
const isImagePopup = await galleryImage
.locator('[data-vp-popup-img]')
.count();
const title = galleryImage.locator(
const title = await galleryImage.locator(
'.vp-portfolio__item-meta-title > a'
);
const titleText = await title.innerText();
Expand Down Expand Up @@ -525,8 +529,10 @@ test.describe('click action gallery images', () => {
.first()
.click();

await page.waitForTimeout(3000);

// Check Frontend.
const galleryFrontendImages = page.locator(
const galleryFrontendImages = await page.locator(
'.vp-portfolio__items .vp-portfolio__item-wrap'
);

Expand All @@ -540,7 +546,7 @@ test.describe('click action gallery images', () => {
const isImagePopup = await galleryImage
.locator('[data-vp-popup-img]')
.count();
const title = galleryImage.locator(
const title = await galleryImage.locator(
'.vp-portfolio__item-meta-title > a'
);
const titleText = await title.innerText();
Expand Down

0 comments on commit 6ac360a

Please sign in to comment.