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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Cloud Kibana UI testing #8880

Merged
merged 4 commits into from
Nov 1, 2016
Merged

Conversation

LeeDr
Copy link
Contributor

@LeeDr LeeDr commented Oct 28, 2016

Support Cloud Kibana testing; Fixes #8861

  • tested setting environment variables for all elasticsearch and kibana protocol/host/port/user/pass settings.
  • Renamed "TEST_UI__" and "SHIELD__" variables to just be "TEST_*" to make life easier when setting these variables.
  • Browsers don't show ports 80 or 443 in the address bar, so filter them out of the expected URL in the navigateToApp function and in the link sharing tests.
  • Updated CONTRIBUTING.md to describe how to run tests against some other instance.
  • added a try loop around a failed data table test (not really related to Cloud testing but it failed for me once).
  • Added 'x-pack' "test" to check for the X-Pack Welcome banner and, if there, opt out, and dismiss. It's in a before method and so doesn't count as a test.
  • Instead of looking for the X-Pack welcome banner with some multi-second timeout, I got the outer toaster-container and got the text from it. Getting this and checking if the text contains 'X-Pack' happens in about 0.1s compared to a find timeout for something in the banner with a default of 10s.

I moved the run:devChromeDriver grunt task from the test:ui:server task to the test:ui:runner task since then you only need to run test:ui:runner against some already running Elasticsearch and Kibana servers.

If anyone wants to run this against my Cloud 5.0 instance I can give you the configuration settings.

@LeeDr LeeDr added the test label Oct 28, 2016
@LeeDr
Copy link
Contributor Author

LeeDr commented Oct 28, 2016

This is in the CONTRIBUTING doc as an example for testing against Cloud;

export TEST_KIBANA_PROTOCOL=https
export TEST_KIBANA_HOSTNAME=9249d04b1186b3e7bbe11ea60df4f963.us-east-1.aws.found.io
export TEST_KIBANA_PORT=443
export TEST_KIBANA_USER=elastic
export TEST_KIBANA_PASS=<ping me for this>

export TEST_ES_PROTOCOL=http
export TEST_ES_HOSTNAME=aaa5d22032d76805fcce724ed9d9f5a2.us-east-1.aws.found.io
export TEST_ES_PORT=9200
export TEST_ES_USER=elastic
export TEST_ES_PASS=<ping me for this>
npm run test:ui:runner

@rashmivkulkarni
Copy link
Contributor

To test this PR:

  • Checked out 5.0 Kibana : git clone https://github.com/elastic/kibana.git
  • Set the Upstream to 8880(PR)
    git remote add upstream git@github.com:elastic/kibana.git
  • git Fetch the PR
    git fetch upstream pull/8880/head && git checkout FETCH_HEAD
  • Do npm install
  • Do node --version : it should be v6.9.0 if old just do ( nvm install "$(cat .node-version)" to update the version)
  • Do nvm --version : 0.31.1
  • Update the run with the following cloud settings
export TEST_KIBANA_PROTOCOL=https
export TEST_KIBANA_HOSTNAME=f1b2798bb2ec1343528fb27091a0be72.us-east-1.aws.found.io 
export TEST_KIBANA_PORT=443
export TEST_KIBANA_USER=elastic
export TEST_KIBANA_PASS=kA1JiDX3czpjKXo7EOR4rQjt 
export TEST_ES_PROTOCOL=http
export TEST_ES_HOSTNAME=8fa6cf4361622605751460375efe1d17.us-east-1.aws.found.io
export TEST_ES_PORT=9200
export TEST_ES_USER=elastic
export TEST_ES_PASS=kA1JiDX3czpjKXo7EOR4rQjt

Do a npm run test:ui:runner and check out the results of the PR

};

exports.kibanaServer = {
username: env.SHIELD_KIBANA_SERVER || 'kibana',
password: env.SHIELD_KIBANA_SERVER_PASS || 'notsecure'
username: env.TEST_KIBANA_SERVER_USER || 'elastic',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this default to kibana?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed.

if (kibanaApp === 'login') {
self.debug('Found loginPage username = '
+ config.servers.kibana.username
+ 'password = ' + config.servers.kibana.password);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove password logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I removed the password logging.

@@ -47,7 +47,7 @@ export default class HeaderPage {
}

isTimepickerOpen() {
return this.remote.setFindTimeout(defaultFindTimeout)
return this.remote.setFindTimeout(2000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. When the timepicker is open we find it right away. When it's not open we don't want to wait the 10 second defaultFindTimeout.

@jbudz
Copy link
Member

jbudz commented Oct 31, 2016

This merge is targeting 5.0, is the plan to forward port it to master?

@@ -20,6 +20,11 @@ bdd.describe('shared links', function describeIndexTests() {

bdd.before(function () {
baseUrl = PageObjects.common.getHostPort();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on replacing this with a common.getHost method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting that instead of stripping port :80 or :443 from baseUrl, that it could test to see if that was the port and if so, baseUrl = common.getHost() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or that common.getHostPort strip the port?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using the getHostPort method and replacing the ports, adding another method called getHost() that returns without ports. my thoughts are mostly around naming, it's slightly confusing to use a method with get ports and then remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'd still have to use .getHostPort() to know if I need the .getHost() or not.

Or I could use some other method to get the kibana port first from the config, and then either .getHostPort() or .getHost().

So either this;

    baseUrl = PageObjects.common.getHostPort();
    if (baseUrl.includes(':80') || baseUrl.includes(':443') {
        baseUrl = PageObjects.common.getHost();
    }

or

if (config.kibana.port === '443' || config.kibana.port === '80') {
        baseUrl = PageObjects.common.getHost();
} else {
        baseUrl = PageObjects.common.getHostPort();
} 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, set the port to null or an empty string. Maybe it wouldn't be appended then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay I understand now, this lgtm.

@LeeDr
Copy link
Contributor Author

LeeDr commented Oct 31, 2016

@jbudz yes, I created this PR on the 5.0 branch because that's what's running on Elastic Cloud and we've already made changes in the tests in master which are not compatible with 5.0.
For example, a test-data-subj was added to the timepicker and the page object was changed to use that test-data-subj, so it won't work against a 5.0 instance of Kibana now.

But I will forward-port it to master.

@LeeDr LeeDr merged commit 4a38a3f into elastic:5.0 Nov 1, 2016
elastic-jasper added a commit that referenced this pull request Nov 1, 2016
Backports PR #8880

**Commit 1:**
Support Cloud Kibana testing

* Original sha: c877b0d
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T19:16:31Z

**Commit 2:**
Merge branch '5.0' into supportCloudTesting

* Original sha: 0c2815b
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T20:53:48Z

**Commit 3:**
Add xpack file

* Original sha: d095dac
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-29T00:02:18Z

**Commit 4:**
Use kibana for kibana server user, Don't log password

* Original sha: 9f63224
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-31T17:09:57Z
LeeDr pushed a commit that referenced this pull request Nov 1, 2016
* Support Cloud Kibana UI testing master

* Add xpack file

* cherry-pick 9f63224
elastic-jasper added a commit that referenced this pull request Nov 1, 2016
Backports PR #8880

**Commit 1:**
Support Cloud Kibana testing

* Original sha: c877b0d
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T19:16:31Z

**Commit 2:**
Merge branch '5.0' into supportCloudTesting

* Original sha: 0c2815b
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T20:53:48Z

**Commit 3:**
Add xpack file

* Original sha: d095dac
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-29T00:02:18Z

**Commit 4:**
Use kibana for kibana server user, Don't log password

* Original sha: 9f63224
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-31T17:09:57Z
elastic-jasper added a commit that referenced this pull request Nov 1, 2016
Backports PR #8915

**Commit 1:**
Support Cloud Kibana UI testing master

* Original sha: 98ba2ce
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T19:16:31Z

**Commit 2:**
Add xpack file

* Original sha: adc27ba
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-29T00:02:18Z

**Commit 3:**
cherry-pick 9f63224

* Original sha: f4549ee
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-31T17:09:57Z
LeeDr pushed a commit that referenced this pull request Nov 1, 2016
Backports PR #8915

**Commit 1:**
Support Cloud Kibana UI testing master

* Original sha: 98ba2ce
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T19:16:31Z

**Commit 2:**
Add xpack file

* Original sha: adc27ba
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-29T00:02:18Z

**Commit 3:**
cherry-pick 9f63224

* Original sha: f4549ee
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-31T17:09:57Z
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 10, 2016
* Support Cloud Kibana UI testing master

* Add xpack file

* cherry-pick 9f63224
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
Backports PR elastic#8915

**Commit 1:**
Support Cloud Kibana UI testing master

* Original sha: 98ba2ce
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-28T19:16:31Z

**Commit 2:**
Add xpack file

* Original sha: adc27ba
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-29T00:02:18Z

**Commit 3:**
cherry-pick 9f63224

* Original sha: f4549ee
* Authored by LeeDr <lee.drengenberg@elastic.co> on 2016-10-31T17:09:57Z

Former-commit-id: 9eb4f5b
@LeeDr LeeDr deleted the supportCloudTesting branch August 20, 2020 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants