-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate the testing of popular blocks in current and edge versions of GB #45048
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0beed60
Automate the testing of popular blocks in current and edge versions o…
fullofcaffeine 565f67d
Take screenshots
fullofcaffeine 36e202c
Improve code a bit and group sshots in a directory named after the site
fullofcaffeine 13cd9f1
Simplified the assertions by DRYing it in a single re-usable function
fullofcaffeine 0c149b2
Update config with the new test account credentials
fullofcaffeine 08d17d7
Cleanup
fullofcaffeine b9ea585
Take screenshot of editor blocks and preview for edge sites too
fullofcaffeine 8b3c9ba
Step description improvement
fullofcaffeine a999037
Use the published page instead of the preview to check content render…
fullofcaffeine d922a96
Fix code editor text area not being found in headless mode
fullofcaffeine 539728e
Reduce repetition and some other minor improvements
fullofcaffeine 1c52a2d
Use static getters to define block name and title in the test block c…
fullofcaffeine 4ae8d71
Close the tools and options menu after using to avoid it getting on t…
fullofcaffeine 685b7f5
Added check for invalid blocks and grouped other common steps in a re…
fullofcaffeine fe36a72
Comment-out the invalid block assertion temporarily
fullofcaffeine 6d1857d
Move the file selector for the TiledGalleryBlockComponent to a field …
fullofcaffeine 0044d6a
Simplify a bit more and be explicit about the editor checks
fullofcaffeine 2f206ed
Use static properties for block{Name,Title}
sirreal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/blog-posts-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class BlogPostsBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Blog Posts'; | ||
static blockName = 'a8c/blog-posts'; | ||
} | ||
|
||
export { BlogPostsBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/contact-info-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class ContactInfoBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Contact Info'; | ||
static blockName = 'jetpack/contact-info'; | ||
} | ||
|
||
export { ContactInfoBlockComponent }; |
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/dynamic-separator-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class DynamicSeparatorBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Dynamic HR'; | ||
static blockName = 'coblocks/dynamic-separator'; | ||
} | ||
|
||
export { DynamicSeparatorBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/gallery-masonry-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class GalleryMasonryBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Masonry'; | ||
static blockName = 'coblocks/gallery-masonry'; | ||
} | ||
|
||
export { GalleryMasonryBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// TODO some blocks are exported as default and some not... maybe change all of them to export as default? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consistency is likely the best approach. Maybe in another PR we change them all to use one or the other. Slight preference from me for named exports here. |
||
export { BlogPostsBlockComponent } from './blog-posts-block-component'; | ||
export { ContactFormBlockComponent } from './contact-form-block-component'; | ||
export { ContactInfoBlockComponent } from './contact-info-block-component'; | ||
export { DynamicSeparatorBlockComponent } from './dynamic-separator-block-component'; | ||
export { GalleryMasonryBlockComponent } from './gallery-masonry-block-component'; | ||
export { ImageBlockComponent } from './image-block-component'; | ||
export { LayoutGridBlockComponent } from './layout-grid-block-component'; | ||
export { RatingStarBlockComponent } from './rating-star-block-component'; | ||
export { ShortcodeBlockComponent } from './shortcode-block-component'; | ||
export { SlideshowBlockComponent } from './slideshow-block-component'; | ||
export { SubscriptionsBlockComponent } from './subscriptions-block-component'; | ||
export { TiledGalleryBlockComponent } from './tiled-gallery-block-component'; | ||
export { YoutubeBlockComponent } from './youtube-block-component'; | ||
export { default as EmbedsBlockComponent } from './embeds-block-component'; | ||
export { default as GutenbergBlockComponent } from './gutenberg-block-component'; | ||
export { default as MarkdownBlockComponent } from './markdown-block-component'; | ||
export { default as SimplePaymentBlockComponent } from './payment-block-component'; |
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/layout-grid-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class LayoutGridBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Layout Grid'; | ||
static blockName = 'jetpack/layout-grid'; | ||
} | ||
|
||
export { LayoutGridBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/rating-star-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class RatingStarBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Star Rating'; | ||
static blockName = 'jetpack/rating-star'; | ||
} | ||
|
||
export { RatingStarBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/slideshow-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class SlideshowBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Slideshow'; | ||
static blockName = 'jetpack/slideshow'; | ||
} | ||
|
||
export { SlideshowBlockComponent }; |
11 changes: 11 additions & 0 deletions
11
test/e2e/lib/gutenberg/blocks/subscriptions-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class SubscriptionsBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Subscription Form'; | ||
static blockName = 'jetpack/subscriptions'; | ||
} | ||
|
||
export { SubscriptionsBlockComponent }; |
28 changes: 28 additions & 0 deletions
28
test/e2e/lib/gutenberg/blocks/tiled-gallery-block-component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { By } from 'selenium-webdriver'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class TiledGalleryBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'Tiled Gallery'; | ||
static blockName = 'jetpack/tiled-gallery'; | ||
|
||
fileInputSelector = By.xpath( | ||
`//*[@id="${ this.blockID.slice( 1 ) }"]/div/div/div[3]/div[2]/input` | ||
); | ||
|
||
async uploadImages( filesDetails ) { | ||
const fileInput = this.driver.findElement( this.fileInputSelector ); | ||
|
||
const files = filesDetails.map( ( f ) => f.file ).join( '\n ' ); | ||
|
||
fileInput.sendKeys( files ); | ||
} | ||
} | ||
|
||
export { TiledGalleryBlockComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import GutenbergBlockComponent from './gutenberg-block-component'; | ||
|
||
class YoutubeBlockComponent extends GutenbergBlockComponent { | ||
static blockTitle = 'YouTube'; | ||
static blockName = 'core-embed/youtube'; | ||
} | ||
|
||
export { YoutubeBlockComponent }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleanup is nice, but it distracts from the focus on this PR. There's a lot of cleanup like this that we can probably do in a few tiny, focused PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy that 👍🏻 , I'll keep that in mind.