mirror of
https://github.com/goharbor/harbor
synced 2025-04-16 19:36:44 +00:00
Upgrade harbor-portal to v2.9.0 (#18525)
1.Magrate protractor to cypress as protractor has been deprecated Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
parent
d3d6e29aa3
commit
de6e517136
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -41,6 +41,8 @@ src/portal/src/lib/coverage
|
||||||
src/portal/ng-swagger-gen
|
src/portal/ng-swagger-gen
|
||||||
src/portal/docker-build/nginx.conf
|
src/portal/docker-build/nginx.conf
|
||||||
src/portal/.angular
|
src/portal/.angular
|
||||||
|
src/portal/cypress/videos
|
||||||
|
src/portal/cypress/screenshots
|
||||||
**/npm*.log
|
**/npm*.log
|
||||||
|
|
||||||
**/*ngsummary.json
|
**/*ngsummary.json
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"project": [
|
"project": [
|
||||||
"server/tsconfig.json",
|
"server/tsconfig.json",
|
||||||
"tsconfig.json",
|
"tsconfig.json",
|
||||||
"e2e/tsconfig.json"
|
"cypress/tsconfig.json"
|
||||||
],
|
],
|
||||||
"createDefaultProgram": true
|
"createDefaultProgram": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
"ng-swagger-gen": "^1.8.1",
|
"ng-swagger-gen": "^1.8.1",
|
||||||
|
|
||||||
// For e2e test. Required
|
// For e2e test. Required
|
||||||
"protractor": "^7.0.0",
|
"cypress": "latest"
|
||||||
|
|
||||||
// For code grammar checking. Optional
|
// For code grammar checking. Optional
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
|
|
|
@ -127,33 +127,24 @@
|
||||||
"builder": "@angular-eslint/builder:lint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
|
"cypress/**/*.ts",
|
||||||
"server/**/*.ts",
|
"server/**/*.ts",
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.html"
|
"src/**/*.html"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"harbor-portal-e2e": {
|
|
||||||
"root": "e2e",
|
|
||||||
"sourceRoot": "e2e",
|
|
||||||
"projectType": "application",
|
|
||||||
"architect": {
|
|
||||||
"e2e": {
|
"e2e": {
|
||||||
"builder": "@angular-devkit/build-angular:protractor",
|
"builder": "@cypress/schematic:cypress",
|
||||||
"options": {
|
"options": {
|
||||||
"protractorConfig": "./protractor.config.js",
|
"devServerTarget": "harbor-portal:serve",
|
||||||
"devServerTarget": "harbor-portal:serve"
|
"watch": false,
|
||||||
}
|
"headless": true
|
||||||
},
|
},
|
||||||
"lint": {
|
"configurations": {
|
||||||
"builder": "@angular-eslint/builder:lint",
|
"production": {
|
||||||
"options": {
|
"devServerTarget": "harbor-portal:serve:production"
|
||||||
"lintFilePatterns": [
|
}
|
||||||
"e2e/**/*.ts",
|
|
||||||
"e2e/**/*.html"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +159,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
"analytics": false
|
"analytics": false,
|
||||||
|
"schematicCollections": [
|
||||||
|
"@cypress/schematic",
|
||||||
|
"@cypress/schematic",
|
||||||
|
"@schematics/angular"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
src/portal/cypress.config.ts
Normal file
7
src/portal/cypress.config.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { defineConfig } from 'cypress';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
e2e: {
|
||||||
|
baseUrl: 'http://localhost:4200',
|
||||||
|
},
|
||||||
|
});
|
6
src/portal/cypress/e2e/spec.cy.ts
Normal file
6
src/portal/cypress/e2e/spec.cy.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
describe('Should open sign-in page', () => {
|
||||||
|
it('Will be redirected to sign-in page when visiting /', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('#log_in').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
5
src/portal/cypress/fixtures/example.json
Normal file
5
src/portal/cypress/fixtures/example.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "Using fixtures to represent data",
|
||||||
|
"email": "hello@cypress.io"
|
||||||
|
}
|
||||||
|
|
43
src/portal/cypress/support/commands.ts
Normal file
43
src/portal/cypress/support/commands.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// ***********************************************
|
||||||
|
// This example namespace declaration will help
|
||||||
|
// with Intellisense and code completion in your
|
||||||
|
// IDE or Text Editor.
|
||||||
|
// ***********************************************
|
||||||
|
// declare namespace Cypress {
|
||||||
|
// interface Chainable<Subject = any> {
|
||||||
|
// customCommand(param: any): typeof customCommand;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// function customCommand(param: any): void {
|
||||||
|
// console.warn(param);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// NOTE: You can use it like so:
|
||||||
|
// Cypress.Commands.add('customCommand', customCommand);
|
||||||
|
//
|
||||||
|
// ***********************************************
|
||||||
|
// This example commands.js shows you how to
|
||||||
|
// create various custom commands and overwrite
|
||||||
|
// existing commands.
|
||||||
|
//
|
||||||
|
// For more comprehensive examples of custom
|
||||||
|
// commands please read more here:
|
||||||
|
// https://on.cypress.io/custom-commands
|
||||||
|
// ***********************************************
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// -- This is a parent command --
|
||||||
|
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// -- This is a child command --
|
||||||
|
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// -- This is a dual command --
|
||||||
|
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// -- This will overwrite an existing command --
|
||||||
|
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
17
src/portal/cypress/support/e2e.ts
Normal file
17
src/portal/cypress/support/e2e.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// ***********************************************************
|
||||||
|
// This example support/e2e.ts is processed and
|
||||||
|
// loaded automatically before your test files.
|
||||||
|
//
|
||||||
|
// This is a great place to put global configuration and
|
||||||
|
// behavior that modifies Cypress.
|
||||||
|
//
|
||||||
|
// You can change the location of this file or turn off
|
||||||
|
// automatically serving support files with the
|
||||||
|
// 'supportFile' configuration option.
|
||||||
|
//
|
||||||
|
// You can read more here:
|
||||||
|
// https://on.cypress.io/configuration
|
||||||
|
// ***********************************************************
|
||||||
|
|
||||||
|
// When a command from ./commands is ready to use, import with `import './commands'` syntax
|
||||||
|
// import './commands';
|
8
src/portal/cypress/tsconfig.json
Normal file
8
src/portal/cypress/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"include": ["**/*.ts"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"sourceMap": false,
|
||||||
|
"types": ["cypress"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,32 +0,0 @@
|
||||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
import { ClaritySeedAppHome } from './app.po';
|
|
||||||
|
|
||||||
fdescribe('harbor-portal app', function () {
|
|
||||||
let expectedMsg: string =
|
|
||||||
'This is a Clarity seed application. This is the default page that loads for the application.';
|
|
||||||
|
|
||||||
let page: ClaritySeedAppHome;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
page = new ClaritySeedAppHome();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display: ' + expectedMsg, () => {
|
|
||||||
page.navigateTo();
|
|
||||||
page.getParagraphText().then(res => {
|
|
||||||
expect(res).toEqual(expectedMsg);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright Project Harbor Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
import { browser, element, by } from 'protractor';
|
|
||||||
|
|
||||||
export class ClaritySeedAppHome {
|
|
||||||
navigateTo() {
|
|
||||||
return browser.get('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
getParagraphText() {
|
|
||||||
return element(by.css('my-app p')).getText();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"compileOnSave": false,
|
|
||||||
"compilerOptions": {
|
|
||||||
"rootDir": "../",
|
|
||||||
"baseUrl": "",
|
|
||||||
"declaration": false,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"module": "commonjs",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"outDir": "dist/out-tsc-e2e",
|
|
||||||
"sourceMap": true,
|
|
||||||
"target": "es5",
|
|
||||||
"typeRoots": [
|
|
||||||
"node_modules/@types"
|
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
"jasmine"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
|
1112
src/portal/package-lock.json
generated
1112
src/portal/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "harbor",
|
"name": "harbor",
|
||||||
"version": "2.8.0",
|
"version": "2.9.0",
|
||||||
"description": "Harbor UI with Clarity",
|
"description": "Harbor UI with Clarity",
|
||||||
"angular-cli": {},
|
"angular-cli": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
"test:headless": "ng test --watch=false --no-progress --code-coverage --browsers=ChromeNoSandboxHeadless",
|
"test:headless": "ng test --watch=false --no-progress --code-coverage --browsers=ChromeNoSandboxHeadless",
|
||||||
"test:chrome-debug": "ng test --code-coverage --browsers Chrome --watch",
|
"test:chrome-debug": "ng test --code-coverage --browsers Chrome --watch",
|
||||||
"pree2e": "webdriver-manager update",
|
"pree2e": "webdriver-manager update",
|
||||||
"e2e": "protractor",
|
"e2e": "ng e2e",
|
||||||
"build": "ng build --aot",
|
"build": "ng build --aot",
|
||||||
"release": "ng build --configuration production",
|
"release": "ng build --configuration production",
|
||||||
"build-mock-api-server": "tsc -p server",
|
"build-mock-api-server": "tsc -p server",
|
||||||
|
@ -61,6 +61,7 @@
|
||||||
"@angular-eslint/template-parser": "15.1.0",
|
"@angular-eslint/template-parser": "15.1.0",
|
||||||
"@angular/cli": "^15.2.1",
|
"@angular/cli": "^15.2.1",
|
||||||
"@angular/compiler-cli": "^15.2.1",
|
"@angular/compiler-cli": "^15.2.1",
|
||||||
|
"@cypress/schematic": "^2.5.0",
|
||||||
"@types/express": "^4.17.12",
|
"@types/express": "^4.17.12",
|
||||||
"@types/jasmine": "~4.3.1",
|
"@types/jasmine": "~4.3.1",
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
|
@ -81,12 +82,12 @@
|
||||||
"ng-swagger-gen": "^1.8.1",
|
"ng-swagger-gen": "^1.8.1",
|
||||||
"prettier": "^2.6.2",
|
"prettier": "^2.6.2",
|
||||||
"prettier-eslint": "^14.0.2",
|
"prettier-eslint": "^14.0.2",
|
||||||
"protractor": "^7.0.0",
|
|
||||||
"stylelint": "^14.8.5",
|
"stylelint": "^14.8.5",
|
||||||
"stylelint-config-prettier": "^9.0.3",
|
"stylelint-config-prettier": "^9.0.3",
|
||||||
"stylelint-config-prettier-scss": "^0.0.1",
|
"stylelint-config-prettier-scss": "^0.0.1",
|
||||||
"stylelint-config-standard": "^25.0.0",
|
"stylelint-config-standard": "^25.0.0",
|
||||||
"stylelint-config-standard-scss": "^4.0.0",
|
"stylelint-config-standard-scss": "^4.0.0",
|
||||||
"typescript": "~4.8.2"
|
"typescript": "~4.8.2",
|
||||||
|
"cypress": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
|
|
||||||
|
|
||||||
/*global jasmine */
|
|
||||||
var SpecReporter = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 11000,
|
|
||||||
specs: [
|
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
'browserName': 'chrome'
|
|
||||||
},
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function() {}
|
|
||||||
},
|
|
||||||
useAllAngular2AppRoots: true,
|
|
||||||
beforeLaunch: function() {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: 'e2e'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onPrepare: function() {
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter());
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -17,5 +17,6 @@
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"useDefineForClassFields": false
|
"useDefineForClassFields": false
|
||||||
}
|
},
|
||||||
|
"exclude": ["cypress.config.ts"],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user