Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
2090043
Bootstrap the new admin navigation screen (start with the site editor)
youknowriad Sep 15, 2022
16b18f8
Fix unit tests
youknowriad Oct 14, 2022
82d3778
Tweak the sidebar animation
youknowriad Oct 14, 2022
c72f552
Fix toggle button height
youknowriad Oct 14, 2022
7b43bc2
Improve the animation
youknowriad Oct 14, 2022
525ce71
Add save button to the canvas header
youknowriad Oct 17, 2022
6ae91c8
Fix e2e tests
youknowriad Oct 17, 2022
11ba051
Auto switch to edit mode when clicking templates or template parts
youknowriad Oct 17, 2022
87df95d
Adjust menu spacing and animation vfx
jameskoster Oct 17, 2022
c08add2
Small style refactoring
youknowriad Oct 18, 2022
d6983d3
Add the currently edited template title to the view mode header
youknowriad Oct 18, 2022
1d81206
Add a home button
youknowriad Oct 18, 2022
2269126
a11y improvements
youknowriad Oct 20, 2022
54b547f
Fix more e2e tests
youknowriad Oct 21, 2022
c5cf7d9
Fix performance tests
youknowriad Oct 21, 2022
b5cae0e
more e2e test fixes
youknowriad Oct 21, 2022
5dcaea3
smoother animation
youknowriad Oct 21, 2022
096b23b
Fix the site editor toggle
youknowriad Oct 25, 2022
62328a6
Remove duplicated doc
youknowriad Oct 25, 2022
86914ed
Fix the site editor on mobile
youknowriad Oct 26, 2022
ab14e6f
Remove the editor menu item
youknowriad Oct 26, 2022
c070c55
Fix header padding
youknowriad Oct 26, 2022
0e139af
Selecting a template doesn't move into edit mode right away
youknowriad Oct 26, 2022
7331a5e
Redesign the sidebar title
youknowriad Oct 26, 2022
1e1b378
Remove home and save buttons
youknowriad Oct 26, 2022
ce5f07f
Scale down the frame content
youknowriad Oct 27, 2022
138bb5b
Better spacing and colors for the menu items
youknowriad Oct 27, 2022
da7fd8d
Tweak the sidebar width
youknowriad Oct 28, 2022
0a04fe4
Remove home page template setting
youknowriad Oct 28, 2022
b964e7c
Move the edit button outside of the canvas
youknowriad Oct 31, 2022
fd12005
only apply radius in view mode
youknowriad Oct 31, 2022
1505ab7
Fix sidebar alignment
youknowriad Oct 31, 2022
dd9a0f6
Remove the background and fix radius
youknowriad Oct 31, 2022
adbdafc
Update spacing
jameskoster Nov 1, 2022
eddd2b5
Increase frame border radius
jameskoster Nov 1, 2022
3cd8109
Remove iframe background and add elevation
jameskoster Nov 1, 2022
b2e08f7
Fix list header appearance
jameskoster Nov 2, 2022
b2aff8a
Use -size for nav margin
jameskoster Nov 2, 2022
5594734
Consistent canvas style
youknowriad Nov 7, 2022
133bdde
Remove back button
youknowriad Nov 7, 2022
06d7833
Fix template parts in view mode
youknowriad Nov 7, 2022
63a4180
Reshuffle the structure to animate the header from the top
youknowriad Nov 10, 2022
cd51ae8
Keep the sidebar visible while animating the canvas
youknowriad Nov 10, 2022
913322f
Scaling the whole canvas
youknowriad Nov 10, 2022
64a75b7
Remove useless code
youknowriad Nov 11, 2022
e78bd97
Remove the sidebar animation
youknowriad Nov 11, 2022
9b437e1
Restore the sidebar animation
youknowriad Nov 11, 2022
d01e26a
Fix text color
youknowriad Nov 11, 2022
1a0f80e
Animate the iframe
youknowriad Nov 11, 2022
68fd4af
Move the edit button to the sidebar
youknowriad Nov 14, 2022
e954612
Fix mobile
youknowriad Nov 14, 2022
a4fbe48
Improve the canvas animation
youknowriad Nov 15, 2022
0b36c3c
Remove scaling and simplify animation
youknowriad Nov 15, 2022
258622b
Tweak animation easing and frame shadow.
mtias Nov 15, 2022
4b312eb
Hide the sidebar behind the canvas
youknowriad Nov 16, 2022
8d7e1d5
Improve the animation
youknowriad Nov 16, 2022
72f74fc
Restore the sidebar padding
youknowriad Nov 16, 2022
c228eb6
Rebase cleanup
youknowriad Nov 16, 2022
0263436
Update shadow on the frame.
mtias Nov 16, 2022
7b92eb8
Fix inserter height
youknowriad Nov 16, 2022
3aaad16
Improve the animation of the edit button
youknowriad Nov 16, 2022
e8918cd
Move the edit button next to design
youknowriad Nov 17, 2022
940250e
Fix e2e tests
youknowriad Nov 17, 2022
ae2c7d0
fix more e2e tests
youknowriad Nov 17, 2022
82af6ca
Restore aria region
youknowriad Nov 17, 2022
fb76172
Fix the padding of the template list
youknowriad Nov 17, 2022
3efae5a
Hide edit button in template list
youknowriad Nov 17, 2022
39b86fd
Remove link from the site title
youknowriad Nov 17, 2022
16de8a2
Fix post rebase
youknowriad Nov 17, 2022
d5bc732
Quit zoom-out when switching to view mode
youknowriad Nov 21, 2022
96e43b3
Switch to edit mode when creating templates
youknowriad Nov 21, 2022
7f91013
Remove useless condition
youknowriad Nov 21, 2022
c27764a
Code simplification
youknowriad Nov 21, 2022
d54f42b
Hide publish flow in view mode
youknowriad Nov 21, 2022
5676e75
Fix layout shift
youknowriad Nov 21, 2022
ecfc594
Remove useless showDropdown
youknowriad Nov 21, 2022
04f8d7e
Remove useless prop
youknowriad Nov 21, 2022
d53a47f
Split site icon and title component
youknowriad Nov 21, 2022
732cea6
Fix showIconLabels behavior
youknowriad Nov 24, 2022
ad0ff98
Restore the onError prop
youknowriad Nov 24, 2022
acb368f
Fix code editor position
youknowriad Nov 24, 2022
3191104
Catch the error in setTemplate
youknowriad Nov 24, 2022
d5dcbc7
Remove list view styling changes
youknowriad Nov 24, 2022
a8683bd
Allow scrolling in view mode
youknowriad Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix e2e tests
  • Loading branch information
youknowriad committed Dec 1, 2022
commit 6ae91c88023ec6e83cf70ca97938c4898c167299
4 changes: 4 additions & 0 deletions packages/e2e-test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking changes

- Remove all the site editor navigation panel related utils: getSiteEditorMenuItem, isSiteEditorRoot, navigateSiteEditorBack, navigateSiteEditorBackToRoot, openSiteEditorNavigationPanel, siteEditorNavigateSequence, clickSiteEditorMenuItem, closeSiteEditorNavigationPanel.

## 8.6.0 (2022-11-16)

## 8.5.0 (2022-11-02)
Expand Down
59 changes: 4 additions & 55 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ _Parameters_

- _buttonLabel_ `string`: The label to search the button for.

### clickSiteEditorMenuItem

Searches for an item in the navigation panel with the label provided and clicks it.

_Parameters_

- _label_ `string`: The label to search the menu item for.

### closeGlobalBlockInserter

Undocumented declaration.
Expand All @@ -125,10 +117,6 @@ Undocumented declaration.

Closes list view

### closeSiteEditorNavigationPanel

Closes the site editor navigation panel if open

### createEmbeddingMatcher

Creates a function to determine if a request is embedding a certain URL.
Expand Down Expand Up @@ -453,18 +441,6 @@ _Returns_

- `Promise<?string>`: Promise resolving to a string or null, depending whether a page error is present.

### getSiteEditorMenuItem

Searches for an item in the site editor navigation menu with the provided label.

_Parameters_

- _label_ `string`: The label to search the menu item for.

_Returns_

- `Promise<?ElementHandle>`: The menu item handle or `null`

### hasBlockSwitcher

Returns a boolean indicating if the current selected block has a block switcher or not.
Expand Down Expand Up @@ -555,17 +531,6 @@ _Returns_

Undocumented declaration.

### isSiteEditorRoot

Returns `true` if in the site editor navigation root

Checks whether the “Back to dashboard” button is visible. If
not in the root, a “Back” button would be visible instead.

_Returns_

- `Promise<boolean>`: Whether it currently is the navigation root or not

### isThemeInstalled

Checks whether a theme exists on the site.
Expand Down Expand Up @@ -602,14 +567,6 @@ _Returns_

- `Promise`: Promise that uses `mockCheck` to see if a request should be mocked with `mock`, and optionally transforms the response with `responseObjectTransform`.

### navigateSiteEditorBack

Navigates the site editor back

### navigateSiteEditorBackToRoot

Goes back until it gets to the root

### openDocumentSettingsSidebar

Clicks on the button in the header which opens Document Settings sidebar when it is closed.
Expand Down Expand Up @@ -650,10 +607,6 @@ Opens the previous global styles panel.

Opens the publish panel.

### openSiteEditorNavigationPanel

Opens the site editor navigation panel if closed

### openTypographyToolsPanelMenu

Opens the Typography tools panel menu provided via block supports.
Expand Down Expand Up @@ -820,14 +773,6 @@ _Parameters_
The block toolbar is not always visible while typing.
Call this function to reveal it.

### siteEditorNavigateSequence

Navigates through a sequence of links in the site editor navigation panel

_Parameters_

- _labels_ `string[] | string`: Labels to navigate through

### switchEditorModeTo

Switches editor mode.
Expand All @@ -846,6 +791,10 @@ running the test is not already the admin user).
Switches the current user to whichever user we should be
running the tests as (if we're not already that user).

### toggleCanvasMode

Switch between edit and view mode.

### toggleGlobalBlockInserter

Toggles the global inserter.
Expand Down
9 changes: 1 addition & 8 deletions packages/e2e-test-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,11 @@ export {
} from './rest-api';
export { openListView, closeListView } from './list-view';
export {
clickSiteEditorMenuItem,
closeSiteEditorNavigationPanel,
disableSiteEditorWelcomeGuide,
getCurrentSiteEditorContent,
getSiteEditorMenuItem,
isSiteEditorRoot,
navigateSiteEditorBack,
navigateSiteEditorBackToRoot,
openSiteEditorNavigationPanel,
siteEditorNavigateSequence,
visitSiteEditor,
toggleGlobalStyles,
toggleCanvasMode,
openGlobalStylesPanel,
openPreviousGlobalStylesPanel,
} from './site-editor';
Expand Down
132 changes: 7 additions & 125 deletions packages/e2e-test-utils/src/site-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,9 @@ import { addQueryArgs } from '@wordpress/url';
*/

const SELECTORS = {
navigationPanel: {
backToDashboard:
'.edit-site-navigation-panel .edit-site-navigation-panel__back-to-dashboard',
goBack: '.components-navigation__back-button',
isOpenState: '.edit-site-navigation-toggle.is-open',
menuItem: ( label ) =>
`//div[contains(@class, "edit-site-navigation-panel")]//button[.//*[text()="${ label }"]]`,
open: '.edit-site-navigation-toggle__button',
panelContainer: '.edit-site-navigation-panel',
},
visualEditor: '.edit-site-visual-editor iframe',
};

/**
* Searches for an item in the navigation panel with the label provided and clicks it.
*
* @param {string} label The label to search the menu item for.
*/
export async function clickSiteEditorMenuItem( label ) {
const item = await getSiteEditorMenuItem( label );

if ( item ) {
await item.click();
} else {
throw new Error(
`Navigation item with label ${ label } was not found.`
);
}
}

/**
* Closes the site editor navigation panel if open
*/
export async function closeSiteEditorNavigationPanel() {
const { navigationPanel } = SELECTORS;

const isOpen = !! ( await page.$( navigationPanel.isOpenState ) );

if ( isOpen ) {
await page.click( navigationPanel.open );
await page.waitForSelector( navigationPanel.panelContainer, {
hidden: true,
} );
}
}

/**
* Skips the welcome guide popping up to first time users of the site editor
*/
Expand Down Expand Up @@ -154,88 +111,6 @@ export function getCurrentSiteEditorContent() {
} );
}

/**
* Searches for an item in the site editor navigation menu with the provided label.
*
* @param {string} label The label to search the menu item for.
*
* @return {Promise<?ElementHandle>} The menu item handle or `null`
*/
export async function getSiteEditorMenuItem( label ) {
const { navigationPanel } = SELECTORS;

const item = await page.waitForXPath( navigationPanel.menuItem( label ), {
visible: true,
} );

return item;
}

/**
* Returns `true` if in the site editor navigation root
*
* Checks whether the “Back to dashboard” button is visible. If
* not in the root, a “Back” button would be visible instead.
*
* @return {Promise<boolean>} Whether it currently is the navigation root or not
*/
export async function isSiteEditorRoot() {
const { navigationPanel } = SELECTORS;

const isBackToDashboardButtonVisible = !! ( await page.$(
navigationPanel.backToDashboard
) );

return isBackToDashboardButtonVisible;
}

/**
* Navigates the site editor back
*/
export async function navigateSiteEditorBack() {
const { navigationPanel } = SELECTORS;

await page.click( navigationPanel.goBack );
}

/**
* Goes back until it gets to the root
*/
export async function navigateSiteEditorBackToRoot() {
while ( ! ( await isSiteEditorRoot() ) ) {
await navigateSiteEditorBack();
}
}

/**
* Opens the site editor navigation panel if closed
*/
export async function openSiteEditorNavigationPanel() {
const { navigationPanel } = SELECTORS;

const isOpen = !! ( await page.$( navigationPanel.isOpenState ) );

if ( ! isOpen ) {
await page.click( navigationPanel.open );
await page.waitForSelector( navigationPanel.panelContainer );
}
}

/**
* Navigates through a sequence of links in the site editor navigation panel
*
* @param {string[] | string} labels Labels to navigate through
*/
export async function siteEditorNavigateSequence( labels ) {
if ( ! Array.isArray( labels ) ) {
labels = [ labels ];
}

for ( const label of labels ) {
await clickSiteEditorMenuItem( label );
}
}

/**
* Visits the Site Editor main page
*
Expand Down Expand Up @@ -286,3 +161,10 @@ export async function openPreviousGlobalStylesPanel() {
'div[aria-label="Editor settings"] button[aria-label="Navigate to the previous view"]'
);
}

/**
* Switch between edit and view mode.
*/
export async function toggleCanvasMode() {
await page.click( '.edit-site-header__toggle' );
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
activateTheme,
setOption,
visitSiteEditor,
openSiteEditorNavigationPanel,
navigateSiteEditorBackToRoot,
toggleCanvasMode,
deleteAllTemplates,
canvas,
} from '@wordpress/e2e-test-utils';
Expand All @@ -24,16 +23,16 @@ describe( 'Post Comments Form', () => {

// Navigate to "Singular" post template
await visitSiteEditor();
await openSiteEditorNavigationPanel();
await navigateSiteEditorBackToRoot();
await expect( page ).toClick(
'.components-navigation__item-title',
'.edit-site-sidebar-navigation-item',
{ text: /templates/i }
);
await expect( page ).toClick( '.components-heading > a', {
text: /singular/i,
} );

await toggleCanvasMode();

// Insert post comments form
await insertBlock( 'Post Comments Form' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
deleteAllTemplates,
activateTheme,
visitSiteEditor,
toggleCanvasMode,
toggleGlobalStyles,
openGlobalStylesPanel,
} from '@wordpress/e2e-test-utils';
Expand All @@ -26,6 +27,7 @@ describe( 'Global styles sidebar', () => {
} );
beforeEach( async () => {
await visitSiteEditor();
await toggleCanvasMode();
} );
describe( 'blocks list', () => {
it( 'should filter results properly', async () => {
Expand Down
Loading