Skip to content

Commit 8fe5d5d

Browse files
illuminati1911jokerttu
authored andcommitted
test: fix tests
1 parent 107b511 commit 8fe5d5d

File tree

4 files changed

+43
-19
lines changed

4 files changed

+43
-19
lines changed

example/e2e/navigation.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import {
1818
initializeIntegrationTestsPage,
1919
agreeToTermsAndConditions,
20-
waitForStepNumber,
2120
selectTestByName,
2221
waitForTestToFinish,
2322
} from './shared.js';
@@ -30,7 +29,6 @@ describe('Navigation tests', () => {
3029

3130
it('T01 - initialize navigation controller and test terms and conditions (TOS) dialog acceptance', async () => {
3231
await selectTestByName('testNavigationSessionInitialization');
33-
await waitForStepNumber(1);
3432
await agreeToTermsAndConditions();
3533
await waitForTestToFinish();
3634
await expect(element(by.id('test_result_label'))).toHaveText(

example/e2e/shared.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export const initializeNavigationPage = async () => {
3535

3636
export const agreeToTermsAndConditions = async () => {
3737
if (device.getPlatform() === 'ios') {
38-
await waitFor(element(by.text("YES, I'M IN")))
38+
await waitFor(element(by.text('OK')))
3939
.toBeVisible()
4040
.withTimeout(10000);
41-
await element(by.text("YES, I'M IN")).tap();
41+
await element(by.text('OK')).tap();
4242
} else if (device.getPlatform() === 'android') {
4343
await waitFor(element(by.text('GOT IT')))
4444
.toBeVisible()

example/src/screens/IntegrationTestsScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const IntegrationTestsScreen = () => {
156156
};
157157

158158
const runTest = async (testId: string) => {
159+
setIsOverlayOpen(false);
159160
setActiveTestId(testId);
160161
setTestResult(TestResult.None);
161162
setTestStatus(TestRunStatus.TestRunning);

example/src/screens/integration_tests/integration_test.ts

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
NavigationController,
2121
NavigationInitErrorCode,
2222
} from '@googlemaps/react-native-navigation-sdk';
23+
import { Platform } from 'react-native';
2324

2425
interface TestTools {
2526
navigationController: NavigationController;
@@ -76,21 +77,41 @@ const expectFalseMessage = (expectation: string) => {
7677
};
7778

7879
export const testMapInitialization = async (testTools: TestTools) => {
79-
const { mapViewController, passTest, failTest, expectFalseError } = testTools;
80+
const {
81+
mapViewController,
82+
passTest,
83+
failTest,
84+
expectFalseError,
85+
expectTrueError,
86+
} = testTools;
8087
if (!mapViewController) {
8188
return failTest('mapViewController was expected to exist');
8289
}
83-
if ((await mapViewController.getUiSettings()).isCompassEnabled) {
84-
return expectFalseError(
85-
'mapViewController.getUiSettings()).isCompassEnabled'
86-
);
90+
if (Platform.OS === 'ios') {
91+
if ((await mapViewController.getUiSettings()).isCompassEnabled) {
92+
return expectFalseError(
93+
'mapViewController.getUiSettings()).isCompassEnabled'
94+
);
95+
}
96+
} else {
97+
if (!(await mapViewController.getUiSettings()).isCompassEnabled) {
98+
return expectTrueError(
99+
'mapViewController.getUiSettings()).isCompassEnabled'
100+
);
101+
}
87102
}
88-
if ((await mapViewController.getUiSettings()).isMapToolbarEnabled) {
89-
return failTest(
90-
expectFalseMessage(
103+
if (Platform.OS === 'ios') {
104+
if ((await mapViewController.getUiSettings()).isMapToolbarEnabled) {
105+
return expectFalseError(
91106
'mapViewController.getUiSettings()).isMapToolbarEnabled'
92-
)
93-
);
107+
);
108+
}
109+
} else {
110+
if (!(await mapViewController.getUiSettings()).isMapToolbarEnabled) {
111+
return expectTrueError(
112+
'mapViewController.getUiSettings()).isMapToolbarEnabled'
113+
);
114+
}
94115
}
95116
if (!(await mapViewController.getUiSettings()).isIndoorLevelPickerEnabled) {
96117
return failTest(
@@ -99,11 +120,6 @@ export const testMapInitialization = async (testTools: TestTools) => {
99120
)
100121
);
101122
}
102-
if ((await mapViewController.getUiSettings()).isMapToolbarEnabled) {
103-
return expectFalseError(
104-
'mapViewController.getUiSettings()).isMapToolbarEnabled'
105-
);
106-
}
107123
if (!(await mapViewController.getUiSettings()).isRotateGesturesEnabled) {
108124
return expectFalseError(
109125
'mapViewController.getUiSettings()).isRotateGesturesEnabled'
@@ -137,6 +153,15 @@ export const testMapInitialization = async (testTools: TestTools) => {
137153
'mapViewController.getUiSettings()).isZoomGesturesEnabled'
138154
);
139155
}
156+
if (Platform.OS === 'ios') {
157+
if (!(await mapViewController.isMyLocationEnabled())) {
158+
return expectFalseError('await mapViewController.isMyLocationEnabled()');
159+
}
160+
} else {
161+
if (await mapViewController.isMyLocationEnabled()) {
162+
return expectTrueError('await mapViewController.isMyLocationEnabled()');
163+
}
164+
}
140165

141166
passTest();
142167
};

0 commit comments

Comments
 (0)