Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose driver types from the agent #239

Merged
merged 1 commit into from
Mar 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
destroyTaskStep,
} from './helpers';

journey('basic addition and completion of single task', async ({ page }) => {
journey('addition and completion of single task', async ({ page }) => {
const testText = "Don't put salt in your eyes";

loadAppStep(page);
Expand All @@ -18,7 +18,7 @@ journey('basic addition and completion of single task', async ({ page }) => {
assertTaskListSizeStep(page, 0);
});

journey('adding and removing a few tasks', async ({ page }) => {
journey('adding and removing multiple tasks', async ({ page }) => {
const testTasks = ['Task 1', 'Task 2', 'Task 3'];

loadAppStep(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import { journey, step } from '@elastic/synthetics';
import { deepStrictEqual } from 'assert';
import { join } from 'path';

journey('check that title is present', async ({ page }) => {
step('go to app', async () => {
journey('check if title is present', async ({ page }) => {
step('launch app', async () => {
const path = 'file://' + join(__dirname, 'app', 'index.html');
await page.goto(path);
});

step('check title is present', async () => {
step('assert title', async () => {
const header = await page.$('h1');
deepStrictEqual(await header.textContent(), 'todos');
});
});

journey('check that input placeholder is correct', async ({ page }) => {
step('go to app', async () => {
journey('check if input placeholder is correct', async ({ page }) => {
step('launch app', async () => {
const path = 'file://' + join(__dirname, 'app', 'index.html');
await page.goto(path);
});

step('check title is present', async () => {
step('assert placeholder value', async () => {
const input = await page.$('input.new-todo');
deepStrictEqual(
await input.getAttribute('placeholder'),
Expand Down
5 changes: 2 additions & 3 deletions examples/todos/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { step } from '@elastic/synthetics';
import { step, Page } from '@elastic/synthetics';
import * as assert from 'assert';
import { join } from 'path';
import { Page } from 'playwright-core';

export const loadAppStep = (page: Page) => {
step('go to app', async () => {
step('launch app', async () => {
const path = 'file://' + join(__dirname, 'app', 'index.html');
await page.goto(path);
});
Expand Down
3 changes: 1 addition & 2 deletions examples/todos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"scripts": {},
"license": "MIT",
"dependencies": {
"@elastic/synthetics": "*",
"playwright-core": "=1.6.2"
"@elastic/synthetics": "file:../../"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change once we merge and release a new version where types would become available.

}
}
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ export async function run(options: RunOptions) {
}

export { beforeAll, afterAll, journey, step, before, after } from './core';
/**
* Export all the driver related types to be consumed
* and used by suites
*/
export type {
Page,
ChromiumBrowser,
ChromiumBrowserContext,
CDPSession,
} from 'playwright-chromium';