-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12135 replace designer cypress (#12204)
* Moving all e2e tests from Cypress to Playwright * initial commit * initial commit * creating overview page * fixing typo * fixing feedback from PR * almost implementing all tests * Finalinsing navigation Playwright test * fix cypress * fix * fixing cypress * implementing header class * adding more delay to playwright tests * initial commit * adding 1 of 2 designer tests * Completing designer cypress to playwright * Removing unused cypress * merge main
- Loading branch information
WilliamThorenfeldt
authored
Feb 1, 2024
1 parent
e5d7074
commit 3d3add3
Showing
9 changed files
with
154 additions
and
78 deletions.
There are no files selected for viewing
68 changes: 0 additions & 68 deletions
68
frontend/testing/cypress/src/integration/studio/designer.js
This file was deleted.
Oops, something went wrong.
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
80 changes: 80 additions & 0 deletions
80
frontend/testing/playwright/tests/ui-editor/ui-editor.spec.ts
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,80 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { Page } from '@playwright/test'; | ||
import { test } from '../../extenders/testExtend'; | ||
import { DesignerApi } from '../../helpers/DesignerApi'; | ||
import type { StorageState } from '../../types/StorageState'; | ||
import { UiEditorPage } from '../../pages/UiEditorPage'; | ||
import { Gitea } from '../../helpers/Gitea'; | ||
|
||
// This line must be there to ensure that the tests do not run in parallell, and | ||
// that the before all call is being executed before we start the tests | ||
test.describe.configure({ mode: 'serial' }); | ||
|
||
// Before the tests starts, we need to create the data model app | ||
test.beforeAll(async ({ testAppName, request, storageState }) => { | ||
// Create a new app | ||
const designerApi = new DesignerApi({ app: testAppName }); | ||
const response = await designerApi.createApp(request, storageState as StorageState); | ||
expect(response.ok()).toBeTruthy(); | ||
}); | ||
|
||
test.afterAll(async ({ request, testAppName }) => { | ||
const gitea = new Gitea(); | ||
const response = await request.delete(gitea.getDeleteAppEndpoint({ app: testAppName })); | ||
expect(response.ok()).toBeTruthy(); | ||
}); | ||
|
||
const setupAndVerifyDashboardPage = async ( | ||
page: Page, | ||
testAppName: string, | ||
): Promise<UiEditorPage> => { | ||
const uiEditorPage = new UiEditorPage(page, { app: testAppName }); | ||
await uiEditorPage.loadUiEditorPage(); | ||
await uiEditorPage.verifyUiEditorPage(); | ||
return uiEditorPage; | ||
}; | ||
|
||
test('That it is possible to add and delete form components', async ({ | ||
page, | ||
testAppName, | ||
}): Promise<void> => { | ||
const uiEditorPage = await setupAndVerifyDashboardPage(page, testAppName); | ||
|
||
const page1: string = 'Side1'; | ||
await uiEditorPage.clickOnPageAccordion(page1); | ||
await uiEditorPage.verifyThatPageIsEmpty(); | ||
await uiEditorPage.verifyUiEditorPage(page1); // When clicking the page, the url is updated to include the layout | ||
|
||
await uiEditorPage.dragTitleInputComponentInToDroppableList(); | ||
await uiEditorPage.verifyThatInputComponentTreeItemIsVisibleInDroppableList(); | ||
await uiEditorPage.verifyThatPageEmptyMessageIsHidden(); | ||
await uiEditorPage.clickOnDeleteInputComponentButton(); | ||
|
||
await uiEditorPage.verifyThatPageIsEmpty(); | ||
}); | ||
|
||
test('That when adding more than one page, navigation buttons are added to the pages', async ({ | ||
page, | ||
testAppName, | ||
}): Promise<void> => { | ||
const uiEditorPage = await setupAndVerifyDashboardPage(page, testAppName); | ||
|
||
const page1: string = 'Side1'; | ||
const page2: string = 'Side2'; | ||
|
||
await uiEditorPage.clickOnPageAccordion(page1); | ||
await uiEditorPage.verifyThatPageIsEmpty(); | ||
await uiEditorPage.verifyUiEditorPage(page1); | ||
|
||
await uiEditorPage.clickOnAddNewPage(); | ||
await uiEditorPage.verifyThatNewPageIsVisible(page2); | ||
await uiEditorPage.verifyUiEditorPage(page2); | ||
|
||
await uiEditorPage.verifyThatPageEmptyMessageIsHidden(); | ||
await uiEditorPage.verifyThatNavigationButtonsAreAddedToPage(); | ||
|
||
await uiEditorPage.clickOnPageAccordion(page1); | ||
await uiEditorPage.verifyUiEditorPage(page1); | ||
await uiEditorPage.verifyThatPageEmptyMessageIsHidden(); | ||
await uiEditorPage.verifyThatNavigationButtonsAreAddedToPage(); | ||
}); |