-
Notifications
You must be signed in to change notification settings - Fork 5
test(playwright): ⚗️ improve integration tests #1805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -86,10 +86,12 @@ export async function addRandomRepositoryToProject({ | |
| page, | ||
| repositoryName, | ||
| externalRepoUrlInput, | ||
| infraRepo, | ||
| }: { | ||
| page: Page | ||
| repositoryName?: string | ||
| externalRepoUrlInput?: string | ||
| infraRepo?: bool | ||
| }) { | ||
| repositoryName = repositoryName ?? faker.string.alpha(10).toLowerCase() | ||
| await page.getByTestId('addRepoLink').click() | ||
|
|
@@ -103,6 +105,9 @@ export async function addRandomRepositoryToProject({ | |
| .getByTestId('externalRepoUrlInput') | ||
| .fill(`${faker.internet.url({ appendSlash: true })}myrepository.git`) | ||
| } | ||
| if (infraRepo) { | ||
| await page.getByText('Dépôt contenant du code d\'').click() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: *soupir*, ça manque cruellement de |
||
| } | ||
| await page.getByTestId('addRepoBtn').click() | ||
| await expect(page.getByTestId(`repoTr-${repositoryName}`)).toContainText( | ||
| repositoryName, | ||
|
|
||
This file contains hidden or 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,59 @@ | ||
| import { test } from '@playwright/test' | ||
| import { adminUser, clientURL, signInCloudPiNative } from '../config/console' | ||
|
|
||
| import { | ||
| createCluster, | ||
| createStage, | ||
| createZone, | ||
| deleteCluster, | ||
| deleteStage, | ||
| deleteZone, | ||
| } from '../e2e-tests/utils' | ||
|
|
||
| const zonesToDelete: string[] = [] | ||
| const stagesToDelete: string[] = [] | ||
| const clustersToDelete: string[] = [] | ||
|
|
||
| test.describe('Integration tests for admin', { tag: '@integ' }, () => { | ||
| test.describe.configure({ mode: 'serial' }) | ||
|
|
||
| test('Admin setup', async ({ page }) => { | ||
| await page.goto(clientURL) | ||
| await signInCloudPiNative({ page, credentials: adminUser }) | ||
| await page.getByTestId('menuAdministrationBtn').click() | ||
| const zoneName = await createZone({ page }) | ||
| zonesToDelete.push(zoneName) | ||
| // we need to attains 7 stages to be able to use associateStageNames argument in createCluster | ||
| await page.getByRole('link', { name: 'Console Cloud π Native' }).click() | ||
| const customStageName1 = await createStage({ page, check: true, stagesToDelete }) | ||
| await page.getByRole('link', { name: 'Console Cloud π Native' }).click() | ||
| const customStageName2 = await createStage({ page, check: true, stagesToDelete }) | ||
| await page.getByRole('link', { name: 'Console Cloud π Native' }).click() | ||
| const customStageName3 = await createStage({ page, check: true, stagesToDelete }) | ||
| stagesToDelete.push(customStageName1) | ||
| stagesToDelete.push(customStageName2) | ||
| stagesToDelete.push(customStageName3) | ||
| const clusterName = await createCluster({ | ||
| page, | ||
| zone: zoneName, | ||
| confidentiality: 'public', | ||
| associateStageNames: [customStageName1, customStageName2, customStageName3], | ||
| }) | ||
| clustersToDelete.push(clusterName) | ||
| }) | ||
|
|
||
| test('Cleanup admin test data', async ({ page }) => { | ||
| await page.goto(clientURL) | ||
| await signInCloudPiNative({ page, credentials: adminUser }) | ||
| await page.getByTestId('menuAdministrationBtn').click() | ||
| for (const stageName of stagesToDelete) { | ||
| await deleteStage(page, stageName) | ||
| } | ||
| for (const clusterName of clustersToDelete) { | ||
| await deleteCluster(page, clusterName) | ||
| } | ||
| for (const zoneName of zonesToDelete) { | ||
| await deleteZone(page, zoneName) | ||
| } | ||
| }) | ||
| }) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Nickel 👍 Faudra dans le turfu qu'on source un fichier .env quelconque pour éviter la tartine d'export mais c'est un très bon début, et documenté 👏