Salesforce lwc lightning/modal dispatchEvent - salesforce

Documentation - https://developer.salesforce.com/docs/component-library/bundle/lightning-modal/documentation - modal - API 56
When I try to fire an event from the modal window to the parent window - completely according to the example from the documentation - I get an error -
Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.
Completely according to the example from the documentation
this.dispatchEvent(new CustomEvent('select', {
detail: {
id: 42
}
}));
The error occurs even at the moment the event is sent - not to mention the moment it is received
I'm waiting for an event but it doesn't happen

You have to enable Lightning Web Security Enabled in the org to get this working.
You can check this https://salesforce.stackexchange.com/questions/387924/lightning-modal-custom-event-not-working-in-winter-23-release
I've checked it myself and it's working well.

Related

Gatling check does not fail

I am trying to send a http request and fail if the request returns not 200:
exec(http("Get some html")
.get("${aggUrl}/somePath")
.check(status.is(200))
.check(regex("websocket=(.*?)&").saveAs("wsLink"))
)
The server sends the 401 response:
[HTTP/1.1 401 Unauthorized]{"errors":[{"code":"authentication.failure","message":"Failed to authenticate user details"}]}]
I expect in console something like "expecting code 200, but was 401"
But the actual error is:
[ERROR] i.g.c.a.b.SessionHookBuilder$$anon$1 - 'hook-38' crashed with 'j.u.NoSuchElementException: No attribute named 'wsLink' is defined', forwarding to the next one
[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-37' failed to execute: No attribute named 'wsLink' is defined
So I assume that the ".check(status.is(200))" is just ignored?
How then should I fail the test?
Thanks in advance,
Andrei Isakov
I think you're mistaken.
[ERROR] i.g.c.a.b.SessionHookBuilder$$anon$1 - 'hook-38' crashed with 'j.u.NoSuchElementException: No attribute named 'wsLink' is defined', forwarding to the next one
[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-37' failed to execute: No attribute named 'wsLink' is defined
Those errors happens happen AFTER the request you provided the code for, in an exec block you didn't mentioned where you're trying to inspect the Session's content and fetch the wsLink attribute that doesn't exist because the request failed.
Check failures are not logged with ERROR level. You have to either lower the logging level (see logback.xml) or check the HTML reports.

How to add additional track in twilio-video?

After updating twilio-video JS SDK (from 1.x to 2.x) I have a problem in adding additional device.
This is example error message - ERROR TypeError: transceiver.sender.replaceTrack(...).then(...).finally is not a function.
If I disable this device i get new error message - ERROR Error: Uncaught (in promise): Error: The [LocalVideoTrack #5: 8da6e8e0-a9c1-473b-9916-484a17f61524] was unpublished.
And if I repeat enable device - is OK.
Below is example publishing track in share additional track method.
this.room
.localParticipant
.publishTrack(this.deviceTracks[type]);
this.deviceTrackShared[type] = true;
Below is example unpublishing track -
this.room
.localParticipant
.unpublishTrack(this.deviceTracks[type]);
this.deviceTrackShared[type] = false;
So, I fixed this issue. I lost a lot of time searching for errors in the code, but I just needed to update zone.js from 0.8.x to 0.9.x. Now it's working fine!

AngularJS testing with Protractor- call to click() never seems to be performed

I am developing a suite of tests for an AngularJS application, and have recently added the following test script to my spec.js file:
it('should navigate to the Charts page', function() {
console.log("Start Charts page test ");
browser.waitForAngularEnabled(false);
browser.wait(EC.presenceOf(chartsMenuBtn), 5000).then(
browser.actions().mouseMove(chartsMenuBtn).perform().then(
chartsMenuBtn.click().then(
browser.wait(EC.elementToBeClickable(closeDlgBtn)).then(
function(){
closeDlg();
expect(browser.getCurrentUrl()).toBe(VM + '/#/charts');
}
)
//)
)
)
)
})
Currently, when I run my tests, all of the tests written before this one run & execute correctly, then when this test is run, I get the following output in the command line where I'm running protractor conf.js:
...Alarms page test completed
.Start Charts page test
FA Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
Start final Browser page test
Browser menu button clicked
End Browser page test (then call)
.
Failures:
1) App should navigate to the Charts page
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
6 specs, 1 failure
Finished in 64.989 seconds
In the browser window that is opened by the script (the window where the tests are being run), I can see that the chartsMenuBtn element is highlighted (i.e. when the test moves the cursor to it), but at that point, the script appears to freeze, and the call to chartsMenuBtn.click() never appears to be run...
If I add a call to browser.pause() into my script, so that I manually have to tell the script to continue at every executable line, then the script behaves exactly as I expect, and everything passes.
But when I remove the call to browser.pause(), and watch the script run through on its own, it always gets stuck at the same point.
It's clear that the line:
browser.actions().mouseMove(chartsMenuBtn).perform().then(
is executed, because I can see that the chartsMenuBtn element is highlighted in the browser. But for some reason, the script never then seems to execute the line:
chartsMenuBtn.click().then(
If it did, I would expect the browser to navigate to the Charts page (as it does if I manually click on the chartsMenuBtn element.
The DEFAULT_TIMEOUT_INTERVAL is set to 35 seconds in jasmine.js with:
j$.DEFAULT_TIMEOUT_INTERVAL = 35000;
I tried increasing its value, but that didn't make a difference- the test still timed out in the same place, for the same reason, which would indicate to me that there is another reason that this test is failing/ timing out.
Does anyone have any suggestions how I can fix this?
Edit
So I changed my script to add some debug to the test (print statements before and after the call to chartsMenuBtn.click().then(, to see whether or not this line was actually being run, and when I run my test now, I can see both of those print statements displayed in the command line:
Started
...Alarms page test completed
.Start Charts page test
Cursor hovering over chartsMenuBtn
Call to chartsMenuBtn.click() performed
FA Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
Start final Tag Browser page test
Tag Browser menu button clicked
End Tag Browser page test (then call)
.
The two debug lines I added were:
Cursor hovering over chartsMenuBtn
Call to chartsMenuBtn.click() performed
I added these debug lines either side of the call to:
chartsMenuBtn.click().then(
so it's clear that this line is being run, yet for some reason, the click either doesn't seem to be registering, or the result of a click on this element is not actually performing the required & expected action.
Any suggestions for why this is?
Edit
So I've managed to make a bit of progress with this, although it's still not working as I intended/ hoped... I've altered the test script slightly by putting the call to chartsMenuBtn.click() inside a browser.actions() call, chaining multiple promises together:
it('should navigate to the Charts page', function() {
console.log("Start Charts page test ");
browser.waitForAngularEnabled(false);
browser.wait(EC.presenceOf(chartsMenuBtn), 5000).then(
browser.actions().mouseMove(chartsMenuBtn).perform().then(
browser.actions(console.log("Cursor hovering over chartsMenuBtn ")).perform().then(
browser.actions(chartsMenuBtn.click()).perform().then(
browser.actions(console.log("Call to chartsMenuBtn.click() performed ")).perform().then(
function(){
expect(EC.visibilityOf(closeDlgBtn).call()).toBeTruthy();
}
)
)
)
)
)
})
When I now run my script again, I just get a single failure- which seems to be caused by the timing associated with animation that has been set on one of the dialogs opened during the course of one of the tests to run prior to this test.
The error states:
Failed: unknown error: Element ... is not clickable at point (40, 229). Other element would receive the click:
<div tabindex="-1" role="dialog" class="modal fade ng-isolate-scope ult-loading modal-message ng-animate in-remove in-remove-active" ng-class="{in: animate}" ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)" modal-window="" window-class="ult-loading modal-message" size="sm" index="0" animate="animate" style="z-index: 1050; display: block;; transition-property: opacity;transition-duration: 0.15s;">...</div>
(Session info: chrome=62.0.3202.89)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86_64)
I tried putting the expect clause of my test inside a browser.wait() that would wait for the closeDlgBtn element to be present before running (but given that my expectation is that the button element is visible, this seems a bit redundant...):
function(){
browser.wait(EC.presenceOf(closeDlgBtn), 5000).then(
expect(EC.visibilityOf(closeDlgBtn).call()).toBeTruthy();
)
}
but this gives me a syntax error stating that there's a missing ) on the line:
expect(EC.visibilityOf(closeDlgBtn).call()).toBeTruthy();
I can't see a missing ) anywhere on that line. Can anyone spot what I'm doing wrong here?
Edit
I also tried surrounding the call to browser.actions(chartsMenuBtn.click()).perform().then( with a call to browser.wait(EC.elementToBeClickable()), so that it would wait for the element to be clickable before clicking on it (instead of just waiting for it to be present):
browser.wait(EC.elementToBeClickable(chartsMenuBtn), 5000).then(
browser.actions(chartsMenuBtn.click()).perform().then(
browser.actions(console.log("Call to chartsMenuBtn.click() performed ")).perform().then(
function(){
expect(EC.visibilityOf(closeDlgBtn).call()).toBeTruthy();
}
)
)
)
But for some reason, I still get the same error:
Failed: unknown error: Element ... is not clickable at point (40, 229). Other element would receive the click:
which doesn't make sense- since it should be waiting for the element to be clickable before clicking on it...?
Edit
So, I had a look at actions on the Protract API, and it appears I have been chaining the promises incorrectly. I changed the test script to:
it('should navigate to the Charts page', function() {
console.log("Start Charts page test ");
browser.waitForAngularEnabled(false);
browser.wait(EC.elementToBeClickable(chartsMenuBtn), 5000).then(
browser.actions().
mouseMove(chartsMenuBtn).
//console.log("Cursor hovering over chartsMenuBtn").
chartsMenuBtn.click().
//console.log("Call to chartsMenuBtn.click() performed").
browser.wait(EC.urlIs(VM + '/#/charts'), 5000).
//console.log("browser.wait called- URL should now be VM + /#/charts/ ").
perform()
);
})
and this seems to have resolved the 'element not clickable' issue. However, I now get another error that says:
Failed: Cannot read property 'click' of undefined
but chartsMenuBtn has been defined with:
var chartsMenuBtn = element(by.linkText("Charts"));
Anyone have any suggestions?

Thunderbird Lightning caldav sync doesn't show any data/events

when i try to synchronize my caldav server implementation with Thunderbird 45.4.0 and Lightning 4.7.4 (one particular calendar collection) it doesnt show any data or events in the calendar though the last call of the sequence provided the data.
In the Thunderbird error log i can see one error:
Zeitstempel: 07.11.16, 14:21:12
Fehler: [calCachedCalendar] replay action failed: null,
uri=http://127.0.0.1:8003/sap/sports/webdav/appsvc/webdav/services/
server.xsjs/cal/_D043133/, result=2147500037, op=[xpconnect wrapped
calIOperation]
Quelldatei:
file:///Users/d043133/Library/Thunderbird/Profiles/hfbvuk9f.default/
extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-
js/calCachedCalendar.js
Zeile: 327
the call sequence is as follows (detailed content via gist-links):
Propfind Request - Response
Options Request - Response
Propfind Request - Response
Report Request - Response - Response Raw
The synchronization with other clients like macOS-calendar and ios-calendar works in principle and shows the data. Does anyone has a clue what is going wrong here?
Not sure whether that is the cause but I can see two incorrect things:
a) Your <href/> property has trailing spaces:
<d:href>/sap/sports/webdav/appsvc/webdav/services/server.xsjs/cal/_D043133/EVENT%3A070768ba5dd78ff15458f1985cdaabb1.ics
</d:href>
b) your ORGANIZER property is not a valid URI
ORGANIZER:_D043133
i was able to find the cause of the above issue by debugging Thunderbird as propsed by Philipp. The Report Response has http status code 200, but as it is a multistatus response Thunderbird/Lightning expects status code 207 ;-)
Thanks for the hints!

Google+'s Signin APis [AngularJS]: Refused to display 'X-Frame-Options' to 'SAMEORIGIN'

I've had a look to several similar problems on SO on this problems but I didn't find one which solves mine.
I'm following this tutorial to implement Google+'s Sign-in in my web application: https://blog.codecentric.de/en/2014/06/angularjs-google-sign-integration/
gapi is loaded correctly.
In my controller I have the following code:
gapi.signin.render('signInButton',
{
'callback': $scope.signInCallback, // Function handling the callback.
'clientid': '[MY_CLIENT_ID].apps.googleusercontent.com',
'requestvisibleactions': 'http://schemas.google.com/AddActivity',
'cookiepolicy': 'single_host_origin'
}
);
where
MY_CLIENT_ID is of course replaced by my actual client ID got from Google Dashboard.
I'm working on localhost:85 and "Javascript origin" is set exactly to http://localhost:85/
The error I'm getting is:
Refused to display ... in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'
NOTE: this error appears only sometimes. I don't understand why (the user interaction doesn't change, though).

Resources