Skip to content

Commit 13cfa24

Browse files
Automated testing infrastructure (#111)
1 parent 44f1d5e commit 13cfa24

File tree

153 files changed

+3576
-2111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3576
-2111
lines changed

.github/workflows/smoke-checks.yml

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ on:
44
push:
55
branches:
66
- main
7+
78
pull_request:
89
branches:
9-
- main
10+
- '**'
11+
1012
release:
1113
types:
1214
- created
1315

16+
workflow_dispatch:
17+
1418
concurrency:
1519
group: ${{ github.workflow }}-${{ github.ref }}
1620
cancel-in-progress: true
@@ -22,6 +26,7 @@ jobs:
2226
automated-code-review:
2327
name: Automated Code Review
2428
runs-on: macos-12
29+
if: ${{ github.event_name != 'push' }}
2530
steps:
2631
- uses: actions/checkout@v1
2732
- uses: ./.github/actions/bootstrap
@@ -52,6 +57,13 @@ jobs:
5257
xcode: "13.3.1"
5358
- name: Run Tests (Debug)
5459
run: bundle exec fastlane test_ui device:"iPhone 12 (15.4)"
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
GITHUB_EVENT: ${{ toJson(github.event) }}
63+
- uses: test-summary/action@v1
64+
with:
65+
paths: fastlane/test_output/report.junit
66+
if: failure()
5567
- name: Get branch name
5668
id: get_branch_name
5769
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
@@ -74,21 +86,70 @@ jobs:
7486
MATRIX_CONTEXT: ${{ toJson(matrix) }}
7587
if: ${{ github.event_name == 'push' && failure() }}
7688

89+
build-and-test-e2e-debug:
90+
name: Test E2E UI (Debug)
91+
runs-on: macos-12
92+
if: ${{ github.event_name != 'push' }}
93+
needs: allure_testops_launch
94+
env:
95+
LAUNCH_ID: ${{ needs.allure_testops_launch.outputs.launch_id }}
96+
strategy:
97+
matrix:
98+
batch: [0]
99+
fail-fast: false
100+
steps:
101+
- uses: actions/checkout@v2
102+
if: env.LAUNCH_ID != ''
103+
- uses: ./.github/actions/bootstrap
104+
if: env.LAUNCH_ID != ''
105+
env:
106+
INSTALL_ALLURE: true
107+
- name: Run UI Tests (Debug)
108+
if: env.LAUNCH_ID != ''
109+
run: bundle exec fastlane test_e2e_mock device:"iPhone 12 Pro" batch:'${{ matrix.batch }}'
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
GITHUB_EVENT: ${{ toJson(github.event) }}
113+
MATRIX_SIZE: ${{ strategy.job-total }}
114+
- name: Allure TestOps Upload
115+
if: env.LAUNCH_ID != '' && (success() || failure())
116+
run: bundle exec fastlane allure_upload launch_id:$LAUNCH_ID
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
120+
- name: Allure TestOps Launch Removal
121+
if: env.LAUNCH_ID != '' && cancelled()
122+
run: bundle exec fastlane allure_launch_removal launch_id:$LAUNCH_ID
123+
env:
124+
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
125+
126+
allure_testops_launch:
127+
name: Launch Allure TestOps
128+
runs-on: macos-12
129+
if: ${{ github.event_name != 'push' }}
130+
outputs:
131+
launch_id: ${{ steps.get_launch_id.outputs.launch_id }}
132+
steps:
133+
- uses: actions/checkout@v2
134+
- uses: ./.github/actions/bootstrap
135+
env:
136+
XCODE_ACTIONS: false
137+
- name: Launch Allure TestOps
138+
run: bundle exec fastlane allure_launch
139+
env:
140+
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
GITHUB_EVENT: ${{ toJson(github.event) }}
143+
- id: get_launch_id
144+
run: echo "::set-output name=launch_id::${{env.LAUNCH_ID}}"
145+
if: env.LAUNCH_ID != ''
146+
77147
build-apps:
78148
name: Build Demo App
79149
runs-on: macos-12
150+
if: ${{ github.event_name != 'push' }}
80151
steps:
81152
- uses: actions/checkout@v1
82153
- uses: ./.github/actions/bootstrap
83154
- name: Build Demo App
84155
run: bundle exec fastlane build_demo
85-
- uses: 8398a7/action-slack@v3
86-
with:
87-
status: ${{ job.status }}
88-
text: "You shall not pass!"
89-
job_name: "Build Demo App"
90-
fields: message,commit,author,action,workflow,job,took
91-
env:
92-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
93-
MATRIX_CONTEXT: ${{ toJson(matrix) }}
94-
if: ${{ github.event_name == 'push' && failure() }}

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ gem "danger-commit_lint"
1111
gem "jazzy"
1212
gem "xcode-install"
1313
gem "json"
14+
gem 'plist'
1415
gem "fastlane-plugin-lizard"
1516
gem "slather"
17+
gem 'xctest_list'
1618

1719
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
1820
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ GEM
358358
rouge (~> 2.0.7)
359359
xcpretty-travis-formatter (1.0.1)
360360
xcpretty (~> 0.2, >= 0.0.7)
361+
xctest_list (1.2.1)
361362
zeitwerk (2.5.4)
362363

363364
PLATFORMS
@@ -375,8 +376,10 @@ DEPENDENCIES
375376
fastlane-plugin-versioning
376377
jazzy
377378
json
379+
plist
378380
slather
379381
xcode-install
382+
xctest_list
380383

381384
BUNDLED WITH
382385
2.3.13

Scripts/bootstrap.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,15 @@ if [[ ${INSTALL_SONAR-default} == true ]]; then
5151
pip install lizard
5252
brew install sonar-scanner
5353
fi
54+
55+
if [[ ${INSTALL_ALLURE-default} == true ]]; then
56+
puts "Install allurectl"
57+
DOWNLOAD_URL="https://github.com/allure-framework/allurectl/releases/download/1.22.1/allurectl_darwin_amd64"
58+
curl -sL "${DOWNLOAD_URL}" -o ./fastlane/allurectl
59+
chmod +x ./fastlane/allurectl
60+
61+
puts "Install xcresults"
62+
DOWNLOAD_URL="https://github.com/eroshenkoam/xcresults/releases/download/1.10.1/xcresults"
63+
curl -sL "${DOWNLOAD_URL}" -o ./fastlane/xcresults
64+
chmod +x ./fastlane/xcresults
65+
fi

Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public struct DefaultChatChannelHeader: ToolbarContent {
4848
channel: channel,
4949
shouldShowTypingIndicator: shouldShowTypingIndicator
5050
)
51+
.accessibilityIdentifier("ChannelTitleView")
52+
.accessibilityElement(children: .contain)
5153
}
5254

5355
ToolbarItem(placement: .navigationBarTrailing) {
@@ -69,6 +71,7 @@ public struct DefaultChatChannelHeader: ToolbarContent {
6971
.offset(x: 8)
7072
.allowsHitTesting(false)
7173
}
74+
.accessibilityIdentifier("ChannelAvatarView")
7275
}
7376
}
7477
}
@@ -111,6 +114,8 @@ struct ChannelTitleView: View {
111114
VStack(spacing: 2) {
112115
Text(channelNamer(channel, currentUserId) ?? "")
113116
.font(fonts.bodyBold)
117+
.accessibilityIdentifier("chatName")
118+
114119
if shouldShowTypingIndicator {
115120
HStack {
116121
TypingIndicatorView()
@@ -120,6 +125,7 @@ struct ChannelTitleView: View {
120125
Text(channel.onlineInfoText(currentUserId: currentUserId))
121126
.font(fonts.footnote)
122127
.foregroundColor(Color(colors.textLowEmphasis))
128+
.accessibilityIdentifier("chatOnlineInfo")
123129
}
124130
}
125131
}

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
153153
)
154154
.padding(.bottom, keyboardShown || !tabBarAvailable || generatingSnapshot ? 0 : bottomPadding)
155155
.ignoresSafeArea(.container, edges: tabBarAvailable ? .bottom : [])
156+
.accessibilityIdentifier("ChatChannelView")
156157
}
157158

158159
private var generatingSnapshot: Bool {

Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public struct AttachmentPickerTypeView: View {
5555
pickerType: .media,
5656
selected: attachmentPickerType
5757
)
58+
.accessibilityIdentifier("PickerTypeButtonMedia")
5859
}
5960

6061
if commandsAvailable {
@@ -63,6 +64,7 @@ public struct AttachmentPickerTypeView: View {
6364
pickerType: .instantCommands,
6465
selected: attachmentPickerType
6566
)
67+
.accessibilityIdentifier("PickerTypeButtonCommands")
6668
}
6769
case .collapsed:
6870
Button {
@@ -74,8 +76,10 @@ public struct AttachmentPickerTypeView: View {
7476
.renderingMode(.template)
7577
.foregroundColor(Color(colors.highlightedAccentBackground))
7678
}
79+
.accessibilityIdentifier("PickerTypeButtonCollapsed")
7780
}
7881
}
82+
.accessibilityElement(children: .contain)
7983
}
8084
}
8185

Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public struct AttachmentPickerView<Factory: ViewFactory>: View {
7777
askForAssetsAccessPermissions()
7878
}
7979
}
80+
.accessibilityElement(children: .contain)
81+
.accessibilityIdentifier("AttachmentPickerView")
8082
}
8183
}
8284

@@ -97,26 +99,31 @@ struct AttachmentSourcePickerView: View {
9799
isSelected: selected == .photos,
98100
onTap: onTap
99101
)
102+
.accessibilityIdentifier("attachmentPickerPhotos")
100103

101104
AttachmentPickerButton(
102105
icon: images.attachmentPickerFolder,
103106
pickerType: .files,
104107
isSelected: selected == .files,
105108
onTap: onTap
106109
)
110+
.accessibilityIdentifier("attachmentPickerFiles")
107111

108112
AttachmentPickerButton(
109113
icon: images.attachmentPickerCamera,
110114
pickerType: .camera,
111115
isSelected: selected == .camera,
112116
onTap: onTap
113117
)
118+
.accessibilityIdentifier("attachmentPickerCamera")
114119

115120
Spacer()
116121
}
117122
.padding(.horizontal, 16)
118123
.frame(height: 56)
119124
.background(Color(colors.background1))
125+
.accessibilityElement(children: .contain)
126+
.accessibilityIdentifier("AttachmentSourcePickerView")
120127
}
121128
}
122129

Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerHelperViews.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public struct AttachmentTypeContainer<Content: View>: View {
5858
}
5959
.background(Color(colors.background1))
6060
.cornerRadius(16)
61+
.accessibilityIdentifier("AttachmentTypeContainer")
6162
}
6263
}
6364

@@ -128,6 +129,7 @@ struct AssetsAccessPermissionView: View {
128129
Spacer()
129130
}
130131
.padding(.all, 8)
132+
.accessibilityIdentifier("AssetsAccessPermissionView")
131133
}
132134

133135
func openAppPrivacySettings() {
@@ -168,11 +170,13 @@ struct QuotedMessageHeaderView: View {
168170
}
169171
}
170172
.frame(height: 32)
173+
.accessibilityIdentifier("QuotedMessageHeaderView")
171174
.onAppear() {
172175
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
173176
showContent = true
174177
}
175178
}
179+
.accessibilityIdentifier("QuotedMessageHeaderView")
176180
}
177181
}
178182

@@ -200,5 +204,6 @@ struct EditMessageHeaderView: View {
200204
}
201205
}
202206
.frame(height: 32)
207+
.accessibilityIdentifier("EditMessageHeaderView")
203208
}
204209
}

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
179179
editedMessageWillShow = true
180180
}
181181
}
182+
.accessibilityElement(children: .contain)
182183
}
183184
}
184185

@@ -282,6 +283,8 @@ public struct ComposerInputView<Factory: ViewFactory>: View {
282283
maxMessageLength: maxMessageLength,
283284
currentHeight: textFieldHeight
284285
)
286+
.accessibilityIdentifier("ComposerTextInputView")
287+
.accessibilityElement(children: .contain)
285288
.frame(height: textFieldHeight)
286289
.overlay(
287290
command?.displayInfo?.isInstant == true ?
@@ -310,6 +313,7 @@ public struct ComposerInputView<Factory: ViewFactory>: View {
310313
.clipShape(
311314
RoundedRectangle(cornerRadius: 20)
312315
)
316+
.accessibilityIdentifier("ComposerInputView")
313317
}
314318

315319
private var composerInputBackground: Color {

0 commit comments

Comments
 (0)