mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 10:08:57 +00:00
Update tests to work with latest tooling
This commit is contained in:
@@ -31,7 +31,7 @@ artifacts:
|
|||||||
# - ps: .\build.ps1
|
# - ps: .\build.ps1
|
||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
test_script:
|
test_script:
|
||||||
- dotnet restore ./src
|
- dotnet restore
|
||||||
- npm install -g selenium-standalone
|
- npm install -g selenium-standalone
|
||||||
- selenium-standalone install
|
- selenium-standalone install
|
||||||
# The nosys flag is needed for selenium to work on Appveyor
|
# The nosys flag is needed for selenium to work on Appveyor
|
||||||
|
|||||||
@@ -5,23 +5,20 @@ import { generateProjectSync } from './util/yeoman';
|
|||||||
import { AspNetProcess, AspNetCoreEnviroment, defaultUrl, publishProjectSync } from './util/aspnet';
|
import { AspNetProcess, AspNetCoreEnviroment, defaultUrl, publishProjectSync } from './util/aspnet';
|
||||||
import { getValue, getCssPropertyValue } from './util/webdriverio';
|
import { getValue, getCssPropertyValue } from './util/webdriverio';
|
||||||
|
|
||||||
// Currently we test both 'csproj' and 'project.json' project types. Eventually we'll only need csproj.
|
// First, generate a new project using the locally-built generator-aspnetcore-spa
|
||||||
['csproj', 'projectjson'].forEach(toolingType => {
|
// Do this outside the Mocha fixture, otherwise Mocha will time out
|
||||||
// First, generate a new project using the locally-built generator-aspnetcore-spa
|
const appDir = path.resolve(__dirname, '../generated/angular');
|
||||||
// Do this outside the Mocha fixture, otherwise Mocha will time out
|
const publishedAppDir = path.resolve(appDir, './bin/Release/published');
|
||||||
const appDir = path.resolve(__dirname, '../generated/angular', toolingType);
|
if (!process.env.SKIP_PROJECT_GENERATION) {
|
||||||
const publishedAppDir = path.resolve(appDir, './bin/Release/published');
|
|
||||||
if (!process.env.SKIP_PROJECT_GENERATION) {
|
|
||||||
generateProjectSync(appDir, {
|
generateProjectSync(appDir, {
|
||||||
framework: 'angular-2',
|
framework: 'angular',
|
||||||
name: 'Test App',
|
name: 'Test App',
|
||||||
sdkVersion: toolingType === 'projectjson' ? '1.0.0-preview2-1-003177' : '1.0.0-preview3-004056',
|
|
||||||
tests: false
|
tests: false
|
||||||
});
|
});
|
||||||
publishProjectSync(appDir, publishedAppDir);
|
publishProjectSync(appDir, publishedAppDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBasicNavigation() {
|
function testBasicNavigation() {
|
||||||
describe('Basic navigation', () => {
|
describe('Basic navigation', () => {
|
||||||
beforeEach(() => browser.url(defaultUrl));
|
beforeEach(() => browser.url(defaultUrl));
|
||||||
|
|
||||||
@@ -48,9 +45,9 @@ import { getValue, getCssPropertyValue } from './util/webdriverio';
|
|||||||
expect(getValue(browser.elements('fetchdata table tbody tr')).length).to.eq(5);
|
expect(getValue(browser.elements('fetchdata table tbody tr')).length).to.eq(5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function testHotModuleReplacement() {
|
function testHotModuleReplacement() {
|
||||||
describe('Hot module replacement', () => {
|
describe('Hot module replacement', () => {
|
||||||
beforeEach(() => browser.url(defaultUrl));
|
beforeEach(() => browser.url(defaultUrl));
|
||||||
|
|
||||||
@@ -88,19 +85,16 @@ import { getValue, getCssPropertyValue } from './util/webdriverio';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now launch dotnet and use selenium to perform tests
|
// Now launch dotnet and use selenium to perform tests
|
||||||
describe('Angular template: dev mode', () => {
|
describe('Angular template: dev mode', () => {
|
||||||
AspNetProcess.RunInMochaContext(appDir, AspNetCoreEnviroment.development);
|
AspNetProcess.RunInMochaContext(appDir, AspNetCoreEnviroment.development);
|
||||||
testBasicNavigation();
|
testBasicNavigation();
|
||||||
testHotModuleReplacement();
|
testHotModuleReplacement();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Angular template: production mode', () => {
|
describe('Angular template: production mode', () => {
|
||||||
// csproj tooling takes the assembly name from <name>.csproj, whereas project.json takes it from the directory name
|
AspNetProcess.RunInMochaContext(publishedAppDir, AspNetCoreEnviroment.production, 'TestApp.dll');
|
||||||
const assemblyName = toolingType === 'csproj' ? 'TestApp.dll' : 'projectjson.dll';
|
testBasicNavigation();
|
||||||
AspNetProcess.RunInMochaContext(publishedAppDir, AspNetCoreEnviroment.production, assemblyName);
|
|
||||||
testBasicNavigation();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@@ -9,7 +9,6 @@ const yoPackageDirAbsolute = path.resolve('./node_modules/yo');
|
|||||||
export interface GeneratorOptions {
|
export interface GeneratorOptions {
|
||||||
framework: string;
|
framework: string;
|
||||||
name: string;
|
name: string;
|
||||||
sdkVersion?: string;
|
|
||||||
tests?: boolean;
|
tests?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user