Skip to content

Commit def53e0

Browse files
committed
Tests: Fix header test on webkit
1 parent 11c2f35 commit def53e0

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

exampleSite/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module github.com/nginxinc/docs
22

33
go 1.23
44

5-
require github.com/nginxinc/nginx-hugo-theme v0.41.27 // indirect
5+
require github.com/nginxinc/nginx-hugo-theme v1.0.4 // indirect
66

77
replace github.com/nginxinc/nginx-hugo-theme => ../

tests/src/cards.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ test.describe('Testing for cards shortcode', () => {
99
});
1010

1111
test('basic section', async ({ page }) => {
12-
const section = await page.getByTestId('cards-test__basic');
13-
const showAsCardCode = await section.getByTestId('card-section-content');
12+
const section = page.getByTestId('cards-test__basic');
13+
const showAsCardCode = section.getByTestId('card-section-content');
1414

1515
expect(await showAsCardCode.count()).toBe(0);
1616
});
1717

1818
test('featured section', async ({ page }) => {
19-
const section = await page.getByTestId('cards-test__featuredSection');
20-
const featuredSection = await section.getByTestId(
19+
const section = page.getByTestId('cards-test__featuredSection');
20+
const featuredSection = section.getByTestId(
2121
'card-section__featured-section'
2222
);
23-
const cards = await (await featuredSection.getByTestId('card')).all();
23+
const cards = await featuredSection.getByTestId('card').all();
2424

2525
// Test featured section exists AND there are less than or equal to 3 cards.
2626
expect(await featuredSection.count()).toBeTruthy();

tests/src/header.spec.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ test.describe('Smoke test for header', () => {
1818
});
1919

2020
test('header control works', async ({ page }) => {
21-
const sidebarButtonClose = await page.getByTestId(
21+
const sidebarButtonClose = page.getByTestId(
2222
'header__control--sidebar--close'
2323
);
24-
const sidebarButtonOpen = await page.getByTestId(
24+
const sidebarButtonOpen = page.getByTestId(
2525
'header__control--sidebar--open'
2626
);
27-
const sidebar = await page.getByTestId('sidebar');
27+
const sidebar = page.getByTestId('sidebar');
2828

2929
// Close the sidebar
3030
await expect(sidebarButtonClose).toBeVisible();
@@ -44,9 +44,11 @@ test.describe('Smoke test for header', () => {
4444
});
4545

4646
test('F5 Sites button works', async ({ page }) => {
47-
const f5SitesButton = await page.getByTestId('header__f5sites_button');
48-
await f5SitesButton.click();
49-
const f5SitesContent = await page.getByTestId('header__f5sites_content');
50-
await expect(f5SitesContent.count()).toBeTruthy();
47+
const f5SitesButton = page.getByTestId('header__f5sites_button');
48+
await expect(async () => {
49+
await f5SitesButton.click();
50+
const f5SitesContent = page.getByTestId('header__f5sites_content');
51+
await expect(f5SitesContent).toBeVisible();
52+
}).toPass();
5153
});
5254
});

tests/src/sidebar.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function openPage(page, sidebarPage) {
3535

3636
// Click on the page
3737
await sidebarPage.click();
38-
const content = await page.getByTestId('content');
38+
const content = page.getByTestId('content');
3939
await content.waitFor();
4040
}
4141

tests/src/tabs.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ test.describe('Testing for tabs shortcode', () => {
99
});
1010

1111
test('tabs render', async ({ page }) => {
12-
const section = await page.getByTestId('tabs-test__basic');
13-
const tabsContainer = await section.getByTestId('tabs-container');
14-
const tabLabels = await tabsContainer.getByTestId('tab-labels');
15-
const tabContents = await tabsContainer.getByTestId('tab-contents');
12+
const section = page.getByTestId('tabs-test__basic');
13+
const tabsContainer = section.getByTestId('tabs-container');
14+
const tabLabels = tabsContainer.getByTestId('tab-labels');
15+
const tabContents = tabsContainer.getByTestId('tab-contents');
1616

1717
expect(await tabsContainer.count()).toBeTruthy();
1818
expect(await tabLabels.count()).toBeTruthy();
1919
expect(await tabContents.count()).toBeTruthy();
2020
});
2121

2222
test('tabs shift content when clicked', async ({ page }) => {
23-
const section = await page.getByTestId('tabs-test__basic');
24-
const tabsContainer = await section.getByTestId('tabs-container');
25-
const tabLabels = await tabsContainer.getByTestId('tab-labels');
26-
const tabContents = await tabsContainer.getByTestId('tab-contents');
23+
const section = page.getByTestId('tabs-test__basic');
24+
const tabsContainer = section.getByTestId('tabs-container');
25+
const tabLabels = tabsContainer.getByTestId('tab-labels');
26+
const tabContents = tabsContainer.getByTestId('tab-contents');
2727

2828
const tabsList = await tabLabels.locator('li').all();
2929
for (const tab of tabsList) {

0 commit comments

Comments
 (0)