Skip to content

Commit

Permalink
Disable test for adding new aztec post. Fix Gutenberg test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Apr 1, 2021
1 parent c062cc3 commit 82ecea5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 55 deletions.
4 changes: 4 additions & 0 deletions WordPress/WordPressUITests/Flows/EditorFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class EditorFlow {
}
}

static func goToMySiteScreen() -> MySiteScreen {
return TabNavComponent().gotoMySiteScreen()
}

static func toggleBlockEditor(to state: SiteSettingsScreen.Toggle) -> SiteSettingsScreen {
if !SiteSettingsScreen.isLoaded() {
_ = TabNavComponent()
Expand Down
108 changes: 55 additions & 53 deletions WordPress/WordPressUITests/Tests/EditorAztecTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,59 @@ class EditorAztecTests: XCTestCase {
super.tearDown()
}

func testTextPostPublish() {
let title = getRandomPhrase()
let content = getRandomContent()
editorScreen
.enterTextInTitle(text: title)
.enterText(text: content)
.publish()
.viewPublishedPost(withTitle: title)
.verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.done()
}

func testBasicPostPublish() {
let title = getRandomPhrase()
let content = getRandomContent()
let category = getCategory()
let tag = getTag()
editorScreen
.enterTextInTitle(text: title)
.enterText(text: content)
.addImageByOrder(id: 0)
.openPostSettings()
.selectCategory(name: category)
.addTag(name: tag)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.removeFeatureImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: false)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.closePostSettings()
AztecEditorScreen(mode: .rich).publish()
.viewPublishedPost(withTitle: title)
.verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.done()
}

// Github issue https://github.com/wordpress-mobile/AztecEditor-iOS/issues/385
func testLongTitle() {
let longTitle = "long title in a galaxy not so far away"
// Title heigh contains of actual textfield height + bottom line.
// 16.5px - is the height of that bottom line. Its not changing with different font sizes
let titleTextView = editorScreen.titleView
let titleLineHeight = titleTextView.frame.height - 16.5
let oneLineTitleHeight = titleTextView.frame.height

let repeatTimes = isIPhone ? 6 : 20
_ = editorScreen.enterTextInTitle(text: String(repeating: "very ", count: repeatTimes) + longTitle)

let twoLineTitleHeight = titleTextView.frame.height

XCTAssert(twoLineTitleHeight - oneLineTitleHeight >= titleLineHeight )
}
// TODO: Re-enable Aztec tests but for editing an existing Aztec post.
// For more information, see Issue: https://github.com/wordpress-mobile/WordPress-iOS/issues/16218
// func testTextPostPublish() {
// let title = getRandomPhrase()
// let content = getRandomContent()
// editorScreen
// .enterTextInTitle(text: title)
// .enterText(text: content)
// .publish()
// .viewPublishedPost(withTitle: title)
// .verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
// .done()
// }
//
// func testBasicPostPublish() {
// let title = getRandomPhrase()
// let content = getRandomContent()
// let category = getCategory()
// let tag = getTag()
// editorScreen
// .enterTextInTitle(text: title)
// .enterText(text: content)
// .addImageByOrder(id: 0)
// .openPostSettings()
// .selectCategory(name: category)
// .addTag(name: tag)
// .setFeaturedImage()
// .verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
// .removeFeatureImage()
// .verifyPostSettings(withCategory: category, withTag: tag, hasImage: false)
// .setFeaturedImage()
// .verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
// .closePostSettings()
// AztecEditorScreen(mode: .rich).publish()
// .viewPublishedPost(withTitle: title)
// .verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
// .done()
// }
//
// // Github issue https://github.com/wordpress-mobile/AztecEditor-iOS/issues/385
// func testLongTitle() {
// let longTitle = "long title in a galaxy not so far away"
// // Title heigh contains of actual textfield height + bottom line.
// // 16.5px - is the height of that bottom line. Its not changing with different font sizes
// let titleTextView = editorScreen.titleView
// let titleLineHeight = titleTextView.frame.height - 16.5
// let oneLineTitleHeight = titleTextView.frame.height
//
// let repeatTimes = isIPhone ? 6 : 20
// _ = editorScreen.enterTextInTitle(text: String(repeating: "very ", count: repeatTimes) + longTitle)
//
// let twoLineTitleHeight = titleTextView.frame.height
//
// XCTAssert(twoLineTitleHeight - oneLineTitleHeight >= titleLineHeight )
// }
}
3 changes: 1 addition & 2 deletions WordPress/WordPressUITests/Tests/EditorGutenbergTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class EditorGutenbergTests: XCTestCase {

_ = LoginFlow.loginIfNeeded(siteUrl: WPUITestCredentials.testWPcomSiteAddress, email: WPUITestCredentials.testWPcomUserEmail, password: WPUITestCredentials.testWPcomPassword)
editorScreen = EditorFlow
.toggleBlockEditor(to: .on)
.goBackToMySite()
.goToMySiteScreen()
.tabBar.gotoBlockEditorScreen()
}

Expand Down

0 comments on commit 82ecea5

Please sign in to comment.