Get help with testing, discuss unit testing strategies etc.


Post by fancy »

2 questions

1 - Is it possible to record mousewheel events?
2 - Is it possible to disable id-s for events recorder?

Post by nickolay »

What is your Siesta version? Recorder code has changed a lot in 4.2.0

1) Currently not. What is your use case? Shouldn't you be interested in recording `scroll` event?
2) Yes, possible, but why? Auto-generated ids should be already ignored, and user-assigned are the best possible selector?

Post by fancy »

nickolay wrote:What is your Siesta version? Recorder code has changed a lot in 4.2.0
I play with 4.2.0
nickolay wrote:1) Currently not. What is your use case? Shouldn't you be interested in recording `scroll` event?
My use case is trying Siesta for testing our company product that has following ways of work.
a) Without dependency
b) jQuery based
...

We have not-native scroller.
And we need to test that our scroller works right

nickolay wrote:2) Yes, possible, but why? Auto-generated ids should be already ignored, and user-assigned are the best possible selector?
We have some problems with Recordered tests.
We do not know why, but some lack if it sets ids, another lack if it contains textEquals.
So it requires from us to try for 3-5 times till we get selectors good and sometime rewrite selectors.

P.S.:
We have small product internal that do the same like Siesta, but we tired with it and want to try Siesta.
We do not use ExtJS.
Our product is some kind of light UI library without dependecies.

Post by nickolay »

I see. Siesta will work for plain-dom apps/libs just fine.

Right now there's no way to record/simulate mousewheel, you'll have to figure something out manually. Remember that you can extend test class with custom methods: https://bryntum.com/docs/siesta/#!/guide ... test_class

You can try to re-use Siesta's code for events simulation may be, see the sources.

As about recorder - please post a more detailed description of the problems you have and we'll try to help.

"textEquals" is a custom Siesta's "pseudo" selector. Note, that actions, recorded with Siesta recorder are expected to be replayed inside Siesta (which will provide "textEquals")

Post by fancy »

I play with Siesta for 5 days only.
I will try to sum.

About MouseWheel.
Ok, I think I will wait about it, maybe in future you will add it.
Since I do not know at the moment how to record it by self on Siesta.

About id-s.
We use some ExtJS pattern like auto-id generation. But we use it in our mode.
So when EventRecord generate id-s and than we run it,
test simulator can not replicate all behavior and id-s on the same elements could be other.
So trouble and test does not go.

About "textEquals", we understand that it is "pseudo" selector.
But none sample with it works. Just tests does not run.

One more - Does not show bugs.
If test runs over clicking on it's file name - all is ok.
If we run Checked tests button to run or All Tests buttont to run than
it does not find any bugs.

We use t.ok(false, 'Error');

Maybe it is bug.

I will on next week provide more details with screenshots if I can not solve all these.
Last edited by fancy on Fri Dec 02, 2016 3:45 pm, edited 1 time in total.

Post by nickolay »

Ok, please provide something reproducible and we'll investigate it.

Post by fancy »

1 - Siesta Bug when click on Button to run All Tests/Check Tests.

Maybe it is not bug, just needs to configuring, but I tried many varients.
Here is video.
https://www.screencast.com/t/zvXTvHFr

The last sample code is following
StartTest(function(t){
  t.diag('Resize Grid');
  
  ...
  events: [{
    init: function(){
      t.diag("Grid rendered");
      
      t.describe("Resize In", function(t){
        t.chain(
          { drag : ".fancy-panel-resize-corner", by : [-189, -134] }
        );
      });
      
      t.describe("Resize Out", function(t){
        t.chain(
          { drag : ".fancy-panel-resize-corner", by : [143, 122] },
          function(){
            t.ok(false, 'Resize was done ok');
          }
        );
      });
    }
  }]
});
});
The main is
      t.describe("Resize Out", function(t){
        t.chain(
          { drag : ".fancy-panel-resize-corner", by : [143, 122] },
          function(){
            t.ok(false, 'Resize was done ok');
          }
        );
      });
Sum:
When error occurs inside of recorded code it does not inform about bugs if to run over buttons.

Post by fancy »

2 - Wrong code generated for input when RecordEvents
describe("New recording...", function(t) {
  t.chain(
    { moveCursorTo : "#fancy-grid-1 .fancy-grid-cell-inner:textEquals(Miller)", offset : [9, 13] },
    { click : "#fancy-grid-1 .fancy-grid-cell-inner:textEquals(Miller)" },
    { moveCursorTo : "#fancy-gen-42 .fancy-field-text-input", offset : [22, 18] },
    { type : "#fancy-gen-42 .fancy-field-text-input", text : "[BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE]" },
    { type : "#fancy-gen-42 .fancy-field-text-input", options : { shiftKey : true }, text : "J" },
    { type : "#fancy-gen-42 .fancy-field-text-input", text : "ack[RETURN]" }
  );
});
Look at
    { type : "#fancy-gen-42 .fancy-field-text-input", text : "ack[RETURN]" }
This will do type in input
#fancy-gen-42 .fancy-field-text-input
So I fix it manually to and it it works.
describe("New recording...", function(t) {
  t.chain(
    { moveCursorTo : "#fancy-grid-1 .fancy-grid-cell-inner:textEquals(Miller)", offset : [9, 13] },
    { click : "#fancy-grid-1 .fancy-grid-cell-inner:textEquals(Miller)" },
    { moveCursorTo : "#fancy-gen-42 .fancy-field-text-input", offset : [22, 18] },
    { type : "[BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE]" },
    { type : "J", options : { shiftKey : true }},
    { type : "ack[RETURN]" }
  );
});
In attachment - screenshot of wrong behavior with almost the same sample.

Note:
If to run just generated code, it works ok.
But if to place generated code to test than wrong behavior.
Attachments
type-error.png
type-error.png (26.73 KiB) Viewed 5938 times

Post by fancy »

3 - Wrong generated selectors

Here is generated code that gives error
describe("New recording...", function(t) {
  t.chain(
     { click : ".fancy-grid-cell:nth-of-type(2) :textEquals(Canada)" },
     { click : "#fancy-gen-40 .fancy-combo-dropdown-button" },
     { click : "li:nth-of-type(1)" }
  );
});
Error
Subtest `New recording...` threw an exception
Syntax error, unrecognized expression: nth-of-type
On video similiar example that generate wrong selector.
https://www.screencast.com/t/kerjRCzps

I think the problem is in
1 - :nth-of-type(2) - I see that it very often can not detect element
2 - Selector without "parent" example
".fancy-grid-cell:nth-of-type(2) :textEquals(Canada)"
As I know css selector with ':' should be appling to some rule.
But here it is absent.

Post by mats »

@fancy - Please try to be more structured in your feedback. We have clear rules in this forum - one question per thread and always provide a clear test case to us. upload a simple sample, along with clear instructions on what to do - and then we'll try to address your issues. We'll close this thread now, waiting for you to start new clean organized questions. Looking forward to your feedback.

Locked