Is there a way to inject ExtJS library inside Cypress testing environment?
For example, I have a grid with itemID: 'something' and I would like to fetch it in a test using Ext.down('#something');
Currently I get an error that
Ext is not defined
Is there a way to include it?
In the project ExtJS is added using <script> tag in index.html
Related
I'm trying to run DOM tests that I have written using Mocha and Chai for assert on Browserstack.
I have an HTML file test.html that looks like this:
<body>
<div id="mocha"></div>
<script src="https://unpkg.com/chai/chai.js"></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>
<script class="mocha-init">
mocha.setup('bdd');
mocha.checkLeaks();
assert = chai.assert;
</script>
<script src="MY_DOM_TESTS.js"></script>
<script class="mocha-exec">
mocha.run();
</script>
</body>
When I open this file in the browser locally, it runs through and shows me that all tests pass. My question now is how I can run it in one of the testing clouds, for example Browserstack.
They seem to have many adapters and plugins, but nothing explains this simple use case of DOM tests in an HTML file. Everything seems to be about js files exclusively, but not for HTML files.
I have tried using Karma with their plugins karma-mocha and karma-browserstack-launcher, to no avail. I tried having Karma run this simple test file but not even that seems to work:
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'chai'],
files: [
'./tests/test.html',
],
client: {
mocha: {
reporter: 'html',
ui: 'bdd',
},
},
Question: How can I run DOM tests using above HTML file in Browserstack (or any other Selenium testing cloud for that matter)?
I have figured it out. You need to use their local testing (the name is misleading), which basically opens a local server and pipes through local files to browserstack. I created a minimum example here on how to run mocha dom tests inside an HTML file on browserstack:
https://github.com/fritzfr/mocha-html-browserstack-bridge
Thank you for showing your interest in running tests on the remote cloud using Browserstack.
I did read through your query and could find that you want to run HTML DOM Tests on Browserstack, however, that is NOT supported and would require you to use a JS testing framework and write your tests accordingly in order to run tests.
Also, the documents you have referred are the required necessity in order to run JS Tests.
Please note you can use different Javascript unit testing frameworks such as QUnit, Jasmine, Mocha, and others to write our first unit test, and the same you can refer to the following documentation:
https://www.browserstack.com/docs/automate/javascript-testing/getting-started
Regards,
Browserstack Support
Currently I'm migrating a Vue.js App to an Nuxt.js App. In our previous setup we used favicons-webpack-plugin to generate favicons during compile-time. These were then injected into the HTML with html-webpack-plugin.
As we want to achieve the same functionality after the migration we need a way to generate these favicons. We came across nuxt-rfg-icon Nuxt-plugin but it does not provided the same feature-set (less generated favicons & the favicons are converted by an online service).
Generally speaking one could use webpack-plugins in Nuxt. So i tried integrating the webpack-plugin, but these favicons are only injected in one of two generated HTML-files. A index.spa.html (favicons present) and a index.ssr.html (favicons not present). When the Page is rendered by Nuxt on the serverside it seems to use the index.ssr.html (seems expected).
So I made a little dive into the #nuxt/webpack package to get some info about how Nuxt configures webpack. There I found this code:
// Generate output HTML for SSR
if (buildOptions.ssr) {
plugins.push(
new HtmlWebpackPlugin__default['default']({
filename: '../server/index.ssr.html',
template: appTemplatePath,
minify: buildOptions.html.minify,
inject: false // Resources will be injected using bundleRenderer
})
);
}
There it says that webpack should disable the automatic injection because the bundleRenderer is doing this. Unfortunately I could not find any resources online on how to inject the HTML of a webpack-plugin into the bundleRenderer. Maybe this is not possible or even intended?
So here is my actual question: How can i get Nuxt to work with the favicons-webpack-plugin?
I was looking at https://github.com/DevExpress/testcafe-browser-provider-electron repository.
To automate electron apps using testcafe, I see we need to provide "mainWindowUrl" in .testcafe-electron-rc . Regular electron apps have index.html files in it which I can pass to mainWindowUrl but I'm not sure what should we pass for executable electron apps like atom.exe/vscode.exe.
TestCafe will show a list of URLs opened during the app initialization time if it fails to find the main window URL. You can specify an empty string as a value of mainWindowUrl, wait until TestCafe shows an error and use links from the displayed list.
To test executable electron applications you should configure the 'testcafe-browser-provider-plugin' in another way. See the Testing an Executable Electron Application section for more information.
I am testing my Ember app (Ember 1.6) using PhantomJS(ver. 2.1.1). I want to assert that an HTML5 validation is triggered for invalid input. Here is my test:
fillIn('#MyInputField', 'some invalid data');
click('#MyButton');
andThen(function() {
strictEqual(find('#MyInputField:invalid').length, 1, 'Expected HTML 5 validation triggered!');
});
This works fine when I test it using Karma running in a browser. But when testing in PhantomJS, this fails.
I have made screenshot, and according to that image, there is no HTML5 validation.
Do you need to upgrade Phantom? The default Phantom installed by many CI services (Phantom 1.9) is missing some ES6 features and may be missing what you need too.
I tried to put it in script and without script tag.Suppose we have to run following code.What should we do?I have included proper bootstrap css and js files.
$('#myModal').modal('toggle')
Is it possible that the script is running before DOM ready? Try
$(function(){
$('#myModal').modal('toggle')
});
Other than that, either jQuery or bootstrap js file might not be included properly.