Skip to content

Commit

Permalink
fix(e2e): remove webkit skip conditions (strapi#21611)
Browse files Browse the repository at this point in the history
* fix(e2e): remove webkit skip conditions

* chore: revert uniqueness spec to test others on ci

* fix(e2e): ctb navigation

* chore: ci config to speed up testing

* chore: revert lock

* chore(e2e): wip add webkit waiting

* chore: single out history spec changes for ci

* chore(e2e): use new webkit navigation for all affected test files

* chore(e2e): revert e2e ci config so all tests run again

* chore(e2e): temp skip uniqueness to test others

* chore(e2e): revert so all tests run again

* chore(e2e): re-skip uniqueness in webkit

* chore(e2e): revert workflow yaml

* chore(e2e): pr feedback

---------

Co-authored-by: Ben Irvin <[email protected]>
  • Loading branch information
jhoward1994 and innerdvations authored Oct 17, 2024
1 parent c23fb8e commit 4cf3602
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 118 deletions.
115 changes: 52 additions & 63 deletions tests/e2e/tests/content-manager/history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect, Page } from '@playwright/test';
import { login } from '../../utils/login';
import { resetDatabaseAndImportDataFromPath } from '../../utils/dts-import';
import { describeOnCondition, findAndClose } from '../../utils/shared';
import { clickAndWait, describeOnCondition, findAndClose, skipCtbTour } from '../../utils/shared';
import { resetFiles } from '../../utils/file-reset';
import { waitForRestart } from '../../utils/restart';

Expand Down Expand Up @@ -37,6 +37,11 @@ const goToHistoryPage = async (page: Page) => {
}
};

const goToContentTypeBuilder = async (page: Page) => {
await clickAndWait(page, page.getByRole('link', { name: 'Content-Type Builder' }));
await skipCtbTour(page);
};

describeOnCondition(edition === 'EE')('History', () => {
test.beforeEach(async ({ page }) => {
await resetDatabaseAndImportDataFromPath('with-admin.tar', (cts) => cts, { coreStore: false });
Expand All @@ -52,8 +57,8 @@ describeOnCondition(edition === 'EE')('History', () => {
});

test('A user should be able to restore a history version', async ({ page }) => {
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(ARTICLE_CREATE_URL);

const titleInput = page.getByRole('textbox', { name: 'title' });
Expand Down Expand Up @@ -87,10 +92,10 @@ describeOnCondition(edition === 'EE')('History', () => {
page,
}) => {
// Navigate to the content-manager - collection type - article
await page.getByRole('link', { name: 'Content Manager' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await page.getByRole('combobox', { name: 'Select a locale' }).click();
await page.getByRole('option', { name: 'French (fr)' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(ARTICLE_CREATE_URL);

/**
Expand All @@ -111,8 +116,8 @@ describeOnCondition(edition === 'EE')('History', () => {

// Go back to the CM to create a new english entry
await page.goto('/admin');
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(ARTICLE_CREATE_URL);

// Create an english version
Expand All @@ -139,7 +144,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(page.getByText(frenchTitle)).not.toBeVisible();

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Update
Expand All @@ -160,7 +165,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(previousVersion.getByText('(current)')).not.toBeVisible();

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Publish
Expand All @@ -178,7 +183,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(titleInput).toHaveValue('Being from Kansas City');

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Modified
Expand All @@ -195,28 +200,20 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(titleInput).toHaveValue('Being from Kansas City, Missouri');
});

test('A user should see the relations and whether some are missing', async ({
page,
browserName,
}) => {
// TODO: there is a webkit bug to be fixed
if (browserName === 'webkit') {
return test.fixme();
}

test('A user should see the relations and whether some are missing', async ({ page }) => {
// Create new author
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Author' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Author' }));
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(AUTHOR_CREATE_URL);
await page.getByRole('textbox', { name: 'name' }).fill('Will Kitman');
await page.getByRole('button', { name: 'Save' }).click();
await page.waitForURL(AUTHOR_EDIT_URL);

// Create new article and add authors to it
await page.getByRole('link', { name: 'Article' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Article' }));
await page.waitForURL(ARTICLE_LIST_URL);
await page.getByRole('link', { name: 'Create new entry' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Create new entry' }));
await page.getByRole('textbox', { name: 'title' }).fill('Zava retires');
await page.getByRole('combobox', { name: 'Authors' }).click();
await page.getByText('Will Kitman').click();
Expand All @@ -226,14 +223,14 @@ describeOnCondition(edition === 'EE')('History', () => {
await page.waitForURL(ARTICLE_EDIT_URL);

// Delete one of the authors, leaving only Coach Beard
await page.getByRole('link', { name: 'Will Kitman' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Will Kitman' }));
await page.waitForURL(AUTHOR_EDIT_URL);
await page.getByRole('button', { name: /more actions/i }).click();
await page.getByRole('menuitem', { name: /delete entry/i }).click();
await page.getByRole('button', { name: /confirm/i }).click();

// Go to the the article's history page
await page.getByRole('link', { name: 'Article' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Article' }));
await page.getByRole('gridcell', { name: 'Zava retires' }).click();
await page.waitForURL(ARTICLE_EDIT_URL);
await goToHistoryPage(page);
Expand All @@ -251,8 +248,8 @@ describeOnCondition(edition === 'EE')('History', () => {
/**
* Create an initial entry to also create an initial version
*/
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(ARTICLE_CREATE_URL);
await page.getByRole('textbox', { name: 'title' }).fill('Being from Kansas');
await page.getByRole('textbox', { name: 'slug' }).fill('being-from-kansas');
Expand All @@ -262,9 +259,7 @@ describeOnCondition(edition === 'EE')('History', () => {
/**
* Rename field in content-type builder
*/
await page.getByRole('link', { name: 'Content-Type Builder' }).click();
await page.waitForURL('**/content-type-builder');
await page.getByRole('link', { name: 'Article' }).click();
await goToContentTypeBuilder(page);
await page.waitForURL(
'/admin/plugins/content-type-builder/content-types/api::article.article'
);
Expand All @@ -279,8 +274,8 @@ describeOnCondition(edition === 'EE')('History', () => {
* Update the existing entry to create another version
*/
await page.goto('/admin');
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Article' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Article' }));
await page.getByRole('gridcell', { name: 'being-from-kansas' }).click();
await page.waitForURL(ARTICLE_EDIT_URL);
await page.getByRole('textbox', { name: 'titleRename' }).fill('Being from Kansas City');
Expand Down Expand Up @@ -316,8 +311,8 @@ describeOnCondition(edition === 'EE')('History', () => {
/\/admin\/content-manager\/single-types\/api::homepage.homepage\/history(\?.*)?/;

// Navigate to the content-manager - single type - homepage
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.getByRole('combobox', { name: 'Locales' }).click();
await page.getByRole('option', { name: 'French (fr)' }).click();

Expand All @@ -335,7 +330,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(titleInput).toHaveValue(frenchTitle);

// Go back to the CM to create a new english entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));
await page.getByRole('combobox', { name: 'Locales' }).click();
await page.getByRole('option', { name: 'English (en)' }).click();

Expand All @@ -362,7 +357,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(page.getByText(frenchTitle)).not.toBeVisible();

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Update
Expand All @@ -380,7 +375,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(titleInput).toHaveValue('AFC Richmond');

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Publish
Expand All @@ -399,7 +394,7 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(titleInput).toHaveValue('Welcome to AFC Richmond');

// Go back to the entry
await page.getByRole('link', { name: 'Back' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Back' }));

/**
* Modified
Expand All @@ -415,18 +410,11 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(currentVersion.getByText('Modified')).toBeVisible();
});

test('A user should see the relations and whether some are missing', async ({
page,
browserName,
}) => {
// TODO: there is a webkit bug to be fixed
if (browserName === 'webkit') {
return test.fixme();
}

test('A user should see the relations and whether some are missing', async ({ page }) => {
// Create relation in Content-Type Builder
await page.getByRole('link', { name: 'Content-Type Builder' }).click();
await page.getByRole('link', { name: 'Homepage' }).click();
await goToContentTypeBuilder(page);

await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.waitForURL(
'/admin/plugins/content-type-builder/content-types/api::homepage.homepage'
);
Expand All @@ -441,16 +429,18 @@ describeOnCondition(edition === 'EE')('History', () => {
await expect(page.getByRole('cell', { name: 'authors', exact: true })).toBeVisible();

// Create new author
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Author' }).click();
await page.getByRole('link', { name: /Create new entry/, exact: true }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
// await page.waitForSelector('text=Author');
await clickAndWait(page, page.getByRole('link', { name: 'Author' }));
// await page.waitForSelector('text=Create new entry');
await clickAndWait(page, page.getByRole('link', { name: /Create new entry/, exact: true }));
await page.waitForURL(AUTHOR_CREATE_URL);
await page.getByRole('textbox', { name: 'name' }).fill('Will Kitman');
await page.getByRole('button', { name: 'Save' }).click();
await page.waitForURL(AUTHOR_EDIT_URL);

// Add author to homepage
await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.waitForURL(HOMEPAGE_EDIT_URL);
await page.getByRole('combobox', { name: 'Authors' }).click();
await page.getByText('Will Kitman').click();
Expand All @@ -459,14 +449,14 @@ describeOnCondition(edition === 'EE')('History', () => {
await page.getByRole('button', { name: 'Save' }).click();

// Delete one of the authors, leaving only Coach Beard
await page.getByRole('link', { name: 'Will Kitman' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Will Kitman' }));
await page.waitForURL(AUTHOR_EDIT_URL);
await page.getByRole('button', { name: /more actions/i }).click();
await page.getByRole('menuitem', { name: /delete entry/i }).click();
await page.getByRole('button', { name: /confirm/i }).click();

// Go to the the article's history page
await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.waitForURL(HOMEPAGE_EDIT_URL);
await page.getByRole('button', { name: /more actions/i }).click();
await page.getByRole('menuitem', { name: /content history/i }).click();
Expand All @@ -484,19 +474,18 @@ describeOnCondition(edition === 'EE')('History', () => {
/**
* Create an initial entry to also create an initial version
*/
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.getByRole('textbox', { name: 'title' }).fill('Welcome to AFC Richmond');
await page.getByRole('button', { name: 'Save' }).click();
await findAndClose(page, 'Saved Document');

/**
* Rename field in content-type builder
*/
await page.getByRole('link', { name: 'Content-Type Builder' }).click();
await page.waitForURL('**/content-type-builder');
await goToContentTypeBuilder(page);

await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.waitForURL(
'/admin/plugins/content-type-builder/content-types/api::homepage.homepage'
);
Expand All @@ -511,8 +500,8 @@ describeOnCondition(edition === 'EE')('History', () => {
* Update the existing entry to create another version
*/
await page.goto('/admin');
await page.getByRole('link', { name: 'Content Manager' }).click();
await page.getByRole('link', { name: 'Homepage' }).click();
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Homepage' }));
await page.getByRole('textbox', { name: 'titleRename' }).fill('Welcome to AFC Richmond!');
await page.getByRole('button', { name: 'Save' }).click();
await findAndClose(page, 'Saved Document');
Expand Down
Loading

0 comments on commit 4cf3602

Please sign in to comment.