Skip to content

Commit

Permalink
fixed tests for running in the pro version
Browse files Browse the repository at this point in the history
  • Loading branch information
Fellan-91 committed Aug 20, 2024
1 parent 242eec3 commit 80696b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/e2e/specs/archive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ test.describe('archive pages', () => {
hasText: 'Categories Count',
})
.locator('input.components-input-control__input')
.first()
.fill('3');

await page.getByLabel('Display Excerpt').check();
Expand Down Expand Up @@ -351,7 +352,7 @@ test.describe('archive pages', () => {
.locator('#menu-posts-portfolio')
.getByRole('link', { name: 'Settings' })
.click();
await page.getByRole('textbox', { name: '-- Select Page --' }).click();
await page.locator('.select2-container').click();
await page.getByRole('option', { name: 'Portfolio' }).click();
await page.getByLabel('Archive Page Items Per Page').fill('2');
await page.getByRole('button', { name: 'Save Changes' }).click();
Expand Down
9 changes: 8 additions & 1 deletion tests/e2e/utils/get-wordpress-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import imagePaths from '../../fixtures/images.json';
* @param {Admin} admin End to end test utilities for WordPress admin’s user interface.
* @param {Editor} editor End to end test utilities for the WordPress Block Editor.
* @param {boolean} alternativeSetting Set alternative meta settings for test images.
* @param {boolean} usingInPro Set if using in pro plugin.
* @return {{images: {format: string, video_url: string, url: string}[]}}
*/
export async function getWordpressImages({
Expand All @@ -23,6 +24,7 @@ export async function getWordpressImages({
admin,
editor,
alternativeSetting = false,
usingInPro = false,
}) {
let images = [];
let postLink = '';
Expand Down Expand Up @@ -56,9 +58,14 @@ export async function getWordpressImages({
await page.goto(currentPage);
}

const imagePath =
process.env.CORE || usingInPro
? 'core-plugin/tests/fixtures/'
: 'tests/fixtures/';

images = await Promise.all(
imagePaths.map(async (object) => {
const filepath = path.join('tests/fixtures/', object.filename);
const filepath = path.join(imagePath, object.filename);
// Upload image to WordPress gallery.
const media = await requestUtils.uploadMedia(filepath);

Expand Down

0 comments on commit 80696b9

Please sign in to comment.