fix: releases page e2e (#21938)

* fix: releases page e2e

* chore: log e2e

* chore: use click and wait utility

* chore: test not waiting for redirect

* chore: change release name

* chore: log network error

* fix: comma

* fix: set timezone

* chore: remove logs

---------

Co-authored-by: markkaylor <mark.kaylor@strapi.io>
This commit is contained in:
Marc Roig 2024-10-28 14:41:10 +01:00 committed by GitHub
parent c222e1c4de
commit f8de0529b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 53 deletions

View File

@ -62,6 +62,9 @@ const createConfig = ({ port, testDir, appDir }) => ({
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: `http://127.0.0.1:${port}`,
/** Set timezone for consistency across any machine*/
timezoneId: 'Europe/Paris',
/* Default time each action such as `click()` can take to 20s */
actionTimeout: getEnvNum(process.env.PLAYWRIGHT_ACTION_TIMEOUT, 20 * 1000),
trace: 'retain-on-failure',

View File

@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { describeOnCondition, navToHeader } from '../../utils/shared';
import { clickAndWait, describeOnCondition } from '../../utils/shared';
import { resetDatabaseAndImportDataFromPath } from '../../utils/dts-import';
import { login } from '../../utils/login';
@ -43,60 +43,58 @@ describeOnCondition(edition === 'EE')('Releases page', () => {
await expect(page.getByRole('link', { name: `${newReleaseName}` })).toBeVisible();
});
test.fixme(
'A user should be able to create a release with scheduling info and view their pending and done releases',
async ({ page }) => {
// Navigate to the releases page
await page.getByRole('link', { name: 'Releases' }).click();
test('A user should be able to create a release with scheduling info and view their pending and done releases', async ({
page,
}) => {
// Navigate to the releases page
await clickAndWait(page, page.getByRole('link', { name: 'Releases' }));
// Open the create release dialog
await page.getByRole('button', { name: 'New release' }).click();
await expect(page.getByRole('dialog', { name: 'New release' })).toBeVisible();
// Open the create release dialog
await clickAndWait(page, page.getByRole('button', { name: 'New release' }));
await expect(page.getByRole('dialog', { name: 'New release' })).toBeVisible();
// Create a release
const newReleaseName = 'The Diamond Dogs';
await page.getByRole('textbox', { name: 'Name' }).fill(newReleaseName);
// Create a release
const newReleaseName = 'The Diamond Dogs';
await page.getByRole('textbox', { name: 'Name' }).fill(newReleaseName);
// Select valid date and time
await page
.getByRole('combobox', {
name: 'Date',
})
.click();
// Select valid date and time
await page
.getByRole('combobox', {
name: 'Date',
})
.click();
const date = new Date();
date.setDate(date.getDate() + 1);
const formattedDate = date.toLocaleDateString('en-US', {
weekday: 'long',
month: 'long',
day: 'numeric',
year: 'numeric',
});
const date = new Date();
date.setDate(date.getDate() + 1);
const formattedDate = date.toLocaleDateString('en-US', {
weekday: 'long',
month: 'long',
day: 'numeric',
year: 'numeric',
});
await page.getByLabel(formattedDate).click();
await page.getByLabel(formattedDate).click();
await page
.getByRole('combobox', {
name: /^time$/i,
})
.click();
await page.getByRole('combobox', { name: /^time$/i }).click();
await page.getByRole('option', { name: '14:00' }).click();
await page.getByRole('button', { name: 'Continue' }).click();
// Wait for client side redirect to created release
await page.waitForURL('/admin/plugins/content-releases/*');
await expect(page.getByRole('heading', { name: newReleaseName })).toBeVisible();
await page.getByRole('option', { name: '08:00' }).click();
// Navigate back to the release page to see the newly created release
await page.getByRole('link', { name: 'Releases' }).click();
await expect(page.getByRole('link', { name: `${newReleaseName}` })).toBeVisible();
}
);
await clickAndWait(page, page.getByRole('button', { name: 'Continue' }));
test.fixme('A user should be able to perform bulk release on entries', async ({ page }) => {
// Wait for client side redirect to created release
await page.waitForURL('/admin/plugins/content-releases/*');
await expect(page.getByRole('heading', { name: newReleaseName })).toBeVisible();
// Navigate back to the release page to see the newly created release
await clickAndWait(page, page.getByRole('link', { name: 'Releases' }));
await expect(page.getByRole('link', { name: `${newReleaseName}` })).toBeVisible();
});
test('A user should be able to perform bulk release on entries', async ({ page }) => {
await test.step('bulk release', async () => {
// Navigate to the releases page
await page.getByRole('link', { name: 'Releases' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Releases' }));
await page.getByRole('button', { name: 'New release' }).click();
await expect(page.getByRole('dialog', { name: 'New release' })).toBeVisible();
// Create a new release
@ -104,20 +102,19 @@ describeOnCondition(edition === 'EE')('Releases page', () => {
await page.getByRole('textbox', { name: 'Name' }).fill(newReleaseName);
// Uncheck default scheduling of a release and save
await page.getByRole('checkbox', { name: 'Schedule release' }).uncheck();
await page.getByRole('button', { name: 'Continue' }).click();
await clickAndWait(page, page.getByRole('button', { name: 'Continue' }));
// Wait for client side redirect to created release
await page.waitForURL('/admin/plugins/content-releases/*');
await expect(page.getByRole('heading', { name: newReleaseName })).toBeVisible();
// Navigate to the content manager
await page.getByRole('link', { name: 'Open the Content Manager' }).click();
await expect(page).toHaveTitle('Content Manager');
await clickAndWait(page, page.getByRole('link', { name: 'Open the Content Manager' }));
await page.waitForURL('/admin/content-manager/collection-types/*');
await expect(page.getByRole('heading', { name: 'Article' })).toBeVisible();
expect(page.getByRole('gridcell', { name: 'published' })).toHaveCount(2);
// Select all entries to release
await page.getByRole('checkbox', { name: 'Select all entries' }).check();
await page.getByRole('button', { name: 'add to release' }).click();
await clickAndWait(page, page.getByRole('button', { name: 'add to release' }));
// Wait for the add to release dialog to appear
await page
@ -128,7 +125,7 @@ describeOnCondition(edition === 'EE')('Releases page', () => {
await page.getByRole('option', { name: 'The Diamond Dogs' }).click();
await page.getByText('unpublish', { exact: true }).click();
await page.getByText('continue').click();
await clickAndWait(page, page.getByText('continue'));
await page.getByText(/Successfully added to release./).waitFor({
state: 'visible',
timeout: 5000,
@ -136,10 +133,9 @@ describeOnCondition(edition === 'EE')('Releases page', () => {
});
await test.step('releases should be updated in the release column of list view', async () => {
const releaseColumn = page.getByRole('button', { name: '2 releases' });
await releaseColumn.first().click();
const releaseColumn = page.getByRole('button', { name: '1 release' });
await clickAndWait(page, releaseColumn.first());
await expect(page.getByText('The Diamond Dogs')).toBeVisible();
await expect(page.getByText('Trent Crimm: The Independent')).toBeVisible();
});
});
});