Skip to content

Commit 2361603

Browse files
committed
Configure expect [skip ci]
1 parent f37e7aa commit 2361603

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { expect } from "@playwright/test";
2+
3+
export default expect.configure({ timeout: 30000 });

e2e-playwright/src/helper/wrapper/assert.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { expect, Page } from "@playwright/test";
1+
import { Page } from "@playwright/test";
2+
import expect from "../util/expect";
23

34
export default class Assert {
45

@@ -22,4 +23,4 @@ export default class Assert {
2223
expect(pageURL).toContain(title);
2324
}
2425

25-
}
26+
}

e2e-playwright/src/hooks/hooks.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '../helper/env/env';
2-
import { BeforeAll, AfterAll, Before, After, Status } from "@cucumber/cucumber";
2+
import { BeforeAll, AfterAll, Before, After, Status, setDefaultTimeout } from "@cucumber/cucumber";
33
import { Browser, BrowserContext } from "@playwright/test";
44
import { fixture } from "./pageFixture";
55
import { invokeBrowser } from "../helper/browsers/browserManager";
@@ -22,6 +22,8 @@ BeforeAll(async function () {
2222
browser = await invokeBrowser();
2323
});
2424

25+
setDefaultTimeout(60 * 1000);
26+
2527
Before(async function ({ pickle }) {
2628
const scenarioName = pickle.name + pickle.id
2729
context = await browser.newContext();
@@ -34,9 +36,6 @@ Before(async function ({ pickle }) {
3436
const page = await context.newPage();
3537

3638
fixture.page = page;
37-
fixture.page.setDefaultTimeout(60_000); // 60s for actions (clicks, waits)
38-
fixture.page.setDefaultNavigationTimeout(60_000); // 60s for navigation
39-
4039

4140
fixture.logger = createLogger(options(scenarioName));
4241

e2e-playwright/src/services/uiHelper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { expect, Locator } from '@playwright/test';
1+
import { Locator } from '@playwright/test';
2+
import expect from "../helper/util/expect";
23

34
export const expectVisibility = async (locator: Locator, visibleString: string): Promise<void> => {
45
if (visibleString === "true") {
@@ -19,4 +20,4 @@ export const ensureCheckboxState = async (checkbox: Locator, expectedState: stri
1920
await checkbox.uncheck();
2021
}
2122
}
22-
};
23+
};

e2e-playwright/src/steps/TopicsCreate.steps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber";
2-
import { expect } from "@playwright/test";
32
import { fixture } from "../hooks/pageFixture";
43
import { expectVisibility } from "../services/uiHelper";
54
import { CustomWorld } from "../support/customWorld";
65
import { generateName } from "../services/commonFunctions";
6+
import expect from "../helper/util/expect";
77

88
setDefaultTimeout(60 * 1000 * 2);
99

@@ -140,4 +140,4 @@ When('TopicCreate 7Day button clicked', async () => {
140140

141141
When('TopicCreate 4Weeks button clicked', async () => {
142142
await fixture.topicsCreate.topicsCreate4Weeks().click();
143-
});
143+
});

e2e-playwright/src/steps/navigation.steps.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber";
2-
import { expect } from "@playwright/test";
32
import { fixture } from "../hooks/pageFixture";
3+
import expect from "../helper/util/expect";
44

55
setDefaultTimeout(60 * 1000 * 2);
66

@@ -17,12 +17,12 @@ Then('Brokers heading visible', async () => {
1717
await fixture.brokers.brokersHeading().waitFor({ state: 'visible' });
1818
});
1919

20-
20+
2121
Given('Topics is visible', async () => {
2222
await fixture.page.goto(process.env.BASEURL!);
2323
await expect(fixture.navigationPanel.topicsLink()).toBeVisible();
2424
});
25-
25+
2626
When('click on Topics link', async () => {
2727
await fixture.navigationPanel.topicsLink().click();
2828
});
@@ -72,7 +72,7 @@ When('click on Kafka Connect link', async () => {
7272
Then('Kafka Connect heading visible', async () => {
7373
await fixture.connectors.connectorsHeading().waitFor({ state: 'visible' });
7474
});
75-
75+
7676
Given('KSQL DB is visible', async () => {
7777
await fixture.page.goto(process.env.BASEURL!);
7878
await expect(fixture.navigationPanel.ksqlDbLink()).toBeVisible();
@@ -81,7 +81,7 @@ Given('KSQL DB is visible', async () => {
8181
When('click on KSQL DB link', async () => {
8282
await fixture.navigationPanel.ksqlDbLink().click();
8383
});
84-
84+
8585
Then('KSQL DB heading visible', async () => {
8686
await fixture.ksqlDb.ksqlDbHeading().waitFor({ state: 'visible' });
8787
});
@@ -92,7 +92,7 @@ Given('Dashboard is visible', async () => {
9292
var tmp = fixture.navigationPanel.getDashboardLink();
9393
await expect(fixture.navigationPanel.getDashboardLink()).toBeVisible();
9494
});
95-
95+
9696
When('click on Dashboard link', async () => {
9797
const dashboard = fixture.navigationPanel.getDashboardLink()
9898
await dashboard.isVisible();

0 commit comments

Comments
 (0)