Skip to content

Commit

Permalink
ci(e2e): fixes for e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef committed Jul 21, 2020
1 parent 6164b97 commit f2bcdf3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 51 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ jobs:
- run: cp ./release/*.dmg ./release/safe_browser-${{ matrix.os }}.dmg
if: matrix.os == 'macos-latest'

- name: Archive Everything (we are on a tag build)!
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
with:
name: safe_browser-${{ matrix.os }}
path: ./release

- name: Archive Artifact!
if: matrix.os != 'macos-latest' && !startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v1
Expand Down
10 changes: 6 additions & 4 deletions app/components/Tab/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class Tab extends Component<TabProps, TabState> {
this.pageFaviconUpdated.bind( this )
);
webview.addEventListener( 'new-window', this.newWindow.bind( this ) );
// webview.addEventListener( 'did-fail-load', this.didFailLoad.bind( this ) );
webview.addEventListener( 'did-fail-load', this.didFailLoad.bind( this ) );
webview.addEventListener(
'update-target-url',
this.updateTargetUrl.bind( this )
Expand Down Expand Up @@ -433,7 +433,7 @@ export class Tab extends Component<TabProps, TabState> {
const urlObject = stdUrl.parse( url );
const errorUrl = error.validatedURL;

logger.info( 'didfail load', error );
logger.info( 'didfail load for url', urlObject, error );
const renderError = ( header, subHeader? ) => {
const errorAsHtml = ReactDOMServer.renderToStaticMarkup(
<Error error={{ header, subHeader }} />
Expand All @@ -460,15 +460,17 @@ export class Tab extends Component<TabProps, TabState> {
try {
renderError( 'Page Load Failed' );
} catch ( scriptError ) {
logger.error( scriptError );
// not logger due to error contents
console.error( scriptError );
}
return;
}
if ( error && error.errorDescription === 'ERR_INVALID_URL' ) {
try {
renderError( `Invalid URL: ${url}` );
} catch ( scriptError ) {
logger.error( scriptError );
// not logger due to error contents
console.error( scriptError );
}
return;
}
Expand Down
30 changes: 14 additions & 16 deletions app/extensions/safe/backgroundProcess/server-routes/safe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { errorConstants } from '$Extensions/safe/err-constants';
import {
rangeStringToArray,
generateResponseString,
cleanupNeonError
cleanupNeonError,
} from '$Extensions/safe/utils/safeHelpers';
import { getHTTPFriendlyData } from '$Extensions/safe/backgroundProcess';
import { SAFE } from '$Extensions/safe/constants';
import {
windowCloseTab,
addTabEnd,
addTabNext
addTabNext,
} from '$Actions/windows_actions';

export const safeRoute = ( store ) => ( {
Expand All @@ -29,18 +29,16 @@ export const safeRoute = ( store ) => ( {
badVersion?: string,
latestVersion?: string
): void => {
response
.status( ERROR_CODES[type] )
.send(
ReactDOMServer.renderToStaticMarkup(
<Error
type={type}
address={address}
badVersin={badVersion}
latestVersion={latestVersion}
/>
)
);
const page = ReactDOMServer.renderToStaticMarkup(
<Error
type={type}
address={address}
badVersin={badVersion}
latestVersion={latestVersion}
/>
);
logger.debug( 'Constructing error page:', page );
response.status( ERROR_CODES[type] ).send( page );
};

try {
Expand Down Expand Up @@ -159,7 +157,7 @@ export const safeRoute = ( store ) => ( {
.set( {
'Content-Type': data.headers['Content-Type'],
'Content-Range': data.headers['Content-Range'],
'Content-Length': data.headers['Content-Length']
'Content-Length': data.headers['Content-Length'],
} )
.send( data.body );
}
Expand All @@ -179,5 +177,5 @@ export const safeRoute = ( store ) => ( {
logger.error( message );
return sendErrorResponse( ERROR_TYPES.BAD_REQUEST, problemLink );
}
}
},
} );
30 changes: 1 addition & 29 deletions app/extensions/safe/webviewProcess/webviewPreload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { XorUrlEncoder } from 'safe-nodejs';
import { SaferSafe } from '$Extensions/safe/webviewProcess/saferSafe';
// eslint-disable-next-line import/extensions
import pkg from '$Package';
import { logger } from '$Logger';
// import { logger } from '$Logger';

// shim for rdflib.js
// eslint-disable-next-line no-underscore-dangle
Expand All @@ -26,32 +26,6 @@ class WebIdEvents extends EventEmitter {}

const webIdEventEmitter = new WebIdEvents();

// const createRemoteCall = ( functionName, passedStore ) => {
// if ( !functionName ) {
// throw new Error( 'Remote calls must have a functionName to call.' );
// }
//
// const remoteCall = ( ...args ) =>
// new Promise( ( resolve, reject ) => {
// const callId = Math.random().toString( 36 );
//
// const theCall = {
// id: callId,
// name: functionName,
// args
// };
//
// passedStore.dispatch( remoteCallActions.addRemoteCall( theCall ) );
//
// pendingCalls[theCall.id] = {
// resolve,
// reject
// };
// } );
//
// return remoteCall;
// };

/**
* Set the window var for experimentsEnabled for Tab api import.
* Also subscrives to the store to watch for updates / trigger reload.
Expand Down Expand Up @@ -102,8 +76,6 @@ export const setupWebIdEventEmitter = ( passedStore, win = window ) => {

export const setupSafeAPIs = ( passedStore, win = window ) => {
const theWindow = win;
logger.info( 'Setup up SAFE Dom API... UPDATED' );

// use from passed object if present (for testing)
theWindow.Safe = theWindow.Safe || SaferSafe;

Expand Down
2 changes: 0 additions & 2 deletions app/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ if ( inMainProcess && !isRunningTestCafeProcess ) {
log.info( 'startedRunningProduction?', startedRunningProduction );
log.info( 'startedRunningMock?', startedRunningMock );
log.info( 'isRunningTestCafeProcess?', isRunningTestCafeProcess );
log.info( 'isRunningTestCafeProcess?', isRunningTestCafeProcess );
log.info( 'isRunningTestCafeProcess?', isRunningTestCafeProcess );
log.info( '' );
log.info( '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>' );
log.info( '' );
Expand Down

0 comments on commit f2bcdf3

Please sign in to comment.