web-component-tester

Test lit-element webcomponent with Karma

情到浓时终转凉″ 提交于 2021-01-29 11:28:51
问题 I am trying to create a blank project, like a template, using lit-html. I wanted to also add some testing capabilities, so i have been trying to get it to work with Karma. I can run a normal test, like an addition, without any errors, so i think Karma itself is running ok. but i can't run any test involving the webcomponent. I can't import the webcomponent! i am exporting the webcomponent with: export default class MyComponent ... and then on the test file i am importing it with: import

Web Component / HtmlElement : unit testing

不羁的心 提交于 2020-01-02 12:42:44
问题 I'm trying to test a web component. Here is my project structure : ├── package.json ├── src │ ├── app.js │ └── index.html └── test └── hello-world-test.html Here is my working code : class HelloWorld extends HTMLElement { connectedCallback () { this.innerHTML = 'Hello, World!' } } customElements.define('hello-world', HelloWorld); <!doctype html> <html> <head> <meta charset="utf-8"> <script src="app.js"></script> </head> <body> <hello-world></hello-world> </body> </html> I'm trying to test

Web Component / HtmlElement : unit testing

落花浮王杯 提交于 2020-01-02 12:40:31
问题 I'm trying to test a web component. Here is my project structure : ├── package.json ├── src │ ├── app.js │ └── index.html └── test └── hello-world-test.html Here is my working code : class HelloWorld extends HTMLElement { connectedCallback () { this.innerHTML = 'Hello, World!' } } customElements.define('hello-world', HelloWorld); <!doctype html> <html> <head> <meta charset="utf-8"> <script src="app.js"></script> </head> <body> <hello-world></hello-world> </body> </html> I'm trying to test

Why does web-component-tester time out in flight mode?

烈酒焚心 提交于 2019-12-24 22:13:57
问题 I've got a basic web-component-tester project which works fine when I'm online. If I switch to flight mode, it seems to fail to connect to Selenium, and instead gives a largely useless error message after about 60s delay: "Error: Unable to connect to selenium". Edit 2 : I've narrowed the problem down in the following question, but I'd still like to know how to avoid it with web-component-tester: Why does NodeJS request() fail on localhost in flight mode, but not 127.0.0.1? (Windows 10) Edit :

Specify browser location for wct-local test

狂风中的少年 提交于 2019-12-21 12:03:07
问题 The Polymer Starter Kit contains web-component-tester for unit testing your custom elements. In wct.conf.json you can specify the browsers to run the tests in. { "suites": ["app/test"], "plugins": { "local": { "browsers": ["firefox"] } } Unfortunately, when I launch the tests through gulp, wct is not able to find my local Firefox. I read at GitHub that wct uses launchpad to detect local browsers. Afaik, on a Windows machine, launchpad searches for Firefox in the default directory "C:\Program

Testing polymer 1.0 components with iron-ajax using wct

微笑、不失礼 提交于 2019-12-10 23:51:21
问题 I am having the hardest time mocking the server response to an iron-ajax component inside my custom component. Here is my code files. custom-component.html: <link rel="import" href="/iron-ajax/iron-ajax.html"> <link rel="import" href="/internal-component/internal-component.html"> <dom-module id="custom-component"> <template> <iron-ajax url="staticFile.json" auto handle-as="json" last-response={{ajaxResponse}}></iron-ajax> <template is="dom-repeat" items={{ajaxResponse}} sort="_sort" id=

How can I replace the server in Web Component Tester

↘锁芯ラ 提交于 2019-12-10 22:39:08
问题 I have a project set up based around the Polymer Starter Kit, which includes Web-Component-Tester This project includes php server code which I would also like to test by writing tests to run in the browser which will utilise the PHP server code through Ajax Calls. This implies replacing the server that Web Component Tester is using ONLY when testing server side code. I hope to make a separate gulp task for this. Unfortunately, I don't understand the relationship between WCT, Selenium and

How to display the XUnit test output on Jenkins

我只是一个虾纸丫 提交于 2019-12-08 11:26:06
问题 According to JUnit formatted test output I created an XUnit report xml with https://github.com/garcus/wct-xunit-reporter. What does not work is that Jenkins displays the Test-Results. I tried: different XUnit Test Results (Publish xUnit test result report: [xUnit] [ERROR] - The converted file for the result file '..../testfile.xml' (during conversion process for the metric 'NUnit') is not valid.) the JUnit Test Results Is there another XUnit xsl needed, or what else do I miss? 回答1: I found

“chrome failed to maximize” during unit tests

限于喜欢 提交于 2019-12-02 16:02:54
问题 I am trying to unit test a very simple web-component. I don'ty know what would be some of recommended tools for that. At this moment I am trying by using wct and I am facing some issue that I didn't find anyone facing same issue. That said, I am not sure if I choose an appropriated tool for my test or I am using it incorrectly. So, my straight question is: why I am getting "chrome failed to maximize" during such simple test. An additional and highly appreciated comment will be whatelse others

“chrome failed to maximize” during unit tests

雨燕双飞 提交于 2019-12-02 09:23:45
I am trying to unit test a very simple web-component. I don'ty know what would be some of recommended tools for that. At this moment I am trying by using wct and I am facing some issue that I didn't find anyone facing same issue. That said, I am not sure if I choose an appropriated tool for my test or I am using it incorrectly. So, my straight question is: why I am getting "chrome failed to maximize" during such simple test. An additional and highly appreciated comment will be whatelse others are using for their own webcomponent test. Console: # wct --npm test -l chrome Installing and starting