Have I found a bug in the Sonos Self-test Suite? - testing

Summary
The Sonos self-test suite seems to incorrectly fail for an item with itemType=other if it also has a custom browse icon.
I believe that the item type other should be included in this list from utility.py:
17 BROWSEABLE_CONTAINER_TYPES = ('artist', 'album', 'genre', 'playlist', 'favorites', 'albumList', 'trackList', 'artistTrackList', 'container', 'favorite', 'collection', 'program', 'show')
Details
When running the sonos self-test suite, I got the following error as part of the output:
...
INFO Start Test Case: 844 Albumart test_custom_browse_icon_configuration
STOP Discovered custom browse icon URI should be something other than None. (is None)
STOP 844 Albumart test_custom_browse_icon_configuration
...
By debugging albumart.py (test_custom_browse_icon_configuration method), I traced the issue to the following extract of the get_sample_custom_browse_icon_url method:
# TODO: Need to drill down one level deeper if the target image url cannot be found on the root level containers
for mediaColl in response.Items:
if mediaColl.itemType in container_types:
if substitution_str in mediaColl.albumArtURI:
return mediaColl.albumArtURI
elif hasattr(mediaColl.albumArtURI,'value') and substitution_str in mediaColl.albumArtURI.value:
return mediaColl.albumArtURI.value
This code was supposed to find containers with custom album art. However, it turns out that container_types was defined by an earlier line:
container_types = [t for t in Validation.BROWSEABLE_CONTAINER_TYPES if t.lower() != 'album']
and Validation.BROWSEABLE_CONTAINER_TYPES was defined in utility.py as follows:
# sonos-selftest/smapi/content_workflow/utility.py
15 class Validation(WorkflowTestFixture, SMAPIClient, SMAPIService):
16
17 BROWSEABLE_CONTAINER_TYPES = ('artist', 'album', 'genre', 'playlist', 'favorites', 'albumList', 'trackList', 'artistTrackList', 'container', 'favorite', 'collection', 'program', 'show')
Note that the type 'other' is missing from this list! I'm pretty sure it is supposed to be inluded in the list, browse.py mentions it:
234 **Reference:** BROWSEABLE_CONTAINER_TYPES = 'artist', 'album', 'genre', 'playlist', 'favorites', 'albumList', 'trackList', 'artistTrackList', 'container', 'favorite', 'collection', 'other', ' program'
Workaround
I was able to work around this issue by changing itemType=other to itemType=container (which are pretty much equivalent).
However, it would be nice if this was fixed in future versions of the Sonos self-test suite.

Related

WebdriverIO: Retrieving browser logging

According to WebdriverIO-Dokumentation I can integrate the output of browser console logging into webdriverio-logging. My call is then browser.getLogs('browser'). However, only log messages issued with console.warn() are retrieved. All console.log() messages are ignored. How can I manage that and include all of console messages into my webriverio report?
If you are using a recent version of Chrome and find that you only get warning and error messages in your logs, but you want INFO as well, add the following into your wdio.conf.js:
exports.config = {
capabilities: [{
...
"goog:loggingPrefs": { // <-- Add this
browser: "ALL",
},
}],
};

Not able to close the browser using NightwatchJS

I am trying to open my url using Nightwatch and I wan't able to close the browser afterwards.
I tried using timeouts, as well as browser.end(), or browser.closeWindow(). None of them seem to be working for my url.
module.exports = {
'Demo test mywrkouts' : function (browser) {
browser.url('https://www.mywrkouts.com/workouts/search')
browser.timeouts('script', 10000, function(result) {
browser.end();
console.log("Test result"+result);
});
//browser.closeWindow();
}
};
It opens the page, but doesn't close the browser. I am using Chrome browser with chromedriver. I am expecting to close the window, but it doesn't work.
Any advice is appreciated.
LE: Like I extensibly described below, you don't need to explicitly close the browser at the end of the test (via browser.end()) as the Nightwatch test-runner does that for you at the end of each feature-file.
But, if you need to do some teardown operations and then explicitly close the session, do it in an after (or afterEach) hook. Try the following snippet:
module.exports = {
before(browser) {
browser.maximizeWindow();
},
'My Wrkouts Test': (browser) => {
browser.url('https://www.mywrkouts.com/');
// Check if the website logo is visible:
browser.expect.element('#barbell-homepage-top-image-desktop img.app-bar-desktop-logo').to.be.visible;
// Check the articles heading text:
browser.expect.element('h3.blog-carousel-title.primary-blue-text.center').text.to.contain('Foundational Education Series');
},
after(browser, done) {
browser.end(() => {
console.info('*--*--*--*--*--*--*--*--*--*--*--*--*');
console.info('*-- Clossing session... Good bye! --*');
console.info('*--*--*--*--*--*--*--*--*--*--*--*--*');
done();
});
}
};
Anyways, I feel you are confusing the way NightwatchJS/WebdriverIO/Protractor (or any other Webdriver-based test solution) is handling a browser session.
First off, you need not worry about closing the active session. Nightwatch does it for you at the end of each test feature-file. Thus, running a suit of let's say three test suites (login.js, register.js, forgot_password.js) will sequentially spawn & close three different browser sessions.
Also, browser.closeWindow() is only used for closing a window instance (taking into account that you have multiple windows associated with the same browser session). It won't close your main window, unless you have switched to another window instance (which was previously opened during your test run).
If you use browser.end() in the middle of your test, then you basically kill the active session, nullifying the following logic from your feature-file:
INFO Request: DELETE /wd/hub/session/4a4bb4cb1b38409ee466b0fc8af78101
- data:
- headers: {"Content-Length":0,"Authorization":"Basic Z29wcm86YmM3MDk2MGYtZGE0Yy00OGUyLTk5MGMtMzA5MmNmZGJhZTMz"}
INFO Response 200 DELETE /wd/hub/session/4a4bb4cb1b38409ee466b0fc8af78101 (56ms) { sessionId: '4a4bb4cb1b38409ee466b0fc8af78101',
status: 0,
value: null }
LOG → Completed command end (57 ms)
Everything after will look like this:
INFO Response 404 POST /wd/hub/session/null/elements (11ms) { sessionId: 'null',
value:
{ error: 'invalid session id',
message: 'No active session with ID null',
stacktrace: '' },
status: 6 }
!Note: There is no support for doing what you are trying to do, nor is it a common use-case, thus the lack of support for it across
all of these testing solutions.
They say a picture is worth 1000 words, so let's me simply put it this way... what you are trying to do is synonymous with the following:

WebRTC - getting 'malformed constraints object'

I am using Chrome ans working on a webRTC application. I am getting an error 'malformed constraints object' in the createAnswer() for a session Description offer
pc.createAnswer(gotDescription, errorHandler, constraints);
I have tried all the options such as
constraints = {'mandatory': {
'offerToReceiveAudio': true,
'offerToReceiveVideo': true}};
constraints = {'offerToReceiveAudio': true,
'offerToReceiveVideo': true};
and with both capital and small 'o' but still the same error.
Any suggestions?
It seems in the latest Specs, the audio/video offers are not required any more in RTCOfferOptions, so you may omit that unless you want to specify the iceRestart option which default is false.
http://w3c.github.io/webrtc-pc/#idl-def-RTCOfferOptions
pc.createAnswer(gotDescription, errorHandler);

Basic authentication with Selenium in Internet Explorer 11

I read Basic authentication with Selenium in Internet Explorer 10
And I change my register key and when I use the user and pass in the url I don't see the basic authentication popup, but actually the page is not load. I see blank page!
I see my url in the IE but nothing happened - I see white page.
Must I change somethin in IE too?
It is not possible without some workarounds.
I also needed the same feature and previous SO answer confirms, that is it either impossible or possible with high probability of failure.
One thing I learned about Protrator is not to try to make too complicated stuff with it, or I'll have a bad time.
As for the feature- I ended up making Protractor to initiate Node.js task, which use request to make the authentication and provide back the data.
Taken straight from request module:
request.get('http://some.server.com/').auth('username', 'password', false);
// or
request.get('http://some.server.com/', {
'auth': {
'user': 'username',
'pass': 'password',
'sendImmediately': false
}
});
// or
request.get('http://some.server.com/').auth(null, null, true, 'bearerToken');
// or
request.get('http://some.server.com/', {
'auth': {
'bearer': 'bearerToken'
}
});

Cross-domain requests does not work using Sencha Touch 2

I have an application which displays some articles. The application works perfectly on Wamp in localhost. I've uploaded my database management in an other server. I already configured my ArticleStore.js in JSONP but when I run my application the following error appears in the console :
Resource interpreted as Script but transferred with MIME type text/html: "http://[ip_address]:[port]/totos?_dc=1372152920457&keyword=&page=1&start=0&limit=25&callback=Ext.data.JsonP.callback1"
and :
Uncaught SyntaxError: Unexpected token : totos:1
When I clic on the url above I'm redirected to the view which display the following content :
{"articles_list":[{"id":"28","title":"Prixtel dope son service client avec le forfait Sumo"}],"total":1}
For sake of simplicity, I tested to display just the title of one article. Here's the JSON response for the line 1 when I clic on 'totos:1':
{"articles_list":[{"id":"28","title":"Prixtel dope son service client avec le forfait Sumo"}],"total":1}
Here's my ArticleStore.js content :
Ext.define("MyApp.store.ArticleListStore",
{
extend: "Ext.data.Store",
requires: ["MyApp.model.ArticleModel","Ext.data.proxy.JsonP"],
config: {
model: "MyApp.model.ArticleModel",
proxy: {
type: 'jsonp',
model: "MyApp.model.ArticleModel",
url: "http://62.23.96.124:81/totos",
},
reader: {
type: "json",
rootProperty: "articles_list",
totalProperty: "total"
},
},
autoLoad: true
}
});
When I was launched my resquest in localhost directly on Wamp server my JSON responses had the same syntax (The JSON tree architecture is the same). Here's an example :
{"articles_list":[{"id":"384","title":"Skype est disponible sur Windows Phone"}],"total":1}
I cannot see any difference between the two responses. However, I have an 'Unexpected token' error!. As you can see the two nodes 'articles_list' and 'total' have the same place in the JSON tree for the two examples. I don't understand why there is an syntax error. I'm really lost. Does anyone can help me, please ?
Thanks a lot in advance for your help.
Your server is not formatting the response correctly for JSON-P. JSON-P essentially needs your response to be embedded within a function, which is specified by the callbackKey property of your proxy:
proxy: {
type: 'jsonp',
url : "http://62.23.96.124:81/totos",
callbackKey: 'myCallbackKey'
}
Then, on your server, you need to use that parameter to wrap your response:
myCallbackKey({
"articles_list": [
{
"id":"28",
"title":"Prixtel dope son service client avec le forfait Sumo"
}
],
"total":1
})
You can learn more about this from the docs here: http://docs.sencha.com/touch/2.2.1/#!/api/Ext.data.proxy.JsonP.
You also will want to know a little more about the purpose of JSON-P, and how it works. Find out more here: What is JSONP all about?