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