Skip to content

Commit 99d7c22

Browse files
committed
try to fix e2e tests
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent f1ddc3f commit 99d7c22

12 files changed

Lines changed: 27 additions & 29 deletions

playwright/e2e/create-empty-form.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
*/
55

66
import { expect, mergeTests } from '@playwright/test'
7-
import { test as randomUserTest } from '../support/fixtures/random-user'
8-
import { test as appNavigationTest } from '../support/fixtures/navigation'
9-
import { test as formTest } from '../support/fixtures/form'
7+
import { test as formTest } from '../support/fixtures/form.ts'
8+
import { test as appNavigationTest } from '../support/fixtures/navigation.ts'
9+
import { test as randomUserTest } from '../support/fixtures/random-user.ts'
1010

1111
const test = mergeTests(randomUserTest, appNavigationTest, formTest)
1212

1313
test.beforeEach(async ({ page }) => {
14-
await page.goto('apps/forms')
15-
await page.waitForURL(/apps\/forms$/)
14+
// use absolute path and wait until network is idle to avoid flaky load waits
15+
await page.goto('apps/forms', { waitUntil: 'networkidle' })
16+
await page.waitForURL(/apps\/forms\/$/)
1617
})
1718

1819
test.describe('No forms created - empty content', () => {

playwright/e2e/form-description.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
*/
55

66
import { expect, mergeTests } from '@playwright/test'
7-
import { test as randomUserTest } from '../support/fixtures/random-user'
8-
import { test as appNavigationTest } from '../support/fixtures/navigation'
9-
import { test as topBarTest } from '../support/fixtures/topBar'
10-
import { test as formTest } from '../support/fixtures/form'
11-
import { FormsView } from '../support/sections/TopBarSection'
7+
import { test as formTest } from '../support/fixtures/form.ts'
8+
import { test as appNavigationTest } from '../support/fixtures/navigation.ts'
9+
import { test as randomUserTest } from '../support/fixtures/random-user.ts'
10+
import { test as topBarTest } from '../support/fixtures/topBar.ts'
11+
import { FormsView } from '../support/sections/TopBarSection.ts'
1212

1313
const test = mergeTests(randomUserTest, appNavigationTest, formTest, topBarTest)
1414

1515
test.beforeEach(async ({ page }) => {
16-
await page.goto('apps/forms')
17-
await page.waitForURL(/apps\/forms$/)
16+
await page.goto('apps/forms', { waitUntil: 'networkidle' })
17+
await page.waitForURL(/apps\/forms\/$/)
1818
})
1919

2020
test.describe('Form description', () => {

playwright/e2e/ime-input.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
*/
55

66
import { expect, mergeTests } from '@playwright/test'
7-
import { test as randomUserTest } from '../support/fixtures/random-user'
8-
import { test as appNavigationTest } from '../support/fixtures/navigation'
9-
import { test as formTest } from '../support/fixtures/form'
10-
import { QuestionType } from '../support/sections/QuestionType'
7+
import { test as formTest } from '../support/fixtures/form.ts'
8+
import { test as appNavigationTest } from '../support/fixtures/navigation.ts'
9+
import { test as randomUserTest } from '../support/fixtures/random-user.ts'
10+
import { QuestionType } from '../support/sections/QuestionType.ts'
1111

1212
const test = mergeTests(randomUserTest, appNavigationTest, formTest)
1313

1414
test.beforeEach(async ({ page }) => {
15-
await page.goto('apps/forms')
16-
await page.waitForURL(/apps\/forms$/)
15+
await page.goto('apps/forms', { waitUntil: 'networkidle' })
16+
await page.waitForURL(/apps\/forms\/$/)
1717
})
1818

1919
test(

playwright/support/fixtures/form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test as baseTest } from '@playwright/test'
7-
import { FormSection } from '../sections/FormSection'
7+
import { FormSection } from '../sections/FormSection.ts'
88

99
interface FormFixture {
1010
form: FormSection

playwright/support/fixtures/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test as baseTest } from '@playwright/test'
7-
import { AppNavigationSection } from '../sections/AppNavigationSection'
7+
import { AppNavigationSection } from '../sections/AppNavigationSection.ts'
88

99
interface AppNavigationFixture {
1010
appNavigation: AppNavigationSection

playwright/support/fixtures/random-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { test as base } from '@playwright/test'
76
import { createRandomUser, login } from '@nextcloud/e2e-test-server/playwright'
7+
import { test as base } from '@playwright/test'
88

99
/**
1010
* This test fixture ensures a new random user is created and used for the test (current page)

playwright/support/fixtures/topBar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test as baseTest } from '@playwright/test'
7-
import { TopBarSection } from '../sections/TopBarSection'
7+
import { TopBarSection } from '../sections/TopBarSection.ts'
88

99
interface TopBarFixture {
1010
topBar: TopBarSection

playwright/support/sections/AppNavigationSection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export class AppNavigationSection {
1111
public readonly ownFormsLocator: Locator
1212
public readonly sharedFormsLocator: Locator
1313

14-
// eslint-disable-next-line no-useless-constructor
1514
constructor(public readonly page: Page) {
1615
this.navigationLocator = this.page.getByRole('navigation', {
1716
name: 'Forms navigation',

playwright/support/sections/FormSection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
*/
55

66
import type { Locator, Page, Response } from '@playwright/test'
7-
import type { QuestionType } from './QuestionType'
8-
import { QuestionSection } from './QuestionSection'
7+
import type { QuestionType } from './QuestionType.ts'
8+
9+
import { QuestionSection } from './QuestionSection.ts'
910

1011
export class FormSection {
1112
public readonly mainContent: Locator
1213
public readonly titleField: Locator
1314
public readonly descriptionField: Locator
1415
public readonly newQuestionButton: Locator
1516

16-
// eslint-disable-next-line no-useless-constructor
1717
constructor(public readonly page: Page) {
1818
this.mainContent = this.page.getByRole('main')
1919
this.newQuestionButton = this.page.getByRole('button', {

playwright/support/sections/QuestionSection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export class QuestionSection {
1010
public readonly newAnswerInput: Locator
1111
public readonly answerInputs: Locator
1212

13-
// eslint-disable-next-line no-useless-constructor
1413
constructor(
1514
public readonly page: Page,
1615
public readonly section: Locator,

0 commit comments

Comments
 (0)