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
972bdf80
Unverified
Commit
972bdf80
authored
Aug 06, 2021
by
Jenn Magder
Committed by
GitHub
Aug 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for module UI test buttons to be hittable before tapping them (#87607)
parent
6dfa53b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
30 deletions
+29
-30
FlutterUITests.m
...ration_tests/ios_host_app/FlutterUITests/FlutterUITests.m
+29
-30
No files found.
dev/integration_tests/ios_host_app/FlutterUITests/FlutterUITests.m
View file @
972bdf80
...
@@ -5,24 +5,26 @@
...
@@ -5,24 +5,26 @@
@import
XCTest
;
@import
XCTest
;
@interface
FlutterUITests
:
XCTestCase
@interface
FlutterUITests
:
XCTestCase
@property
(
strong
)
XCUIApplication
*
app
;
@end
@end
@implementation
FlutterUITests
@implementation
FlutterUITests
-
(
void
)
setUp
{
-
(
void
)
setUp
{
[
super
setUp
];
self
.
continueAfterFailure
=
NO
;
self
.
continueAfterFailure
=
NO
;
}
-
(
void
)
testFullScreenColdPop
{
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
[
app
launch
];
[
app
launch
];
self
.
app
=
app
;
}
XCUIElement
*
coldButton
=
app
.
buttons
[
@"Full Screen (Cold)"
];
-
(
void
)
testFullScreenColdPop
{
XCTAssertTrue
([
coldButton
waitForExistenceWithTimeout
:
60
.
0
]);
XCUIApplication
*
app
=
self
.
app
;
[
coldButton
tap
];
[
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
:
60
.
0
]);
[
app
.
otherElements
[
@"Increment via Flutter"
]
tap
];
[
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
:
60
.
0
]);
// Back navigation.
// Back navigation.
...
@@ -31,15 +33,12 @@
...
@@ -31,15 +33,12 @@
}
}
-
(
void
)
testFullScreenWarm
{
-
(
void
)
testFullScreenWarm
{
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
XCUIApplication
*
app
=
self
.
app
;
[
app
launch
];
XCUIElement
*
warmButton
=
app
.
buttons
[
@"Full Screen (Warm)"
];
XCTAssertTrue
([
warmButton
waitForExistenceWithTimeout
:
60
.
0
]);
[
warmButton
tap
];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Full Screen (Warm)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
[
app
.
otherElements
[
@"Increment via Flutter"
]
tap
];
[
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
:
60
.
0
]);
// Back navigation.
// Back navigation.
...
@@ -48,15 +47,12 @@
...
@@ -48,15 +47,12 @@
}
}
-
(
void
)
testFlutterViewWarm
{
-
(
void
)
testFlutterViewWarm
{
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
XCUIApplication
*
app
=
self
.
app
;
[
app
launch
];
XCUIElement
*
warmButton
=
app
.
buttons
[
@"Flutter View (Warm)"
];
XCTAssertTrue
([
warmButton
waitForExistenceWithTimeout
:
60
.
0
]);
[
warmButton
tap
];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Flutter View (Warm)"
]];
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
[
app
.
otherElements
[
@"Increment via Flutter"
]
tap
];
[
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
:
60
.
0
]);
// Back navigation.
// Back navigation.
...
@@ -65,17 +61,14 @@
...
@@ -65,17 +61,14 @@
}
}
-
(
void
)
testHybridViewWarm
{
-
(
void
)
testHybridViewWarm
{
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
XCUIApplication
*
app
=
self
.
app
;
[
app
launch
];
XCUIElement
*
warmButton
=
app
.
buttons
[
@"Hybrid View (Warm)"
];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Hybrid View (Warm)"
]];
XCTAssertTrue
([
warmButton
waitForExistenceWithTimeout
:
60
.
0
]);
[
warmButton
tap
];
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
staticTexts
[
@"Flutter button tapped 0 times."
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
[
app
.
otherElements
[
@"Increment via Flutter"
]
tap
];
[
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
:
60
.
0
]);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
XCTAssertTrue
(
app
.
staticTexts
[
@"Platform button tapped 0 times."
].
exists
);
...
@@ -89,10 +82,9 @@
...
@@ -89,10 +82,9 @@
}
}
-
(
void
)
testDualCold
{
-
(
void
)
testDualCold
{
XCUIApplication
*
app
=
[[
XCUIApplication
alloc
]
init
];
XCUIApplication
*
app
=
self
.
app
;
[
app
launch
];
[
app
.
buttons
[
@"Dual Flutter View (Cold)"
]
tap
];
[
self
waitForAndTapElement
:
app
.
buttons
[
@"Dual Flutter View (Cold)"
]
];
// There are two marquees.
// There are two marquees.
XCUIElementQuery
*
marqueeQuery
=
[
app
.
staticTexts
matchingIdentifier
:
@"This is Marquee"
];
XCUIElementQuery
*
marqueeQuery
=
[
app
.
staticTexts
matchingIdentifier
:
@"This is Marquee"
];
...
@@ -104,4 +96,11 @@
...
@@ -104,4 +96,11 @@
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
XCTAssertTrue
([
app
.
navigationBars
[
@"Flutter iOS Demos Home"
]
waitForExistenceWithTimeout
:
60
.
0
]);
}
}
-
(
void
)
waitForAndTapElement
:
(
XCUIElement
*
)
element
{
NSPredicate
*
hittable
=
[
NSPredicate
predicateWithFormat
:
@"exists == YES AND hittable == YES"
];
[
self
expectationForPredicate
:
hittable
evaluatedWithObject
:
element
handler
:
nil
];
[
self
waitForExpectationsWithTimeout
:
30
.
0
handler
:
nil
];
[
element
tap
];
}
@end
@end
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