Skip to content

Commit 96c1729

Browse files
Fix linted
Co-authored-by: SrinivasanTarget <srinivasan.sekar1990@gmail.com>
1 parent 26cf1d6 commit 96c1729

2 files changed

Lines changed: 68 additions & 53 deletions

File tree

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ flutter-by/wdio-flutter-by-service/package.json
66
flutter-by/wdio-flutter-by-service/package-lock.json
77
*.conf.ts
88
CHANGELOG.md
9+
test/*.png

test/specs/test.e2e.js

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { browser, expect } from '@wdio/globals';
2-
import path from "path";
2+
import path from 'path';
33

44
async function performLogin(userName = 'admin', password = '1234') {
55
await browser.takeScreenshot();
@@ -288,84 +288,98 @@ describe('My Login application', () => {
288288
.getText();
289289
expect(dropped).toEqual('The box is dropped');
290290
});
291-
292-
//TODO: Wbview is not inspectable on iOS demo app, need to fix it.
293-
itForAndroidOnly('should switch to webview context and validate the page title', async () => {
294-
await performLogin();
295-
await openScreen('Web View');
296-
await switchToWebview();
297-
298-
await browser.waitUntil(
299-
async () => (await browser.getTitle()) === 'Hacker News',
300-
{
301-
timeout: 10000,
302-
timeoutMsg: 'Expected Hacker News title not found',
303-
},
304-
);
305291

306-
const title = await browser.getTitle();
307-
expect(title).toEqual(
308-
'Hacker News',
309-
'Webview title did not match expected',
310-
);
311-
});
292+
//TODO: Wbview is not inspectable on iOS demo app, need to fix it.
293+
itForAndroidOnly(
294+
'should switch to webview context and validate the page title',
295+
async () => {
296+
await performLogin();
297+
await openScreen('Web View');
298+
await switchToWebview();
299+
300+
await browser.waitUntil(
301+
async () => (await browser.getTitle()) === 'Hacker News',
302+
{
303+
timeout: 10000,
304+
timeoutMsg: 'Expected Hacker News title not found',
305+
},
306+
);
307+
308+
const title = await browser.getTitle();
309+
expect(title).toEqual(
310+
'Hacker News',
311+
'Webview title did not match expected',
312+
);
313+
},
314+
);
312315

313-
itForAndroidOnly('should execute native commands correctly while in Webview context', async () => {
314-
await performLogin();
315-
await openScreen('Web View');
316-
await switchToWebview();
316+
itForAndroidOnly(
317+
'should execute native commands correctly while in Webview context',
318+
async () => {
319+
await performLogin();
320+
await openScreen('Web View');
321+
await switchToWebview();
317322

318-
// Verify no-proxy native commands still operate while in webview context
319-
const currentContext = await browser.getContext();
320-
expect(currentContext).toContain('WEBVIEW');
323+
// Verify no-proxy native commands still operate while in webview context
324+
const currentContext = await browser.getContext();
325+
expect(currentContext).toContain('WEBVIEW');
321326

322-
const contexts = await browser.getContexts();
323-
expect(Array.isArray(contexts)).toBe(true);
324-
expect(contexts.length).toBeGreaterThan(0);
327+
const contexts = await browser.getContexts();
328+
expect(Array.isArray(contexts)).toBe(true);
329+
expect(contexts.length).toBeGreaterThan(0);
325330

326-
const windowHandle = await browser.getWindowHandle();
327-
expect(typeof windowHandle).toBe('string');
331+
const windowHandle = await browser.getWindowHandle();
332+
expect(typeof windowHandle).toBe('string');
328333

329-
const pageSource = await browser.getPageSource();
330-
expect(typeof pageSource).toBe('string');
331-
});
334+
const pageSource = await browser.getPageSource();
335+
expect(typeof pageSource).toBe('string');
336+
},
337+
);
332338

333-
itForAndroidOnly('should switch back and forth between native and Webview contexts', async () => {
334-
await performLogin();
335-
await openScreen('Web View');
339+
itForAndroidOnly(
340+
'should switch back and forth between native and Webview contexts',
341+
async () => {
342+
await performLogin();
343+
await openScreen('Web View');
336344

337-
await switchToWebview();
338-
expect(await browser.getContext()).toContain('WEBVIEW');
345+
await switchToWebview();
346+
expect(await browser.getContext()).toContain('WEBVIEW');
339347

340-
await browser.switchContext('NATIVE_APP');
341-
expect(await browser.getContext()).toBe('NATIVE_APP');
348+
await browser.switchContext('NATIVE_APP');
349+
expect(await browser.getContext()).toBe('NATIVE_APP');
342350

343-
await switchToWebview();
344-
expect(await browser.getContext()).toContain('WEBVIEW');
345-
});
351+
await switchToWebview();
352+
expect(await browser.getContext()).toContain('WEBVIEW');
353+
},
354+
);
346355
});
347356

348-
describe('Image mocking', async() => {
357+
describe('Image mocking', async () => {
349358
afterEach(async () => {
350359
await handleAppManagement();
351360
});
352361

353-
it('Inject Image', async() => {
362+
it('Inject Image', async () => {
354363
const firstImageToMock = path.resolve('test/qr.png');
355364
const secondImageToMock = path.resolve('test/SecondImage.png');
356365
await performLogin();
357366
await openScreen('Image Picker');
358-
const firstInjectedImage = await browser.flutterInjectImage(firstImageToMock);
367+
const firstInjectedImage =
368+
await browser.flutterInjectImage(firstImageToMock);
359369
await browser.flutterByValueKey$('capture_image').click();
360370
await browser.flutterByText$('PICK').click();
361371
expect(await browser.flutterByText$('Success!').isDisplayed()).toBe(true);
362372
await browser.flutterInjectImage(secondImageToMock);
363373
await browser.flutterByValueKey$('capture_image').click();
364374
await browser.flutterByText$('PICK').click();
365-
expect(await browser.flutterByText$('SecondInjectedImage').isDisplayed()).toBe(true);
366-
await browser.flutterActivateInjectedImage({ imageId: firstInjectedImage });
375+
expect(
376+
await browser.flutterByText$('SecondInjectedImage').isDisplayed(),
377+
).toBe(true);
378+
await browser.flutterActivateInjectedImage({
379+
imageId: firstInjectedImage,
380+
});
367381
await browser.flutterByValueKey$('capture_image').click();
368382
await browser.flutterByText$('PICK').click();
369383
expect(await browser.flutterByText$('Success!').isDisplayed()).toBe(true);
370-
})
371-
})
384+
});
385+
});

0 commit comments

Comments
 (0)