Skip to content

Commit

Permalink
add some allure annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisLys committed Nov 23, 2024
1 parent c0f813a commit a23b506
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 38 deletions.
4 changes: 4 additions & 0 deletions SwiftRadio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
B0E8C5642CE9D2F20044D220 /* TestObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0E8C5632CE9D2F20044D220 /* TestObserver.swift */; };
B0E8C56B2CF1C9800044D220 /* Regression.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = B0E8C56A2CF1C66B0044D220 /* Regression.xctestplan */; };
B0E8C56C2CF1C9840044D220 /* Smoke.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = B0E8C5692CF1BCE30044D220 /* Smoke.xctestplan */; };
B0E8C56E2CF1E5940044D220 /* Severity.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0E8C56D2CF1E5900044D220 /* Severity.swift */; };
CAA8FDB52000614600050F77 /* RadioPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA8FDB42000614600050F77 /* RadioPlayer.swift */; };
CF72ACE721F7155200461EED /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CF72ACE621F714D000461EED /* Main.storyboard */; };
DAEBB1E525161E5B0065ECF0 /* MainPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEBB1E425161E5B0065ECF0 /* MainPage.swift */; };
Expand Down Expand Up @@ -172,6 +173,7 @@
B0E8C5632CE9D2F20044D220 /* TestObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestObserver.swift; sourceTree = "<group>"; };
B0E8C5692CF1BCE30044D220 /* Smoke.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Smoke.xctestplan; sourceTree = "<group>"; };
B0E8C56A2CF1C66B0044D220 /* Regression.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Regression.xctestplan; sourceTree = "<group>"; };
B0E8C56D2CF1E5900044D220 /* Severity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Severity.swift; sourceTree = "<group>"; };
CAA8FDB42000614600050F77 /* RadioPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioPlayer.swift; sourceTree = "<group>"; };
CF72ACE621F714D000461EED /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
DAEBB1E425161E5B0065ECF0 /* MainPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainPage.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -387,6 +389,7 @@
isa = PBXGroup;
children = (
B05F1B1D2CC795E7007D10D5 /* BundleId.swift */,
B0E8C56D2CF1E5900044D220 /* Severity.swift */,
);
path = Data;
sourceTree = "<group>";
Expand Down Expand Up @@ -609,6 +612,7 @@
DAEBB1E825161EE50065ECF0 /* CommonTest.swift in Sources */,
B05F1B292CC79F26007D10D5 /* SafariPage.swift in Sources */,
DAEBB1EE251622BF0065ECF0 /* StationInfoPage.swift in Sources */,
B0E8C56E2CF1E5940044D220 /* Severity.swift in Sources */,
DAEBB1EC251621B50065ECF0 /* StationDetailsPage.swift in Sources */,
B05F1B1E2CC795E7007D10D5 /* BundleId.swift in Sources */,
B05F1B242CC79908007D10D5 /* XCUIElement+Asserts.swift in Sources */,
Expand Down
Binary file not shown.
15 changes: 15 additions & 0 deletions SwiftRadioUITests/Data/Severity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Severity.swift
// SwiftRadio
//
// Created by Lysikov Boris on 23.11.2024.
// Copyright © 2024 matthewfecher.com. All rights reserved.
//

enum Severity: String {
case blocker
case critical
case normal
case minor
case trivial
}
66 changes: 64 additions & 2 deletions SwiftRadioUITests/Extensions/XCTest+Allure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,83 @@ import XCTest
public extension String {
static let allureName = "allure.name"
static let allureLabel = "allure.label."
static let allureLink = "allure.link."
static let allureDescription = "allure.description"
static let allureId = "AS_ID"
static let epic = "epic"
static let feature = "feature"
static let story = "story"
static let severity = "severity"
static let tag = "tag"
static let owner = "owner"
}

public extension XCTest {

// allureId - For TestOps
@discardableResult
func allureId(_ value: String) -> XCTest {
label(.allureId, value)
return self
}

@discardableResult
func epic(_ value: String) -> XCTest {
label(.epic, value)
return self
}

@discardableResult
func owner(_ value: String) -> XCTest {
label(.owner, value)
return self
}

@discardableResult
func feature(_ value: String) -> XCTest {
label(.feature, value)
return self
}

@discardableResult
func story(_ value: String) -> XCTest {
label(.story, value)
return self
}


@discardableResult
func label(_ name: String, _ value: String) -> XCTest {
XCTContext.runActivity(named: .allureLabel + name + ":" + value, block: { _ in })
internal func severity(_ value: Severity) -> XCTest {
label(.severity, value.rawValue)
return self
}

@discardableResult
func tags(_ values: [String]) -> XCTest {
values.forEach { value in
label(.tag, value)
}
return self
}

@discardableResult
func link(name: String, value: String) -> XCTest {
XCTContext.runActivity(named: .allureLink + name + ":" + value, block: { _ in })
return self

}

@discardableResult
func name(_ value: String) -> XCTest {
XCTContext.runActivity(named: .allureName + ":" + value, block: { _ in })
return self
}

@discardableResult
func description(_ value: String) -> XCTest {
XCTContext.runActivity(named: .allureDescription + ":" + value, block: { _ in })
return self
}

@discardableResult
func step(_ name: String, step: () -> Void) -> XCTest {
Expand All @@ -40,5 +96,11 @@ public extension XCTest {
}
return self
}

@discardableResult
private func label(_ name: String, _ value: String) -> XCTest {
XCTContext.runActivity(named: .allureLabel + name + ":" + value, block: { _ in })
return self
}
}

2 changes: 2 additions & 0 deletions SwiftRadioUITests/Page/RadioInfoPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import XCTest


/// Экран радио
struct RadioInfoPage: BaseScreen, Alert {
static let versionText = "Xcode 9 / Swift 4"
static let textViewText = "FEATURES:
+ Displays Artist, Track and Album/Station Art on lock screen.\n+ Background Audio performance\n+iTunes API integration to automatically download album art\n+ Loads and parses Icecast metadata (i.e. artist & track names)\n+ Ability to update stations from server without resubmitting to the app store.\n"
Expand Down
1 change: 0 additions & 1 deletion SwiftRadioUITests/Test Plans/Regression.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"maximumTestExecutionTimeAllowance" : 60,
"maximumTestRepetitions" : 2,
"repeatInNewRunnerProcess" : true,
"testRepetitionMode" : "retryOnFailure",
"testTimeoutsEnabled" : true
},
"testTargets" : [
Expand Down
30 changes: 20 additions & 10 deletions SwiftRadioUITests/Test Plans/Smoke.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,34 @@
"name" : "Configuration 1",
"options" : {

}
},
{
"id" : "A5510637-396F-460C-93CB-580AB41316C8",
"name" : "Configuration 2",
"options" : {

}
}
],
"defaultOptions" : {
"codeCoverage" : false,
"diagnosticCollectionPolicy" : "Never",
"mainThreadCheckerEnabled" : false,
"repeatInNewRunnerProcess" : true,
"targetForVariableExpansion" : {
"containerPath" : "container:SwiftRadio.xcodeproj",
"identifier" : "9409E1151ABF6FEA00312E2B",
"name" : "SwiftRadio"
},
"testTimeoutsEnabled" : true
},
"testTargets" : [
{
"skippedTests" : [
"AppInfoTest",
"AppInfoTest\/testOpenWebsiteFromAppInfo()",
"CommonTest",
"RadioInfoTest",
"RadioInfoTest\/testClosePage()",
"RadioInfoTest\/testOpemEmailMeIfWeDontHaveEmail()",
"RadioInfoTest\/testOpenWebLink()",
"StationInfoTest",
"StationInfoTest\/testOpenStationDetailsByTapOnNowPlayingButton()"
"selectedTests" : [
"SmokeTest\/testDisplayNowPlayingButton()",
"SmokeTest\/testDisplaySelectedStationInPlayButton()",
"SmokeTest\/testElementExistOnScreen()"
],
"target" : {
"containerPath" : "container:SwiftRadio.xcodeproj",
Expand Down
4 changes: 1 addition & 3 deletions SwiftRadioUITests/Tests/AppInfoTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

final class AppInfoTest: CommonTest {

/*
Проверка отображения элементов на экране и переход на корректную ссылку при нажатии на кнопку "Website"
*/
func testOpenWebsiteFromAppInfo() {
name("Проверка отображения элементов на экране и переход на корректную ссылку при нажатии на кнопку Website")
let openSourceText = "Open Source Project"
let authorsText = "Matt Fecher & Fethi El Hassasna"

Expand Down
1 change: 1 addition & 0 deletions SwiftRadioUITests/Tests/CommonTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CommonTest: XCTestCase {

continueAfterFailure = false
app.launch()
let _ = app.wait(for: .runningForeground, timeout: 5)
}

override func tearDown() {
Expand Down
23 changes: 13 additions & 10 deletions SwiftRadioUITests/Tests/RadioInfoTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@
// Copyright © 2020 matthewfecher.com. All rights reserved.
//
import Foundation
import XCTest

final class RadioInfoTest: CommonTest {

/*
Проверка отображения элементов на экране и переход на корректную ссылку при нажатии на кнопку "matthewfetcher.com"
*/
func testOpenWebLink() {
name("Открытие ссылки - matthewfetcher.com")
description("Проверка отображения элементов на экране и переход на корректную ссылку при нажатии на кнопку matthewfetcher.com")
severity(.blocker)
owner("b.lysikov")
epic("Экран инфор Радио")
feature("Ссылка на сайт")
story("Открытие ссылки")
tags(["tag1", "tag2"])
link(name: "Allure example", value: "https://allurereport.org/docs/gettingstarted-readability/#severity")

let versionText = "Xcode 9 / Swift 4"
let nameOfAppText = "Radio App"
let textViewText = "FEATURES:
+ Displays Artist, Track and Album/Station Art on lock screen.\n+ Background Audio performance\n+iTunes API integration to automatically download album art\n+ Loads and parses Icecast metadata (i.e. artist & track names)\n+ Ability to update stations from server without resubmitting to the app store.\n"

step("Открыть первую станцию") {
let _ = app.wait(for: .runningForeground, timeout: 5)
MainPage.getStation(index: 0).tapElement()
}
step("Открыть страницу компании") {
Expand Down Expand Up @@ -46,10 +53,8 @@ final class RadioInfoTest: CommonTest {
}
}

/*
Проверка отображения алерта при нажатии на кнопку email
*/
func testOpemEmailMeIfWeDontHaveEmail() {
name("Проверка отображения алерта при нажатии на кнопку email")
step("Открыть первую станцию") {
MainPage.getStation(index: 0).tapElement()
}
Expand All @@ -71,10 +76,8 @@ final class RadioInfoTest: CommonTest {
}
}

/*
Проверка корректного закрытия текущего экрана
*/
func testClosePage() {
name("Проверка корректного закрытия текущего экрана")
let nameOfStation = MainPage.getStationName(index: 0)

step("Открыть первую станцию") {
Expand Down
15 changes: 6 additions & 9 deletions SwiftRadioUITests/Tests/SmokeTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

final class SmokeTest: CommonTest {

/*
Проверка правильного отображения кнопки "Now Playing" в Navigation bar
*/
func testDisplayNowPlayingButton() {
name("Проверка правильного отображения кнопки Now Playing в Navigation bar")

step("Проверить что при старте приложения кнопка play не отображается") {
MainPage.playbutton.verifyElement(event: .disabled)
}
Expand All @@ -26,10 +25,9 @@ final class SmokeTest: CommonTest {
}
}

/*
Проверка отображения выбранной станции в кнопке Play
*/
func testDisplaySelectedStationInPlayButton() {
name("Проверка отображения выбранной станции в кнопке Play")

let nameOfStation = MainPage.getStationName(index: 0)

step("Проверить отображение текста в кнопке play") {
Expand All @@ -46,10 +44,9 @@ final class SmokeTest: CommonTest {
}
}

/*
Проверка отображения всех элементов в ячейке
*/
func testElementExistOnScreen() {
name("Проверка отображения всех элементов в ячейке")

step("Проверить отображение станции") {
MainPage.getStation(index: 0).verifyLabel(equal: "Absolute Country Hits")
}
Expand Down
5 changes: 2 additions & 3 deletions SwiftRadioUITests/Tests/StationInfoTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

final class StationInfoTest: CommonTest {

/*
Проверка отображение элементов на экране с информацией о станции, также корректную работу переходов по нажатию на кнопку назад(в Navigation bar) и ок на самом экране
*/
func testOpenStationDetailsByTapOnNowPlayingButton() {
name("Проверка отображение элементов на экране с информацией о станции, также корректную работу переходов по нажатию на кнопку назад(в Navigation bar) и ок на самом экране")
severity(.critical)
let stationName = MainPage.getStationName(index: 0)

step("Открыть первую станцию") {
Expand Down

0 comments on commit a23b506

Please sign in to comment.