Skip to content

Commit a0299af

Browse files
author
Evgeny Barabanov
authored
Add test for existence of all the native strings (#15)
* Add test for existence of all the native strings * Fix appveyor.yml to avoid conflict of nodejs platform variable with system platform variable
1 parent 9143b2d commit a0299af

File tree

4 files changed

+36
-12
lines changed

4 files changed

+36
-12
lines changed

appveyor.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ image: Visual Studio 2015
33
environment:
44
BASH: C:/cygwin/bin/bash
55

6-
platform:
7-
- x86
8-
- x64
6+
matrix:
7+
- node_platform: x86
8+
dist_platform: 32
9+
- node_platform: x64
10+
dist_platform: 64
911

1012
cache:
1113
- node_modules
1214

1315
install:
14-
- ps: Install-Product node LTS $env:platform
16+
- ps: Install-Product node LTS $env:node_platform
1517
- npm config set msvs_version 2015
1618
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && npm install"'
1719

1820
build: off
1921

2022
test_script:
21-
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && npm run dist"'
22-
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && npm run e2e"'
23+
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && npm run dist:windows:$dist_platform"'
24+
- npm run e2e

e2e/common/spectron-utils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ const platformToExtension = {
1616

1717
export class SpectronUtils {
1818
public static app = new SpectronApplication({
19-
// Your electron path can be any binary
20-
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
21-
// But for the sake of the example we fetch it from our node_modules.
2219
path: `build-artifacts/ElectronAngularNativeApp.${platformToExtension[process.platform]}`,
23-
args: [path.join(__dirname, '../..')],
2420
});
2521

2622
static describe(desc: string, describeFunction: (app: Application) => void) {
2723

2824
describe(desc, function () {
29-
this.timeout(20000);
25+
this.timeout(10000);
3026

3127
before(() => {
3228
return SpectronUtils.app.start();

e2e/native-strings.e2e-spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {SpectronUtils} from './common/spectron-utils';
2+
import {Application} from 'spectron';
3+
import * as path from 'path';
4+
import * as fs from 'fs';
5+
6+
const chaiAsPromised = require('chai-as-promised');
7+
const chai = require('chai');
8+
9+
chai.should();
10+
chai.use(chaiAsPromised);
11+
12+
function containsString(app: Application, str: string) {
13+
it(`Contains ${str}`,
14+
() => {
15+
return app.client.waitForExist('ul li h2').then(() => app.client.getText('ul li h2').then(list => {
16+
const index = list.indexOf(str);
17+
return index > -1 ? list[index] : '';
18+
}).should.eventually.equal(str));
19+
}
20+
);
21+
}
22+
23+
SpectronUtils.describe('Native strings', app => {
24+
containsString(app, 'c++ .node string');
25+
containsString(app, 'c++ precompiled library string');
26+
});

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<base href="./">
77

88
<meta name="viewport" content="width=device-width, initial-scale=1">
9-
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
<link rel="icon" type="image/x-icon" href="favicon.png">
1010
</head>
1111
<body>
1212
<app-root></app-root>

0 commit comments

Comments
 (0)