Skip to content

Commit

Permalink
Production release: v20240130.0 (#5204)
Browse files Browse the repository at this point in the history
* FORNO-1751: Update mu-plugins to use new smtp (#5144)

* Use VIP's SMTP server for sending emails

* Add flag VIP_SMTP_ENABLED to handle safe migration to new SMTP server

* style: fix lint issues

* Add VIP SMTP related tests

---------

Co-authored-by: Abdullah bin Kasim <[email protected]>
Co-authored-by: Volodymyr Kolesnykov <[email protected]>

* chore(deps-dev): Bump sass-loader in /search/search-dev-tools (#5149)

Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 13.3.3 to 14.0.0.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](webpack-contrib/sass-loader@v13.3.3...v14.0.0)

---
updated-dependencies:
- dependency-name: sass-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump postcss-loader in /search/search-dev-tools (#5158)

Bumps [postcss-loader](https://github.com/webpack-contrib/postcss-loader) from 7.3.4 to 8.0.0.
- [Release notes](https://github.com/webpack-contrib/postcss-loader/releases)
- [Changelog](https://github.com/webpack-contrib/postcss-loader/blob/master/CHANGELOG.md)
- [Commits](webpack-contrib/postcss-loader@v7.3.4...v8.0.0)

---
updated-dependencies:
- dependency-name: postcss-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump autoprefixer in /search/search-dev-tools (#5164)

Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.16 to 10.4.17.
- [Release notes](https://github.com/postcss/autoprefixer/releases)
- [Changelog](https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md)
- [Commits](postcss/autoprefixer@10.4.16...10.4.17)

---
updated-dependencies:
- dependency-name: autoprefixer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump css-minimizer-webpack-plugin from 5.0.1 to 6.0.0 in /search/search-dev-tools (#5165)

* chore(deps-dev): Bump css-minimizer-webpack-plugin

Bumps [css-minimizer-webpack-plugin](https://github.com/webpack-contrib/css-minimizer-webpack-plugin) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/webpack-contrib/css-minimizer-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/css-minimizer-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](webpack-contrib/css-minimizer-webpack-plugin@v5.0.1...v6.0.0)

---
updated-dependencies:
- dependency-name: css-minimizer-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Regenerate the bundle

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: WordPress VIP Bot <[email protected]>

* chore(deps-dev): Bump @types/node in /__tests__/e2e (#5163)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.0 to 20.11.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump playwright from 1.40.1 to 1.41.0 in /__tests__/e2e (#5156)

Bumps [playwright](https://github.com/microsoft/playwright) from 1.40.1 to 1.41.0.
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.40.1...v1.41.0)

---
updated-dependencies:
- dependency-name: playwright
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @playwright/test in /__tests__/e2e (#5155)

Bumps [@playwright/test](https://github.com/microsoft/playwright) from 1.40.1 to 1.41.0.
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.40.1...v1.41.0)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump shivammathur/setup-php from 2.28.0 to 2.29.0 (#5148)

Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.28.0 to 2.29.0.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](shivammathur/setup-php@2.28.0...2.29.0)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump @wordpress/i18n from 4.48.0 to 4.49.0 (#5161)

Bumps [@wordpress/i18n](https://github.com/WordPress/gutenberg/tree/HEAD/packages/i18n) from 4.48.0 to 4.49.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/i18n/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/[email protected]/packages/i18n)

---
updated-dependencies:
- dependency-name: "@wordpress/i18n"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @wordpress/env from 9.0.0 to 9.1.0 (#5160)

Bumps [@wordpress/env](https://github.com/WordPress/gutenberg/tree/HEAD/packages/env) from 9.0.0 to 9.1.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/env/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/[email protected]/packages/env)

---
updated-dependencies:
- dependency-name: "@wordpress/env"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump @wordpress/api-fetch from 6.45.0 to 6.46.0 (#5159)

Bumps [@wordpress/api-fetch](https://github.com/WordPress/gutenberg/tree/HEAD/packages/api-fetch) from 6.45.0 to 6.46.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/api-fetch/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/[email protected]/packages/api-fetch)

---
updated-dependencies:
- dependency-name: "@wordpress/api-fetch"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: update Dependabot configuration (#5166)

* chore(deps): Bump actions/dependency-review-action from 3 to 4 (#5169)

Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 3 to 4.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](actions/dependency-review-action@v3...v4)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump actions/checkout in /.github/actions/prepare-source (#5167)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump sass in /search/search-dev-tools (#5168)

Bumps [sass](https://github.com/sass/dart-sass) from 1.69.7 to 1.70.0.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](sass/dart-sass@1.69.7...1.70.0)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump sjinks/setup-wordpress-test-library (#5171)

Bumps [sjinks/setup-wordpress-test-library](https://github.com/sjinks/setup-wordpress-test-library) from 1.1.18 to 2.0.2.
- [Release notes](https://github.com/sjinks/setup-wordpress-test-library/releases)
- [Commits](sjinks/setup-wordpress-test-library@1.1.18...2.0.2)

---
updated-dependencies:
- dependency-name: sjinks/setup-wordpress-test-library
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump shivammathur/setup-php (#5170)

Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.25.2 to 2.29.0.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](shivammathur/setup-php@2.25.2...2.29.0)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump eslint-plugin-playwright in /__tests__/e2e (#5172)

Bumps [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright) from 0.21.0 to 0.22.1.
- [Release notes](https://github.com/playwright-community/eslint-plugin-playwright/releases)
- [Changelog](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/CHANGELOG.md)
- [Commits](playwright-community/eslint-plugin-playwright@v0.21.0...v0.22.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-playwright
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test(e2e): fix Unexpected use of page.waitForSelector() (#5173)

* chore(deps-dev): Bump css-loader in /search/search-dev-tools (#5174)

Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 6.9.0 to 6.9.1.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](webpack-contrib/css-loader@v6.9.0...v6.9.1)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add and set wp-parsely 3.13 as the default version (#5176)

* Add smtp port and smtp auth configuration (#5175)

* FORNO-1745: Handle SMTP mail failure when sending mail from unmapped domains (#5182)

* Attempt to resend mail from unmapped domains

* Add tests related to unmapped domains

* Add test cases for handling mail failures related to sender address getting rejected at SMTP side

* Update the smtp message for which we are doing validation

* Enable wp_mail_failed hook only if VIP SMTP Flag is enabled

* Add VIP_SMTP_ENABLED check for wp mail failures

---------

Co-authored-by: Todd Wright <[email protected]>

* Don’t esc_html wp_mail arguments (#5202)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Aagam Shah <[email protected]>
Co-authored-by: Abdullah bin Kasim <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: WordPress VIP Bot <[email protected]>
Co-authored-by: Alex Cicovic <[email protected]>
Co-authored-by: Luiz Tiago Oliveira <[email protected]>
Co-authored-by: Todd Wright <[email protected]>
Co-authored-by: Todd Wright <[email protected]>
  • Loading branch information
9 people authored Jan 30, 2024
1 parent de3299d commit 6013e87
Show file tree
Hide file tree
Showing 29 changed files with 659 additions and 557 deletions.
2 changes: 1 addition & 1 deletion .github/actions/prepare-source/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: composite
steps:
- name: Check out mu-plugins-ext
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: 'Automattic/vip-go-mu-plugins-ext'
path: 'vip-go-mu-plugins-ext'
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/run-wp-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ runs:
fi
- name: Set up PHP
uses: shivammathur/setup-php@2.25.2
uses: shivammathur/setup-php@2.29.0
with:
coverage: ${{ steps.coverage.outputs.coverage }}
ini-values: ${{ steps.coverage.outputs.ini }}
Expand All @@ -76,7 +76,7 @@ runs:
uses: ramsey/[email protected]

- name: Set up WordPress and WordPress Test Library
uses: sjinks/setup-wordpress-test-library@1.1.18
uses: sjinks/setup-wordpress-test-library@2.0.2
with:
version: ${{ inputs.wordpress }}

Expand Down
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ updates:
package-ecosystem: github-actions
schedule:
interval: daily
labels:
- '[Status] Needs Review'
- '[Status] No files to Deploy'
- '[Type] Maintenance'

- directory: /.github/actions/prepare-source
package-ecosystem: github-actions
schedule:
interval: daily
labels:
- '[Status] Needs Review'
- '[Status] No files to Deploy'
- '[Type] Maintenance'

- directory: /.github/actions/run-wp-tests
package-ecosystem: github-actions
schedule:
interval: daily
labels:
- '[Status] Needs Review'
- '[Status] No files to Deploy'
- '[Type] Maintenance'

- directory: /
package-ecosystem: npm
Expand All @@ -13,21 +35,31 @@ updates:
versioning-strategy: increase-if-necessary
ignore:
- dependency-name: "cypress"
labels:
- '[Status] Needs Review'
- '[Status] No files to Deploy'

- directory: /__tests__/e2e/
package-ecosystem: npm
schedule:
interval: daily
versioning-strategy: increase-if-necessary
labels:
- '[Status] Needs Review'
- '[Status] No files to Deploy'

- directory: /search/search-dev-tools/
package-ecosystem: npm
schedule:
interval: daily
versioning-strategy: increase-if-necessary
labels:
- '[Status] Needs Review'

- directory: /
package-ecosystem: composer
schedule:
interval: daily
versioning-strategy: increase-if-necessary
labels:
- '[Status] Needs Review'
2 changes: 1 addition & 1 deletion .github/workflows/changelog-summary-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: actions/[email protected]

- name: Setup PHP
uses: shivammathur/setup-php@2.28.0
uses: shivammathur/setup-php@2.29.0

- name: Install
uses: ramsey/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-summary-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/[email protected]

- name: Setup PHP
uses: shivammathur/setup-php@2.28.0
uses: shivammathur/setup-php@2.29.0

- name: Install
uses: ramsey/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
cache-dependency-path: 'wordpress/package-lock.json'

- name: Set up PHP
uses: shivammathur/setup-php@2.28.0
uses: shivammathur/setup-php@2.29.0
with:
php-version: 8.0
coverage: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
uses: actions/[email protected]

- name: Review dependencies
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/[email protected]

- name: Set up PHP
uses: shivammathur/setup-php@2.28.0
uses: shivammathur/setup-php@2.29.0
with:
coverage: none
env:
Expand Down
30 changes: 13 additions & 17 deletions __tests__/e2e/lib/pages/media-upload-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* External dependencies
*/
import { Page } from '@playwright/test';
import type { Page } from '@playwright/test';

const selectors = {
selectFilesButton: '#plupload-browse-button',
Expand All @@ -13,19 +10,19 @@ export class MediaUploadPage {
readonly page: Page;

/**
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
constructor( page: Page ) {
this.page = page;
}

/**
* Upload File
*
* @param { string } mediaFile Media file name
*/
* Upload File
*
* @param { string } mediaFile Media file name
*/
async uploadFile( mediaFile: string ): Promise<void> {
const [ fileChooser ] = await Promise.all( [
// It is important to call waitForEvent before click to set up waiting.
Expand All @@ -37,12 +34,11 @@ export class MediaUploadPage {
}

/**
* Get Meduia URL
*
* @return { Promise<string | null> } Url of uploaded media
*/
* Get Media URL
*
* @return { Promise<string | null> } Url of uploaded media
*/
async getMediaUrl(): Promise<string | null> {
await this.page.waitForSelector( selectors.attachedMediaDetails );
return this.page.locator( selectors.copyURLButton ).getAttribute( 'data-clipboard-text' );
}
}
25 changes: 11 additions & 14 deletions __tests__/e2e/lib/pages/page-list-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* External dependencies
*/
import { Page } from '@playwright/test';
import type { Page } from '@playwright/test';

const selectors = {
pageLink: ( pageID: string ) => `#post-${ pageID } a.row-title`,
Expand All @@ -11,26 +8,26 @@ export class PageListPage {
readonly page: Page;

/**
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
constructor( page: Page ) {
this.page = page;
}

/**
* Navigate to Page List page
*/
* Navigate to Page List page
*/
visit(): Promise<unknown> {
return this.page.goto( '/wp-admin/edit.php?post_type=page' );
}

/**
* Edit Page by ID
*
* @param { string } pageID ID of the page to be edited
*/
* Edit Page by ID
*
* @param { string } pageID ID of the page to be edited
*/
editPageByID( pageID: string ): Promise<void> {
return this.page.click( selectors.pageLink( pageID ) );
}
Expand Down
25 changes: 11 additions & 14 deletions __tests__/e2e/lib/pages/post-list-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* External dependencies
*/
import { Page } from '@playwright/test';
import type { Page } from '@playwright/test';

const selectors = {
postLink: ( postID: string ) => `#post-${ postID } a.row-title`,
Expand All @@ -11,26 +8,26 @@ export class PostListPage {
readonly page: Page;

/**
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
* Constructs an instance of the component.
*
* @param { Page } page The underlying page
*/
constructor( page: Page ) {
this.page = page;
}

/**
* Navigate to Post List page
*/
* Navigate to Post List page
*/
visit(): Promise<unknown> {
return this.page.goto( '/wp-admin/edit.php' );
}

/**
* Edit Post by ID
*
* @param {string} postID ID of the post to be edited
*/
* Edit Post by ID
*
* @param {string} postID ID of the post to be edited
*/
editPostByID( postID: string ): Promise<void> {
return this.page.click( selectors.postLink( postID ) );
}
Expand Down
30 changes: 13 additions & 17 deletions __tests__/e2e/lib/pages/published-page-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* External dependencies
*/
import { Page } from 'playwright';
import type { Page } from 'playwright';

const selectors = {
entryTitle: '.wp-block-post-title',
Expand All @@ -16,25 +13,24 @@ export class PublishedPagePage {
private page: Page;

/**
* Constructs an instance of the component.
*
* @param {Page} page The underlying page.
*/
* Constructs an instance of the component.
*
* @param {Page} page The underlying page.
*/
constructor( page: Page ) {
this.page = page;
}

/**
* Validates that the provided text can be found in the page.
*
* @param {string} text Text to search for in the page
*/
* Validates that the provided text can be found in the page.
*
* @param {string} text Text to search for in the page
*/
async validateTextInPost( text: string ): Promise<void> {
// If text isn't found the first time, reload and check again up to 2 more times.
let postTry = 0;
/* eslint-disable no-await-in-loop */
while ( postTry < 3 ) {
await this.page.waitForSelector( selectors.entryTitle );
if ( await this.page.locator( selectors.pageText( text ) ).first().isVisible() ) {
break;
} else {
Expand All @@ -46,10 +42,10 @@ export class PublishedPagePage {
}

/**
* Returns boolean of whether or not image was found in page
*
* @return {Promise<boolean>} True if image is found, otherwise false
*/
* Returns boolean of whether or not image was found in page
*
* @return {Promise<boolean>} True if image is found, otherwise false
*/
isImageDisplayed(): Promise<boolean> {
return this.page.isVisible( selectors.pageImage );
}
Expand Down
30 changes: 13 additions & 17 deletions __tests__/e2e/lib/pages/published-post-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* External dependencies
*/
import { Page } from 'playwright';
import type { Page } from 'playwright';

const selectors = {
entryTitle: '.wp-block-post-title',
Expand All @@ -16,25 +13,24 @@ export class PublishedPostPage {
private page: Page;

/**
* Constructs an instance of the component.
*
* @param {Page} page The underlying page.
*/
* Constructs an instance of the component.
*
* @param {Page} page The underlying page.
*/
constructor( page: Page ) {
this.page = page;
}

/**
* Validates that the provided text can be found in the post page.
*
* @param {string} text Text to search for in post page
*/
* Validates that the provided text can be found in the post page.
*
* @param {string} text Text to search for in post page
*/
async validateTextInPost( text: string ): Promise<void> {
// If text isn't found the first time, reload and check again up to 2 more times.
let pageTry = 0;
/* eslint-disable no-await-in-loop */
while ( pageTry < 3 ) {
await this.page.waitForSelector( selectors.entryTitle );
if ( await this.page.locator( selectors.postText( text ) ).first().isVisible() ) {
break;
} else {
Expand All @@ -46,10 +42,10 @@ export class PublishedPostPage {
}

/**
* Returns boolean of whether or not image was found in post
*
* @return {Promise<boolean>} True if image is found, otherwise false
*/
* Returns boolean of whether or not image was found in post
*
* @return {Promise<boolean>} True if image is found, otherwise false
*/
isImageDisplayed(): Promise<boolean> {
return this.page.isVisible( selectors.postImage );
}
Expand Down
Loading

0 comments on commit 6013e87

Please sign in to comment.