Skip to content

Commit ac93eab

Browse files
authored
Remove dotComWebLoginEnabled (#24977)
* Remove `dotComWebLoginEnabled` * Remove WP.com login UI tests * Update self-hosted site login tests * Remove SupportScreenTests After moving to web login, the tests are not longer applicable.
1 parent 22425a7 commit ac93eab

File tree

6 files changed

+31
-132
lines changed

6 files changed

+31
-132
lines changed

WordPress/Classes/System/Root View/WordPressAuthenticatorProtocol.swift

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,8 @@ extension WordPressAuthenticator: WordPressAuthenticatorProtocol {
2121
)
2222
}
2323

24-
static var dotComWebLoginEnabled: Bool {
25-
// Some UI tests go through the native login flow. They should be updated once the web sign in flow is fully
26-
// rolled out. We'll disable web login for UI tests for now.
27-
if UITestConfigurator.isUITesting() {
28-
return false
29-
}
30-
31-
return true
32-
}
33-
3424
private static func continueWithDotCom(_ viewController: UIViewController) -> Bool {
35-
guard Self.dotComWebLoginEnabled, let navigationController = viewController.navigationController else {
25+
guard let navigationController = viewController.navigationController else {
3626
return false
3727
}
3828

WordPress/Classes/System/WordPressAppDelegate.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,6 @@ extension WordPressAppDelegate {
528528
/// Updates the remote feature flags using an authenticated remote if a token is provided or an account exists
529529
/// Otherwise an anonymous remote will be used
530530
func updateFeatureFlags(authToken: String? = nil, completion: (() -> Void)? = nil) {
531-
// Enable certain feature flags on test builds.
532-
if BuildConfiguration.current.isInternal {
533-
FeatureFlagOverrideStore().override(RemoteFeatureFlag.dotComWebLogin, withValue: true)
534-
}
535-
536531
/// - warning: must be called before the `update(using:then:)`.
537532
if remoteFeatureFlagStore.isFreshInstall {
538533
FeatureFlagOverrideStore().override(FeatureFlag.newStats, withValue: true)

WordPress/Classes/ViewRelated/NUX/Helpers/WordPressAuthenticationManager.swift

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -261,41 +261,34 @@ extension WordPressAuthenticationManager {
261261

262262
isPresentingSignIn = true
263263

264-
if WordPressAuthenticator.dotComWebLoginEnabled {
265-
let signedInAccount = try? WPAccount.lookupDefaultWordPressComAccount(in: ContextManager.shared.mainContext)
266-
Task { @MainActor in
267-
let title = NSLocalizedString("wpcom.token.fix.signin", value: "Sign in to WordPress.com", comment: "Message title to be displayed when the user needs to re-authenticate their WordPress.com account.")
268-
let message = NSLocalizedString("wpcom.token.fix.signin.message", value: "You need to sign in to WordPress.com to access your account.", comment: "Detailed message to be displayed when the user needs to re-authenticate their WordPress.com account.")
269-
270-
if showNotice {
271-
Notice(title: title, message: message).post()
272-
}
264+
let signedInAccount = try? WPAccount.lookupDefaultWordPressComAccount(in: ContextManager.shared.mainContext)
265+
Task { @MainActor in
266+
let title = NSLocalizedString("wpcom.token.fix.signin", value: "Sign in to WordPress.com", comment: "Message title to be displayed when the user needs to re-authenticate their WordPress.com account.")
267+
let message = NSLocalizedString("wpcom.token.fix.signin.message", value: "You need to sign in to WordPress.com to access your account.", comment: "Detailed message to be displayed when the user needs to re-authenticate their WordPress.com account.")
273268

274-
let account = await WordPressDotComAuthenticator().signIn(
275-
from: presenter,
276-
context: signedInAccount?.email
277-
.flatMap { .reauthentication(accountEmail: $0) }
278-
?? .default
279-
)
280-
281-
if account == nil {
282-
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
283-
alert.addActionWithTitle(NSLocalizedString("wpcom.token.alert.button.logout", value: "Log out", comment: "Button title to log out the current WordPress.com account"), style: .destructive) { _ in
284-
AccountHelper.logOutDefaultWordPressComAccount()
285-
}
286-
alert.addActionWithTitle(NSLocalizedString("wpcom.token.alert.button.signin", value: "Sign In", comment: "Button title to Sign In to WordPress.com"), style: .default) { _ in
287-
WordPressAuthenticationManager.showSigninForWPComFixingAuthToken(showNotice: false)
288-
}
289-
presenter.present(alert, animated: true)
290-
}
269+
if showNotice {
270+
Notice(title: title, message: message).post()
271+
}
272+
273+
let account = await WordPressDotComAuthenticator().signIn(
274+
from: presenter,
275+
context: signedInAccount?.email
276+
.flatMap { .reauthentication(accountEmail: $0) }
277+
?? .default
278+
)
291279

292-
isPresentingSignIn = false
280+
if account == nil {
281+
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
282+
alert.addActionWithTitle(NSLocalizedString("wpcom.token.alert.button.logout", value: "Log out", comment: "Button title to log out the current WordPress.com account"), style: .destructive) { _ in
283+
AccountHelper.logOutDefaultWordPressComAccount()
284+
}
285+
alert.addActionWithTitle(NSLocalizedString("wpcom.token.alert.button.signin", value: "Sign In", comment: "Button title to Sign In to WordPress.com"), style: .default) { _ in
286+
WordPressAuthenticationManager.showSigninForWPComFixingAuthToken(showNotice: false)
287+
}
288+
presenter.present(alert, animated: true)
293289
}
294-
} else {
295-
let controller = signinForWPComFixingAuthToken({ (_) in
296-
isPresentingSignIn = false
297-
})
298-
presenter.present(controller, animated: true)
290+
291+
isPresentingSignIn = false
299292
}
300293
}
301294

WordPress/UITests/Tests/LoginTests.swift

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,12 @@
11
import UITestsFoundation
22
import XCTest
33

4+
@MainActor
45
class LoginTests: XCTestCase {
56

6-
@MainActor
7-
override func setUpWithError() throws {
8-
try super.setUpWithError()
9-
setUpTestSuite()
10-
}
11-
12-
// Unified email login/out
13-
func testWPcomLoginLogout() throws {
14-
try PrologueScreen()
15-
.selectContinue()
16-
.proceedWith(email: WPUITestCredentials.testWPcomUserEmail)
17-
.proceedWithValidPassword()
18-
try makeMainNavigationComponent()
19-
.goToMeScreen()
20-
.logoutToPrologue()
21-
.assertScreenIsLoaded()
22-
}
23-
24-
/**
25-
This test opens safari to trigger the mocked magic link redirect
26-
*/
27-
func testEmailMagicLinkLogin() throws {
28-
try WelcomeScreen()
29-
.selectLogin()
30-
.selectEmailLogin()
31-
.proceedWith(email: WPUITestCredentials.testWPcomUserEmail)
32-
.proceedWithLink()
33-
.openMagicLoginLink()
34-
35-
try makeMainNavigationComponent()
36-
.goToMeScreen()
37-
.logout()
38-
.assertScreenIsLoaded()
39-
}
40-
417
// Unified self hosted login/out
428
func testSelfHostedLoginLogout() throws {
9+
setUpTestSuite()
4310
try PrologueScreen()
4411
.selectSiteAddress()
4512
.proceedWith(siteAddress: WPUITestCredentials.selfHostedSiteAddress)
@@ -59,24 +26,13 @@ class LoginTests: XCTestCase {
5926
.assertScreenIsLoaded()
6027
}
6128

62-
// Unified WordPress.com email login failure due to incorrect password
63-
func testWPcomInvalidPassword() throws {
64-
try PrologueScreen()
65-
.selectContinue()
66-
.proceedWith(email: WPUITestCredentials.testWPcomUserEmail)
67-
.proceedWithInvalidPassword()
68-
.verifyLoginError()
69-
}
70-
7129
// Self-Hosted after WordPress.com login.
7230
// Login to a WordPress.com account, open site switcher, then add a self-hosted site.
7331
func testAddSelfHostedSiteAfterWPcomLogin() throws {
74-
try PrologueScreen()
75-
.selectContinue()
76-
.proceedWith(email: WPUITestCredentials.testWPcomUserEmail)
77-
.proceedWithValidPassword()
32+
setUpTestSuite(selectWPComSite: WPUITestCredentials.testWPcomFreeSite)
7833

79-
// From here, bring up the sites list and choose to add a new self-hosted site.
34+
// From here, bring up the sites list and choose to add a new self-hosted site.
35+
try MySiteScreen()
8036
.showSiteSwitcher()
8137
.addSelfHostedSite()
8238

WordPress/UITests/Tests/SupportScreenTests.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

WordPress/WordPress.xcodeproj/project.pbxproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@
169169
4AD9555A2C21716A00D0EEFA /* WordPressAuthenticator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AD953B42C21451700D0EEFA /* WordPressAuthenticator.framework */; };
170170
4AD9555B2C21716A00D0EEFA /* WordPressAuthenticator.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4AD953B42C21451700D0EEFA /* WordPressAuthenticator.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
171171
5D69DBC4165428CA00A2D1F7 /* n.caf in Resources */ = {isa = PBXBuildFile; fileRef = 5D69DBC3165428CA00A2D1F7 /* n.caf */; };
172-
6E5BA46926A59D620043A6F2 /* SupportScreenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5BA46826A59D620043A6F2 /* SupportScreenTests.swift */; };
173172
7335AC6021220D550012EF2D /* RemoteNotificationActionParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7335AC5F21220D550012EF2D /* RemoteNotificationActionParser.swift */; };
174173
7358E6BF210BD318002323EB /* WordPressNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7358E6B8210BD318002323EB /* WordPressNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
175174
73768B6B212B4E4F005136A1 /* UNNotificationContent+RemoteNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73768B6A212B4E4F005136A1 /* UNNotificationContent+RemoteNotification.swift */; };
@@ -244,7 +243,6 @@
244243
EA14532C29AD874C001F3143 /* EditorGutenbergTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2BB0CF228ACF710034F9AB /* EditorGutenbergTests.swift */; };
245244
EA14532D29AD874C001F3143 /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF2716911CAAC87B0006E2D4 /* LoginTests.swift */; };
246245
EA14532E29AD874C001F3143 /* BaseScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2B4E9E1FD664F5007AE3E4 /* BaseScreen.swift */; };
247-
EA14532F29AD874C001F3143 /* SupportScreenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5BA46826A59D620043A6F2 /* SupportScreenTests.swift */; };
248246
EA14533029AD874C001F3143 /* StatsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD2BF4127594DAB00A847BB /* StatsTests.swift */; };
249247
EA14533129AD874C001F3143 /* WPUITestCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC8A5EAA22159FA6001B7874 /* WPUITestCredentials.swift */; };
250248
EA14533229AD874C001F3143 /* SignupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7CB97222B1510900642EE9 /* SignupTests.swift */; };
@@ -883,7 +881,6 @@
883881
4AD953B42C21451700D0EEFA /* WordPressAuthenticator.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WordPressAuthenticator.framework; sourceTree = BUILT_PRODUCTS_DIR; };
884882
4AD953BB2C21451700D0EEFA /* WordPressAuthenticatorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WordPressAuthenticatorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
885883
5D69DBC3165428CA00A2D1F7 /* n.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = n.caf; path = Resources/Sounds/n.caf; sourceTree = "<group>"; };
886-
6E5BA46826A59D620043A6F2 /* SupportScreenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportScreenTests.swift; sourceTree = "<group>"; };
887884
6EDC0E8E105881A800F68A1D /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
888885
7335AC5F21220D550012EF2D /* RemoteNotificationActionParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteNotificationActionParser.swift; sourceTree = "<group>"; };
889886
733F36052126197800988727 /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; };
@@ -2053,7 +2050,6 @@
20532050
EAB10E3F27487F5D000DA4C1 /* ReaderTests.swift */,
20542051
CC7CB97222B1510900642EE9 /* SignupTests.swift */,
20552052
EAD2BF4127594DAB00A847BB /* StatsTests.swift */,
2056-
6E5BA46826A59D620043A6F2 /* SupportScreenTests.swift */,
20572053
0C38581F2CA74DC7004880ED /* AppSettingsTests.swift */,
20582054
);
20592055
path = Tests;
@@ -3776,7 +3772,6 @@
37763772
80B42AC02AB2CB1400377607 /* PagesTests.swift in Sources */,
37773773
EA14532E29AD874C001F3143 /* BaseScreen.swift in Sources */,
37783774
0C3858202CA74DC7004880ED /* AppSettingsTests.swift in Sources */,
3779-
EA14532F29AD874C001F3143 /* SupportScreenTests.swift in Sources */,
37803775
EA14533029AD874C001F3143 /* StatsTests.swift in Sources */,
37813776
EA14533129AD874C001F3143 /* WPUITestCredentials.swift in Sources */,
37823777
EA14533229AD874C001F3143 /* SignupTests.swift in Sources */,
@@ -3824,7 +3819,6 @@
38243819
80B42ABF2AB2CB1300377607 /* PagesTests.swift in Sources */,
38253820
BE2B4E9F1FD664F5007AE3E4 /* BaseScreen.swift in Sources */,
38263821
0C3858212CA74DC7004880ED /* AppSettingsTests.swift in Sources */,
3827-
6E5BA46926A59D620043A6F2 /* SupportScreenTests.swift in Sources */,
38283822
EAD2BF4227594DAB00A847BB /* StatsTests.swift in Sources */,
38293823
CC8A5EAB22159FA6001B7874 /* WPUITestCredentials.swift in Sources */,
38303824
CC7CB97322B1510900642EE9 /* SignupTests.swift in Sources */,

0 commit comments

Comments
 (0)