Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] 馃巵 Support for ODC 4.15 #2563

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions test/ui-e2e-tests.sh
Expand Up @@ -36,8 +36,14 @@ OCP_USERNAME="${OCP_USERNAME:-uitesting}"
OCP_PASSWORD="${OCP_PASSWORD:-$(echo "$OCP_USERNAME" | sha1sum - | awk '{print $1}')}"
OCP_LOGIN_PROVIDER="${OCP_LOGIN_PROVIDER:-my_htpasswd_provider}"
CYPRESS_BASE_URL="https://$(oc get route console -n openshift-console -o jsonpath='{.status.ingress[].host}')"

# use dev to run test development UI
NPM_TARGET="${NPM_TARGET:-test}"
DEFAULT_NPM_TARGET='test'
if [ $# -gt 0 ] && [ "$1" = "--dev" ]; then
DEFAULT_NPM_TARGET='dev'
shift
fi

if [ -n "${BUILD_ID:-}" ]; then
export CYPRESS_NUM_TESTS_KEPT_IN_MEMORY=0
fi
Expand All @@ -51,4 +57,4 @@ logger.success '馃殌 Cluster prepared for testing.'
pushd "$(dirname "${BASH_SOURCE[0]}")/ui" >/dev/null
npm install
npm run install
npm run "${NPM_TARGET}"
npm run "${NPM_TARGET:-$DEFAULT_NPM_TARGET}"
27 changes: 10 additions & 17 deletions test/ui/cypress/code/knative/serving/showcase.js
Expand Up @@ -23,8 +23,12 @@ class ShowcaseKservice {
* @returns {Cypress.Chainable<URL>} - the URL of the kservice
*/
url() {
if (this.clusterLocal && environment.ocpVersion().satisfies('>=4.12')) {
return cy.get('.overview__sidebar-pane .pf-c-clipboard-copy input[type=text]')
if (this.clusterLocal) {
let selector = '.overview__sidebar-pane .pf-v5-c-clipboard-copy input[type=text]'
if (environment.ocpVersion().satisfies('<=4.14')) {
selector = '.overview__sidebar-pane .pf-c-clipboard-copy input[type=text]'
}
return cy.get(selector)
.last()
.scrollIntoView()
.should('have.attr', 'value')
Expand Down Expand Up @@ -80,7 +84,6 @@ class ShowcaseKservice {
}

deployImage({kind = 'regular'} = {}) {
const ver = environment.ocpVersion()
cy.log(`Deploy kservice ${kind}${this.clusterLocal ? ', cluster-local' : ''} from image`)
cy.visit(`/deploy-image/ns/${this.namespace}`)
cy.get('input[name=searchTerm]')
Expand All @@ -94,11 +97,6 @@ class ShowcaseKservice {
.scrollIntoView()
.clear()
.type(this.name)
if (ver.satisfies('<4.12')) {
cy.get('input#form-radiobutton-resources-knative-field')
.scrollIntoView()
.check()
}
cy.get('input#form-checkbox-route-create-field')
.scrollIntoView()
.check()
Expand Down Expand Up @@ -167,17 +165,17 @@ class ShowcaseKservice {
.should('not.be.disabled')
.click()
drawer
.get(selectors.deleteApplicationBtn)
.get('li[data-test-action="Delete application"] button')
.should('be.visible')
.should('not.be.disabled')
.click()
cy.get('input#form-input-resourceName-field')
.type(this.app)
cy.get('button#confirm-action.pf-c-button.pf-m-danger').click()
cy.get('.modal-content button#confirm-action.pf-m-danger').click()
// FIXME: https://issues.redhat.com/browse/OCPBUGS-6685
// Removal of the app sometimes leaves a image stream, making the UI
// stale.
this.deleteAppGroupViaKubectl().then((deleted) => {
this.deleteAppGroupViaKubectl().then((_deleted) => {
cy.get('div.pf-topology-content')
.contains('No resources found')
})
Expand All @@ -195,12 +193,7 @@ class ShowcaseKservice {
}

topologyUrl(kind = 'list') {
const ver = environment.ocpVersion()
if (ver.satisfies('>=4.9')) {
return `/topology/ns/${this.namespace}?view=${kind}`
} else {
return `/topology/ns/${this.namespace}/${kind}`
}
return `/topology/ns/${this.namespace}?view=${kind}`
}
}

Expand Down
41 changes: 22 additions & 19 deletions test/ui/cypress/code/openshift/openshiftConsole.js
Expand Up @@ -50,10 +50,7 @@ class OpenshiftConsole {
cy.visit(`/add/ns/${namespace}?view=graph`)
cy.get('#content').contains('Add')
cy.get('body').then(($body) => {
let selector = '[data-test="guided-tour-modal"]'
if (environment.ocpVersion().satisfies('>=4.9')) {
selector = '#guided-tour-modal'
}
let selector = '#guided-tour-modal'
cy.log(`Guided Tour modal selector used: ${selector}`)
const modal = $body.find(selector)
if (modal.length) {
Expand All @@ -66,31 +63,37 @@ class OpenshiftConsole {
const selectors = this.sidebarSelectors()
cy.get(selectors.drawer)
.then(($drawer) => {
if ($drawer.hasClass(selectors.expandedCls)) {
const selector = selectors.drawer +
' button[data-test-id=sidebar-close-button]'
if (selectors.checkIsOpen($drawer)) {
cy.log('Closing sidebar')
cy.get(selectors.closeBtn).click()
cy.get(selector).click()
}
})
}

sidebarSelectors() {
let dataTestAction = 'Delete application'
if (environment.ocpVersion().satisfies('<4.11')) {
dataTestAction = 'Delete Application'
}
if (environment.ocpVersion().satisfies('<4.10')) {
if (environment.ocpVersion().satisfies('<=4.14')) {
return {
drawer: '.odc-topology .pf-topology-container',
expandedCls: 'pf-topology-container__with-sidebar--open',
closeBtn: '.odc-topology .pf-topology-container .pf-topology-side-bar button.close',
deleteApplicationBtn: `button[data-test-action="${dataTestAction}"]`
/**
* @param drawer {JQuery<HTMLElement>}
* @returns {boolean}
*/
checkIsOpen: function (drawer) {
return drawer.hasClass('pf-m-expanded')
},
drawer: '.odc-topology .pf-c-drawer',
}
}
return {
drawer: '.odc-topology .pf-c-drawer',
expandedCls: 'pf-m-expanded',
closeBtn: '.odc-topology .pf-c-drawer button[data-test-id=sidebar-close-button]',
deleteApplicationBtn: `li[data-test-action="${dataTestAction}"] button`
/**
* @param drawer {JQuery<HTMLElement>}
* @returns {boolean}
*/
checkIsOpen: function (drawer) {
return drawer.find('.pf-topology-resizable-side-bar').length > 0
},
drawer: '.pf-v5-c-drawer__panel.ocs-sidebar-index',
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions test/ui/cypress/e2e/eventing/types.cy.js
@@ -1,21 +1,14 @@
import Environment from '../../code/environment'
import ShowcaseKservice from '../../code/knative/serving/showcase'
import OpenshiftConsole from '../../code/openshift/openshiftConsole'

describe('OCP UI for Serverless Eventing', () => {

const environment = new Environment()
const openshiftConsole = new OpenshiftConsole()
const ns = Cypress.env('TEST_NAMESPACE')

it('have Eventing bits to add', () => {
openshiftConsole.login()
cy.visit(`/add/ns/${ns}`)
cy.contains('Event Source')
if (environment.ocpVersion().satisfies('>=4.11')) {
cy.contains('Event Sink')
} else {
cy.contains('Channel')
}
cy.contains('Event Sink')
})
})
5 changes: 0 additions & 5 deletions test/ui/cypress/e2e/serving/cluster-local.cy.js
@@ -1,20 +1,15 @@
import Environment from '../../code/environment'
import ShowcaseKservice from '../../code/knative/serving/showcase'
import OpenshiftConsole from '../../code/openshift/openshiftConsole'

describe('OCP UI for Serverless Serving', () => {

const environment = new Environment()
const openshiftConsole = new OpenshiftConsole()
const showcaseKsvc = new ShowcaseKservice({
clusterLocal: true,
namespace: 'test-cluster-local'
})

it('can deploy a cluster-local service', () => {
const range = '>=4.8 || ~4.7.18 || ~4.6.39'
cy.onlyOn(environment.ocpVersion().satisfies(range))

openshiftConsole.login()
showcaseKsvc.removeApp()
showcaseKsvc.deployImage()
Expand Down
12 changes: 5 additions & 7 deletions test/ui/cypress/e2e/serving/multiple-revisions.cy.js
Expand Up @@ -43,14 +43,12 @@ describe('OCP UI for Serverless Serving', () => {
cy.get('input[name="trafficSplitting.1.tag"]')
.type('v1')
cy.contains('Select a Revision', {matchCase: false}).click()
cy.get('ul.pf-c-dropdown__menu button').click()
cy.get('button[type=submit]').click()

// FIXME: Remove after 4.11+ is the minimal required version
// See: https://issues.redhat.com/browse/OCPBUGSM-41966
if (environment.ocpVersion().satisfies('<4.11')) {
showcaseKsvc.showServiceDetails()
let selector = `ul.pf-v5-c-dropdown__menu button`
if (environment.ocpVersion().satisfies('<=4.14')) {
selector = `ul.pf-c-dropdown__menu button`
}
cy.get(selector).click()
cy.get('button[type=submit]').click()

cy.log('Verify traffic is routed to both v1 and v2')
cy.contains('51%')
Expand Down