Skip to content

Commit afb2707

Browse files
Merge pull request #1197 from spadgett/test-in-cluster-console
Test in-cluster console for e2e tests
2 parents be656a7 + eeeb4eb commit afb2707

File tree

7 files changed

+29
-57
lines changed

7 files changed

+29
-57
lines changed

frontend/integration-tests/protractor.conf.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const config: Config = {
3131
plugins: [failFast.init()],
3232
capabilities: {
3333
browserName: 'chrome',
34+
acceptInsecureCerts: true,
3435
chromeOptions: {
3536
args: [
3637
'--disable-gpu',
@@ -67,6 +68,9 @@ export const config: Config = {
6768
consoleLogStream.write(`${format.apply(null, [`[${level.name}]`, messageStr])}\n`);
6869
});
6970

71+
const url = await browser.getCurrentUrl();
72+
console.log('Last browser URL: ', url);
73+
7074
// Use projects if OpenShift so non-admin users can run tests. We need the fully-qualified name
7175
// since we're using kubectl instead of oc.
7276
const resource = browser.params.openshift === 'true' ? 'projects.project.openshift.io' : 'namespaces';

frontend/integration-tests/tests/base.scenario.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ const BROWSER_TIMEOUT = 15000;
88

99
describe('Basic console test', () => {
1010

11-
afterAll(async() => {
12-
// Clears HTTP 401 errors for subsequent tests
13-
await browser.manage().logs().get('browser');
14-
});
15-
1611
it('logs into console if necessary', async() => {
1712
await browser.get(appHost);
1813

@@ -22,7 +17,7 @@ describe('Basic console test', () => {
2217
await loginView.nameInput.sendKeys(BRIDGE_AUTH_USERNAME);
2318
await loginView.passwordInput.sendKeys(BRIDGE_AUTH_PASSWORD);
2419
await loginView.submitButton.click();
25-
await browser.wait(until.visibilityOf($('#header-logo')), BROWSER_TIMEOUT);
20+
await browser.wait(until.visibilityOf($('.pf-c-page__header')), BROWSER_TIMEOUT);
2621
}
2722

2823
expect(browser.getCurrentUrl()).toContain(appHost);

frontend/integration-tests/tests/olm/etcd.scenario.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as catalogView from '../../views/olm-catalog.view';
1010
import * as sidenavView from '../../views/sidenav.view';
1111
import * as yamlView from '../../views/yaml.view';
1212

13-
describe('Interacting with the etcd OCS', () => {
13+
xdescribe('Interacting with the etcd OCS', () => {
1414
const etcdClusterResources = new Set(['Service', 'Pod']);
1515
const deleteRecoveryTime = 60000;
1616
const etcdOperatorName = 'etcd-operator';

frontend/integration-tests/tests/performance.scenario.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ describe('Performance test', () => {
8585

8686
it(`downloads new bundle for ${routeName}`, async() => {
8787
await browser.get(`${appHost}/status/all-namespaces`);
88+
await browser.executeScript(() => performance.setResourceTimingBufferSize(1000));
8889
await browser.wait(until.presenceOf(crudView.resourceTitle));
8990
// Avoid problems where the Catalog nav section appears where Workloads was at the moment the tests try to click.
9091
await browser.wait(until.visibilityOf(sidenavView.navSectionFor('Catalog')));

frontend/integration-tests/views/login.view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
import { $ } from 'protractor';
44

5-
export const nameInput = $('input[name=login]');
6-
export const passwordInput = $('input[name=password]');
5+
export const nameInput = $('#inputUsername');
6+
export const passwordInput = $('#inputPassword');
77
export const submitButton = $('button[type=submit]');

test-gui.sh

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,14 @@
11
#!/usr/bin/env bash
22

3-
set -euo pipefail
4-
5-
6-
BRIDGE_K8S_AUTH_BEARER_TOKEN=$(kubectl config view -o json | jq '{myctx: .["current-context"], ctxs: .contexts[], users: .users[]}' | jq 'select(.myctx == .ctxs.name)' | jq 'select(.ctxs.context.user == .users.name)' | jq '.users.user.token' -r)
7-
export BRIDGE_K8S_AUTH_BEARER_TOKEN
8-
if [ -z "$BRIDGE_K8S_AUTH_BEARER_TOKEN" ];
9-
then
10-
echo "no BRIDGE_K8S_AUTH_BEARER_TOKEN!?"
11-
exit 1
12-
fi
13-
14-
BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT=$(kubectl config view -o json | jq '{myctx: .["current-context"], ctxs: .contexts[], clusters: .clusters[]}' | jq 'select(.myctx == .ctxs.name)' | jq 'select(.ctxs.context.cluster == .clusters.name)' | jq '.clusters.cluster.server' -r)
15-
export BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT
16-
if [ -z "$BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT" ];
17-
then
18-
echo "no BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT!?"
19-
exit 1
20-
fi
21-
22-
BRIDGE_BASE_PATH="/path-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c10)/"
23-
export BRIDGE_BASE_PATH
24-
25-
# TODO: eventually test auth
26-
./bin/bridge \
27-
--k8s-mode="off-cluster" \
28-
--user-auth="disabled" \
29-
--k8s-mode-off-cluster-skip-verify-tls=true \
30-
--k8s-auth="bearer-token" \
31-
--k8s-mode-off-cluster-endpoint="$BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT" \
32-
--k8s-auth-bearer-token="$BRIDGE_K8S_AUTH_BEARER_TOKEN" &
33-
34-
echo $! > bridge.pid
3+
set -exuo pipefail
354

365
cd frontend
37-
yarn run webdriver-update --quiet > /dev/null 2>&1
6+
yarn install
7+
yarn run webdriver-update
388

399
if [ $# -gt 0 ] && [ -n "$1" ];
4010
then
41-
yarn run test-suite --suite "$1" --params.openshift true --params.servicecatalog false
11+
yarn run test-suite --suite "$1" --params.openshift true
4212
else
43-
yarn run test-gui --params.openshift true --params.servicecatalog true
13+
yarn run test-gui --params.openshift true
4414
fi
45-
46-
kill "$(cat ../bridge.pid)"

test-prow-e2e.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@
22

33
set -exuo pipefail
44

5-
ARTIFACT_DIR=/tmp/artifacts
6-
export ARTIFACT_DIR
5+
ARTIFACT_DIR=${ARTIFACT_DIR:=/tmp/artifacts}
6+
SCREENSHOTS_DIR=frontend/gui_test_screenshots
7+
INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer}
78

89
function copyArtifacts {
9-
echo "Copying artifacts from $(pwd)..."
10-
cp -rv ./frontend/gui_test_screenshots "${ARTIFACT_DIR}/gui_test_screenshots"
10+
if [ -d "$ARTIFACT_DIR" ] && [ -d "$SCREENSHOTS_DIR" ]; then
11+
echo "Copying artifacts from $(pwd)..."
12+
cp -rv "$SCREENSHOTS_DIR" "${ARTIFACT_DIR}/gui_test_screenshots"
13+
fi
1114
}
1215

1316
trap copyArtifacts EXIT
1417

15-
./build.sh
18+
export BRIDGE_AUTH_USERNAME=kubeadmin
19+
# don't log kubeadmin-password
20+
set +x
21+
export BRIDGE_AUTH_PASSWORD="$(cat "${INSTALLER_DIR}/auth/kubeadmin-password")"
22+
set -x
23+
export BRIDGE_BASE_ADDRESS="https://$(oc get route console -n openshift-console -o jsonpath='{.spec.host}')"
1624

17-
oc login -u kubeadmin -p $(cat "${ARTIFACT_DIR}/installer/auth/kubeadmin-password")
18-
19-
source ./contrib/oc-environment.sh
20-
21-
kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_06-rh-operators.configmap.yaml
22-
kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_09-rh-operators.catalogsource.yaml
25+
oc create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_06-rh-operators.configmap.yaml
26+
oc create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_09-rh-operators.catalogsource.yaml
2327

2428
./test-gui.sh e2e

0 commit comments

Comments
 (0)