-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e] Link Scaffolded Templates to Catalog Items
- Loading branch information
1 parent
eaf0c4c
commit 161bbd1
Showing
4 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
e2e-tests/playwright/e2e/catalog-scaffoldedfromLink.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,116 @@ | ||
import { Page, test } from '@playwright/test'; | ||
import { UIhelper } from '../utils/UIhelper'; | ||
import { Common, setupBrowser } from '../utils/Common'; | ||
import { CatalogImport } from '../support/pages/CatalogImport'; | ||
import { APIHelper } from '../utils/APIHelper'; | ||
import { githubAPIEndpoints } from '../utils/APIEndpoints'; | ||
|
||
let page: Page; | ||
test.describe.serial('Link Scaffolded Templates to Catalog Items', () => { | ||
let uiHelper: UIhelper; | ||
let common: Common; | ||
let catalogImport: CatalogImport; | ||
|
||
const template = | ||
'https://github.com/janus-idp/backstage-plugins/blob/main/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml'; | ||
|
||
const reactAppDetails = { | ||
owner: 'janus-qe/maintainers', | ||
componentName: `test-scaffoldedfromlink-${Date.now()}`, | ||
description: 'react app using template', | ||
repo: `test-scaffolded-${Date.now()}`, | ||
repoOwner: process.env.GITHUB_ORG || 'janus-qe', | ||
}; | ||
|
||
test.beforeAll(async ({ browser }, testInfo) => { | ||
page = (await setupBrowser(browser, testInfo)).page; | ||
|
||
common = new Common(page); | ||
uiHelper = new UIhelper(page); | ||
catalogImport = new CatalogImport(page); | ||
|
||
await common.loginAsGithubUser(); | ||
}); | ||
test('Register an Template', async () => { | ||
await uiHelper.openSidebar('Catalog'); | ||
await uiHelper.clickButton('Create'); | ||
await uiHelper.clickButton('Register Existing Component'); | ||
await catalogImport.registerExistingTemplate(template); | ||
}); | ||
|
||
test('Create a React App using the newly registered Template', async () => { | ||
await uiHelper.openSidebar('Catalog'); | ||
await uiHelper.clickButton('Create'); | ||
await uiHelper.searchInputPlaceholder('Create React'); | ||
|
||
await uiHelper.verifyText('Create React App Template'); | ||
await uiHelper.clickButton('Choose'); | ||
|
||
await uiHelper.fillTextInputByLabel('Name', reactAppDetails.componentName); | ||
await uiHelper.fillTextInputByLabel( | ||
'Description', | ||
reactAppDetails.description, | ||
); | ||
await uiHelper.fillTextInputByLabel('Owner', reactAppDetails.owner); | ||
await uiHelper.clickButton('Next'); | ||
|
||
await uiHelper.fillTextInputByLabel('Owner', reactAppDetails.repoOwner); | ||
await uiHelper.fillTextInputByLabel('Repository', reactAppDetails.repo); | ||
await uiHelper.clickButton('Review'); | ||
|
||
await uiHelper.verifyRowInTableByUniqueText('Owner', [ | ||
`group:${reactAppDetails.owner}`, | ||
]); | ||
await uiHelper.verifyRowInTableByUniqueText('Component Id', [ | ||
reactAppDetails.componentName, | ||
]); | ||
await uiHelper.verifyRowInTableByUniqueText('Description', [ | ||
reactAppDetails.description, | ||
]); | ||
await uiHelper.verifyRowInTableByUniqueText('Repo Url', [ | ||
`github.com?owner=${reactAppDetails.repoOwner}&repo=${reactAppDetails.repo}`, | ||
]); | ||
|
||
await uiHelper.clickButton('Create'); | ||
await uiHelper.clickLink('Open in catalog'); | ||
}); | ||
|
||
test('Verify Scaffolded link in components Dependencies and scaffoldedFrom relation in entity Raw Yaml ', async () => { | ||
await common.clickOnGHloginPopup(); | ||
await uiHelper.clickTab('Dependencies'); | ||
await uiHelper.verifyText( | ||
`ownerOf / ownedByscaffoldedFromcomponent:${reactAppDetails.componentName}group:${reactAppDetails.owner}Create React App Template`, | ||
); | ||
await catalogImport.inspectEntityAndVerifyYaml( | ||
`- type: scaffoldedFrom\n targetRef: template:default/create-react-app-template-with-timestamp-entityref\n target:\n kind: template\n namespace: default\n name: create-react-app-template-with-timestamp-entityref`, | ||
); | ||
}); | ||
|
||
test('Verify Registered Template and scaffolderOf relation in entity Raw Yaml', async () => { | ||
await uiHelper.openSidebar('Catalog'); | ||
await uiHelper.selectMuiBox('Kind', 'Template'); | ||
await uiHelper.searchInputPlaceholder('Create React App Template'); | ||
await uiHelper.verifyRowInTableByUniqueText('Create React App Template', [ | ||
'website', | ||
]); | ||
await uiHelper.clickLink('Create React App Template'); | ||
|
||
await catalogImport.inspectEntityAndVerifyYaml( | ||
`- type: scaffolderOf\n targetRef: component:default/${reactAppDetails.componentName}\n target:\n kind: component\n namespace: default\n name: ${reactAppDetails.componentName}\n`, | ||
); | ||
|
||
await uiHelper.clickLink('Launch Template'); | ||
await uiHelper.verifyText('Provide some simple information'); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await APIHelper.githubRequest( | ||
'DELETE', | ||
githubAPIEndpoints.deleteRepo( | ||
reactAppDetails.repoOwner, | ||
reactAppDetails.repo, | ||
), | ||
); | ||
await page.close(); | ||
}); | ||
}); |
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