Skip to content

Fix Protractor tests #4

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

Merged
merged 31 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
11426fc
Add npm install
Jun 12, 2018
2c4d11c
Fix Protractor tests
Jun 13, 2018
f871331
Don't run mvn verify since ITs aren't passing yet
Jun 13, 2018
f0a9539
Navigate back to root after npm install
Jun 13, 2018
e24af07
npm install seems to happen automatically
Jun 13, 2018
0b58bac
Make Travis match pom.xml node version
Jun 13, 2018
accdf31
npm install does need to happen manually
Jun 13, 2018
de943dd
Upgrade serve and sleep after starting Spring Boot
Jun 13, 2018
8a3ebec
Install serve globall since it doesn't work as a dev dependency
Jun 13, 2018
5720aa9
Lock down version of serve
Jun 13, 2018
cb8ab69
Increase startup to 45s
Jun 13, 2018
efbe179
Switch from using serve to node-http-server
Jun 13, 2018
7ca6564
Run prod build before e2e tests
Jun 13, 2018
46b3ff5
Don't use node-http-server b/c it won't proxy /api
Jun 13, 2018
36e8b00
Run e2e from crypto-pwa directory
Jun 13, 2018
7154ba3
Sleep before running e2e tests
Jun 13, 2018
4d896f9
Fix tests and allow Protractor to run against 8100, or 8080 for Travis
Jun 13, 2018
e85317d
Add browser sleep for 1s
Jun 13, 2018
5d80f73
Regenerate Travis variables for repo using:
Jun 13, 2018
810377a
Add scopes to Spring Security config so its possible to switch to Spr…
Jun 13, 2018
abc447f
Try Spring Security starter
Jun 13, 2018
16f4ffe
Refactor logout
Jun 13, 2018
368535a
Try Spring security again
Jun 13, 2018
a1899f5
Crank up the debugging
Jun 13, 2018
88c6329
Restart browser as a workaround for not fully logged out
Jun 13, 2018
72c2782
Restart browser as a workaround for not fully logged out
Jun 13, 2018
124e084
Merge branch 'fix-protractor-tests' of github.com:oktadeveloper/okta-…
Jun 13, 2018
9514802
Comment out Spring Security logging
Jun 13, 2018
87b89e8
Add SSO logout and remove browser.restart()
Jun 14, 2018
9e6a664
Use mvn -q verify instead of tests to prepare for merge with Java IT …
Jun 14, 2018
2dd7d4a
Fixes based on combined PR https://github.com/oktadeveloper/okta-spri…
Jun 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- docker
language: node_js
node_js:
- 9.8.0
- 8.10.0
addons:
apt:
sources:
Expand All @@ -23,15 +23,15 @@ before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g [email protected]
- npm install -g codecov
- npm install -g [email protected] codecov
- cd crypto-pwa && npm install
script:
- cd $TRAVIS_BUILD_DIR
- chmod +x holdings-api/mvnw
- cd holdings-api && ./mvnw -q verify
- ./mvnw clean package -Pprod -DskipTests
- ./mvnw -q clean package -Pprod -DskipTests
- java -jar target/*.jar &
- cd ../crypto-pwa
- npm run e2e
- cd ../crypto-pwa && npm run e2e
notifications:
webhooks:
on_success: always
Expand All @@ -41,4 +41,4 @@ after_success:
- cd $TRAVIS_BUILD_DIR && codecov
env:
matrix:
secure: jAScRJFhOfIPIb3ud9/c/MXmSjLBdudfVD4ItyJdpnq9IzymeKA2ZQVEm420Lb+czBSlz3mxbhVGpl5qRrwFY6kzjj3AA3MOtbgfuQfX9ZpU4WhUtiPexsJMMyYIOFPDRFoyqiI35Gth8GMOLDMaYtlRVRsHDWC6wcYTK3UIvq0zR4AOncgsNlwAaaPf8GDUUJ50C187WYI/Q6EBdaGlvVTUMZHbzCS5Z/2Ue1iZrrFkwvaUtvLTuklNMroDcFjOiL8FP8gDR92d896bbUpu0D0PScUr5512V55M1WLzztvJi5cZLwJghzK/52XTh/bRYK/AIaIagS67Bt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
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export class LoginPage extends Page {
username = element(by.name('username'));
password = element(by.name('password'));
oktaLoginButton = element(by.css('input[type=submit]'));
loginButton = element(by.css('#login'));
logoutButton = element(by.css('#logout'));
header = element(by.css('ion-title'));
loginButton = element.all(by.css('#login')).last();
logoutButton = element.all(by.css('#logout')).last();
header = element.all(by.css('ion-title')).first();

getHeader() {
return this.header.getText();
Expand Down
2 changes: 1 addition & 1 deletion crypto-pwa/e2e/spec/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page } from '../pages/app.po';
import { browser, protractor, ExpectedConditions as ec } from 'protractor';
import { browser, ExpectedConditions as ec } from 'protractor';

describe('App', () => {
let page: Page;
Expand Down
4 changes: 3 additions & 1 deletion crypto-pwa/e2e/spec/login.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { browser, element, by, protractor, ExpectedConditions as ec } from 'protractor';
import { browser, by, element, ExpectedConditions as ec } from 'protractor';
import { LoginPage } from '../pages/login.po';

describe('Login', () => {
Expand All @@ -17,6 +17,7 @@ describe('Login', () => {
});

it('should fail to log in with bad password', () => {
browser.sleep(1000);
loginPage.clickLoginButton();
loginPage.login('admin', 'foo');
const error = element.all(by.css('.infobox-error')).first();
Expand All @@ -40,6 +41,7 @@ describe('Login', () => {
});

it('should log out successfully', () => {
browser.sleep(1000);
loginPage.logout();
browser.wait(ec.urlContains('/#/login'), 2000);
expect(loginPage.loginButton.isPresent());
Expand Down
9 changes: 7 additions & 2 deletions crypto-pwa/e2e/spec/manage.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { browser, element, by, protractor, ExpectedConditions as ec, $ } from 'protractor';
import { browser, by, element, ExpectedConditions as ec } from 'protractor';
import { LoginPage } from '../pages/login.po';
import { AddHoldingPage } from '../pages/add-holding.po';
import { HomePage } from '../pages/home.po';
Expand All @@ -16,18 +16,23 @@ describe('Manage Holdings', () => {
});

beforeEach(() => {
browser.sleep(1000); // to prevent button not clickable error
loginPage.clickLoginButton();
loginPage.login(process.env.E2E_USERNAME, process.env.E2E_PASSWORD);
loginPage.oktaLoginButton.click();

browser.wait(ec.urlContains('home'), 5000);
const success = element.all(by.css('h1')).first();
browser.wait(ec.visibilityOf(success), 5000).then(() => {
expect(success.getText()).toMatch(/Welcome/);
});
});

afterEach(() => {
loginPage.logout();
});

it('should add and remove a holding', () => {
browser.sleep(1000);
homePage.clickAddCoinsButton();

browser.wait(ec.urlContains('add-holding'), 1000);
Expand Down
Loading