Skip to content

Commit

Permalink
Upgrade harbor-portal to v2.9.0
Browse files Browse the repository at this point in the history
1.Magrate protractor to cypress as protractor has been deprecated

Signed-off-by: AllForNothing <sshijun@vmware.com>
  • Loading branch information
AllForNothing authored and AllForNothing committed Apr 13, 2023
1 parent d3d6e29 commit 36585f3
Show file tree
Hide file tree
Showing 17 changed files with 1,212 additions and 164 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ src/portal/src/lib/coverage
src/portal/ng-swagger-gen
src/portal/docker-build/nginx.conf
src/portal/.angular
src/portal/cypress/videos
src/portal/cypress/screenshots
**/npm*.log

**/*ngsummary.json
Expand Down
2 changes: 1 addition & 1 deletion src/portal/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"project": [
"server/tsconfig.json",
"tsconfig.json",
"e2e/tsconfig.json"
"cypress/tsconfig.json"
],
"createDefaultProgram": true
},
Expand Down
2 changes: 1 addition & 1 deletion src/portal/PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"ng-swagger-gen": "^1.8.1",
// For e2e test. Required
"protractor": "^7.0.0",
"cypress": "latest"
// For code grammar checking. Optional
"eslint": "^8.12.0",
Expand Down
38 changes: 17 additions & 21 deletions src/portal/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,33 +127,24 @@
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"cypress/**/*.ts",
"server/**/*.ts",
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
},
"harbor-portal-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.config.js",
"devServerTarget": "harbor-portal:serve"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"e2e": {
"builder": "@cypress/schematic:cypress",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
]
"devServerTarget": "harbor-portal:serve",
"watch": false,
"headless": true
},
"configurations": {
"production": {
"devServerTarget": "harbor-portal:serve:production"
}
}
}
}
Expand All @@ -168,6 +159,11 @@
}
},
"cli": {
"analytics": false
"analytics": false,
"schematicCollections": [
"@cypress/schematic",
"@cypress/schematic",
"@schematics/angular"
]
}
}
7 changes: 7 additions & 0 deletions src/portal/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:4200',
},
});
6 changes: 6 additions & 0 deletions src/portal/cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions src/portal/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}

43 changes: 43 additions & 0 deletions src/portal/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions src/portal/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions src/portal/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"include": ["**/*.ts"],
"compilerOptions": {
"sourceMap": false,
"types": ["cypress"]
}
}
32 changes: 0 additions & 32 deletions src/portal/e2e/app.e2e-spec.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/portal/e2e/app.po.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/portal/e2e/tsconfig.json

This file was deleted.

0 comments on commit 36585f3

Please sign in to comment.