I can use only Electron as browser for my intranet Application,
Test
Launch intranet application
Click on link
new window opened with external link
Code:
cy.window().then((win) => {
cy.stub(win, "open") .as("popup");
});
this.click(webelement);
cy.get("#popup").should("be.called");
cy.get('#popup').should('have.been.calledOnce', path);
Stub works no error in runner, new window (blank) is opened , after some time , cypress crashes with error as
cypress ERR_EMPTY_RESPONSE (-324) loading "extrenal link url"
I added websecurity to false in config
chromeWebSecurity: false,
webPreferences: { webSecurity: false }, --> This is for Electron
Unfortunately I can use only Electron
Related
I am using playwright to right test for our website. In playwright.config.ts I have configured to chromium browser with headless set to false. Earlier everything was working file but now while running the test the browser open but it is transparent and only border is visible. The output screenshot is also doesn't contain anything.
I am using ubuntu through wsl2 of windows 11.
The followings are still working fine with playwright:
chromium browser with headless set to true
firefox browser with either headless set to true or false
also chromium browser installed by playwright at location /xxx/xxxx/.cache/ms-playwright/chromium-1028/chrome-linux/chrome is working fine
my playwright config file is
import type { PlaywrightTestConfig } from '#playwright/test';
import dotenv from 'dotenv';
import path from 'path';
// Read from default ".env" file.
dotenv.config();
// Alternatively, read from "../my.env" file.
dotenv.config({ path: path.resolve('./my.env') });
const config: PlaywrightTestConfig = {
use: {
browserName: 'chromium',
// channel: 'chrome',
headless: false
},
webServer: {
command: ' ~/.yarn/bin/netlify dev',
port: 8888
},
testDir: './tests'
};
export default config;
I have a React Electron app with Webpack and try to build it into an executable.
I used the CLI commands of electron-packager and electron-builder which ran without errors.
But when I run the exe I get a blank screen and from terminal the error message:
(node:8172) electron: Failed to load URL: http://localhost:3000/main_window with error: ERR_CONNECTION_REFUSED
(Use mixmatch --trace-warnings ... to show where the warning was created)
Running with the option doesn't give any additional information.
Searching the source code for localhost leads to index.js in the webpack directory:
var createWindow = function () {
var preload = path_1.default.join(__dirname, '../renderer/main_window', "preload.js");
exports.mainWindow = new electron_1.BrowserWindow({
// show: false,
webPreferences: {
enableRemoteModule: false,
// nodeIntegration: false, // is default value after Electron v5
preload: preload // use a preload script
}
});
exports.mainWindow.loadURL('http://localhost:3000/main_window');
exports.mainWindow.maximize();
exports.mainWindow.webContents.openDevTools();
};
So I guess a server is being started, which probably is the same for every app, but the app is not allowed to access localhost.
So why does it seem to work easily for everyone else but not for me?
Once the build is created, you need to loadURL from build/index.html.
Replace your code of export.mainWindow.loadURL with this
e.g.
const isDev = require('electron-is-dev');
exports.mainWindow.loadURL(
isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../build/index.html')}`
);
I am trying to upload a video file through a web app's form that will first analyse the duration, resolution and FPS of the video. With this information, the video file will then be sent to back end server upon clicking a submit button.
I tried to upload a 100MB video file using the following way:
The following is the uploadFile cypress command in support/commands.js.
Cypress.Commands.add('uploadFile', { prevSubject: true }, (subject, fileName, fileType = '') => {
cy.fixture(fileName,'base64', { timeout: 20000 }).then(content => {
console.log(fileName, content)
return Cypress.Blob.base64StringToBlob(content, fileType).then(blob => {
const fileInput = subject[0];
const testFile = new File([blob], fileName, {type: fileType});
const dataTransfer = new DataTransfer();
dataTransfer.items.add(testFile);
fileInput.files = dataTransfer.files;
console.log(fileInput, testFile, dataTransfer);
cy.wrap(subject).trigger('change', { force: true });
});
});
});
In the spec.js
cy.get('input[type=file]').uploadFile('largeVideo.mp4', 'video/mp4');
Cypress uploadfile failed with 100MB video file in docker cypress/included:4.4.0 yet when running locally with npx cypress run, the video file managed to upload successfully.
The error from cypress was
CypressError: cy.fixture() timed out waiting 200000ms to receive a fixture. No fixture was ever sent by the server.
Details
cypress version 4.4.0
chrome version 80.0.3987.116
node version 12.13.0
What is the difference between local cypress and docker version that causes this to happen?
I am able to run the protractor using command prompt.
However, when I try to run protractor using jenkins, it started the selenium server but does not execute the browser and will fail due to timeout.
Is there any configuration that I need to do at jenkins side aside from the project path?
I also have tried to install the package manually to makesure its updated.
Below is the error when I try to build/run protractor using jenkins:
> webhis_jasmine# protractor C:\Users\user1\.jenkins\HISWEBJASMINE
> protractor conf.js
[12:06:44] I/launcher - Running 1 instances of WebDriver
[12:06:44] I/local - Starting selenium standalone server...
[12:06:46] I/local - Selenium standalone server started at http://10.190.40.39:56419/wd/hub
Started
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m
i tried to run webdriver-manager update only using jenkins just to check and it is giving below error:
C:\Users\user1\.jenkins\HISWEBJASMINE>webdriver-manager update
'webdriver-manager' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\user1\.jenkins\HISWEBJASMINE>exit 9009
Here is config file:
// conf.js
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
capabilities: {
'browserName': 'chrome'
},
specs: ['Patient_positive.js','Visit_positive.js'],
suites:{
Smoke: ['ChainLocators.js', 'Dropdown.js'],
Regression: 'ElementBasics.js',
Testbed: 'testbed.js',
PatientPositive: 'Patient_positive.js',
PatientNegative: 'Patient_negative.js',
VisitPositive: 'Visit_positive.js',
VisitNegative: 'Visit_negative.js',
EpisodeCPOEPositive: 'EpisodeCPOE_positive.js'
},
onPrepare:function(){
browser.driver.manage().window().maximize();
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: './test/reports/',
screenshotsFolder: 'images',
takeScreenshots: true,
fixedScreenshotName: true,
takeScreenshotsOnlyOnFailures: false,
cleanDestination: false,
showPassed: true,
fileName: 'Test_Report',
fileNameSuffix: '',
fileNameDateSuffix: true
})
);
},
jasmineNodeOpts:{
showColors: true
}
};
Is it related?
Update: I strip the spec to have to only 1 'it' and run. Manage to get a success result and report is generated, but i see the browser not launched as when running using cmd prompt.
C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE>npm run protractor
> webhis_jasmine# protractor C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE
> protractor conf.js
[15:14:40] I/launcher - Running 1 instances of WebDriver
[15:14:40] I/local - Starting selenium standalone server...
[15:14:43] I/local - Selenium standalone server started at http://10.190.40.39:52793/wd/hub
Started
Successfully open patient page
Successfully enter name
Successfully select title
Successfully select gender
Successfully enter date of birth
Successfully select ID type
Successfully enter idno= 850921141112
Successfully select Nationality= Malaysia
Successfully enter mobile no
Successfully enter patient address line 1
Successfully enter patient address line 2
Successfully enter patient address line 3
Successfully enter patient postcode= 57000
Successfully enter patient city= Bukit Jalil
Successfully select patient State= Kuala Lumpur
Successfully select patient State= Malaysia
[32m.[0m
1 spec, 0 failures
Finished in 63.169 seconds
CGM
[15:15:52] I/local - Shutting down selenium standalone server.
[15:15:52] I/launcher - 0 instance(s) of WebDriver still running
[15:15:52] I/launcher - chrome #01 passed
Finished: SUCCESS
Try using directConnect:true in your config file instead of seleniumAddress: 'http://localhost:4444/wd/hub',
before runing the test do the below activities
webdriver-manager clean
node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0
Hope it helps you
I builded an hybrid app using Ionic3+AngularJS and it uses the SQLite database.
When I run the app in Android's devices it works perfectly but when I try to run it in an iPhone or iPad I get the following error: plugin_not_installed. It happens when the app tries to create the database.
This is how it's creating the database:
public getDB(){
return this.sqlite.create({
name: 'namedatabase.db',
location: 'default'
}).catch( error => this.showError(error));
}
The catch() is called and it shows the error message "plugin_not_installed".
SQLite installed using:
$ ionic cordova plugin add cordova-sqlite-storage
$ npm install --save #ionic-native/sqlite
Any ideas?
I'm getting the same issue when I run my app in an android emulator using
ionic cordova run android -lc
When the app start, everything is ok. But after a couple of changes in my code and a save command, the app reload and show in my console
console.warn: Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins / and reinstalling them.
console.warn: 'Native: tried accessing the SQLite plugin but it's not installed.
console.warn: Install the SQLite plugin: 'ionic cordova plugin add cordova-sqlite-storage'
console.log: err "plugin_not_installed"
Even if I followed what the console asked me to do, I'm still getting the same error and it cannot create my SQLite database
What I did next is to re-run the app using the run command above, but it waste a lot of time for me to wait for the app to get started again... and again :(
createDBFile() {
this.sqlite.create({
name: DB_NAME,
location: 'default'
}).then((db: SQLiteObject) => {
this.db = db;
console.log('BDD cree')
this.stockageLocal.get('dbstatus').then(opened => {
if (opened) {
console.log('DB deja ouvert');
}
else {
console.log('create all table')
this.createTables();
}
})
}).catch(err => {
console.log(' err', JSON.stringify(err))
});
}
I had the same problem: plugin_not_installed.
I resolved putting console.log check after the promise errors and seeing that the table didn't exist.
The code:
this.sqlite.create({
name: 'ionicdb.db',
location: 'default'
})
.then((db: SQLiteObject) => {
db.executeSql('create table if not exists MY_SQLITE_STORAGE(key VARCHAR(32) PRIMARY KEY, value VARCHAR(32))', [])
.then(() => {
console.log('Executed Create table if not exists');
this.toastCtrl.create({
message: 'Table created ',
duration: 5000,
position: 'center'
}).present();
}).catch(e => console.log('error: '+JSON.stringify(e)));
}).catch(e => console.log('error: '+JSON.stringify(e)));