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

Create from URL e2e tests #1195

Merged
merged 2 commits into from
Feb 10, 2017
Merged

Create from URL e2e tests #1195

merged 2 commits into from
Feb 10, 2017

Conversation

rhamilto
Copy link
Member

@rhamilto rhamilto commented Jan 30, 2017

Huge assist from @benjaminapetersen

@rhamilto rhamilto changed the title [WIP] Create for URL e2e tests Create for URL e2e tests Jan 31, 2017
@rhamilto rhamilto changed the title Create for URL e2e tests Create from URL e2e tests Jan 31, 2017
Copy link
Contributor

@benjaminapetersen benjaminapetersen left a comment

Choose a reason for hiding this comment

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

LGTM, just a few small nits since I'm fairly familiar with all this. Def looking forward to having out test suite grow.

catalogPage
.processImageStream(JSON.stringify(centosImageStream))
.then(function() {
// verify we have the nodejs image stream loaded
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd kind of like to be able to get rid of this comment and have something in code like:

expect(tableRowFor('nodejs')).toBe(true);

But we can prob add that helper later as I bet we would want a few table helpers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a TODO so we're consistent with user_adds_template_to_project.spec.js

Copy link
Contributor

Choose a reason for hiding this comment

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

nice

let namespaceForFixtures = "template-dumpster";

let setupEnv = function() {
// add namespace to create whitelist for template and image stream
Copy link
Contributor

Choose a reason for hiding this comment

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

let name = 'nodejs-edited';
let sourceURI = 'https://github.com/openshift/nodejs-ex.git-edited';
let sourceRef = 'master-edited';
let contextDir = '/-edited';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can update the qs var to get rid of the + with a template literal and ${placeholders}:

let qs = `?imageStream=nodejs&imageTag=4&name=${name}&sourceURI=${sourceURI}&sourceRef=${sourceRef}&contextDir=${contextDir}&namespace=${namespaceForFixtures}`;
let uri = `project/${project.name}create/fromimage${qs}`;

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

it('should load the image stream in to a newly created project', function(){
let createFromURLPage = new CreateFromURLPage();
createFromURLPage.visit(qs);
// NOTE: if the tabs are on the page because there are existing projects, click the 'Create New Project' tab first
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop this comment since we don't have the if statement here anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

expect(nameInput.getAttribute('value')).toEqual(name);
let sourceURIInput = element(by.model('buildConfig.sourceUrl'));
expect(sourceURIInput.getAttribute('value')).toEqual(sourceURI);
// click "Show advanced..." link to reveal hidden fields
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be pushed up into the page object as a method .clickShowAdvanced() & eliminate the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

it('should load the template in to a newly created project', function() {
let createFromURLPage = new CreateFromURLPage();
createFromURLPage.visit(qs);
// NOTE: if the tabs are on the page because there are existing projects, click the 'Create New Project' tab first
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, i think we changed this to not use the if/else so can delete the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -42,24 +38,42 @@ describe('User adds a template to a project', function() {
// verify we have the 2 deployments in the template
var deploymentsPage = new DeploymentsPage(project);
deploymentsPage.visit();
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true); // TODO: use fixture
Copy link
Member

Choose a reason for hiding this comment

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

TODO's should be obvious what is needed for someone coming else looking at this later. Also fixture isn't doesn't seem like the right word here, shouldn't it be a helper.

Copy link
Contributor

Choose a reason for hiding this comment

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

That comment means to eventually use the fixture (json) and pluck out the names, rather than hard-coding mongodb, nodejs-mongodb-example.

Is on my list to add some table helpers as well.

const path = require('path');
// to use: a template literal is probably the easiest way to provide JS to inject into the
// extensions.js file. Please wrap in IIFE as addExtension() may be called multiple times &
// the file contents will be concatonated:
Copy link
Member

Choose a reason for hiding this comment

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

typo: concatenated

// `;
// adding to the extension.js file:
// addExtension(jsToWrite)
exports.addExtension = function(fileContents) {
Copy link
Member

Choose a reason for hiding this comment

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

I dont ever see this cleaning up after itself, are the tests leaving .tmp/extensions.js in a modified state? It should at least make a best effort to clean up.

Copy link
Contributor

Choose a reason for hiding this comment

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

That whole directory gets blown away every time we build. running the tests over and over will generate all new files. Still think its necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess so long as there is a hard refresh which will pick up a cleaned up extensions.js file, we could clean it up. But without a hard refresh updates won't change in the browser. Hmmm.

@jwforres
Copy link
Member

jwforres commented Jan 31, 2017 via email

@jwforres
Copy link
Member

can we squash the commits in the branch a bit, could squash the last 3 together

rhamilto and others added 2 commits February 10, 2017 13:25
@rhamilto
Copy link
Member Author

can we squash the commits in the branch a bit, could squash the last 3 together

Done.

@jwforres
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 09ea11d

@openshift-bot
Copy link

openshift-bot commented Feb 10, 2017

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/1022/) (Base Commit: 35f0730)

@benjaminapetersen
Copy link
Contributor

yay!

@openshift-bot openshift-bot merged commit e56ff68 into openshift:master Feb 10, 2017
@rhamilto rhamilto deleted the run-on-e2e branch February 22, 2017 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants