Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
126370fb
Unverified
Commit
126370fb
authored
Sep 24, 2021
by
Chris Yang
Committed by
GitHub
Sep 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[module_test_ios] trying tap the buttons again if the first time didn't work (#90535)
parent
2d909fcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
17 deletions
+30
-17
FlutterUITests.m
...ration_tests/ios_host_app/FlutterUITests/FlutterUITests.m
+30
-17
No files found.
dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m
View file @
126370fb
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
@import
XCTest
;
@import
XCTest
;
static
const
CGFloat
kStandardTimeOut
=
60
.
0
;
@interface
FlutterUITests
:
XCTestCase
@interface
FlutterUITests
:
XCTestCase
@property
(
strong
)
XCUIApplication
*
app
;
@property
(
strong
)
XCUIApplication
*
app
;
@end
@end
...
@@ -22,42 +24,56 @@
...
@@ -22,42 +24,56 @@
-
(
void
)
testFullScreenColdPop
{
-
(
void
)
testFullScreenColdPop
{
XCUIApplication
*
app
=
self
.
app
;
XCUIApplication
*
app
=
self
.
app
;
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Cold)"
]];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Cold)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
// Back navigation.
// Back navigation.
[
app
.
buttons
[
@"POP"
]
tap
];
[
app
.
buttons
[
@"POP"
]
tap
];
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
}
}
-
(
void
)
testFullScreenWarm
{
-
(
void
)
testFullScreenWarm
{
XCUIApplication
*
app
=
self
.
app
;
XCUIApplication
*
app
=
self
.
app
;
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Warm)"
]];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Warm)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
BOOL
newPageAppeared
=
[
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
];
if
(
!
newPageAppeared
)
{
// Sometimes, the element doesn't respond to the tap, it seems an XCUITest race condition where the tap happened
// too soon. Trying to tap the element again.
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Warm))"
]];
newPageAppeared
=
[
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
];
}
XCTAssertTrue
(
newPageAppeared
);
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
// Back navigation.
// Back navigation.
[
app
.
buttons
[
@"POP"
]
tap
];
[
app
.
buttons
[
@"POP"
]
tap
];
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
}
}
-
(
void
)
testFlutterViewWarm
{
-
(
void
)
testFlutterViewWarm
{
XCUIApplication
*
app
=
self
.
app
;
XCUIApplication
*
app
=
self
.
app
;
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Flutter View (Warm)"
]];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Flutter View (Warm)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
BOOL
newPageAppeared
=
[
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
];
if
(
!
newPageAppeared
)
{
// Sometimes, the element doesn't respond to the tap, it seems an XCUITest race condition where the tap happened
// too soon. Trying to tap the element again.
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Flutter View (Warm)"
]];
newPageAppeared
=
[
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
];
}
XCTAssertTrue
(
newPageAppeared
);
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 1 time."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
// Back navigation.
// Back navigation.
[
app
.
buttons
[
@"POP"
]
tap
];
[
app
.
buttons
[
@"POP"
]
tap
];
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
}
}
-
(
void
)
testHybridViewWarm
{
-
(
void
)
testHybridViewWarm
{
...
@@ -65,20 +81,20 @@
...
@@ -65,20 +81,20 @@
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Hybrid View (Warm)"
]];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Hybrid View (Warm)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 0 times."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
[
self
waitForAndTapElement
:
app
.
otherElements
[
@"Increment via Flutter"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 1 time."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 1 time."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
[
app
.
buttons
[
@"Increment via iOS"
]
tap
];
[
app
.
buttons
[
@"Increment via iOS"
]
tap
];
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 1 time."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 1 time."
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 1 time."
].
exists
);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 1 time."
].
exists
);
// Back navigation.
// Back navigation.
[
app
.
navigationBars
[
@"Hybrid Flutter/Native"
].
buttons
[
@"Flutter iOS Demos Home"
]
tap
];
[
app
.
navigationBars
[
@"Hybrid Flutter/Native"
].
buttons
[
@"Flutter iOS Demos Home"
]
tap
];
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
}
}
-
(
void
)
testDualCold
{
-
(
void
)
testDualCold
{
...
@@ -93,16 +109,13 @@
...
@@ -93,16 +109,13 @@
// Back navigation.
// Back navigation.
[
app
.
navigationBars
[
@"Dual Flutter Views"
].
buttons
[
@"Flutter iOS Demos Home"
]
tap
];
[
app
.
navigationBars
[
@"Dual Flutter Views"
].
buttons
[
@"Flutter iOS Demos Home"
]
tap
];
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
kStandardTimeOut
]);
}
}
-
(
void
)
waitForAndTapElement
:
(
XCUIElement
*
)
element
{
-
(
void
)
waitForAndTapElement
:
(
XCUIElement
*
)
element
{
NSPredicate
*
hittable
=
[
NSPredicate
predicateWithFormat
:
@"exists == YES AND hittable == YES"
];
NSPredicate
*
hittable
=
[
NSPredicate
predicateWithFormat
:
@"exists == YES AND hittable == YES"
];
[
self
expectationForPredicate
:
hittable
evaluatedWithObject
:
element
handler
:
nil
];
[
self
expectationForPredicate
:
hittable
evaluatedWithObject
:
element
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
30
.
0
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
30
.
0
handler
:
nil
];
// Sometimes, the element doesn't respond to the tap, it seems an XCUITest bug. Trying tap
// the app first to fix it.
[
self
.
app
tap
];
[
element
tap
];
[
element
tap
];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment