You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by li...@apache.org on 2020/03/05 01:07:43 UTC

[submarine] branch master updated: SUBMARINE-402. Add tutorial for adding test cases and browsers to e2e with Angular

This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f8740f  SUBMARINE-402. Add tutorial for adding test cases and browsers to e2e with Angular
8f8740f is described below

commit 8f8740f4eee4fe2fe100a89dc5bbabe256e555a8
Author: cchung100m <cc...@cs.ccu.edu.tw>
AuthorDate: Tue Mar 3 22:10:12 2020 +0800

    SUBMARINE-402. Add tutorial for adding test cases and browsers to e2e with Angular
    
    Hi kevin85421
    
    Following our discussion in #197, This PR is going to add the tutorial for the test cases adding and browsers configuration. I would appreciate if you can help to review it, thanks.
    
    ### What is this PR for?
    
    Add tutorial for adding test cases and browsers to e2e with Angular
    
    ### What type of PR is it?
    Documentation
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-402
    
    ### How should this be tested?
    https://travis-ci.com/cchung100m/submarine/builds/151553436
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: cchung100m <cc...@cs.ccu.edu.tw>
    
    Closes #201 from cchung100m/SUBMARINE-402 and squashes the following commits:
    
    5ffae09 [cchung100m] Add tutorial for adding test cases and browsers to e2e with Angular
---
 submarine-workbench/workbench-web-ng/README.md     |  4 ++
 submarine-workbench/workbench-web-ng/e2e/README.md | 79 ++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/submarine-workbench/workbench-web-ng/README.md b/submarine-workbench/workbench-web-ng/README.md
index c018745..138fc81 100644
--- a/submarine-workbench/workbench-web-ng/README.md
+++ b/submarine-workbench/workbench-web-ng/README.md
@@ -28,6 +28,10 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
 
 Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
 
+## Adding end-to-end test cases
+
+If you want to add end-to-end test cases, please click [here](./e2e/README.md) for reference.
+
 ## Further help
 
 To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/submarine-workbench/workbench-web-ng/e2e/README.md b/submarine-workbench/workbench-web-ng/e2e/README.md
new file mode 100644
index 0000000..4e0f8e4
--- /dev/null
+++ b/submarine-workbench/workbench-web-ng/e2e/README.md
@@ -0,0 +1,79 @@
+## Adding test cases
+
+1. Create the test case file `*.e2e-spec.ts` as following code block under [here](./src/).
+
+    describe("test case description", () => {
+
+        beforeEach(() => {
+            // set up actions before running test case
+        });
+
+        afterEach(() => {
+            // set up actions after running test case
+        });
+
+        it("expected result description", function() {
+            // expected result
+            expect(expression).toEqual(true);
+        });
+    });
+
+2. Add the test case file name `*.e2e-spec.ts` to the `specs` field of `protractor.conf.js`.
+
+## Adding the browser for test cases
+
+1. Add the browser to `travis.yml` for preparing testing environment.
+
+        - name: Test submarine workbench-web Angular
+        ...
+        ...
+        addons:
+            chrome: stable
+        script:
+            - npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
+
+2. Configure the browser into the `multiCapabilities` field of `protractor-ci.conf.js` for Angular.
+
+        {
+            browserName: 'chrome',
+            chromeOptions: {
+                args: ['--headless', '--no-sandbox']
+            }
+        }
+
+3. Configure the browser into the `multiCapabilities` field of `protractor.conf.js` for Angular.
+
+        {
+            'browserName': 'chrome'
+        }
+
+4. Configure the browser launcher into `karma.conf.js` for the `karma` testing tool.  
+
+        plugins: [
+            ...
+            require('karma-chrome-launcher'),
+            ...
+        ]
+        ...
+        browsers: ['Chrome'],
+        ...
+        customLaunchers: {
+            ChromeHeadlessCI: {
+                base: 'ChromeHeadless',
+                flags: ['--no-sandbox']
+            },
+        },
+        ...
+
+5. Add the browser launcher into the `package.json` for the `npm` library configuration.    
+
+        "devDependencies": {
+            ...
+            "karma-chrome-launcher": "~2.2.0",
+            ...
+        }
+
+
+## Further helps
+
+Click [here](https://angular.io/guide/testing) for further information.
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org