-
Notifications
You must be signed in to change notification settings - Fork 4
Playwright/integration test console #1752
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
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
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 |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| import { expect, test } from '@playwright/test' | ||
| import { adminUser, clientURL, signInCloudPiNative } from '../config/console' | ||
|
|
||
| import { | ||
| addProject, | ||
| addRandomRepositoryToProject, | ||
| createCluster, | ||
| createStage, | ||
| createZone, | ||
| deleteCluster, | ||
| deleteProject, | ||
| deleteStage, | ||
| deleteZone, | ||
| } from '../e2e-tests/utils' | ||
|
|
||
| const zonesToDelete: string[] = [] | ||
| const projectsToDelete: string[] = [] | ||
| const stagesToDelete: string[] = [] | ||
| const clustersToDelete: string[] = [] | ||
|
|
||
| test.describe('Integration tests', { 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 | ||
StephaneTrebel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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) | ||
| } | ||
| console.log('Stages:', stagesToDelete) | ||
| for (const clusterName of clustersToDelete) { | ||
| await deleteCluster(page, clusterName) | ||
| } | ||
| console.log('Clusters:', clustersToDelete) | ||
| for (const zoneName of zonesToDelete) { | ||
| await deleteZone(page, zoneName) | ||
| } | ||
| console.log('Zones:', zonesToDelete) | ||
| }) | ||
|
|
||
| test('User flow', async ({ page }) => { | ||
| await page.goto(clientURL) | ||
| await signInCloudPiNative({ page, credentials: adminUser }) | ||
| const project = await addProject({ page }) | ||
| const projectName = project.name | ||
| projectsToDelete.push(projectName) | ||
| await addRandomRepositoryToProject({ | ||
| page, | ||
| repositoryName: 'tutojava', | ||
| externalRepoUrlInput: 'https://github.com/cloud-pi-native/tuto-java.git', | ||
| }) | ||
| // Check if mirror pipeline is successful | ||
| await page.getByTestId('test-tab-services').click() | ||
| const page1Promise = page.waitForEvent('popup') | ||
| await page.getByRole('link', { name: 'Gitlab' }).click() | ||
| const page1 = await page1Promise | ||
| await page1.getByTestId('group-name').filter({ hasText: 'mirror' }).click() | ||
| await expect(page1.getByTestId('status_success_borderless-icon')).toBeVisible() | ||
| // Run build pipeline and check if it is successful | ||
| await page1.getByRole('link', { name: projectName }).click() | ||
| await page1.getByTestId('group-name').filter({ hasText: 'tutojava' }).click() | ||
| await page1.getByRole('button', { name: 'Build' }).hover() | ||
| await page1.getByRole('link', { name: 'Pipelines' }).click() | ||
| await page1.getByTestId('run-pipeline-button').click() | ||
| await page1.getByTestId('run-pipeline-button').click() | ||
| await expect( | ||
| page1.getByRole('link', { name: 'Status: Passed read_secret' }), | ||
| ).toBeVisible() | ||
| await expect( | ||
| page1.getByRole('link', { name: 'Status: Passed test-app' }), | ||
| ).toBeVisible() | ||
| await expect( | ||
| page1.getByRole('link', { name: 'Status: Passed docker-build', exact: true }), | ||
| ).toBeVisible() | ||
| await expect( | ||
| page1.getByRole('link', { name: 'Status: Passed docker-build-2' }), | ||
| ).toBeVisible() | ||
| // Check if sonar scan is available | ||
| const page2Promise = page.waitForEvent('popup') | ||
| await page.getByRole('link', { name: 'SonarQube' }).click() | ||
| const page2 = await page2Promise | ||
| await page2.getByRole('button', { name: 'OpenID Connect Log in with' }).click() | ||
| await page2.getByPlaceholder('Search for projects...').fill(projectName) | ||
| await page2.getByRole('link', { name: `${projectName}-tutojava` }).click() | ||
| await expect( | ||
| page2.getByTestId('overview__quality-gate-panel').getByText('Passed', { exact: true }), | ||
| ).toBeVisible() | ||
| }) | ||
|
|
||
| test('Cleanup user test data', async ({ page }) => { | ||
| await page.goto(clientURL) | ||
| await signInCloudPiNative({ page, credentials: adminUser }) | ||
| for (const projectName of projectsToDelete) { | ||
| await deleteProject(page, projectName) | ||
| } | ||
| console.log('Projects:', projectsToDelete) | ||
| }) | ||
| }) | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.