Skip to content

Commit

Permalink
chore: add E2E test for chained actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed May 27, 2024
1 parent 1258e3e commit 33a1129
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/e2e/specs/feed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,43 @@ test.describe( 'Feed Settings', () => {
const blocks = await editor.getBlocks();
expect(blocks).toHaveLength(0); // No content.
});

test( 'chained action for feed content', async({ editor, page, admin }) => {
const importName = 'Test Title: changing General Feed Settings';

await page.goto('/wp-admin/post-new.php?post_type=feedzy_imports');
await tryCloseTourModal( page );

await page.getByPlaceholder('Add a name for your import').fill(importName);
await addFeeds( page, [FEED_URL] );

await page.getByRole('button', { name: 'Step 3 Map content' }).click({ force: true });

await page.getByRole('button', { name: 'Insert Tag' }).nth(2).click({ force: true });
await page.getByRole('link', { name: 'Item Content [#item_content]' }).click({ force: true });

await page.getByRole('button', { name: 'Add new' }).click({ force: true });

await page.getByText('Trim Content').click({ force: true });
await expect( page.getByRole('button', { name: 'Trim Content' }) ).toBeVisible();
await page.getByRole('button', { name: 'Trim Content' }).click({ force: true });
await page.getByPlaceholder('45').fill('10');

await page.getByRole('button', { name: 'Add new' }).click({ force: true });

await page.getByText('Search / Replace').click({ force: true });
await page.getByRole('button', { name: 'Search and Replace' }).click({ force: true });
await page.getByLabel('Search').fill('Lorem');
await page.getByLabel('Replace with').fill('Ipsum');

await page.getByRole('list').getByRole('button').nth(1).click({ force: true }); // Delete the first action.
await expect( page.getByRole('button', { name: 'Trim Content' }) ).toBeHidden();

await page.getByRole('button', { name: 'Save Actions' }).click({ force: true });
await expect( page.getByRole('heading', { name: 'Add actions to this tag' }) ).toBeHidden(); // The modal is closed.

await expect( page.getByTitle('item content').getByRole('link') ).toBeVisible(); // The action tag is added.
await page.getByTitle('remove tag').click({ force: true });
await expect( page.getByTitle('item content').getByRole('link') ).toBeHidden();
});
});

0 comments on commit 33a1129

Please sign in to comment.