-
Notifications
You must be signed in to change notification settings - Fork 264
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
Showing
4 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
cypress/e2e/po/other-products/logging/logging-clusterflow-po.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,82 @@ | ||
import PagePo from '@/cypress/e2e/po/pages/page.po'; | ||
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po'; | ||
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po'; | ||
import TabbedPo from '@/cypress/e2e/po/components/tabbed.po'; | ||
import ResourceListMastheadPo from '@/cypress/e2e/po/components/ResourceList/resource-list-masthead.po'; | ||
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po'; | ||
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po'; | ||
import ArrayListPo from '@/cypress/e2e/po/components/array-list.po'; | ||
|
||
export class LoggingClusterflowListPagePo extends PagePo { | ||
private static createPath(clusterId: string) { | ||
return `/c/${ clusterId }/logging/logging.banzaicloud.io.clusterflow`; | ||
} | ||
|
||
static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> { | ||
return super.goTo(LoggingClusterflowListPagePo.createPath(clusterId)); | ||
} | ||
|
||
constructor(clusterId = 'local') { | ||
super(LoggingClusterflowListPagePo.createPath(clusterId)); | ||
} | ||
|
||
masthead() { | ||
return new ResourceListMastheadPo(this.self()); | ||
} | ||
|
||
createLoggingFlow() { | ||
return this.masthead().create(); | ||
} | ||
|
||
listElementWithName(name:string) { | ||
const baseResourceList = new BaseResourceList(this.self()); | ||
|
||
return baseResourceList.resourceTable().sortableTable().rowElementWithName(name); | ||
} | ||
|
||
rowLinkWithName(name: string) { | ||
const baseResourceList = new BaseResourceList(this.self()); | ||
|
||
return baseResourceList.resourceTable().sortableTable().detailsPageLinkWithName(name); | ||
} | ||
} | ||
|
||
export class LoggingClusterflowEditPagePo extends PagePo { | ||
static url: string; | ||
|
||
private static createPath( clusterId: string, name: string ) { | ||
const urlStr = `/c/${ clusterId }/logging/logging.banzaicloud.io.clusterflow/${ name }#`; | ||
|
||
return urlStr; | ||
} | ||
|
||
static goTo(): Cypress.Chainable<Cypress.AUTWindow> { | ||
return super.goTo(this.url); | ||
} | ||
|
||
constructor(clusterId = 'local', name = 'create') { | ||
super(LoggingClusterflowEditPagePo.createPath(clusterId, name)); | ||
|
||
LoggingClusterflowEditPagePo.url = LoggingClusterflowEditPagePo.createPath(clusterId, name); | ||
} | ||
|
||
nameNsDescription() { | ||
return new NameNsDescription(this.self()); | ||
} | ||
|
||
outputsTab() { | ||
return new TabbedPo().clickTabWithSelector('[data-testid="btn-outputs"]'); | ||
} | ||
|
||
outputSelector() { | ||
return new LabeledSelectPo('section#outputs .labeled-select'); | ||
} | ||
|
||
saveCreateForm(): AsyncButtonPo { | ||
return new AsyncButtonPo('[data-testid="form-save"]', this.self()); | ||
} | ||
|
||
ruleItem(index: number) { | ||
return new ArrayListPo(this.self()).arrayListItem(index); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
cypress/e2e/po/other-products/logging/logging-clusteroutput.po.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,76 @@ | ||
import PagePo from '@/cypress/e2e/po/pages/page.po'; | ||
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po'; | ||
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po'; | ||
import TabbedPo from '@/cypress/e2e/po/components/tabbed.po'; | ||
import ResourceListMastheadPo from '@/cypress/e2e/po/components/ResourceList/resource-list-masthead.po'; | ||
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po'; | ||
import SelectPo from '@/cypress/e2e/po/components/select.po'; | ||
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po'; | ||
|
||
export class LoggingClusteroutputListPagePo extends PagePo { | ||
private static createPath(clusterId: string) { | ||
return `/c/${ clusterId }/logging/logging.banzaicloud.io.clusteroutput`; | ||
} | ||
|
||
static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> { | ||
return super.goTo(LoggingClusteroutputListPagePo.createPath(clusterId)); | ||
} | ||
|
||
constructor(clusterId = 'local') { | ||
super(LoggingClusteroutputListPagePo.createPath(clusterId)); | ||
} | ||
|
||
masthead() { | ||
return new ResourceListMastheadPo(this.self()); | ||
} | ||
|
||
createLoggingOutput() { | ||
return this.masthead().create(); | ||
} | ||
|
||
listElementWithName(name:string) { | ||
const baseResourceList = new BaseResourceList(this.self()); | ||
|
||
return baseResourceList.resourceTable().sortableTable().rowElementWithName(name); | ||
} | ||
} | ||
|
||
export class LoggingClusteroutputEditPagePo extends PagePo { | ||
static url: string; | ||
|
||
private static createPath( clusterId: string, name: string ) { | ||
const urlStr = `/c/${ clusterId }/logging/logging.banzaicloud.io.clusteroutput/${ name }#`; | ||
|
||
return urlStr; | ||
} | ||
|
||
static goTo(): Cypress.Chainable<Cypress.AUTWindow> { | ||
return super.goTo(this.url); | ||
} | ||
|
||
constructor(clusterId = 'local', name = 'create') { | ||
super(LoggingClusteroutputEditPagePo.createPath(clusterId, name)); | ||
|
||
LoggingClusteroutputEditPagePo.url = LoggingClusteroutputEditPagePo.createPath(clusterId, name); | ||
} | ||
|
||
nameNsDescription() { | ||
return new NameNsDescription(this.self()); | ||
} | ||
|
||
clickTab(selector: string) { | ||
return new TabbedPo().clickTabWithSelector(selector); | ||
} | ||
|
||
selectOutputProviderWithLabel(providerName: string) { | ||
return new SelectPo(this.self()).clickOptionWithLabel(providerName); | ||
} | ||
|
||
target(): LabeledInputPo { | ||
return LabeledInputPo.byLabel(this.self(), 'URL'); | ||
} | ||
|
||
saveCreateForm(): AsyncButtonPo { | ||
return new AsyncButtonPo('[data-testid="form-save"]', this.self()); | ||
} | ||
} |
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,75 @@ | ||
import { ChartPage } from '@/cypress/e2e/po/pages/explorer/charts/chart.po'; | ||
import HomePagePo from '@/cypress/e2e/po/pages/home.po'; | ||
import { InstallChartPage } from '@/cypress/e2e/po/pages/explorer/charts/install-charts.po'; | ||
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po'; | ||
import { LoggingClusteroutputEditPagePo, LoggingClusteroutputListPagePo } from '@/cypress/e2e/po/other-products/logging/logging-clusteroutput.po'; | ||
import { LoggingClusterflowEditPagePo, LoggingClusterflowListPagePo } from '@/cypress/e2e/po/other-products/logging/logging-clusterflow-po'; | ||
import Kubectl from '@/cypress/e2e/po/components/kubectl.po'; | ||
|
||
describe('Logging Chart', { testIsolation: 'off', tags: ['@charts', '@adminUser'] }, () => { | ||
before(() => { | ||
cy.login(); | ||
HomePagePo.goTo(); | ||
}); | ||
|
||
it('is installed and a rule created', () => { | ||
cy.updateNamespaceFilter('local', 'none', '{"local":[]}'); | ||
const installChartPage = new InstallChartPage(); | ||
const chartPage = new ChartPage(); | ||
const sideNav = new ProductNavPo(); | ||
const kubectl = new Kubectl(); | ||
const outputName = Cypress._.uniqueId(Date.now().toString()); | ||
const flowName = Cypress._.uniqueId(Date.now().toString()); | ||
const loggingOutputList = new LoggingClusteroutputListPagePo(); | ||
const loggingOutputEdit = new LoggingClusteroutputEditPagePo(); | ||
const loggingFlowList = new LoggingClusterflowListPagePo(); | ||
const loggingFlowEdit = new LoggingClusterflowEditPagePo(); | ||
|
||
ChartPage.navTo(null, 'Logging'); | ||
chartPage.waitForChartHeader('Logging', { timeout: 20000 }); | ||
chartPage.goToInstall(); | ||
installChartPage.nextPage(); | ||
|
||
cy.intercept('POST', 'v1/catalog.cattle.io.clusterrepos/rancher-charts?action=install').as('chartInstall'); | ||
installChartPage.installChart(); | ||
cy.wait('@chartInstall').its('response.statusCode').should('eq', 201); | ||
cy.contains('Disconnected'); | ||
|
||
kubectl.closeTerminal(); | ||
|
||
sideNav.navToSideMenuGroupByLabel('Logging'); | ||
sideNav.navToSideMenuGroupByLabel('ClusterOutput'); | ||
loggingOutputList.createLoggingOutput(); | ||
loggingOutputEdit.waitForPage(); | ||
loggingOutputEdit.nameNsDescription().name().set(outputName); | ||
loggingOutputEdit.target().set('random.domain.site'); | ||
loggingOutputEdit.saveCreateForm().click(); | ||
loggingOutputList.waitForPage(); | ||
loggingOutputList.listElementWithName(outputName).should('exist'); | ||
|
||
sideNav.navToSideMenuEntryByLabel('ClusterFlow'); | ||
loggingFlowList.createLoggingFlow(); | ||
loggingFlowEdit.waitForPage(); | ||
loggingFlowEdit.nameNsDescription().name().set(flowName); | ||
loggingFlowEdit.outputsTab(); | ||
loggingFlowEdit.outputSelector().toggle(); | ||
loggingFlowEdit.outputSelector().clickOptionWithLabel(outputName); | ||
loggingFlowEdit.saveCreateForm().click(); | ||
loggingFlowList.waitForPage(); | ||
loggingFlowList.listElementWithName(flowName).should('exist'); | ||
loggingFlowList.rowLinkWithName(flowName).click(); | ||
const loggingFlowEditExisting = new LoggingClusterflowEditPagePo('local', flowName); | ||
|
||
loggingFlowEditExisting.ruleItem(0).should('be.visible'); | ||
}); | ||
|
||
after('clean up', () => { | ||
const chartNamespace = 'cattle-logging-system'; | ||
const chartApp = 'rancher-logging'; | ||
const chartCrd = 'rancher-logging-crd'; | ||
|
||
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartApp }?action=uninstall`, '{}'); | ||
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartCrd }?action=uninstall`, '{}'); | ||
cy.updateNamespaceFilter('local', 'none', '{"local":["all://user"]}'); | ||
}); | ||
}); |