Skip to content

Commit

Permalink
Merge pull request #18367 from wordpress-mobile/task/remove-site-inte…
Browse files Browse the repository at this point in the history
…nt-ab-test

[Site Name] Removes Site Intent Question A/B test
  • Loading branch information
twstokes authored Apr 15, 2022
2 parents 37ab322 + e611c47 commit cf81248
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 127 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [*] a11y: VoiceOver has been improved on the Menus view and now announces changes to ordering. [#18155]
* [*] Notifications list: remove comment Trash swipe action. [#18349]
* [*] Reader: Fixed a bug that caused cut off content in reader web view [#16106]
* [*] Site creation: Adds a new screen asking the user the intent of the site [#18367]
* [**] Block Editor: Quote block: Adds support for V2 behind a feature flag [https://github.com/WordPress/gutenberg/pull/40133]
* [**] Block Editor: Update "add block" button's style in default editor view [https://github.com/WordPress/gutenberg/pull/39726]
* [*] Block Editor: Remove banner error notification on upload failure [https://github.com/WordPress/gutenberg/pull/39694]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import Foundation
import WordPressKit
import AutomatticTracks

extension SiteIntentAB.Variant {
var tracksProperty: String {
switch self {
case .treatment: return "treatment"
case .control: return "control"
}
}
}

extension Variation {
var tracksProperty: String {
switch self {
Expand Down Expand Up @@ -58,11 +49,6 @@ class SiteCreationAnalyticsHelper {
WPAnalytics.track(.enhancedSiteCreationIntentQuestionCanceled)
}

static func trackSiteIntentExperiment(_ variant: SiteIntentAB.Variant) {
let properties = [variationKey: variant.tracksProperty]
WPAnalytics.track(.enhancedSiteCreationIntentQuestionExperiment, properties: properties)
}

// MARK: - Site Name
static func trackSiteNameViewed() {
WPAnalytics.track(.enhancedSiteCreationSiteNameViewed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import AutomatticTracks

/// Puts together the Site creation wizard, assembling steps.
final class SiteCreationWizardLauncher {
private let intentVariant: SiteIntentAB.Variant
private let nameVariant: Variation

private lazy var creator: SiteCreator = {
return SiteCreator()
}()

private var shouldShowSiteIntent: Bool {
return intentVariant == .treatment && FeatureFlag.siteIntentQuestion.enabled
return FeatureFlag.siteIntentQuestion.enabled
}

private var shouldShowSiteName: Bool {
Expand Down Expand Up @@ -66,19 +65,16 @@ final class SiteCreationWizardLauncher {
private let onDismiss: ((Blog, Bool) -> Void)?

init(
intentVariant: SiteIntentAB.Variant = SiteIntentAB.shared.variant,
nameVariant: Variation = ABTest.siteNameV1.variation,
onDismiss: ((Blog, Bool) -> Void)? = nil
) {
self.onDismiss = onDismiss
self.intentVariant = intentVariant
self.nameVariant = nameVariant

trackVariants()
}

private func trackVariants() {
SiteCreationAnalyticsHelper.trackSiteIntentExperiment(intentVariant)
SiteCreationAnalyticsHelper.trackSiteNameExperiment(nameVariant)
}

Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2001,8 +2001,6 @@
B084E62027E3B7A4007BF7A8 /* SiteIntentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B089140C27E1255D00CF468B /* SiteIntentViewController.swift */; };
B089140D27E1255D00CF468B /* SiteIntentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B089140C27E1255D00CF468B /* SiteIntentViewController.swift */; };
B0960C8727D14BD400BC9717 /* SiteIntentStep.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0960C8627D14BD400BC9717 /* SiteIntentStep.swift */; };
B0960C8927D17B1200BC9717 /* SiteIntentAB.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0960C8827D17B1200BC9717 /* SiteIntentAB.swift */; };
B0960C8A27D17B1200BC9717 /* SiteIntentAB.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0960C8827D17B1200BC9717 /* SiteIntentAB.swift */; };
B0A6DEBF2626335F00B5B8EF /* AztecPostViewController+MenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0A6DEBE2626335F00B5B8EF /* AztecPostViewController+MenuTests.swift */; };
B0AC50DD251E96270039E022 /* ReaderCommentsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0AC50DC251E96270039E022 /* ReaderCommentsViewController.swift */; };
B0B68A9C252FA91E0001B28C /* UserSuggestion+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B68A9A252FA91E0001B28C /* UserSuggestion+CoreDataClass.swift */; };
Expand Down Expand Up @@ -6712,7 +6710,6 @@
B06378BF253F639D00FD45D2 /* SiteSuggestion+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SiteSuggestion+CoreDataProperties.swift"; sourceTree = "<group>"; };
B089140C27E1255D00CF468B /* SiteIntentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteIntentViewController.swift; sourceTree = "<group>"; };
B0960C8627D14BD400BC9717 /* SiteIntentStep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteIntentStep.swift; sourceTree = "<group>"; };
B0960C8827D17B1200BC9717 /* SiteIntentAB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteIntentAB.swift; sourceTree = "<group>"; };
B0A6DEBE2626335F00B5B8EF /* AztecPostViewController+MenuTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "AztecPostViewController+MenuTests.swift"; path = "Aztec/AztecPostViewController+MenuTests.swift"; sourceTree = "<group>"; };
B0AC50DC251E96270039E022 /* ReaderCommentsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderCommentsViewController.swift; sourceTree = "<group>"; };
B0B68A9A252FA91E0001B28C /* UserSuggestion+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserSuggestion+CoreDataClass.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -10665,7 +10662,6 @@
C35D4FF0280077F100DB90B5 /* SiteCreationStep.swift */,
738B9A4121B85CF20005062B /* SiteCreator.swift */,
738B9A4621B85CF20005062B /* WizardNavigation.swift */,
B0960C8827D17B1200BC9717 /* SiteIntentAB.swift */,
);
path = Wizard;
sourceTree = "<group>";
Expand Down Expand Up @@ -18496,7 +18492,6 @@
F52CACCA244FA7AA00661380 /* ReaderManageScenePresenter.swift in Sources */,
FF5371631FDFF64F00619A3F /* MediaService.swift in Sources */,
40C403F52215D66A00E8C894 /* TopViewedPostStatsRecordValue+CoreDataClass.swift in Sources */,
B0960C8927D17B1200BC9717 /* SiteIntentAB.swift in Sources */,
5DAFEAB81AF2CA6E00B3E1D7 /* PostMetaButton.m in Sources */,
40ADB15520686870009A9161 /* PluginStore+Persistence.swift in Sources */,
D83CA3A720842CD90060E310 /* ResultsPage.swift in Sources */,
Expand Down Expand Up @@ -19925,7 +19920,6 @@
FABB21472602FC2C00C8785C /* InvitePersonViewController.swift in Sources */,
FABB21482602FC2C00C8785C /* PushAuthenticationManager.swift in Sources */,
FABB21492602FC2C00C8785C /* CommentServiceRemoteFactory.swift in Sources */,
B0960C8A27D17B1200BC9717 /* SiteIntentAB.swift in Sources */,
FABB214A2602FC2C00C8785C /* SuggestionsTableView.m in Sources */,
FABB214B2602FC2C00C8785C /* PluginDetailViewHeaderCell.swift in Sources */,
B084E62027E3B7A4007BF7A8 /* SiteIntentViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import XCTest
class SiteCreationIntentTracksEventTests: XCTestCase {

let featureFlags = FeatureFlagOverrideStore()
let treatmentVariant = SiteIntentAB.Variant.treatment

let controlVariant = SiteIntentAB.Variant.control
let variationEventPropertyKey = "variation"

override func setUpWithError() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,54 @@ class SiteCreationWizardLauncherTests: XCTestCase {

private let featureFlags = FeatureFlagOverrideStore()

private let intentControl = SiteIntentAB.Variant.control
private let intentTreatment = SiteIntentAB.Variant.treatment
private let nameControl = Variation.control
private let nameTreatment = Variation.treatment(nil)

/// If Site Intent is disabled, Site Name is also disabled
func testSiteCreationStepOrderIntentDisabled() throws {

/// If Site Intent is disabled, Site Name is also disabled

// Given
try featureFlags.override(FeatureFlag.siteIntentQuestion, withValue: false)
try featureFlags.override(FeatureFlag.siteName, withValue: true)
let expectedOrder: [SiteCreationStep] = [.design, .address, .siteAssembly]

// When
let wizardIntentTreatment = SiteCreationWizardLauncher(intentVariant: intentTreatment, nameVariant: nameTreatment)
let wizardIntentTreatment = SiteCreationWizardLauncher(nameVariant: nameTreatment)

// Then
XCTAssertEqual(expectedOrder, wizardIntentTreatment.steps)

/// If in the Site Intent control group, Site Name is disabled

// Given
try featureFlags.override(FeatureFlag.siteIntentQuestion, withValue: true)

// When
let wizardIntentControl = SiteCreationWizardLauncher(intentVariant: intentControl, nameVariant: nameTreatment)

// Then
XCTAssertEqual(expectedOrder, wizardIntentControl.steps)
}

func testSiteCreationStepOrderIntentEnabledNameDisabled() throws {
func testSiteCreationStepOrderNameDisabled() throws {

/// If in the Site Intent treatment group but not in Site Name, or Site Name is disabled
/// Site Name should not be shown if the feature flag is disabled

// Given
try featureFlags.override(FeatureFlag.siteIntentQuestion, withValue: true)
try featureFlags.override(FeatureFlag.siteName, withValue: false)
let expectedOrder: [SiteCreationStep] = [.intent, .design, .address, .siteAssembly]

// When
let wizardNameDisabled = SiteCreationWizardLauncher(intentVariant: intentTreatment, nameVariant: nameTreatment)
let wizardNameDisabled = SiteCreationWizardLauncher(nameVariant: nameTreatment)

// Then
XCTAssertEqual(expectedOrder, wizardNameDisabled.steps)

/// There should be no change if the Site Name feature flag is enabled because Site Name is in the control group
/// There should be no change if the Site Name feature flag is enabled but Site Name is in the control group

// Given
try featureFlags.override(FeatureFlag.siteName, withValue: true)

// When
let wizardNameControl = SiteCreationWizardLauncher(intentVariant: intentTreatment, nameVariant: nameControl)
let wizardNameControl = SiteCreationWizardLauncher(nameVariant: nameControl)

// Then
XCTAssertEqual(expectedOrder, wizardNameControl.steps)
}

func testSiteCreationStepOrderIntentEnabledNameEnabled() throws {

/// If both features are enabled and in both treatment groups, present both and remove Site Address step
/// If both features are enabled and user is in the Site Name treatment group, present both and remove Site Address step

// Given
try featureFlags.override(FeatureFlag.siteIntentQuestion, withValue: true)
Expand All @@ -76,40 +62,12 @@ class SiteCreationWizardLauncherTests: XCTestCase {
let expectedOrder: [SiteCreationStep] = [.intent, .name, .design, .siteAssembly]

// When
let wizardBothEnabled = SiteCreationWizardLauncher(intentVariant: intentTreatment, nameVariant: nameTreatment)
let wizardBothEnabled = SiteCreationWizardLauncher(nameVariant: nameTreatment)

// Then
XCTAssertEqual(expectedOrder, wizardBothEnabled.steps)
}

func testSiteIntentVariantTracking() throws {

/// When the Site Creation Wizard Launcher starts, it should fire an event for the variant being tracked

try runSiteIntentVariantTrackingTest(for: intentTreatment)
try runSiteIntentVariantTrackingTest(for: intentControl)
}

private func runSiteIntentVariantTrackingTest(for variant: SiteIntentAB.Variant) throws {
TestAnalyticsTracker.setup()

// Given
let expectedEvent = WPAnalyticsEvent.enhancedSiteCreationIntentQuestionExperiment.value
let expectedProperty = variant.tracksProperty
let variationEventPropertyKey = "variation"

// When
let _ = SiteCreationWizardLauncher(intentVariant: variant)

// Then
let trackedEvents = try XCTUnwrap(TestAnalyticsTracker.tracked.filter { $0.event == expectedEvent })
XCTAssertEqual(trackedEvents.count, 1)
let variation = try XCTUnwrap(trackedEvents[0].properties[variationEventPropertyKey] as? String)
XCTAssertEqual(variation, expectedProperty)

TestAnalyticsTracker.tearDown()
}

func testSiteNameVariantTracking() throws {

/// When the Site Creation Wizard Launcher starts, it should fire an event for the variant being tracked
Expand Down

0 comments on commit cf81248

Please sign in to comment.