AngularSelector getAngular() not working
Closed this issue · 6 comments
I cannot use .getAngular() to retrieve the angular component. I am getting the following error:
getAngular cannot return DOM elements. Use Selector functions for this purpose.
I'm using ist with:
const myComponentSelector = AngularSelector("app-mycomponent");
const myComponent = await myComponentSelector.getAngular();
I am using Angular 5.2.0
Hi @derchirurg
Could you please provide a small example to reproduce?
I don't know how to provide an online example, because I need Node to run the test.
Here is my test code:
import { Selector } from 'testcafe';
import { waitForAngular, AngularSelector } from 'testcafe-angular-selectors';
fixture("MyComponent").page("http://localhost:4200").beforeEach(async () => { await waitForAngular(); });
test("Default_NOK", async t =>
{
const dataString = '{"name": "doe", "firstname": "john"}';
const data = JSON.parse(dataString);
const myComponentSelector = AngularSelector("app-mycomponent");
const myComponent = await myComponentSelector.getAngular();
myComponent.loadData(data);
});
My Component is:
import { Component, OnInit} from '@angular/core';
@Component({
selector: 'app-mycomponent',
templateUrl: './my.component.html',
styleUrls: ['./my.component.scss']
})
export class MyComponent implements OnInit
{
private data;
constructor()
{
}
async ngOnInit()
{
}
loadData(data)
{
this.data = data;
}
}
I need to load Data in the component.
Could you please attach your example to this issue?
Any updates or work around for this issue?
@d-amit,
We did not get the working project to reproduce the issue on our side. We will really appreciate it if you share your sample project with us.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.