Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
echo 'export UDID=$target_sim_id' >> $BASH_ENV
xcrun simctl boot $target_sim_id
xcrun simctl bootstatus $target_sim_id -b
npm install -g appium
npm install -g appium@2.19.0
npm ci
npm run build
appium driver run xcuitest build-wda
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
echo 'export UDID=$target_sim_id' >> $BASH_ENV
xcrun simctl boot $target_sim_id
xcrun simctl bootstatus $target_sim_id -b
npm install -g appium
npm install -g appium@2.19.0
npm ci
npm run build
appium driver run xcuitest build-wda
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
npm run build
- name: Install Drivers
run: |
npm install -g appium
npm install -g appium@2.19.0
appium driver list
- name: Checkout Test from Flutter Finder
uses: actions/checkout@v2
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
npm run build
- name: Install Drivers
run: |
npm install -g appium
npm install -g appium@2.19.0
appium driver list
- name: Checkout Test from Flutter Finder
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/commands/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export async function getText(this: AppiumFlutterDriver, elementId: string) {
return String(await driver.command(`/element/${elementId}/text`, 'GET', {}));
}

export async function getElementRect(
this: AppiumFlutterDriver,
elementId: string,
) {
const driver = ELEMENT_CACHE.get(elementId);
return await driver.command(`/element/${elementId}/rect`, 'GET', {});
}

export async function elementEnabled(
this: AppiumFlutterDriver,
elementId: string,
Expand Down
6 changes: 6 additions & 0 deletions src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
setValue,
clear,
ELEMENT_CACHE,
getElementRect,
} from './commands/element';
import {
attachAppLaunchArguments,
Expand Down Expand Up @@ -65,6 +66,7 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
findElOrEls = findElOrEls;
getText = getText;
getAttribute = getAttribute;
getElementRect = getElementRect;
elementDisplayed = elementDisplayed;
elementEnabled = elementEnabled;
setValue = setValue;
Expand Down Expand Up @@ -217,6 +219,10 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
isFlutterDriverCommand(command)
) {
return await super.executeCommand(command, ...args);
} else {
this.log.info(
`Executing the command: ${command} with args: ${args} and flutterCommand ${isFlutterDriverCommand(command)}`,
);
}

this.handleContextSwitch(command, args);
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export function isFlutterDriverCommand(command: string) {
'getAttribute',
'elementDisplayed',
'execute',
'getElementRect',
'getSize',
].indexOf(command) >= 0
);
}
Expand Down
16 changes: 16 additions & 0 deletions test/specs/test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ describe('My Login application', () => {
.flutterByValueKey$('double_tap_button')
.flutterByText$('Double Tap');
expect(await element.getText()).toEqual('Double Tap');
const size = await element.getSize();
expect(size.width).toBeGreaterThan(0);
expect(size.height).toBeGreaterThan(0);
await browser.flutterDoubleClick({
element: element,
});
Expand Down Expand Up @@ -101,6 +104,19 @@ describe('My Login application', () => {
expect(await message.getText()).toEqual('Hello world');
});

it.only('Nested Scroll Test', async () => {
await performLogin();
await openScreen('Nested Scroll');
const parentElement = await browser.flutterScrollTillVisible({
finder: await browser.flutterByText('Parent Element 4'),
scrollDirection: 'down',
});
await browser.flutterScrollTillVisible({
finder: await parentElement.flutterByValueKey(''),
scrollView: parentElement,
scrollDirection: 'down',
});
});
it('Scroll Test', async () => {
await performLogin();
await openScreen('Vertical Swiping');
Expand Down
27 changes: 27 additions & 0 deletions test/unit/element.specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
elementEnabled,
findElOrEls,
getAttribute,
getElementRect,
getText,
setValue,
} from '../../src/commands/element';
Expand Down Expand Up @@ -186,6 +187,32 @@ describe('Element Interaction Functions', () => {
});
});

describe('getRect', () => {
it('should get rect from an element correctly', async () => {
const elementId = 'elem1';
ELEMENT_CACHE.set(elementId, mockDriver);
mockDriver.command.resolves(
'{"x": 10, "y": 20, "width": 100, "height": 50}',
);

const result = await getElementRect.call(
mockAppiumFlutterDriver,
elementId,
);

expect(result).to.equal(
'{"x": 10, "y": 20, "width": 100, "height": 50}',
);
expect(
mockDriver.command.calledWith(
`/element/${elementId}/rect`,
'GET',
{},
),
).to.be.true;
});
});

describe('getAttribute', () => {
it('should get an attribute from an element correctly', async () => {
const elementId = 'elem1';
Expand Down
2 changes: 1 addition & 1 deletion wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const config: Options.Testrunner = {

//
// The number of times to retry the entire specfile when it fails as a whole
specFileRetries: 1,
specFileRetries: 0,
//
// Delay in seconds between the spec file retry attempts
// specFileRetriesDelay: 0,
Expand Down