Skip to content

Commit

Permalink
use hash website and circle ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cnishina committed Apr 3, 2018
1 parent 4f13a15 commit a077a98
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"apps": [
{
"root": "src",
"baseHref": "/protractor-new-hope/",
"outDir": "dist",
"deployUrl": "/protractor-new-hope/",
"assets": [
"assets",
"favicon.ico"
Expand Down
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
jobs:
build:
working_directory: ~/workspace
docker:
- image: circleci/node:8-browsers
steps:
- checkout

- run: export UPDATE_SCREENSHOTS='0'
- run: export GITHUB_PAGES='https://angular-seattle.github.io/protractor-new-hope/'

- run: node --version
- run: npm --version
- run: yarn --version
- run: google-chrome --version

- run: yarn install
- run: yarn run webdriver-update

- run: $(npm bin)/protractor protractor.conf.js --specs='e2e/tractor.e2e-spec.ts' --directConnect=true
2 changes: 1 addition & 1 deletion e2e/firing-form.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {type, go, see, slow, click, under, leftOf, below, rightOf} from 'blue-ha

describe('Firing form', () => {
beforeAll(async() => {
await browser.get('/firing');
await browser.get('/protractor-new-hope/#/firing');
});

it('should fillout the required fields', async() => {
Expand Down
Binary file modified e2e/goldens/tractor_control4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions e2e/prisoners.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Prisoner manifest', () => {
describe('with login page', () => {
it('should redirect to the login', async() => {
browser.waitForAngularEnabled(false);
await browser.get('/prisoners');
await browser.get('/protractor-new-hope/#/prisoners');
expect(await browser.getCurrentUrl()).toBe(browser.baseUrl + 'assets/login.html');
});

Expand All @@ -19,7 +19,7 @@ describe('Prisoner manifest', () => {
browser.waitForAngularEnabled(true);
await browser.wait(() => {
return browser.getCurrentUrl().then(url => {
return url !== browser.baseUrl + 'assets/login.html';
return url !== browser.baseUrl + '/protractor-new-hope/assets/login.html';
});
}, 3000);
expect(await browser.getCurrentUrl()).toBe(browser.baseUrl + 'prisoners');
Expand All @@ -29,10 +29,10 @@ describe('Prisoner manifest', () => {
describe('with a cookie', () => {
it('should automatically load prisoners', async() => {
// TODO (milestone #2): Run through chrome://inspect and debug.
await browser.get('/prisoner');
await browser.get('/protractor-new-hope/#/prisoner');
await (browser.manage() as any).addCookie({name: 'userflame', value: 'spock'});
await browser.get('/prisoner');
expect(await browser.getCurrentUrl()).toBe(browser.baseUrl + 'prisoner');
await browser.get('/protractor-new-hope/#/prisoner');
expect(await browser.getCurrentUrl()).toBe(browser.baseUrl + '/protractor-new-hope/#/prisoner');
})
});

Expand Down
2 changes: 1 addition & 1 deletion e2e/tractor.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const GOLDEN_IMAGES = [1,2,3,4].map((i) => {
describe('Tractor beam control page', () => {

beforeEach(async() => {
await browser.get('/tractor');
await browser.get('/protractor-new-hope/#/tractor');
let width = 1280;
let height = 900;
await browser.driver.manage().window().setSize(width, height);
Expand Down
2 changes: 1 addition & 1 deletion protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.config = {
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:4200/',
baseUrl: (process.env['GITHUB_PAGES'] || 'http://localhost:4200/'),
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
Expand Down
18 changes: 18 additions & 0 deletions scripts/gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
npm install
npm run ng build

git checkout gh-pages

rm -rf e2e/ examples/ src/
rm .angular-cli.json .editorconfig karma.conf.js
rm package-lock.json package.json protractor.conf.js
rm README.md tsconfig.json tslint.json

cp -r dist/* .

rm -rf dist/ node_modules/

git add -A
git commit -m "release gh-pages"
git push origin gh-pages
2 changes: 1 addition & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ const appRoutes: Routes = [
}
];

export const AppRoutes = RouterModule.forRoot(appRoutes);
export const AppRoutes = RouterModule.forRoot(appRoutes, {useHash: true});

0 comments on commit a077a98

Please sign in to comment.