-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
517d1bb
commit 25e6c6c
Showing
18 changed files
with
170 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Squidex Headless CMS | ||
* | ||
* @license | ||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. | ||
*/ | ||
|
||
import { expect, test } from '../_fixture'; | ||
import { getRandomId } from '../utils'; | ||
|
||
test.beforeEach(async ({ appsPage, settingsPage }) => { | ||
const appName = `my-app-${getRandomId()}`; | ||
|
||
await appsPage.goto(); | ||
const appDialog = await appsPage.openAppDialog(); | ||
await appDialog.enterName(appName); | ||
await appDialog.save(); | ||
|
||
await settingsPage.goto(appName); | ||
}); | ||
|
||
test('has header', async ({ page }) => { | ||
const header = page.getByRole('heading', { name: /UI Settings/ }); | ||
|
||
expect(header).toBeVisible(); | ||
}); | ||
|
||
test('add pattern', async ({ settingsPage })=> { | ||
const patternName = `name-${getRandomId()}`; | ||
const patternRegex = `regex-${getRandomId()}`; | ||
|
||
const newRow = await settingsPage.getPatternNewRow(); | ||
await newRow.enterName(patternName); | ||
await newRow.enterRegex(patternRegex); | ||
await settingsPage.save(); | ||
|
||
const patternRow = await settingsPage.getPatternRow(patternName); | ||
|
||
expect(patternRow.root).toBeVisible(); | ||
}); | ||
|
||
test('delete pattern', async ({ settingsPage })=> { | ||
const patternRow = await settingsPage.getPatternRow('Email'); | ||
await patternRow.delete(); | ||
await settingsPage.save(); | ||
|
||
expect(patternRow.root).not.toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Squidex Headless CMS | ||
* | ||
* @license | ||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. | ||
*/ | ||
|
||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export class SettingsPage { | ||
constructor(private readonly page: Page) {} | ||
|
||
public async goto(appName: string) { | ||
await this.page.goto(`/app/${appName}/settings/settings`); | ||
} | ||
|
||
public async save() { | ||
await this.page.getByRole('button', { name: 'Save' }).click(); | ||
} | ||
|
||
public async getPatternRow(name: string) { | ||
const locator = this.page.getByTestId(`pattern_${name}`); | ||
|
||
return new PatternRow(this.page, locator); | ||
} | ||
|
||
public async getPatternNewRow() { | ||
const locator = this.page.getByTestId(/pattern_/).last(); | ||
|
||
return new PatternRow(this.page, locator); | ||
} | ||
|
||
public async addPattern() { | ||
await this.page.getByTestId('patterns').getByRole('button', { name: 'Add' }).click(); | ||
} | ||
} | ||
|
||
export class PatternRow { | ||
constructor(private readonly page: Page, | ||
public readonly root: Locator, | ||
) { | ||
} | ||
|
||
public async enterName(value: string) { | ||
await this.root.getByPlaceholder('Name').fill(value); | ||
} | ||
|
||
public async enterRegex(value: string) { | ||
await this.root.getByPlaceholder('Pattern').fill(value); | ||
} | ||
|
||
public async delete() { | ||
await this.root.getByRole('button', { name: 'Delete' }).click(); | ||
await this.page.getByRole('button', { name: 'Yes' }).click(); | ||
} | ||
} |