Skip to content

Commit 0af55e8

Browse files
committed
Verify scheduled post in post list.
1 parent fda6a2b commit 0af55e8

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

WordPress/UITests/Tests/EditorGutenbergTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class EditorGutenbergTests: XCTestCase {
2929
.enterTextInTitle(text: postTitle)
3030
.addParagraphBlock(withText: postContent)
3131
.verifyContentStructure(blocks: 1, words: postContent.components(separatedBy: " ").count, characters: postContent.count)
32-
.publishAndViewEpilogue()
32+
.postAndViewEpilogue(action: .publish)
3333
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomPaidSite)
3434
.tapDone()
3535
}
@@ -47,7 +47,7 @@ class EditorGutenbergTests: XCTestCase {
4747
.selectCategory(name: category)
4848
.addTag(name: tag)
4949
.closePostSettings()
50-
.publishAndViewEpilogue()
50+
.postAndViewEpilogue(action: .publish)
5151
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomPaidSite)
5252
.tapDone()
5353
}

WordPress/UITests/Tests/PostTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ class PostTests: XCTestCase {
3131
.updatePublishDateToFutureDate()
3232
.closePublishDateSelector()
3333
.closePostSettings()
34-
.schedulePostAndViewEpilogue()
35-
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomSiteForScheduledPost)
36-
.tapDone()
34+
.post(action: .schedule)
35+
36+
try MySiteScreen()
37+
.goToPostsScreen()
38+
.showOnly(.scheduled)
39+
.verifyPostExists(withTitle: postTitle)
3740
}
3841
}

WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -244,32 +244,18 @@ public class BlockEditorScreen: ScreenObject {
244244
}
245245
}
246246

247-
private enum postAction: String {
247+
public enum postAction: String {
248248
case publish = "Publish"
249249
case schedule = "Schedule"
250250
}
251251

252-
public func publish() throws {
253-
return try post(action: .publish)
254-
}
255-
256-
public func publishAndViewEpilogue() throws -> EditorPublishEpilogueScreen {
257-
try publish()
258-
waitAndTap(noticeViewButton)
259-
return try EditorPublishEpilogueScreen()
260-
}
261-
262-
public func schedulePost() throws {
263-
try post(action: .schedule)
264-
}
265-
266-
public func schedulePostAndViewEpilogue() throws -> EditorPublishEpilogueScreen {
267-
try schedulePost()
252+
public func postAndViewEpilogue(action: postAction) throws -> EditorPublishEpilogueScreen {
253+
try post(action: action)
268254
waitAndTap(noticeViewButton)
269255
return try EditorPublishEpilogueScreen()
270256
}
271257

272-
private func post(action: postAction) throws {
258+
public func post(action: postAction) throws {
273259
let postButton = app.buttons[action.rawValue]
274260
let postNowButton = app.buttons["\(action.rawValue) Now"]
275261
var tries = 0

WordPress/UITestsFoundation/Screens/MySiteScreen.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public class MySiteScreen: ScreenObject {
180180
}
181181

182182
public func goToPostsScreen() throws -> PostsScreen {
183+
goToMenu()
183184
postsButton.tap()
184185
return try PostsScreen()
185186
}
@@ -219,7 +220,7 @@ public class MySiteScreen: ScreenObject {
219220
@discardableResult
220221
public func goToMenu() -> Self {
221222
// On iPad, the menu items are already listed on screen, so we don't need to tap the menu button
222-
guard XCUIDevice.isPhone else {
223+
guard XCUIDevice.isPhone && !segmentedControlMenuButton.isSelected else {
223224
return self
224225
}
225226

WordPress/UITestsFoundation/Screens/PostsScreen.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class PostsScreen: ScreenObject {
66
public enum PostStatus {
77
case published
88
case drafts
9+
case scheduled
910
}
1011

1112
private var currentlyFilteredPostStatus: PostStatus = .published
@@ -56,6 +57,8 @@ public class PostsScreen: ScreenObject {
5657
publishedButton.tap()
5758
case .drafts:
5859
draftsButton.tap()
60+
case .scheduled:
61+
scheduledButton.tap()
5962
}
6063

6164
currentlyFilteredPostStatus = status
@@ -89,6 +92,12 @@ public class PostsScreen: ScreenObject {
8992
autosaveAlert.buttons.firstMatch.tap()
9093
}
9194
}
95+
96+
public func verifyPostExists(withTitle title: String) {
97+
let expectedPost = app.cells.containing(.staticText, identifier: title).element
98+
99+
XCTAssertTrue(expectedPost.exists)
100+
}
92101
}
93102

94103
public struct EditorScreen {

0 commit comments

Comments
 (0)