Get help with testing, discuss unit testing strategies etc.


Post by Clothia C »

Hi,

I am trying to setup Siesta for my project.

Problem
I have to run the application on port 46000 because the service for the app is run on port 46001. How do I configure this?

I have to tell Chrome to use CORS, but how do I tell Siesta to use my new Chrome link?


Post by nickolay »

Hello,

I have to tell Chrome to use CORS, but how do I tell Siesta to use my new Chrome link?

What does that mean exactly? Do you launch Chrome with certain command line arguments? If so, check the --browser-arg argument of the launcher (bin/webdriver --help)


Post by Clothia C »

see my next post please

Last edited by Clothia C on Thu Jan 21, 2021 12:25 pm, edited 1 time in total.

Post by Clothia C »

The problem now is that I can see that the webpage is loading, but Siesta throws the following exception:

Failed to access cross-origin page: https://localhost:56000/MyApp/index.html. 
In general tests should reside on the same domain as the app itself,
but you can try to disable web security:
https://www.bryntum.com/blog/testing-x-domain-websites-with-siesta-in-chrome/

And it shows that 1 test failed, although I have 4 tests in the file:

        t.diag("Sanity test, loading classes on demand and verifying they were indeed loaded.")

    t.ok(Ext, 'ExtJS is here');

    t.requireOk('MyApp.view.Viewport');
    t.requireOk('MyApp.store.Language');
    t.requireOk('MyApp.controller.CaseCreation');

Post by nickolay »

The problem now is that I can see that the webpage is loading, but Siesta throws the following exception:

Please describe your setup in more detailed way. So your project file is hosted on one port, but test page - on another? Can you host your project file on the same port as the test page?

And it shows that 1 test failed, although I have 4 tests in the file:

You probably mean assertions - the "test" term usually means a whole test file or t.it() section in it. Which one exactly is failing?


Post by Clothia C »

I cannot see which assertion is failing, as it seems not to start the assertions.

My setup

application
    index.html
    [b]tests[/b]
        siesta.html
        siesta.js
        010_sanity.t.js
siesta-sources

Running index.html
https://localhost:46000/MyApp/Client/index.html

Running Siesta
https://localhost:63342/root/MyApp/Client/tests/siesta.html?_ijt=rasr5fpfk4l1al9e6s76lhghnp#010_sanity.t.js

Result
I can see the siesta browser preview to run the webpage.
But I get the previous result.

My 010_sanity.t.js

describe('Sanity Test', t => {
    t.it("Sanity", t => {
        t.diag("Sanity test, loading classes on demand and verifying they were indeed loaded.")

    t.ok(Ext, 'ExtJS is here');

    t.requireOk('MyApp.view.Viewport');
    t.requireOk('MyApp.store.Language');
    t.requireOk('MyApp.controller.CaseCreation');
});
})

My siesta.js

const project = new Siesta.Project.Browser.ExtJS();

project.configure({
    title: 'Basic browser test suite',

transparentEx: true,

autoCheckGlobals: true,
expectedGlobals : [
    'Ext'
],

preload: []
});

project.start({
    group: 'Application',

// need to set the `preload` to empty array - to avoid the double loading of dependencies
preload: [],

expectedGlobals: [
    'MyApp',
    'CKEDITOR',
    'Fashion'
],

items: [
    {
        pageUrl: 'https://localhost:46000/MyApp/Client/index.html',
        url    : '010_sanity.t.js'
    }
]
});

My siesta.html

<!DOCTYPE html>
<html>
<head>
    <!-- Recommended set of pragmas, required for IE11 compatibility-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<!-- Web interface -->
<link rel="stylesheet" type="text/css" href="../../../testing_siesta/resources/css/siesta-all.css">
<script type="text/javascript" src="../../../testing_siesta/siesta-all.js"></script>

<!-- Project file -->
<script type="text/javascript" src="siesta.js"></script>
</head>

<body>
</body>
</html>

Post by nickolay »

Ok, everything looks fine. Any chance you can host/proxy the Siesta's project/test files from the same port as your app itself?


Post by Clothia C »

I moved the Siesta folder parallel to the tests folder and it works.

For testing Siesta that will work. Thanks a lot.
Once I get the customer onto Siesta, we have to see how to get this working.

Awesome.


Post by nickolay »

Cool-cool, glad it works, yw!


Post Reply