Skip to content

Commit

Permalink
chore: add explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Apr 22, 2024
1 parent 8cf9764 commit 33b4b38
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/blocks/test/e2e/blocks/block-conditions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ test.describe( 'Block Conditions', () => {
await admin.createNewPost();
});

test.afterEach( async({ page }) => {

/**
* Because some conditions require an user to be logged in, we need to log in the user after each test so that we do not break the next test.
*/
await tryLoginIn( page, 'admin', 'password' );
});

test( 'check logged out users', async({ editor, page, admin, requestUtils }) => {
await editor.insertBlock({
name: 'core/image',
Expand All @@ -27,14 +35,13 @@ test.describe( 'Block Conditions', () => {

const postId = await editor.publishPost();

// Check the block for logged in users.
await page.goto( `/?p=${postId}` );

await expect( page.locator( '#wp--skip-link--target img' ) ).toBeVisible();

// Check the block for logged out users.
await page.getByRole( 'menuitem', { name: 'Howdy, admin' }).hover();

await page.waitForTimeout( 200 );

await page.getByRole( 'menuitem', { name: 'Log Out' }).click();
await page.goto( `/?p=${postId}` );
await expect( page.locator( '#wp--skip-link--target img' ) ).toBeHidden();
Expand Down

0 comments on commit 33b4b38

Please sign in to comment.