Skip to content

Commit

Permalink
Merge pull request #569 from SourcePointUSA/DIA-3916_fix_tvos_pm_tran…
Browse files Browse the repository at this point in the history
…slation

DIA-3916 fix tvOS pm translation
  • Loading branch information
andresilveirah authored Apr 30, 2024
2 parents 8032c6a + e20ff5d commit ff69444
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 152 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ defaults:
working-directory: Example
jobs:
lint:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: linting
run: swiftlint lint
- run: brew install swiftlint
- run: swiftlint lint
BuildSwiftPackage:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
Expand All @@ -28,14 +28,14 @@ jobs:
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
BuildCarthageProject:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Building Carthage Project
run: cd ./SPCarthageTest && ./build.sh
ObjC-ExampleApp-tests:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
Expand All @@ -47,7 +47,7 @@ jobs:
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
ConsentViewController:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
Expand All @@ -59,7 +59,7 @@ jobs:
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
AuthExample-tests:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
Expand All @@ -71,7 +71,7 @@ jobs:
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
NativePMExampleApp:
runs-on: macos-latest-large
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: sudo xcode-select -s /Applications/Xcode_15.3.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class SourcePointClient: SourcePointProtocol {
"consentLanguage": consentLanguage.rawValue,
"propertyId": propertyId,
"messageId": messageId,
"includeData": "{\"categories\": {\"type\": \"RecordString\"}}"
"includeData": "{\"categories\":{\"type\":\"RecordString\"},\"translateMessage\":true}"
])! // swiftlint:disable:this force_unwrapping
client.get(urlString: url.absoluteString, apiCode: .GDPR_MESSAGE) {
Self.parseResponse($0, InvalidResponseMessageGDPREndpointError()) { (parsingResult: Result<MessageResponse, SPError>) in
Expand All @@ -238,7 +238,8 @@ class SourcePointClient: SourcePointProtocol {
"env": Constants.Urls.envParam,
"consentLanguage": consentLanguage.rawValue,
"propertyId": propertyId,
"messageId": messageId
"messageId": messageId,
"includeData": "{\"translateMessage\":true}"
])! // swiftlint:disable:this force_unwrapping
client.get(urlString: url.absoluteString, apiCode: .CCPA_MESSAGE) {
Self.parseResponse($0, InvalidResponseMessageCCPAEndpointError()) { (parsingResult: Result<MessageResponse, SPError>) in
Expand Down
155 changes: 14 additions & 141 deletions Example/NativePMExampleAppUITests/NativePMUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class NativePMUITests: QuickSpec {
expect(self.app.ccpaMessage.doNotSellMyInfoButton.staticTexts["OFF"]).toEventually(showUp())
}

it("Handles message translation") {
it("Handles message translation via 1st layer") {
self.app.relaunch(clean: true, language: .Spanish)

// Message content is translated
Expand All @@ -167,6 +167,19 @@ class NativePMUITests: QuickSpec {
// as well as categories
expect(self.app.gdprMessage.categoriesList.staticTexts["Crear perfiles para publicidad personalizada"].exists).toEventually(beTrue())
}

it("Handles message translation when loading PM via function") {
self.app.relaunch(clean: true, gdpr: true, ccpa: false, language: .Spanish)

self.waitFor(self.app.gdprMessage)
self.remote.press(.select)

self.app.gdprPrivacyManagerButton.remotePress()
self.waitFor(self.app.gdprMessage)

expect(self.app.gdprMessage.headerTitle).toEventually(containText("Mensage GDPR"))
expect(self.app.gdprMessage.categoriesList.staticTexts["Crear perfiles para publicidad personalizada"].exists).toEventually(beTrue())
}

it("Manage Preferences and Our Vendors through GDPR Privacy Manager with few consent purposes ON") {
self.app.relaunch(clean: true, gdpr: true, ccpa: false)
Expand Down Expand Up @@ -242,145 +255,5 @@ class NativePMUITests: QuickSpec {
self.remote.press(.right)
self.checkForAllVendors(on: self.app.gdprMessage, shouldBe: "On", totalVendors: self.gdprDefaultOnCategories)
}

// it("Save and Exit through CCPA & GDPR Privacy Manager") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// self.app.homeButton.expectToHaveFocus()
// self.app.saveAndExitInternalButton.remotePress()
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// self.app.homeButton.expectToHaveFocus()
// self.app.saveAndExitInternalButton.remotePress()
// }
//
// it("Privacy policy of CCPA & GDPR Privacy Manager") {
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.privacyPolicyButton.remotePress()
// self.app.pressHomeAndReturnToHomeViewWithFocusOnPrivacyPolicyButton()
// self.app.acceptButton.remotePress()
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.privacyPolicyButton.remotePress()
// self.app.pressHomeAndReturnToHomeViewWithFocusOnPrivacyPolicyButton()
// self.app.acceptButton.remotePress()
// }
//
// it("Manage Preferences through CCPA & GDPR Privacy Manager with few purposes ON") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.storeAndAccessInformation)
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.storeAndAccessInformation)
// self.app.pressSaveAndExitInCategory()
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.category)
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.category2)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Manage Preferences through CCPA & GDPR Privacy Manager with few purposes OFF") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.storeAndAccessInformation)
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.storeAndAccessInformation)
// self.app.pressSaveAndExitInCategory()
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.category)
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.category2)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Our Partners through CCPA & GDPR Privacy Manager with few purposes On") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.loopMe)
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.googleCharts)
// self.app.pressSaveAndExitInCategory()
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.freewheel)
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.seedtag)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Our Partners through CCPA & GDPR Privacy Manager with few purposes OFF") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.loopMe)
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.googleCharts)
// self.app.pressSaveAndExitInCategory()
// self.app.ccpaPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.pressCategory(element: self.app.freewheel)
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.seedtag)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Manage Preferences through GDPR Privacy Manager with few Legitimate interest purposes ON") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.switchToLegitInterests()
// self.app.pressCategory(element: self.app.createPersonalisedAdsProfile)
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.createPersonalisedAdsProfile)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Manage Preferences through GDPR Privacy Manager with few Legitimate interest purposes OFF") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.managePreferencesButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.switchToLegitInterests()
// self.app.pressCategory(element: self.app.createPersonalisedAdsProfile)
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.createPersonalisedAdsProfile)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Our Partners through GDPR Privacy Manager with few Legitimate interest purposes ON") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.switchToLegitInterests()
// self.app.pressCategory(element: self.app.loopMe)
// self.app.backButton.expectToHaveFocus()
// self.app.pressOnButtonInCategoryDetails(elementToEnsure: self.app.loopMe)
// self.app.pressSaveAndExitInCategory()
// }
//
// it("Our Partners through GDPR Privacy Manager with few Legitimate interest purposes Off") {
// self.app.gdprPrivacyManagerButton.remotePress()
// self.app.acceptButton.expectToHaveFocus()
// self.app.ourPartnersButton.remotePress()
// expect(self.app.homeButton).toEventually(showUp())
// self.app.switchToLegitInterests()
// self.app.pressCategory(element: self.app.loopMe)
// self.app.backButton.expectToHaveFocus()
// self.app.pressOffButtonInCategoryDetails(elementToEnsure: self.app.loopMe)
// self.app.pressSaveAndExitInCategory()
// }
}
}

0 comments on commit ff69444

Please sign in to comment.