Skip to content

Commit 6370a93

Browse files
authored
Merge pull request #3298 from bmf-ribeiro/feat/2714-start-server-on-integration-tests
Fix #2714 - Start demo server before running integration tests
2 parents 26cda84 + c312317 commit 6370a93

File tree

14 files changed

+37
-33
lines changed

14 files changed

+37
-33
lines changed

addons/xterm-addon-attach/test/AttachAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import WebSocket = require('ws');
77
import { openTerminal, pollFor, getBrowserType } from '../../../out-test/api/TestUtils';
88
import { Browser, Page } from 'playwright';
99

10-
const APP = 'http://127.0.0.1:3000/test';
10+
const APP = 'http://127.0.0.1:3001/test';
1111

1212
let browser: Browser;
1313
let page: Page;

addons/xterm-addon-fit/test/FitAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { assert } from 'chai';
77
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
88
import { Browser, Page } from 'playwright';
99

10-
const APP = 'http://127.0.0.1:3000/test';
10+
const APP = 'http://127.0.0.1:3001/test';
1111

1212
let browser: Browser;
1313
let page: Page;

addons/xterm-addon-search/test/SearchAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { resolve } from 'path';
99
import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
1010
import { Browser, Page } from 'playwright';
1111

12-
const APP = 'http://127.0.0.1:3000/test';
12+
const APP = 'http://127.0.0.1:3001/test';
1313

1414
let browser: Browser;
1515
let page: Page;

addons/xterm-addon-serialize/test/SerializeAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { assert } from 'chai';
77
import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
88
import { Browser, Page } from 'playwright';
99

10-
const APP = 'http://127.0.0.1:3000/test';
10+
const APP = 'http://127.0.0.1:3001/test';
1111

1212
let browser: Browser;
1313
let page: Page;

addons/xterm-addon-unicode11/test/Unicode11Addon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { assert } from 'chai';
77
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
88
import { Browser, Page } from 'playwright';
99

10-
const APP = 'http://127.0.0.1:3000/test';
10+
const APP = 'http://127.0.0.1:3001/test';
1111

1212
let browser: Browser;
1313
let page: Page;

addons/xterm-addon-web-links/test/WebLinksAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { assert } from 'chai';
77
import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
88
import { Browser, Page } from 'playwright';
99

10-
const APP = 'http://127.0.0.1:3000/test';
10+
const APP = 'http://127.0.0.1:3001/test';
1111

1212
let browser: Browser;
1313
let page: Page;

addons/xterm-addon-webgl/test/WebglRenderer.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { assert } from 'chai';
99
import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
1010
import { Browser, Page } from 'playwright';
1111

12-
const APP = 'http://127.0.0.1:3000/test';
12+
const APP = 'http://127.0.0.1:3001/test';
1313

1414
let browser: Browser;
1515
let page: Page;

azure-pipelines.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ jobs:
100100
displayName: 'Install Yarn'
101101
- script: yarn --frozen-lockfile
102102
displayName: 'Install dependencies and build'
103-
- script: |
104-
yarn start &
105-
sleep 10
106-
displayName: 'Start test server'
107103
- script: yarn test-api-chromium --headless --forbid-only
108104
displayName: 'Integration tests (Chromium)'
109105
- script: xvfb-run --auto-servernum -- bash -c "yarn test-api-firefox --headless --forbid-only"
@@ -119,10 +115,6 @@ jobs:
119115
displayName: 'Install Node.js'
120116
- script: yarn --frozen-lockfile
121117
displayName: 'Install dependencies and build'
122-
- script: |
123-
yarn start &
124-
sleep 10
125-
displayName: 'Start test server'
126118
- script: yarn test-api-chromium --headless --forbid-only
127119
displayName: 'Integration tests (Chromium)'
128120
- script: yarn test-api-firefox --headless --forbid-only

bin/test_api.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,31 @@ if (process.argv.length > 2) {
3434

3535

3636
env.DEBUG = flagArgs.indexOf('--debug') >= 0 ? 'debug' : '';
37+
env.PORT = 3001;
3738

38-
const run = cp.spawnSync(
39-
npmBinScript('mocha'),
40-
[...testFiles, ...flagArgs],
41-
{
42-
cwd: path.resolve(__dirname, '..'),
43-
env,
44-
stdio: 'inherit'
45-
}
46-
);
39+
const server = cp.spawn('node', ['demo/start'], {
40+
cwd: path.resolve(__dirname, '..'),
41+
env,
42+
stdio: 'pipe'
43+
})
4744

48-
function npmBinScript(script) {
49-
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? `${script}.cmd` : script));
50-
}
45+
server.stdout.on('data', (data) => {
46+
// await for the server to fully start
47+
if (data.indexOf("successfully") !== -1) {
48+
const run = cp.spawnSync(
49+
npmBinScript('mocha'),
50+
[...testFiles, ...flagArgs], {
51+
cwd: path.resolve(__dirname, '..'),
52+
env,
53+
stdio: 'inherit'
54+
}
55+
);
5156

52-
process.exit(run.status);
57+
function npmBinScript(script) {
58+
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ?
59+
`${script}.cmd` : script));
60+
}
61+
62+
process.exit(run.status);
63+
}
64+
});

test/api/CharWidth.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
77
import { Browser, Page } from 'playwright';
88

9-
const APP = 'http://127.0.0.1:3000/test';
9+
const APP = 'http://127.0.0.1:3001/test';
1010

1111
let browser: Browser;
1212
let page: Page;

0 commit comments

Comments
 (0)