diff --git a/Podfile b/Podfile index 165a6af81773..146c8a5d56b7 100644 --- a/Podfile +++ b/Podfile @@ -192,7 +192,7 @@ target 'WordPress' do pod 'Gridicons', '~> 1.0.1' - pod 'WordPressAuthenticator', '~> 1.26.0-beta' + pod 'WordPressAuthenticator', '~> 1.27.0-beta.2' # While in PR # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => '' # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => '' @@ -363,9 +363,9 @@ end ## =================== ## def wordpress_mocks - pod 'WordPressMocks', '~> 0.0.8' + pod 'WordPressMocks', '~> 0.0.9-beta.1' # pod 'WordPressMocks', :git => 'https://github.com/wordpress-mobile/WordPressMocks.git', :commit => '' - # pod 'WordPressMocks', :git => 'https://github.com/wordpress-mobile/WordPressMocks.git', :branch => 'add/screenshot-mocks' + # pod 'WordPressMocks', :git => 'https://github.com/wordpress-mobile/WordPressMocks.git', :branch => '' # pod 'WordPressMocks', :path => '../WordPressMocks' end diff --git a/Podfile.lock b/Podfile.lock index 79220740b7c4..c89772e40ffe 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -395,7 +395,7 @@ PODS: - WordPress-Aztec-iOS (1.19.3) - WordPress-Editor-iOS (1.19.3): - WordPress-Aztec-iOS (= 1.19.3) - - WordPressAuthenticator (1.26.0): + - WordPressAuthenticator (1.27.0-beta.2): - 1PasswordExtension (= 1.8.6) - Alamofire (= 4.8) - CocoaLumberjack (~> 3.5) @@ -414,7 +414,7 @@ PODS: - UIDeviceIdentifier (~> 1) - WordPressShared (~> 1.12) - wpxmlrpc (~> 0.9.0) - - WordPressMocks (0.0.8) + - WordPressMocks (0.0.9-beta.1) - WordPressShared (1.12.0): - CocoaLumberjack (~> 3.4) - FormatterKit/TimeIntervalFormatter (= 1.8.2) @@ -505,9 +505,9 @@ DEPENDENCIES: - Starscream (= 3.0.6) - SVProgressHUD (= 2.2.5) - WordPress-Editor-iOS (~> 1.19.3) - - WordPressAuthenticator (~> 1.26.0-beta) + - WordPressAuthenticator (~> 1.27.0-beta.2) - WordPressKit (~> 4.18.0-beta) - - WordPressMocks (~> 0.0.8) + - WordPressMocks (~> 0.0.9-beta.1) - WordPressShared (~> 1.12.0) - WordPressUI (~> 1.7.1) - WPMediaPicker (~> 1.7.2) @@ -755,9 +755,9 @@ SPEC CHECKSUMS: UIDeviceIdentifier: a79ccdfc940373835a7d8e9fc7541e6bf61b6319 WordPress-Aztec-iOS: b7ac8b30f746992e85d9668453ac87c2cdcecf4f WordPress-Editor-iOS: 1886f7fe464d79ee64ccfe7985281f8cf45f75eb - WordPressAuthenticator: 31bceb4ab25de663a327b791e76a405b9c903b73 + WordPressAuthenticator: f81da13fbec5ad230538d93d082776777c9c09e3 WordPressKit: 1d10fa14ea185600472d31cf25e677c7d938b17d - WordPressMocks: b4064b99a073117bbc304abe82df78f2fbe60992 + WordPressMocks: 1e04de6afa3a17f6f1ab4782f8460d7faefcf2f7 WordPressShared: 38cb62e9cb998d4dc3c1611f17934c6875a6b3e8 WordPressUI: 9da5d966b8beb091950cd96880db398d7f30e246 WPMediaPicker: d5ae9a83cd5cc0e4de46bfc1c59120aa86658bc3 @@ -772,6 +772,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0 -PODFILE CHECKSUM: 6141b62876d49dbc9b2e5735cff154f0244a888f +PODFILE CHECKSUM: e52e67df2c5945cbfa4a5bcc7648ad382f4685bc COCOAPODS: 1.9.3 diff --git a/WordPress/Classes/Models/Notifications/Actions/ReplyToComment.swift b/WordPress/Classes/Models/Notifications/Actions/ReplyToComment.swift index aaae6453b01f..4a267596df05 100644 --- a/WordPress/Classes/Models/Notifications/Actions/ReplyToComment.swift +++ b/WordPress/Classes/Models/Notifications/Actions/ReplyToComment.swift @@ -2,6 +2,7 @@ class ReplyToComment: DefaultNotificationActionCommand { static let title = NSLocalizedString("Reply", comment: "Reply to a comment.") static let hint = NSLocalizedString("Replies to a comment.", comment: "VoiceOver accessibility hint, informing the user the button can be used to reply to a comment.") + static let identifier = "reply-button" override var actionTitle: String { return ReplyToComment.title diff --git a/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockActionsTableViewCell.swift b/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockActionsTableViewCell.swift index 0779ad4e3513..c56b45b6ed3c 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockActionsTableViewCell.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Views/NoteBlockActionsTableViewCell.swift @@ -194,6 +194,7 @@ class NoteBlockActionsTableViewCell: NoteBlockTableViewCell { btnReply.setTitleColor(textNormalColor, for: UIControl.State()) btnReply.accessibilityLabel = ReplyToComment.title btnReply.accessibilityHint = ReplyToComment.hint + btnReply.accessibilityIdentifier = ReplyToComment.identifier btnLike.setTitle(LikeComment.TitleStrings.like, for: UIControl.State()) btnLike.setTitle(LikeComment.TitleStrings.unlike, for: .highlighted) diff --git a/WordPress/WordPressScreenshotGeneration/WordPressScreenshotGeneration.swift b/WordPress/WordPressScreenshotGeneration/WordPressScreenshotGeneration.swift index 4571bdf0c1d6..614cb13143a7 100644 --- a/WordPress/WordPressScreenshotGeneration/WordPressScreenshotGeneration.swift +++ b/WordPress/WordPressScreenshotGeneration/WordPressScreenshotGeneration.swift @@ -36,34 +36,46 @@ class WordPressScreenshotGeneration: XCTestCase { func testGenerateScreenshots() { - // Get My Site screenshot - let mySite = MySiteScreen() + // Get post editor screenshot + let postList = MySiteScreen() .showSiteSwitcher() - .switchToSite(withTitle: "infocusphotographers.com") - snapshot("4-MySite") - - // Get BlockPicker screenshot - let postList = mySite + .switchToSite(withTitle: "fourpawsdoggrooming.wordpress.com") .gotoPostsScreen() .showOnly(.drafts) - let postEditorScreenshot = postList.selectPost(withSlug: "summer-band-jam") - BlockEditorScreen().openBlockPicker() - snapshot("1-BlockPicker") - BlockEditorScreen().closeBlockPicker() + let postEditorScreenshot = postList.selectPost(withSlug: "our-services") + sleep(imagesWaitTime) // wait for post images to load + if isIpad { + snapshot("1-Editor") + } else { + BlockEditorScreen().openBlockPicker() + snapshot("1-Editor-With-BlockPicker") + BlockEditorScreen().closeBlockPicker() + } postEditorScreenshot.close() - // Get a screenshot of the full-screen editor + // Get a screenshot of the editor with keyboard (iPad only) if isIpad { - let ipadScreenshot = postList.selectPost(withSlug: "now-booking-summer-sessions") - snapshot("6-No-Keyboard-Editor") + let ipadScreenshot = MySiteScreen() + .showSiteSwitcher() + .switchToSite(withTitle: "weekendbakesblog.wordpress.com") + .gotoPostsScreen() + .showOnly(.drafts) + .selectPost(withSlug: "easy-blueberry-muffins") + BlockEditorScreen().selectBlock(containingText: "Ingredients") + sleep(imagesWaitTime) // wait for post images to load + snapshot("7-Editor-With-Keyboard") ipadScreenshot.close() - } - - if !isIpad { + } else { postList.pop() } + // Get My Site screenshot + let mySite = MySiteScreen() + .showSiteSwitcher() + .switchToSite(withTitle: "tricountyrealestate.wordpress.com") + snapshot("4-MySite") + // Get Media screenshot _ = mySite.gotoMediaScreen() sleep(imagesWaitTime) // wait for post images to load @@ -77,7 +89,7 @@ class WordPressScreenshotGeneration: XCTestCase { let statsScreen = mySite.gotoStatsScreen() statsScreen .dismissCustomizeInsightsNotice() - .switchTo(mode: .years) + .switchTo(mode: .months) snapshot("3-Stats") // Get Discover screenshot @@ -88,9 +100,13 @@ class WordPressScreenshotGeneration: XCTestCase { snapshot("2-Discover") // Get Notifications screenshot - TabNavComponent() + let notificationList = TabNavComponent() .gotoNotificationsScreen() .dismissNotificationAlertIfNeeded() + if isIpad { + notificationList.openNotification(withText: "Reyansh Pawar commented on My Top 10 Pastry Recipes") + .replyToNotification() + } snapshot("5-Notifications") } } diff --git a/WordPress/WordPressUITests/Screens/Editor/BlockEditorScreen.swift b/WordPress/WordPressUITests/Screens/Editor/BlockEditorScreen.swift index 73506bd2fc6a..d510015f9b15 100644 --- a/WordPress/WordPressUITests/Screens/Editor/BlockEditorScreen.swift +++ b/WordPress/WordPressUITests/Screens/Editor/BlockEditorScreen.swift @@ -65,6 +65,16 @@ class BlockEditorScreen: BaseScreen { return self } + /** + Selects a block based on part of the block label (e.g. partial text in a paragraph block) + */ + @discardableResult + func selectBlock(containingText text: String) -> BlockEditorScreen { + let predicate = NSPredicate(format: "label CONTAINS[c] '\(text)'") + XCUIApplication().buttons.containing(predicate).firstMatch.tap() + return self + } + // returns void since return screen depends on from which screen it loaded func closeEditor() { XCTContext.runActivity(named: "Close the block editor") { (activity) in diff --git a/WordPress/WordPressUITests/Screens/Login/LoginEpilogueScreen.swift b/WordPress/WordPressUITests/Screens/Login/LoginEpilogueScreen.swift index 4aca07f5953a..da46bb0c6ba5 100644 --- a/WordPress/WordPressUITests/Screens/Login/LoginEpilogueScreen.swift +++ b/WordPress/WordPressUITests/Screens/Login/LoginEpilogueScreen.swift @@ -21,7 +21,7 @@ class LoginEpilogueScreen: BaseScreen { connectSiteButton = app.cells[ElementStringIDs.connectSiteButton] continueButton = app.buttons[ElementStringIDs.continueButton] - super.init(element: siteUrlField) + super.init(element: continueButton) } func continueWithSelectedSite() -> MySiteScreen { @@ -41,7 +41,7 @@ class LoginEpilogueScreen: BaseScreen { } let expectedSiteUrl = getDisplayUrl(for: siteUrl) - let actualSiteUrl = siteUrlField.label + let actualSiteUrl = siteUrlField.firstMatch.label XCTAssertEqual(expectedSiteUrl, actualSiteUrl, "Site URL displayed is \(actualSiteUrl) but should be \(expectedSiteUrl)") return self diff --git a/WordPress/WordPressUITests/Screens/NotificationsScreen.swift b/WordPress/WordPressUITests/Screens/NotificationsScreen.swift index 3da6750c02b7..18cece74bac8 100644 --- a/WordPress/WordPressUITests/Screens/NotificationsScreen.swift +++ b/WordPress/WordPressUITests/Screens/NotificationsScreen.swift @@ -4,14 +4,27 @@ import XCTest class NotificationsScreen: BaseScreen { let tabBar: TabNavComponent + let replyButton: XCUIElement init() { let navBar = XCUIApplication().tables["Notifications Table"] + replyButton = XCUIApplication().buttons["reply-button"] tabBar = TabNavComponent() super.init(element: navBar) } + func openNotification(withText notificationText: String) -> NotificationsScreen { + XCUIApplication().staticTexts[notificationText].tap() + return self + } + + @discardableResult + func replyToNotification() -> NotificationsScreen { + replyButton.tap() + return self + } + static func isLoaded() -> Bool { return XCUIApplication().tables["Notifications Table"].exists } diff --git a/WordPress/WordPressUITests/Screens/StatsScreen.swift b/WordPress/WordPressUITests/Screens/StatsScreen.swift index 31c5a4df35f7..7a06ad37ff3c 100644 --- a/WordPress/WordPressUITests/Screens/StatsScreen.swift +++ b/WordPress/WordPressUITests/Screens/StatsScreen.swift @@ -8,6 +8,7 @@ private struct ElementStringIDs { class StatsScreen: BaseScreen { enum Mode: String { + case months = "months" case years = "years" } diff --git a/WordPress/WordPressUITests/Screens/TabNavComponent.swift b/WordPress/WordPressUITests/Screens/TabNavComponent.swift index 050a54ec1175..346210125ca1 100644 --- a/WordPress/WordPressUITests/Screens/TabNavComponent.swift +++ b/WordPress/WordPressUITests/Screens/TabNavComponent.swift @@ -27,7 +27,7 @@ class TabNavComponent: BaseScreen { func gotoMySiteScreen() -> MySiteScreen { // Avoid transitioning to the sites list if MySites is already on screen if !MySiteScreen.isVisible { - gotoMySitesScreen().switchToSite(withTitle: "infocusphotographers.com") + gotoMySitesScreen().switchToSite(withTitle: WPUITestCredentials.testWPcomSiteAddress) } return MySiteScreen() } diff --git a/WordPress/WordPressUITests/Tests/MainNavigationTests.swift b/WordPress/WordPressUITests/Tests/MainNavigationTests.swift index 2f468f927c61..4316deb5eaad 100644 --- a/WordPress/WordPressUITests/Tests/MainNavigationTests.swift +++ b/WordPress/WordPressUITests/Tests/MainNavigationTests.swift @@ -27,6 +27,7 @@ class MainNavigationTests: XCTestCase { _ = mySiteScreen .tabBar.gotoNotificationsScreen() + .dismissNotificationAlertIfNeeded() XCTContext.runActivity(named: "Confirm Notifications screen and main navigation bar are loaded.") { (activity) in XCTAssert(NotificationsScreen.isLoaded(), "Notifications screen isn't loaded.") diff --git a/WordPress/WordPressUITests/WPUITestCredentials.swift b/WordPress/WordPressUITests/WPUITestCredentials.swift index dca4d802b80a..95f0076527cc 100644 --- a/WordPress/WordPressUITests/WPUITestCredentials.swift +++ b/WordPress/WordPressUITests/WPUITestCredentials.swift @@ -3,8 +3,8 @@ struct WPUITestCredentials { static let testWPcomUserEmail: String = "e2eflowtestingmobile@example.com" static let testWPcomUsername: String = "e2eflowtestingmobile" static let testWPcomPassword: String = "mocked_password" - static let testWPcomSiteAddress: String = "infocusphotographers.wordpress.com" - static let testWPcomSitePrimaryAddress: String = "infocusphotographers.com" + static let testWPcomSiteAddress: String = "tricountyrealestate.wordpress.com" + static let testWPcomSitePrimaryAddress: String = "tricountyrealestate.wordpress.com" static let selfHostedUsername: String = "e2eflowtestingmobile" static let selfHostedPassword: String = "mocked_password" static let selfHostedSiteAddress: String = "\(WireMock.URL().absoluteString)"