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

Local visreg #60

Closed
wants to merge 86 commits into from
Closed

Local visreg #60

wants to merge 86 commits into from

Conversation

Droogans
Copy link
Contributor

@Droogans Droogans commented Oct 12, 2017

JIRA: https://jira.rax.io/browse/SURF-616

Not sure if a Design LGTM is called for here but I can at least get a demo put together for designers during a zoom review.

You can run this by navigating into the test directory, running yarn install, then npm run visreg {branchName}.

I'll demo it in better detail during the zoom review.

LGTM's

  • Dev LGTM
  • Zoom LGTM

@Droogans
Copy link
Contributor Author

I'm going to keep dumping more and more review related commits here, and try to never force push.

When it looks good to squash, I'll close this PR and open local-visreg-squashed.

@Droogans
Copy link
Contributor Author

At a minimum draw a picture (architecture diagram) of the different pieces and what kinds of input are required/used.

Copy link
Contributor

@catsiller catsiller left a comment

Choose a reason for hiding this comment

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

Zoom LGTM

Copy link
Contributor Author

@Droogans Droogans left a comment

Choose a reason for hiding this comment

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

From the PR review yesterday.

@@ -0,0 +1,13 @@
export interface IConfig {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on all of this stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Including the fact that this isn't run because it needs to be copied first.

Copy link
Contributor Author

@Droogans Droogans Oct 18, 2017

Choose a reason for hiding this comment

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


const storedToken: any = fs.existsSync(f) && fs.readFileSync(f);
const token = (storedToken || (await password("github PAT: ")));
const repoUrl = url.parse(`https://github.rackspace.com/${config.githubName}/${config.repo}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use the config here.

`cd ${config.screenshotsDirectory}`,
`git add -A`,
`git status -sb`,
`git commit -m "Baseline"`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better commit message?

test/index.ts Outdated
});
});

describe.skip("firefox", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Undo this.

@@ -0,0 +1,6 @@
#!/usr/bin/env bash

java -Dwebdriver.gecko.driver=bin/selenium/geckodriver \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Document this.


wget -nc -q https://{GH_TOKEN}@github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-${platform_gecko}.tar.gz -O bin/selenium/geckodriver-v0.18.0.tar.gz
wget -nc -q https://chromedriver.storage.googleapis.com/2.31/chromedriver_${platform_chrome}.zip -O bin/selenium/chromedriver_2.31.zip
wget -nc -q https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar -O bin/selenium/selenium-server-standalone.jar
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Document this too (brew install wget).


export var config: IConfig = {
"githubEmail": "andrew.yurisich@rackspace.com",
"githubName": "andr6283",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs a github hostname.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, consider removing my personal information and instead leave it blank or use an obviously fake account for info.

];
return safeExecSync(cmds.join('; '));

};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these anonymous util functions can be brought out into it's own file and exported.

@Droogans
Copy link
Contributor Author

Droogans commented Oct 19, 2017

https://github.com/rackerlabs/helix-ui/wiki/Testing updated

Looking to close this and open the squashed version of this. Should I be squashing this down to just one commit, @CITguy?

@@ -0,0 +1,232 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to util.ts to match common javascript module naming convention.

#!/usr/bin/env bash

# https://stackoverflow.com/a/4785518/881224
which wget >/dev/null 2>&1 || { echo "Install wget. Try 'brew install wget' on mac. Aborting." >&2; exit 1; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Generalize the message to be less system-specific.

wget -nc -q https://selenium-release.storage.googleapis.com/${TARFILE_STANDALONE} -O bin/selenium/selenium-server-standalone.jar
tar -xzf bin/selenium/geckodriver-v0.18.0.tar.gz -C bin/selenium/
unzip -o bin/selenium/chromedriver_2.31.zip -d bin/selenium/
cd node_modules/.bin/ && ln -s ../../bin/selenium/* .
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment about why this is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will it be a problem if things are already symlinked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No because the script starts by removing them first.

export const repoUrl = url.parse(`https://${config.githubHostname}/${config.githubName}/${config.repo}`);
export const hasCommitRegex = /\[.*([0-9a-f]{7})] Checking in screenshots.../;

export async function getBranchName(targetBranch: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename to askBranch?

return branch;
}

export async function getGithubToken() {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename to askGithubToken?

}

if (unknownError) {
throw new Error("Something has gone very wrong " + afterCommitData);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why no template literal?

};

export function buildCurlFlags(token: string) {
const flags = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use a multi-line template literal?

res.on("data", d => { data.push(d.toString())});
if (res.statusCode !== 201) {
res.on("end", () => {
const msg = `(HTTP ${res.statusCode}) Something went wrong while creating the repository ${repoUrl.href}:\n${data.join("")}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be useful as a multi-line template literal.

};

function commitScreenshots(token: string, screenshotsDirectory: string) {
let cmds = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be a multi-line template literal?


# https://stackoverflow.com/a/4785518/881224
LINK="https://github.com/rackerlabs/helix-ui/wiki/Testing#java"
which java >/dev/null 2>&1 || { echo ${LINK}; echo "Install java. Try 'brew install java' on mac. Aborting." >&2; exit 1; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Generalize the message to be less system-specific.

Copy link
Contributor

@CITguy CITguy left a comment

Choose a reason for hiding this comment

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

Dev LGTM

We know it's a work in progress, but this looks good enough for the first iteration.

@Droogans Droogans mentioned this pull request Oct 20, 2017
3 tasks
@Droogans Droogans closed this Oct 20, 2017
@CITguy CITguy deleted the local-visreg branch March 7, 2018 00:48
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