I have a "problem"
I'm trying to upload a file in my cypress test, however my test runs with sucess but it doesn't upload.
I using the library cypress-file-upload;
my code:
const filePath = 'teste.pdf'
cy.get(':nth-child(1) > .backgroundColor > :nth-child(2) > :nth-child(1) > .col-auto > .input-group.mb-0 > .custom-file > .row > .form-group > .input-group > .input-group-text').attachFile(filePath)
result:
enter image description here
my html/css:
enter image description here
button:
enter image description here
ps: sorry for my bad english
I'm trying many css selector until xpath, but doesn't sucess
I think your target element in this case should be the input one.
Make sure teste.pdf is located at fixtures folder and try something like:
const filePath = 'teste.pdf'
cy.get('.custom-file-input.form-control-sm.file-input').attachFile(filePath)
Related
I am new in the use of cypress, which makes me face concern.
I would like to automate actions in order to test some Progressive Web App (PWA) and so I have recorded actions using the cypress extension of google chrome and when I create specs in cypress locally in order to reproduce the captures, I get errors especially when I am facing toasters.
cy.get('.h-full > #app > .layout--full > div > .hover\\3Aopacity-90').click()
cy.get('#app > .layout > .my-10 > .list-item:nth-child(3) > .text').click()
**cy.get('.h-full > #app > .pt-4 > .transform > .svg-inline--fa').click()**
cy.wait(15000)
cy.get('.form > .flex > div > .mt-6 > #mark').click()
cy.get('.form > .flex > div > .mt-6 > #mark').select('other')
The toaster pops up and then I get this error.
I even added a wait but without success
This script is part of a legacy code that runs to create a GUI interface for editing text files to be used in analysis codes. There is a windows command script that references a ".sed" file which controls the formatting, editing, and help menu for the GUI. I would like to identify the coding language/rules used in these ".sed" files so that I can make a new more complicated input text file with descriptions of inputs.
Ideally, I would like to be able to use this code to create/edit ".csv" files which can be edited in Excel. This would potentially mean needing to avoid the set variable sizes/padding in the #file block of code below.
Any googling attempts to find more about the coding result in unix sed instructions that are not helpful.
UPDATE: I did find an additional exe in the shell folder of the legacy code for "sedwin.exe". When googled this seems to refer to an old "SEDT text editor for MS-DOS".
An example section from a ".sed" file is below:
<code>
#rem( version description information here )
#version(){"2.0"}
%--------------------------------------------------------------------
#file(seal2,native){
title1(A80);
title2(A80);
title3(A80);
r(G10),del(A1),ll(G10),c(G10),lg(G10),dg(G10),ngroov(I10);
ncase(I10),necc(I10),necase(I10),#for(i,1,necase,0){entlos[i](G10)};
#for(i,1,ncase,0){
speed[i](G10),ro[i](G10),nu[i](G10),delp[i](G10);
}
}
#edit(seal2){
#prompted(22,5,"SEAL2 Input Data"){
#help(){
" Code Name Here
"",
"Code description here"
};
#icon("Titles",titles){#titles();}
#icon("Seal Parameters",seal){#seal();}
#icon("Speed, Fluid Parameters",cases){#cases();}
}
}
#titles(){
#prompted(1,7,"Three Title Lines"){
#help(){
"These title lines will appear on the output of",
"the program.",
"",
"They are useful for identifying the output but",
"do not directly affect the results."
};
#datum("",title1,75,"");
#datum("",title2,75,"");
#datum("",title3,75,"");
}
}
#seal(){
#prompted(12,8,"Seal Parameters"){
#help(){
"Descriptions of inputs in this window.",
};
#datum("Shaft Radius (in)",r,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Land Length (in)",ll,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Seal Radial Clearance (in)",c,15,"0.");
#float_check("Must be > 0.0","(%g)>0.");
#datum("Groove Length (in)",lg,15,"0.");
#float_check("Must be >= 0.0","(%g)>=0.");
#datum("Groove Depth (in)",dg,15,"0.");
#float_check("Must be >= 0.0","(%g)>=0.");
#datum("Number of Grooves (0=plain seal)",ngroov,15,"0");
#int_check("Must be >= 0","(%d)>=0");
#datum("Number of Eccentricities",necc,15,"1");
#int_check("Must be between 1 and 10","(%d)>0&&(%d)<11");
#icon("Entrance Loss Cases",losses){#losses();}
}
}
#new_file(seal2){
file_type=seal2;
unit_type=native;
titles=New;
title1=;
title2=;
title3="(SEAL2 Data File)";
del=",";
seal=New;
ll=0.0;
r=0.0;
c=0.0;
lg=0.0;
dg=0.0;
ngroov=0;
losses=New;
necc=1;
necase=1;
entlos[1...necase]=0.1;
cases=New;
ncase=1;
speed[1...ncase]=0.0;
delp[1...ncase]=0.0;
nu[1...ncase]=0.0;
ro[1...ncase]=0.0;
}
</code>
I have password reset page I'd like to perform some tests on. If my current password won't match with my typed current password area it shows a "Password don't match" alert. Here is my alert:
<p-message *ngIf="error" severity="error" id="alert-danger" class="alert alert-danger" text="{{'password.messages.error' | translate}}" >
<ng-template pTemplate>
<div jhiTranslate="password.messages.error" ></div>
</ng-template>
</p-message>
What I've tried so far:
cy.get('[severity="error"] > .p-inline-message > .p-inline-message-text')
.should("have.text","password.messages.error")
But I get an error in cypress saying "expected password.messages.error but the text was Passwords don't match!. Which is understandable it takes directly whatever text was inside my element. Then I've tried:
cy.get('[severity="error"] > .p-inline-message > .p-inline-message-text')
.invoke('attr','jhiTranslate')
.should('eq','password.messages.error')
this gives me "expected undefined to equal password.messages.error"
What I'm doing wrong and what else should I try here?
Just change the text Cypress is checking,
cy.get('[severity="error"] > .p-inline-message > .p-inline-message-text')
.should("have.text", "Passwords don't match!")
The HTML you show above is the source code, but AngularJS has looked up the variable password.messages.error and output the string contained in that variable.
It then removes jhiTranslate from the element, so you cannot test it at runtime (in the browser).
You can see what the runtime HTML is by right-clicking on an element and inspecting it in the dev-tools.
You can do something like:
cy.get('p-message#alert-danger').within(() => {
cy.get('div').should('have.attr', 'jhiTranslate', 'password.messages.error')
})
I am trying to include a QR barcode in a report.
Doing:
https://www.foo.com/report/barcode/QR/test
Generates a valid barcode in the browser.
But using in a QWeb PDF report template:
<img t-att-src="/report/barcode/QR/test"/>
Does not work:
File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 300, in _compile_expr
st = ast.parse(expr.strip(), mode='eval')
File "/usr/lib/python2.7/ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
/report/barcode/QR/test
^
SyntaxError: invalid syntax
You should write as following :
<img t-att-src="'/report/barcode/QR/test'"/>
In QWeb reports for barcode you have to try this code...
<img t-if="o.barcode" t-att-src="'data:image/png;base64,%s' % o.barcode"/>
Also you can try this :
<img t-att-src="'/report/barcode/QR/test?
type=%s&value=%s&width=%s&height=%s' % ('EAN13', o.ean13, 600, 900)"
style="width:100%;height:100px"/>
Define height and width that you want.
In Q-web Report Include the Barcode, that have only include the image in your module,--->>> module_name-->>static-->>src-->>img--->> images.gif.
Code :
Else :
You can directly get the barcode from the report also.
Hope It will Work for you.
Add this to your report file.
<center style="margin:6px 0;">
<img t-if="o.barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' %('Code128',o.barcode,250,50)"/>
</center>
I want to download all wallpapers from this gallery: http://minus.com/mPxswm5Mn
Googling I found that I could use:
wget -r -A jpg http://minus.com/mPxswm5Mn
However, the page contains the thumbnails only, and the link of the wallpapers could be found from them like the following:
Example 1:
Thumbnail url: i3.minus.com/jsyJQqqkzB66W_e.jpg
Wallpaper url: i3.minus.com/isyJQqqkzB66W.jpg
Example 2:
Thumbnail url: i1.minus.com/jNgnESZBOrhfk_e.jpg
Wallpaper url: i1.minus.com/iNgnESZBOrhfk.jpg
Any help is appreciated
This is far from a perfect solution, but you could always use your browser to list all the files you need to download and then use wget to download them :
Run this javascript snippet in your browser :
var imgs = document.getElementsByClassName("grid_item_thumb");
var html = "";
for(var i=0; i<imgs.length; ++i) {
html += imgs[i].src.replace(/\/j(.*)_e.jpg/, "/i$1.jpg") + ' ';
}
document.getElementsByTagName("body")[0].innerHTML = html;
For your specific page, it will give you this :
http://i1.minus.com/ibb1tmEYMJGWFT.jpg http://i1.minus.com/iNgnESZBOrhfk.jpg http://i3.minus.com/iitJZBqmXOYUq.jpg http://i3.minus.com/iyuCwEjztXsMF.jpg http://i2.minus.com/i0ZQNJf8vb6O2.jpg http://i2.minus.com/i6VRXhptiq1KU.jpg http://i5.minus.com/ib0H6MXLY4JeGL.jpg http://i1.minus.com/ibdwVqCRDKD8R7.jpg http://i3.minus.com/ievFZt5lDS0xy.jpg http://i4.minus.com/iHqfqOEkZDPo0.jpg http://i1.minus.com/iUe1SLFXjtyVe.jpg http://i1.minus.com/i8diPC08rFPIg.jpg http://i4.minus.com/isl4vklSl72pd.jpg http://i3.minus.com/isyJQqqkzB66W.jpg http://i7.minus.com/iriBAKsCaL92j.jpg http://i5.minus.com/im0ZKpI5FAHq0.jpg http://i2.minus.com/ilSVC7K8c0aXK.jpg http://i4.minus.com/ibmQ6r3h8SWYzI.jpg http://i3.minus.com/iVzu4QVH9azWW.jpg http://i2.minus.com/ijYWU36ege0Rr.jpg http://i1.minus.com/iQel0uLQK2Z4z.jpg http://i7.minus.com/ibk24biYBBYAeT.jpg http://i4.minus.com/ieGTVoAZaPbI2.jpg http://i2.minus.com/iuYThOzLn6XsF.jpg http://i2.minus.com/i0SAaVhrZZaL5.jpg http://i3.minus.com/ibztNp9L7zaU3F.jpg http://i5.minus.com/iJCl7B0bRahTr.jpg http://i5.minus.com/iR6Wa5uoxJFeA.jpg http://i2.minus.com/i5QHKNePLD9C0.jpg http://i3.minus.com/ibzAkM1IjGFHvR.jpg http://i2.minus.com/iqYYDjp83txiQ.jpg http://i6.minus.com/i6jFQkoAJYa1R.jpg http://i6.minus.com/ibrPBnHFyGEHQC.jpg http://i3.minus.com/iGzGyXBihCWcQ.jpg http://i4.minus.com/ibqwMh3mFNCirI.jpg http://i3.minus.com/ibvCZejMz05iH4.jpg http://i5.minus.com/iE85MKn3sMyqk.jpg http://i7.minus.com/ipixgQGKKkPw2.jpg http://i5.minus.com/iX5wooBBLIl39.jpg http://i4.minus.com/iNqvRAmIQAphd.jpg http://i6.minus.com/icj3SqCWVXDiV.jpg http://i4.minus.com/iblZFuq9kvs1Nf.jpg http://i1.minus.com/iigEYtFY87N0U.jpg http://i3.minus.com/ibtZHiIuJQTU6w.jpg http://i3.minus.com/iGujEMf2OfWIY.jpg http://i5.minus.com/ib0JPBn8i4VCNx.jpg http://i3.minus.com/ibvTyZm0l6MXiZ.jpg http://i1.minus.com/i5dJh4TYPx9bj.jpg http://i6.minus.com/ibrHdaADSSejvl.jpg http://i1.minus.com/ibcUJxQZCU49BF.jpg http://i1.minus.com/ixcoa5XdfgtCn.jpg http://i5.minus.com/ip52CdwKAz2bR.jpg http://i2.minus.com/i5KMTx22lA7bP.jpg http://i5.minus.com/iuDulPAkX9CGk.jpg http://i5.minus.com/iB3sqxh7pIuH9.jpg http://i5.minus.com/i20DFIO4GVB1h.jpg http://i6.minus.com/ibhcAIwJ8AYgJR.jpg http://i5.minus.com/ioCdy2IZSqmWx.jpg http://i3.minus.com/iby48bA5K2GP0L.jpg http://i1.minus.com/iPfaYCDuz9xwz.jpg http://i2.minus.com/inO9GQr6450Bv.jpg http://i2.minus.com/iiYxzaAKpa6A4.jpg http://i1.minus.com/ibaaCqAGnT5CAu.jpg http://i7.minus.com/ibkc4xjbf0yKEG.jpg http://i5.minus.com/iuDW7LnAKqWrf.jpg http://i5.minus.com/ib1TTRbjEOrVsd.jpg http://i1.minus.com/ivfdsnDvOm0As.jpg http://i2.minus.com/iFR7E3cVR7vFM.jpg http://i2.minus.com/iGRxohksNdi1H.jpg http://i2.minus.com/iGVYyjaP9DWgs.jpg http://i1.minus.com/ibd34cjNZysV9D.jpg http://i6.minus.com/ibhFhdBswSdRbl.jpg http://i4.minus.com/iGqdr0L18P3Kr.jpg http://i5.minus.com/iCEZ5T4sUDjHi.jpg http://i7.minus.com/ivBTUAk6cK26L.jpg http://i2.minus.com/ifO73LUD5tgQp.jpg http://i5.minus.com/i98v2HTQgcjcb.jpg http://i2.minus.com/iFLa4Zo1u8KOu.jpg http://i3.minus.com/iDzGoaFEbOK3X.jpg http://i4.minus.com/ibqzS9GS4z7gCD.jpg http://i4.minus.com/iblogFe9Op8tFk.jpg http://i4.minus.com/i5nnZ6wXLHtgn.jpg http://i4.minus.com/iCpWjYy07z7S1.jpg http://i4.minus.com/iKnkXFPRZB7W.jpg http://i3.minus.com/iby6Dg1zpdY1in.jpg http://i7.minus.com/iABhWmq0upnuz.jpg http://i4.minus.com/ibn52BzbDsG4L5.jpg http://i2.minus.com/icOC6xjysZVpu.jpg http://i4.minus.com/ism8wP4XNCW7M.jpg http://i3.minus.com/iby5hJlpTlO1I3.jpg http://i6.minus.com/ihILTGiearIR6.jpg http://i2.minus.com/idYS2bhiPdDc3.jpg http://i6.minus.com/iOj9Omn6HEnYv.jpg http://i4.minus.com/iMmgVQAXqrg4Q.jpg http://i4.minus.com/ibpZhkaaPzDtWU.jpg http://i1.minus.com/ibaOlHIsx0iJMS.jpg http://i6.minus.com/iyrZSX5TswnDk.jpg http://i3.minus.com/ibujJB04GxWwvO.jpg http://i4.minus.com/ibor2bgtCBjMp3.jpg http://i5.minus.com/ij1JjMySkCATm.jpg http://i3.minus.com/ivxToOWGkXko4.jpg http://i4.minus.com/ibllcqgDcJ8ess.jpg http://i6.minus.com/ixji9sK26KiAT.jpg http://i4.minus.com/iboh6KjVVXlIV7.jpg http://i7.minus.com/ibsod54BAoswvp.jpg http://i2.minus.com/ihRIt03KJasW0.jpg http://i4.minus.com/iMnPTCNhtyhtv.jpg
You can then copy-paste this to a console and download the images with wget :
wget http://i1.minus.com/ibb1tmEYMJGWFT.jpg http://i1.minus.com/iNgnESZBOrhfk.jpg http://i3.minus.com/iitJZBqmXOYUq.jpg http://i3.minus.com/iyuCwEjztXsMF.jpg http://i2.minus.com/i0ZQNJf8vb6O2.jpg http://i2.minus.com/i6VRXhptiq1KU.jpg http://i5.minus.com/ib0H6MXLY4JeGL.jpg http://i1.minus.com/ibdwVqCRDKD8R7.jpg http://i3.minus.com/ievFZt5lDS0xy.jpg http://i4.minus.com/iHqfqOEkZDPo0.jpg http://i1.minus.com/iUe1SLFXjtyVe.jpg http://i1.minus.com/i8diPC08rFPIg.jpg http://i4.minus.com/isl4vklSl72pd.jpg http://i3.minus.com/isyJQqqkzB66W.jpg http://i7.minus.com/iriBAKsCaL92j.jpg http://i5.minus.com/im0ZKpI5FAHq0.jpg http://i2.minus.com/ilSVC7K8c0aXK.jpg http://i4.minus.com/ibmQ6r3h8SWYzI.jpg http://i3.minus.com/iVzu4QVH9azWW.jpg http://i2.minus.com/ijYWU36ege0Rr.jpg http://i1.minus.com/iQel0uLQK2Z4z.jpg http://i7.minus.com/ibk24biYBBYAeT.jpg http://i4.minus.com/ieGTVoAZaPbI2.jpg http://i2.minus.com/iuYThOzLn6XsF.jpg http://i2.minus.com/i0SAaVhrZZaL5.jpg http://i3.minus.com/ibztNp9L7zaU3F.jpg http://i5.minus.com/iJCl7B0bRahTr.jpg http://i5.minus.com/iR6Wa5uoxJFeA.jpg http://i2.minus.com/i5QHKNePLD9C0.jpg http://i3.minus.com/ibzAkM1IjGFHvR.jpg http://i2.minus.com/iqYYDjp83txiQ.jpg http://i6.minus.com/i6jFQkoAJYa1R.jpg http://i6.minus.com/ibrPBnHFyGEHQC.jpg http://i3.minus.com/iGzGyXBihCWcQ.jpg http://i4.minus.com/ibqwMh3mFNCirI.jpg http://i3.minus.com/ibvCZejMz05iH4.jpg http://i5.minus.com/iE85MKn3sMyqk.jpg http://i7.minus.com/ipixgQGKKkPw2.jpg http://i5.minus.com/iX5wooBBLIl39.jpg http://i4.minus.com/iNqvRAmIQAphd.jpg http://i6.minus.com/icj3SqCWVXDiV.jpg http://i4.minus.com/iblZFuq9kvs1Nf.jpg http://i1.minus.com/iigEYtFY87N0U.jpg http://i3.minus.com/ibtZHiIuJQTU6w.jpg http://i3.minus.com/iGujEMf2OfWIY.jpg http://i5.minus.com/ib0JPBn8i4VCNx.jpg http://i3.minus.com/ibvTyZm0l6MXiZ.jpg http://i1.minus.com/i5dJh4TYPx9bj.jpg http://i6.minus.com/ibrHdaADSSejvl.jpg http://i1.minus.com/ibcUJxQZCU49BF.jpg http://i1.minus.com/ixcoa5XdfgtCn.jpg http://i5.minus.com/ip52CdwKAz2bR.jpg http://i2.minus.com/i5KMTx22lA7bP.jpg http://i5.minus.com/iuDulPAkX9CGk.jpg http://i5.minus.com/iB3sqxh7pIuH9.jpg http://i5.minus.com/i20DFIO4GVB1h.jpg http://i6.minus.com/ibhcAIwJ8AYgJR.jpg http://i5.minus.com/ioCdy2IZSqmWx.jpg http://i3.minus.com/iby48bA5K2GP0L.jpg http://i1.minus.com/iPfaYCDuz9xwz.jpg http://i2.minus.com/inO9GQr6450Bv.jpg http://i2.minus.com/iiYxzaAKpa6A4.jpg http://i1.minus.com/ibaaCqAGnT5CAu.jpg http://i7.minus.com/ibkc4xjbf0yKEG.jpg http://i5.minus.com/iuDW7LnAKqWrf.jpg http://i5.minus.com/ib1TTRbjEOrVsd.jpg http://i1.minus.com/ivfdsnDvOm0As.jpg http://i2.minus.com/iFR7E3cVR7vFM.jpg http://i2.minus.com/iGRxohksNdi1H.jpg http://i2.minus.com/iGVYyjaP9DWgs.jpg http://i1.minus.com/ibd34cjNZysV9D.jpg http://i6.minus.com/ibhFhdBswSdRbl.jpg http://i4.minus.com/iGqdr0L18P3Kr.jpg http://i5.minus.com/iCEZ5T4sUDjHi.jpg http://i7.minus.com/ivBTUAk6cK26L.jpg http://i2.minus.com/ifO73LUD5tgQp.jpg http://i5.minus.com/i98v2HTQgcjcb.jpg http://i2.minus.com/iFLa4Zo1u8KOu.jpg http://i3.minus.com/iDzGoaFEbOK3X.jpg http://i4.minus.com/ibqzS9GS4z7gCD.jpg http://i4.minus.com/iblogFe9Op8tFk.jpg http://i4.minus.com/i5nnZ6wXLHtgn.jpg http://i4.minus.com/iCpWjYy07z7S1.jpg http://i4.minus.com/iKnkXFPRZB7W.jpg http://i3.minus.com/iby6Dg1zpdY1in.jpg http://i7.minus.com/iABhWmq0upnuz.jpg http://i4.minus.com/ibn52BzbDsG4L5.jpg http://i2.minus.com/icOC6xjysZVpu.jpg http://i4.minus.com/ism8wP4XNCW7M.jpg http://i3.minus.com/iby5hJlpTlO1I3.jpg http://i6.minus.com/ihILTGiearIR6.jpg http://i2.minus.com/idYS2bhiPdDc3.jpg http://i6.minus.com/iOj9Omn6HEnYv.jpg http://i4.minus.com/iMmgVQAXqrg4Q.jpg http://i4.minus.com/ibpZhkaaPzDtWU.jpg http://i1.minus.com/ibaOlHIsx0iJMS.jpg http://i6.minus.com/iyrZSX5TswnDk.jpg http://i3.minus.com/ibujJB04GxWwvO.jpg http://i4.minus.com/ibor2bgtCBjMp3.jpg http://i5.minus.com/ij1JjMySkCATm.jpg http://i3.minus.com/ivxToOWGkXko4.jpg http://i4.minus.com/ibllcqgDcJ8ess.jpg http://i6.minus.com/ixji9sK26KiAT.jpg http://i4.minus.com/iboh6KjVVXlIV7.jpg http://i7.minus.com/ibsod54BAoswvp.jpg http://i2.minus.com/ihRIt03KJasW0.jpg http://i4.minus.com/iMnPTCNhtyhtv.jpg
Or, as pointed out by Enissay, the urls could be saved to a file and downloaded like this :
wget -i urls.txt
If you are feeling lucky, you could always try to download all files from your browser using only javascript.