Skip to content

Conversation

@prushforth
Copy link
Member

… each.

Draft to see if this fixes problems due to test parallelism.

popupTabNavigation.test.js / popupTabNavigation.html
tabFeatureNavigation.test.js / tabFeatureNavigation.html
reticle.test.js / reticle.html
should be treated like promises, and expect should be treated likewise, per
this description: https://jestjs.io/docs/asynchronous#asyncawait 

Unfortunately featureLinks.test.js still fails, despite the above. So, on 
the theory that the individual describe blocks are competing in the jest
environment, split out the one describe that appears to routinely fail, 
into a new test file:linkTypes.test.js.
@prushforth prushforth marked this pull request as ready for review November 26, 2021 22:37
@prushforth
Copy link
Member Author

@Malvoz give this branch a try with your css changes, please. It might work...

@prushforth prushforth requested a review from Malvoz November 26, 2021 22:41
@Malvoz
Copy link
Member

Malvoz commented Nov 26, 2021

@prushforth I gave it a try:

Result

After running the grunt command:

   test/layers/mapMLLayer.spec.js
      3 |        test("(null content, null options) should return a MapMLLayer object", async () => {
                                                                                                    ^ Expected '(' and instead saw '{'.
      4 |      var url = "https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/";
               ^ Expected an identifier and instead saw 'var' (a reserved word).
      4 |      var url = "https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/";
                   ^ Expected ')' to match '{' from line 3 and instead saw 'url'.
      4 |      var url = "https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/";
                       ^ Expected an identifier and instead saw '='.
      4 |      var url = "https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/";
                         ^ Expected ')' and instead saw 'https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/'.
      6 |            await expect(ml._content).toBeFalsy();
                     ^ Expected an assignment or function call and instead saw an expression.
      6 |            await expect(ml._content).toBeFalsy();
                          ^ Missing semicolon.
      7 |            await expect(ml._container).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
      7 |            await expect(ml._container).toBeTruthy();
                          ^ Missing semicolon.
      8 |            await expect(
                     ^ Expected an assignment or function call and instead saw an expression.
      8 |            await expect(
                          ^ Missing semicolon.
     11 |            await expect(ml._imageContainer).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
     11 |            await expect(ml._imageContainer).toBeTruthy();
                          ^ Missing semicolon.
     12 |            await expect(
                     ^ Expected an assignment or function call and instead saw an expression.
     12 |            await expect(
                          ^ Missing semicolon.
     15 |            await expect(ml._href === url).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
     15 |            await expect(ml._href === url).toBeTruthy();
                          ^ Missing semicolon.
     16 |            await expect(ml.options.zIndex).toBe(0);
                     ^ Expected an assignment or function call and instead saw an expression.
     16 |            await expect(ml.options.zIndex).toBe(0);
                          ^ Missing semicolon.
     22 |        beforeEach(async () => {
                                        ^ Expected '(' and instead saw '{'.
     23 |            content = document.createElement("layer-");
                                                               ^ Expected ')' to match '{' from line 22 and instead saw ';'.
     29 |                    </map-extent>`;
                                           ^ Expected ')' and instead saw ';'.
     29 |                    </map-extent>`;
                                            ^ Missing semicolon.
     31 |            await expect(content instanceof HTMLElement).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
     31 |            await expect(content instanceof HTMLElement).toBeTruthy();
                          ^ Missing semicolon.
     33 |        test("null url should return a MapMLLayer object",async () => {
                                                                               ^ Expected '(' and instead saw '{'.
     34 |            var ml = M.mapMLLayer(null, content);
                     ^ Expected an identifier and instead saw 'var' (a reserved word).
     34 |            var ml = M.mapMLLayer(null, content);
                         ^ Expected ')' to match '{' from line 33 and instead saw 'ml'.
     34 |            var ml = M.mapMLLayer(null, content);
                            ^ Expected an identifier and instead saw '='.
     34 |            var ml = M.mapMLLayer(null, content);
                              ^ Expected ')' and instead saw 'M'.
     35 |            await expect(ml._content).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
     35 |            await expect(ml._content).toBeTruthy();
                          ^ Missing semicolon.
     36 |            await expect(
                     ^ Expected an assignment or function call and instead saw an expression.
     36 |            await expect(
                          ^ Missing semicolon.
     39 |            await expect(ml._imageContainer).toBeTruthy();
                     ^ Expected an assignment or function call and instead saw an expression.
     39 |            await expect(ml._imageContainer).toBeTruthy();
                          ^ Missing semicolon.
     40 |            await expect(
                     ^ Expected an assignment or function call and instead saw an expression.
     40 |            await expect(
                          ^ Missing semicolon.
     43 |            await expect(ml._href).toBeFalsy();
                     ^ Expected an assignment or function call and instead saw an expression.
     43 |            await expect(ml._href).toBeFalsy();
                          ^ Missing semicolon.
     44 |            await expect(ml.options.zIndex).toBe(0);
                     ^ Expected an assignment or function call and instead saw an expression.
     44 |            await expect(ml.options.zIndex).toBe(0);
                          ^ Missing semicolon.
>> Unrecoverable syntax error. (31% scanned).
   test/layers/mapMLStaticTileLayer.spec.js
      9 |  test("Setting Tile Layer options", async () => {
                                                          ^ Expected '(' and instead saw '{'.
     10 |    let tileContainer = document.createElement("div");
             ^ Expected an identifier and instead saw 'let' (a reserved word).
     10 |    let tileContainer = document.createElement("div");
                 ^ Expected ')' to match '{' from line 9 and instead saw 'tileContainer'.
     10 |    let tileContainer = document.createElement("div");
                               ^ Expected an identifier and instead saw '='.
     10 |    let tileContainer = document.createElement("div");
                                 ^ Expected ')' and instead saw 'document'.
     19 |    await expect(layer.options.pane).toEqual(container);
             ^ Expected an assignment or function call and instead saw an expression.
     19 |    await expect(layer.options.pane).toEqual(container);
                  ^ Missing semicolon.
     20 |    await expect(layer.options.className).toEqual("tempGridML");
             ^ Expected an assignment or function call and instead saw an expression.
     20 |    await expect(layer.options.className).toEqual("tempGridML");
                  ^ Missing semicolon.
     21 |    await expect(layer.options.maxNativeZoom).toEqual(3);
             ^ Expected an assignment or function call and instead saw an expression.
     21 |    await expect(layer.options.maxNativeZoom).toEqual(3);
                  ^ Missing semicolon.
     22 |    await expect(layer.options.minNativeZoom).toEqual(0);
             ^ Expected an assignment or function call and instead saw an expression.
     22 |    await expect(layer.options.minNativeZoom).toEqual(0);
                  ^ Missing semicolon.
     23 |    await expect(layer.options.maxZoom).toEqual(24);
             ^ Expected an assignment or function call and instead saw an expression.
     23 |    await expect(layer.options.maxZoom).toEqual(24);
                  ^ Missing semicolon.
     24 |    await expect(layer.options.minZoom).toEqual(0);
             ^ Expected an assignment or function call and instead saw an expression.
     24 |    await expect(layer.options.minZoom).toEqual(0);
                  ^ Missing semicolon.
     27 |  test("Creating tile group map",  async () => {
                                                        ^ Expected '(' and instead saw '{'.
     28 |    let tileContainer = document.createElement("div");
             ^ Expected an identifier and instead saw 'let' (a reserved word).
     28 |    let tileContainer = document.createElement("div");
                 ^ Expected ')' to match '{' from line 27 and instead saw 'tileContainer'.
     28 |    let tileContainer = document.createElement("div");
                               ^ Expected an identifier and instead saw '='.
     28 |    let tileContainer = document.createElement("div");
                                 ^ Expected ')' and instead saw 'document'.
     38 |    await expect(Object.keys(result).length).toEqual(6); await expect(result["17:18:3"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     38 |    await expect(Object.keys(result).length).toEqual(6); await expect(result["17:18:3"]).toBeTruthy();
                  ^ Missing semicolon.
     38 |    await expect(Object.keys(result).length).toEqual(6); await expect(result["17:18:3"]).toBeTruthy();
                                                                  ^ Expected an assignment or function call and instead saw an expression.
     38 |    await expect(Object.keys(result).length).toEqual(6); await expect(result["17:18:3"]).toBeTruthy();
                                                                       ^ Missing semicolon.
     39 |    await expect(result["11:10:2"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     39 |    await expect(result["11:10:2"]).toBeTruthy();
                  ^ Missing semicolon.
     40 |    await expect(result["9:10:2"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     40 |    await expect(result["9:10:2"]).toBeTruthy();
                  ^ Missing semicolon.
     41 |    await expect(result["9:11:2"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     41 |    await expect(result["9:11:2"]).toBeTruthy();
                  ^ Missing semicolon.
     42 |    await expect(result["2:3:0"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     42 |    await expect(result["2:3:0"]).toBeTruthy();
                  ^ Missing semicolon.
     43 |    await expect(result["3:3:0"]).toBeTruthy();
             ^ Expected an assignment or function call and instead saw an expression.
     43 |    await expect(result["3:3:0"]).toBeTruthy();
                  ^ Missing semicolon.
>> Unrecoverable syntax error. (15% scanned).
   test/projections/tcrs.spec.js
      5 |        test("M.CBMTILE origin", async () => {
                                                      ^ Expected '(' and instead saw '{'.
      6 |            cbmtile = M.CBMTILE;
                                        ^ Expected ')' to match '{' from line 5 and instead saw ';'.
      7 |            await expect(cbmtile.options.origin[0]).toBe(-34655800);
                           ^ Expected ')' and instead saw 'expect'.
      8 |            await expect(cbmtile.options.origin[1]).toBe(39310000);
                     ^ Expected an assignment or function call and instead saw an expression.
      8 |            await expect(cbmtile.options.origin[1]).toBe(39310000);
                          ^ Missing semicolon.
>> Unrecoverable syntax error. (47% scanned).
   test/utils/boundsUtils.spec.js
     60 |    test("Null, Null parameters", async () => {
                                                       ^ Expected '(' and instead saw '{'.
     61 |      let output = M.pixelToPCRSBounds(null, null);
               ^ Expected an identifier and instead saw 'let' (a reserved word).
     61 |      let output = M.pixelToPCRSBounds(null, null);
                   ^ Expected ')' to match '{' from line 60 and instead saw 'output'.
     61 |      let output = M.pixelToPCRSBounds(null, null);
                          ^ Expected an identifier and instead saw '='.
     61 |      let output = M.pixelToPCRSBounds(null, null);
                            ^ Expected ')' and instead saw 'M'.
     62 |      await expect(output).toEqual(undefined);
               ^ Expected an assignment or function call and instead saw an expression.
     62 |      await expect(output).toEqual(undefined);
                    ^ Missing semicolon.
     64 |    test("Null, float parameters", async () => {
                                                        ^ Expected '(' and instead saw '{'.
     65 |      let output = M.pixelToPCRSBounds(null, osmtileResolutions[0]);
               ^ Expected an identifier and instead saw 'let' (a reserved word).
     65 |      let output = M.pixelToPCRSBounds(null, osmtileResolutions[0]);
                   ^ Expected ')' to match '{' from line 64 and instead saw 'output'.
     65 |      let output = M.pixelToPCRSBounds(null, osmtileResolutions[0]);
                          ^ Expected an identifier and instead saw '='.
     65 |      let output = M.pixelToPCRSBounds(null, osmtileResolutions[0]);
                            ^ Expected ')' and instead saw 'M'.
     66 |      await expect(output).toEqual(undefined);
               ^ Expected an assignment or function call and instead saw an expression.
     66 |      await expect(output).toEqual(undefined);
                    ^ Missing semicolon.
     68 |    test("bounds, Null parameters", async () => {
                                                         ^ Expected '(' and instead saw '{'.
     69 |      let bounds = L.bounds(L.point(1, 1), L.point(5, 5));
               ^ Expected an identifier and instead saw 'let' (a reserved word).
     69 |      let bounds = L.bounds(L.point(1, 1), L.point(5, 5));
                   ^ Expected ')' to match '{' from line 68 and instead saw 'bounds'.
     69 |      let bounds = L.bounds(L.point(1, 1), L.point(5, 5));
                          ^ Expected an identifier and instead saw '='.
     69 |      let bounds = L.bounds(L.point(1, 1), L.point(5, 5));
                            ^ Expected ')' and instead saw 'L'.
     71 |      await expect(output).toEqual(undefined);
               ^ Expected an assignment or function call and instead saw an expression.
     71 |      await expect(output).toEqual(undefined);
                    ^ Missing semicolon.
>> Unrecoverable syntax error. (15% scanned).
   test/utils/options.spec.js
      2 |  test("M.options.announceMovement default set", async () => {
                                                                      ^ Expected '(' and instead saw '{'.
      3 |    await expect(M.options.announceMovement).toEqual(false);
                   ^ Expected ')' to match '{' from line 2 and instead saw 'expect'.
      3 |    await expect(M.options.announceMovement).toEqual(false);
                                                                    ^ Expected ')' and instead saw ';'.
      3 |    await expect(M.options.announceMovement).toEqual(false);
                                                                     ^ Missing semicolon.
>> Unrecoverable syntax error. (80% scanned).
   test/utils/util.spec.js
     12 |    test("M.parseStylesheetToHTML(mapml,base,container)", async () => {
                                                                               ^ Expected '(' and instead saw '{'.
     15 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
               ^ Expected an identifier and instead saw 'var' (a reserved word).
     15 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                   ^ Expected ')' to match '{' from line 12 and instead saw 'mapml'.
     15 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                         ^ Expected an identifier and instead saw '='.
     15 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                           ^ Expected ')' and instead saw 'parser'.
     18 |      await expect(testcontainer.querySelector('link')).toBeFalsy();
               ^ Expected an assignment or function call and instead saw an expression.
     18 |      await expect(testcontainer.querySelector('link')).toBeFalsy();
                    ^ Missing semicolon.
     19 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
               ^ Expected an assignment or function call and instead saw an expression.
     19 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
                    ^ Missing semicolon.
     20 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
               ^ Expected an assignment or function call and instead saw an expression.
     20 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
                    ^ Missing semicolon.
     25 |    test("M.parseStylesheetToHTML(mapml with linked, inline styles, base, container)", async () => {
                                                                                                            ^ Expected '(' and instead saw '{'.
     27 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
               ^ Expected an identifier and instead saw 'var' (a reserved word).
     27 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                   ^ Expected ')' to match '{' from line 25 and instead saw 'mapml'.
     27 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                         ^ Expected an identifier and instead saw '='.
     27 |      var mapml = parser.parseFromString(mapmlString, "application/xml");
                           ^ Expected ')' and instead saw 'parser'.
     34 |      await expect(mapml.firstChild.firstChild.nodeName).toEqual("map-head");
               ^ Expected an assignment or function call and instead saw an expression.
     34 |      await expect(mapml.firstChild.firstChild.nodeName).toEqual("map-head");
                    ^ Missing semicolon.
     35 |      await expect(testcontainer.querySelector('link')).toBeTruthy();
               ^ Expected an assignment or function call and instead saw an expression.
     35 |      await expect(testcontainer.querySelector('link')).toBeTruthy();
                    ^ Missing semicolon.
     36 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
               ^ Expected an assignment or function call and instead saw an expression.
     36 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
                    ^ Missing semicolon.
     37 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
               ^ Expected an assignment or function call and instead saw an expression.
     37 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
                    ^ Missing semicolon.
     38 |      await expect(testcontainer.querySelector('link').href).toEqual(base + "remote.css");
               ^ Expected an assignment or function call and instead saw an expression.
     38 |      await expect(testcontainer.querySelector('link').href).toEqual(base + "remote.css");
                    ^ Missing semicolon.
     42 |    test("M.parseStylesheetToHTML(mapml with inline styles only, base, container)", async () => {
                                                                                                         ^ Expected '(' and instead saw '{'.
     43 |      var testcontainer = document.createElement('div');
               ^ Expected an identifier and instead saw 'var' (a reserved word).
     43 |      var testcontainer = document.createElement('div');
                   ^ Expected ')' to match '{' from line 42 and instead saw 'testcontainer'.
     43 |      var testcontainer = document.createElement('div');
                                 ^ Expected an identifier and instead saw '='.
     43 |      var testcontainer = document.createElement('div');
                                   ^ Expected ')' and instead saw 'document'.
     46 |      await expect(testcontainer.querySelector('link')).toBeFalsy();
               ^ Expected an assignment or function call and instead saw an expression.
     46 |      await expect(testcontainer.querySelector('link')).toBeFalsy();
                    ^ Missing semicolon.
     47 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
               ^ Expected an assignment or function call and instead saw an expression.
     47 |      await expect(testcontainer.querySelector('style')).toBeTruthy();
                    ^ Missing semicolon.
     48 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
               ^ Expected an assignment or function call and instead saw an expression.
     48 |      await expect(testcontainer.querySelector('style').textContent).toEqual('.css {property:cool}');
                    ^ Missing semicolon.
>> Unrecoverable syntax error. (10% scanned).

>> 151 errors in 35 files

after npm test:

Summary of all failing tests
 FAIL  test/e2e/core/linkTypes.test.js (18.412 s)
  ● Playwright Feature Links Tests › HTML Link Type Tests › HTML _top target point navigates to new page

    missing ) after argument list

  ● Playwright Feature Links Tests › HTML Link Type Tests › HTML _parent target point navigates to new page

    expect(received).toEqual(expected) // deep equality

    Expected: "http://geogratis.gc.ca/mapml/en/cbmtile/fdi/"
    Received: "http://localhost:30001/featureLinks.html"


Test Suites: 1 failed, 38 passed, 39 total
Tests:       2 failed, 343 passed, 345 total
Snapshots:   0 total
Time:        44.935 s
Ran all test suites in 2 projects.

@prushforth
Copy link
Member Author

Dang! Ok I will see if I can fix that.

@prushforth
Copy link
Member Author

@Malvoz one test is still flaky but the css minification stuff works a charm. I've merged it into this PR. The problem was that the gh CI action was running 'grunt clean copy rollup', not 'grunt default' so the minification task wasn't being run on gh. Other problems may have been old dependencies not being updated, I have updated to the max at this point. Have to clean the house, will check in later.

@prushforth prushforth marked this pull request as draft November 27, 2021 14:32
@ahmadayubi
Copy link
Member

What are the packages jest-environment-node and jest-circus for? The jest-environment-node package doesn't seem to have a README so I am not fully sure what it's used for as it's repository also links to the jest repository.

@prushforth
Copy link
Member Author

When you npm install it tells you it's a "peer" dependency of jest that you have to install manually. I don't know what it is.

@ahmadayubi
Copy link
Member

I ran it a few times and a number of the tests failed on my end, It also seemed to run a little slower but nothing major (from 85s to 170s, on average).

The tests that failed were (over 4 tries);

  • zoomChangeProjection.test.js (consistently failed)
    • zoomin link changes projections
    • zoomout link changes projections
  • scroll.test.js (passed but had a console.error once)
    • Error: ":" is not permitted in projection name
  • layerContextMenu.test.js (once)
    • Layer context menu copy layer extent

@prushforth prushforth marked this pull request as ready for review November 29, 2021 01:03
@prushforth prushforth merged commit 90540cb into Maps4HTML:main Nov 29, 2021
@prushforth prushforth deleted the keyboard-tests branch November 29, 2021 01:08
@Malvoz Malvoz added the tests label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants