Skip to content

Commit

Permalink
[FCE-481] Fix local e2e example tests (#99)
Browse files Browse the repository at this point in the history
## Description

- Changed appium method to swipeGesture for closing select audio source
- Enabled all tests for Android 
- Disabled some tests for iOS and added a TODO that should be fixed
here:
https://linear.app/swmansion/issue/FCE-504/fix-e2e-test-on-ios-related-to-showing-camera-view-when-camera-is

## Motivation and Context

- Some tests were disabled on Github and failed locally. This was
because it was not possible to close the audio source selection input.

## How has this been tested?

- Run Android tests both locally and on Github Actions
- Run remaining iOS tests locally

## Types of changes

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [x] My code follows the code style of this project.

---------

Co-authored-by: Miron Pawlik <[email protected]>
  • Loading branch information
MiloszFilimowski and mironiasty authored Sep 10, 2024
1 parent cd6a0a6 commit 509e829
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import React, { useCallback, useState } from 'react';
import { StyleSheet } from 'react-native';

import SoundOutputDevicesSection from './SoundOutputDevicesSection';
import { soundOutputDevicesLabels } from '../types/ComponentLabels';

const { OUTPUT_DEVICES_BOTTOM_SHEET } = soundOutputDevicesLabels;

export default function SoundOutputDevicesBottomSheet({
bottomSheetRef,
Expand All @@ -23,7 +26,7 @@ export default function SoundOutputDevicesBottomSheet({
index={bottomSheetIndex}
snapPoints={[300]}
backgroundStyle={styles.bottomSheetWrapper}>
<BottomSheetView>
<BottomSheetView accessibilityLabel={OUTPUT_DEVICES_BOTTOM_SHEET}>
<SoundOutputDevicesSection />
</BottomSheetView>
</BottomSheet>
Expand Down
1 change: 1 addition & 0 deletions examples/fishjam-chat/types/ComponentLabels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const roomScreenLabels = {
const soundOutputDevicesLabels = {
TITLE_TEXT: 'title_text',
OUTPUT_DEVICE_BUTTON: 'output_device_button',
OUTPUT_DEVICES_BOTTOM_SHEET: 'output_devices_bottom_sheet',
};

export {
Expand Down
1 change: 0 additions & 1 deletion examples/webdriverio-test/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FISHJAM_HOST_MOBILE =<ip address>:<port number>
ANDROID_DEVICE_NAME=Phone name
ANDROID_APP_PATH=path/to/your/repo/examples/fishjam-chat/android/app/build/outputs/apk/release/app-release.apk

IOS_FISHJAM_TOKEN=Token_for_ios_generated_from_fishjam_dashboard
IOS_DEVICE_ID=123123123
IOS_TEAM_ID=123123123
IOS_APP_PATH=path/to/your/ipa/folder/FishjamExample.ipa
37 changes: 19 additions & 18 deletions examples/webdriverio-test/test/specs/test.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
tapApp,
tapButton,
typeToInput,
swipeDown,
} from '../../utils';

const { TOKEN_TAB } = appNavigationLabels;
Expand All @@ -46,6 +47,11 @@ const {

const { TITLE_TEXT, OUTPUT_DEVICE_BUTTON } = soundOutputDevicesLabels;

const { OUTPUT_DEVICES_BOTTOM_SHEET } = soundOutputDevicesLabels;

// TODO: Remove after fixing: FCE-504
const SKIP_IOS_TODO = driver.isIOS;

type Test = {
name: string;
run: () => Promise<void>;
Expand Down Expand Up @@ -123,7 +129,6 @@ const tests: Test[] = [
if (driver.isIOS) {
await driver.acceptAlert();
await driver.pause(1000);
await driver.acceptAlert();
}
},
skip: false,
Expand All @@ -135,19 +140,22 @@ const tests: Test[] = [
if (driver.isAndroid) {
await getElement(driver, '~' + TITLE_TEXT);
await tapButton(driver, '~' + OUTPUT_DEVICE_BUTTON + 0);
await swipeDown(driver, '~' + OUTPUT_DEVICES_BOTTOM_SHEET);
}
await driver.pause(100);
await tapApp(driver);
},
skip: process.env.GITHUB_ACTIONS === 'true',
skip: false,
},
{
name: 'toggle off preview camera and microphone then join the room',
run: async () => {
await tapButton(driver, '~' + TOGGLE_MICROPHONE_BUTTON_PREVIEW);
await tapButton(driver, '~' + TOGGLE_CAMERA_BUTTON_PREVIEW);
await tapButton(driver, '~' + JOIN_BUTTON);
await driver.pause(100);
if (driver.isIOS) {
await driver.acceptAlert();
}
await driver.pause(1000);
},
skip: false,
},
Expand All @@ -157,12 +165,9 @@ const tests: Test[] = [
await getElement(driver, '~' + NO_CAMERA_VIEW);
//todo remove next lines of code when this issue is solved https://membraneframework.atlassian.net/browse/RTC-549
await driver.pause(4000);
if (driver.isIOS) {
await driver.acceptAlert();
}
//todo up to here
},
skip: false,
skip: SKIP_IOS_TODO,
},
{
name: 'toggle camera on',
Expand Down Expand Up @@ -216,7 +221,7 @@ const tests: Test[] = [
await tapApp(driver);
}
},
skip: process.env.GITHUB_ACTIONS === 'true',
skip: SKIP_IOS_TODO,
},
{
name: 'check if two video cells',
Expand All @@ -225,7 +230,7 @@ const tests: Test[] = [
await getElement(driver, '~' + VIDEO_CELL + 1);
await getElement(driver, '~' + VIDEO_CELL + 3, true);
},
skip: process.env.GITHUB_ACTIONS === 'true',
skip: SKIP_IOS_TODO,
},
{
name: 'toggle camera off',
Expand All @@ -237,14 +242,10 @@ const tests: Test[] = [
{
name: 'check if only 1 video cell',
run: async () => {
await getElement(
driver,
'~' + VIDEO_CELL + 0,
process.env.GITHUB_ACTIONS === 'true',
);
await getElement(driver, '~' + VIDEO_CELL + 0);
await getElement(driver, '~' + VIDEO_CELL + 1, true);
},
skip: false,
skip: SKIP_IOS_TODO,
},
{
name: 'screen share off',
Expand All @@ -256,14 +257,14 @@ const tests: Test[] = [
}
await tapApp(driver);
},
skip: process.env.GITHUB_ACTIONS === 'true',
skip: SKIP_IOS_TODO,
},
{
name: 'check if no camera view again',
run: async () => {
await getElement(driver, '~' + NO_CAMERA_VIEW);
},
skip: false,
skip: SKIP_IOS_TODO,
},
{
name: 'toggle microphone on',
Expand Down
13 changes: 13 additions & 0 deletions examples/webdriverio-test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ const tapApp = async (driver: WebdriverIO.Browser) => {
]);
};

const swipeDown = async (driver: WebdriverIO.Browser, selector: string) => {
const element = await getElement(driver, selector);

await driver.executeScript('mobile: swipeGesture', [
{
elementId: element.elementId,
direction: 'down',
percent: 1.0,
},
]);
};

const getWebsocketUrl = (host: string, secure: boolean = false) =>
`${secure ? 'wss' : 'ws'}://${host}`;

Expand Down Expand Up @@ -125,6 +137,7 @@ export {
tapApp,
typeToInput,
tapButton,
swipeDown,
getElement,
getInputValue,
compareInputValue,
Expand Down

0 comments on commit 509e829

Please sign in to comment.