Skip to content

Commit 2f51efb

Browse files
chore: Minor fixes in test app (#138)
1 parent 9a5a0d0 commit 2f51efb

File tree

12 files changed

+56
-93
lines changed

12 files changed

+56
-93
lines changed

plugin/e2e-tests/src/pages/Drawing/Circles.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const CircleMapPage: React.FC = () => {
2222
setCommandOutput('');
2323
setMap(null);
2424
try {
25-
const mapRef = document.getElementById('map')!;
25+
const mapRef = document.getElementById('map_circles')!;
2626

2727
const newMap = await GoogleMap.create({
2828
element: mapRef,
29-
id: 'test-map',
29+
id: 'test-map-circles',
3030
apiKey: apiKey!,
3131
config: {
3232
center: { lat: 37.09, lng: -95.712 },
@@ -174,13 +174,13 @@ const CircleMapPage: React.FC = () => {
174174
></IonTextarea>
175175
</div>
176176
<capacitor-google-map
177-
id="map"
177+
id="map_circles"
178178
style={{
179179
position: 'absolute',
180180
bottom: 0,
181181
left: 0,
182182
width: window.outerWidth,
183-
height: 500,
183+
height: window.outerWidth * 2 / 3,
184184
}}
185185
></capacitor-google-map>
186186
</BaseTestingPage>

plugin/e2e-tests/src/pages/Drawing/Polygons.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const PolygonMapPage: React.FC = () => {
2222
setCommandOutput('');
2323
setMap(null);
2424
try {
25-
const mapRef = document.getElementById('map')!;
25+
const mapRef = document.getElementById('map_polygons')!;
2626

2727
const newMap = await GoogleMap.create({
2828
element: mapRef,
29-
id: 'test-map',
29+
id: 'test-map-polygons',
3030
apiKey: apiKey!,
3131
config: {
3232
center: {
@@ -199,13 +199,13 @@ const PolygonMapPage: React.FC = () => {
199199
></IonTextarea>
200200
</div>
201201
<capacitor-google-map
202-
id="map"
202+
id="map_polygons"
203203
style={{
204204
position: 'absolute',
205205
bottom: 0,
206206
left: 0,
207207
width: window.outerWidth,
208-
height: 500,
208+
height: window.outerWidth * 2 / 3,
209209
}}
210210
></capacitor-google-map>
211211
</BaseTestingPage>

plugin/e2e-tests/src/pages/Drawing/Polylines.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const PolylineMapPage: React.FC = () => {
2222
setCommandOutput('');
2323
setMap(null);
2424
try {
25-
const mapRef = document.getElementById('map')!;
25+
const mapRef = document.getElementById('map_polylines')!;
2626

2727
const newMap = await GoogleMap.create({
2828
element: mapRef,
29-
id: 'test-map',
29+
id: 'test-map-polylines',
3030
apiKey: apiKey!,
3131
config: {
3232
center: {
@@ -156,13 +156,13 @@ const PolylineMapPage: React.FC = () => {
156156
></IonTextarea>
157157
</div>
158158
<capacitor-google-map
159-
id="map"
159+
id="map_polylines"
160160
style={{
161161
position: 'absolute',
162162
bottom: 0,
163163
left: 0,
164164
width: window.outerWidth,
165-
height: 500,
165+
height: window.outerWidth * 2 / 3,
166166
}}
167167
></capacitor-google-map>
168168
</BaseTestingPage>

plugin/e2e-tests/src/pages/Map/Bounds.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const BoundsMapPage: React.FC = () => {
2222
setCommandOutput('');
2323
setMap(null);
2424
try {
25-
const mapRef = document.getElementById('map')!;
25+
const mapRef = document.getElementById('map_bounds')!;
2626

2727
const newMap = await GoogleMap.create({
2828
element: mapRef,
29-
id: 'test-map',
29+
id: 'test-map-bounds',
3030
apiKey: apiKey!,
3131
config: {
3232
center: {
@@ -122,16 +122,16 @@ const BoundsMapPage: React.FC = () => {
122122
return (
123123
<BaseTestingPage pageTitle="Bounds">
124124
<div>
125-
<IonButton expand="block" id="createMapButton" onClick={createMap}>
125+
<IonButton id="createMapButton" onClick={createMap}>
126126
Create Map
127127
</IonButton>
128-
<IonButton expand="block" id="destroyMapButton" onClick={destroyMap}>
128+
<IonButton id="destroyMapButton" onClick={destroyMap}>
129129
Destroy Map
130130
</IonButton>
131-
<IonButton expand="block" id="getBoundsButton" onClick={getBounds}>
131+
<IonButton id="getBoundsButton" onClick={getBounds}>
132132
Get Bounds
133133
</IonButton>
134-
<IonButton expand="block" id="fitBoundsButton" onClick={fitBounds}>
134+
<IonButton id="fitBoundsButton" onClick={fitBounds}>
135135
Fit Bounds
136136
</IonButton>
137137
<IonRow>
@@ -179,13 +179,13 @@ const BoundsMapPage: React.FC = () => {
179179
></IonTextarea>
180180
</div>
181181
<capacitor-google-map
182-
id="map"
182+
id="map_bounds"
183183
style={{
184184
position: 'absolute',
185185
top: window.innerHeight - window.outerWidth / 2,
186186
left: 0,
187187
width: window.outerWidth,
188-
height: window.outerWidth,
188+
height: window.outerWidth / 2,
189189
}}
190190
></capacitor-google-map>
191191
</BaseTestingPage>

plugin/e2e-tests/src/pages/Map/ConfigMap.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const ConfigMapPage: React.FC = () => {
1919

2020
const newMap1 = await GoogleMap.create({
2121
element: mapRef1,
22-
id: "test-map",
22+
id: "test-map-config1",
2323
apiKey: apiKey!,
2424
config: {
2525
center: {
@@ -32,7 +32,7 @@ const ConfigMapPage: React.FC = () => {
3232

3333
const newMap2 = await GoogleMap.create({
3434
element: mapRef2,
35-
id: "test-map2",
35+
id: "test-map-config2",
3636
apiKey: apiKey!,
3737
config: {
3838
center: {
@@ -227,10 +227,10 @@ const ConfigMapPage: React.FC = () => {
227227
return (
228228
<BaseTestingPage pageTitle="Map Configuration">
229229
<div>
230-
<IonButton expand="block" id="createMapButton" onClick={createMaps}>
230+
<IonButton id="createMapButton" onClick={createMaps}>
231231
Create Maps
232232
</IonButton>
233-
<IonButton expand="block" id="destroyMapButton" onClick={destroyMaps}>
233+
<IonButton id="destroyMapButton" onClick={destroyMaps}>
234234
Destroy Maps
235235
</IonButton>
236236
<IonButton id="moveCameraButton" onClick={moveCameras}>Move Camera</IonButton>

plugin/e2e-tests/src/pages/Map/CreateAndDestroyMap.tsx

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ const CreateAndDestroyMapPage: React.FC = () => {
2828
setCommandOutput('');
2929
setMaps([]);
3030
try {
31-
const mapRef1 = document.getElementById('map1')!;
32-
const mapRef2 = document.getElementById('map2')!;
31+
const mapRef1 = document.getElementById('map1_create_destroy')!;
32+
const mapRef2 = document.getElementById('map2_create_destroy')!;
3333

3434
const newMap1 = await GoogleMap.create(
3535
{
3636
element: mapRef1,
37-
id: 'test-map',
37+
id: 'test-map-create-destroy1',
3838
apiKey: apiKey!,
3939
config: {
4040
center: {
@@ -51,7 +51,7 @@ const CreateAndDestroyMapPage: React.FC = () => {
5151
const newMap2 = await GoogleMap.create(
5252
{
5353
element: mapRef2,
54-
id: 'test-map2',
54+
id: 'test-map-create-destroy2',
5555
apiKey: apiKey!,
5656
config: {
5757
center: {
@@ -86,20 +86,6 @@ const CreateAndDestroyMapPage: React.FC = () => {
8686
}
8787
}
8888

89-
async function setOnMapBoundsChangedListeners() {
90-
setCommandOutput('');
91-
try {
92-
if (maps) {
93-
for (let map of maps) {
94-
map.setOnBoundsChangedListener(onMapBoundsChanged);
95-
}
96-
setCommandOutput('Map Bounds Changed Listeners Set');
97-
}
98-
} catch (err: any) {
99-
setCommandOutput(err.message);
100-
}
101-
}
102-
10389
async function removeOnMapClickListeners() {
10490
setCommandOutput('');
10591
try {
@@ -158,16 +144,6 @@ const CreateAndDestroyMapPage: React.FC = () => {
158144
}
159145
}
160146

161-
async function getBounds() {
162-
setCommandOutput('');
163-
try {
164-
const bounds = await maps[0].getMapBounds();
165-
setCommandOutput(JSON.stringify(bounds));
166-
} catch (err: any) {
167-
setCommandOutput(err.message);
168-
}
169-
}
170-
171147
return (
172148
<BaseTestingPage pageTitle="Create and Destroy Map">
173149
<div>
@@ -181,16 +157,6 @@ const CreateAndDestroyMapPage: React.FC = () => {
181157
>
182158
Set On Map Click Listeners
183159
</IonButton>
184-
<IonButton
185-
expand="block"
186-
id="setOnMapBoundsButton"
187-
onClick={setOnMapBoundsChangedListeners}
188-
>
189-
Set On Map Bounds Changed Listeners
190-
</IonButton>
191-
<IonButton expand="block" id="getMapBounds" onClick={getBounds}>
192-
Get Current Bounds
193-
</IonButton>
194160
<IonButton
195161
expand="block"
196162
id="removeOnMapClickButton"
@@ -212,7 +178,7 @@ const CreateAndDestroyMapPage: React.FC = () => {
212178
<IonTextarea id="commandOutput" value={commandOutput}></IonTextarea>
213179
</div>
214180
<capacitor-google-map
215-
id="map1"
181+
id="map1_create_destroy"
216182
style={{
217183
position: 'absolute',
218184
top: window.innerHeight - window.outerWidth / 2,
@@ -222,7 +188,7 @@ const CreateAndDestroyMapPage: React.FC = () => {
222188
}}
223189
></capacitor-google-map>
224190
<capacitor-google-map
225-
id="map2"
191+
id="map2_create_destroy"
226192
style={{
227193
position: 'absolute',
228194
top: window.innerHeight - window.outerWidth / 2,

plugin/e2e-tests/src/pages/Map/Localization.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ const LocalizationPage: React.FC = () => {
2828
setCommandOutput('');
2929
setMaps([]);
3030
try {
31-
const mapRef1 = document.getElementById('map1')!;
32-
const mapRef2 = document.getElementById('map2')!;
31+
const mapRef1 = document.getElementById('map1_localization')!;
32+
const mapRef2 = document.getElementById('map2_localization')!;
3333

3434
const newMap1 = await GoogleMap.create(
3535
{
3636
element: mapRef1,
37-
id: 'test-map',
37+
id: 'test-map-localization1',
3838
apiKey: apiKey!,
3939
config: {
4040
center: {
@@ -53,7 +53,7 @@ const LocalizationPage: React.FC = () => {
5353
const newMap2 = await GoogleMap.create(
5454
{
5555
element: mapRef2,
56-
id: 'test-map2',
56+
id: 'test-map2-localization1',
5757
apiKey: apiKey!,
5858
config: {
5959
center: {
@@ -180,7 +180,7 @@ const LocalizationPage: React.FC = () => {
180180
<IonTextarea id="commandOutput" value={commandOutput}></IonTextarea>
181181
</div>
182182
<capacitor-google-map
183-
id="map1"
183+
id="map1_localization"
184184
style={{
185185
position: 'absolute',
186186
top: window.innerHeight - window.outerWidth / 2,
@@ -190,7 +190,7 @@ const LocalizationPage: React.FC = () => {
190190
}}
191191
></capacitor-google-map>
192192
<capacitor-google-map
193-
id="map2"
193+
id="map2_localization"
194194
style={{
195195
position: 'absolute',
196196
top: window.innerHeight - window.outerWidth / 2,

plugin/e2e-tests/src/pages/Map/ResizeMap.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const ResizeMapPage: React.FC = () => {
1818
setCommandOutput('');
1919
setMap(null);
2020
try {
21-
const mapRef = document.getElementById('map')!;
21+
const mapRef = document.getElementById('map_resize')!;
2222

2323
const newMap = await GoogleMap.create({
2424
element: mapRef,
25-
id: 'test-map',
25+
id: 'test-map-resize',
2626
apiKey: apiKey!,
2727
config: {
2828
center: {
@@ -84,7 +84,7 @@ const ResizeMapPage: React.FC = () => {
8484
></IonTextarea>
8585
</div>
8686
<capacitor-google-map
87-
id="map"
87+
id="map_resize"
8888
style={{
8989
position: 'absolute',
9090
top: window.innerHeight - window.outerWidth / 2,

plugin/e2e-tests/src/pages/Markers/AddAndRemoveMarkers.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ const AddAndRemoveMarkers: React.FC = () => {
3232

3333
async function createMap() {
3434
try {
35-
const mapRef1 = document.getElementById("markers_map1")!
35+
const mapRef1 = document.getElementById("markers_add_remove_map1")!
3636
const newMap = await GoogleMap.create({
3737
element: mapRef1,
38-
id: "test-map",
38+
id: "test-map-markers-add-remove",
3939
apiKey: apiKey!,
4040
config: {
4141
center: {
@@ -150,12 +150,12 @@ const AddAndRemoveMarkers: React.FC = () => {
150150
<div>
151151
<IonTextarea id="commandOutput" value={commandOutput}></IonTextarea>
152152
</div>
153-
<capacitor-google-map id="markers_map1" style={{
153+
<capacitor-google-map id="markers_add_remove_map1" style={{
154154
position: "absolute",
155-
top: window.innerHeight - 300,
155+
top: window.innerHeight - 150,
156156
left: 0,
157157
width: window.innerWidth,
158-
height: 300,
158+
height: window.outerWidth / 2,
159159
}}></capacitor-google-map>
160160
</BaseTestingPage>
161161
)

0 commit comments

Comments
 (0)