Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Fixed cypress dictionary for attribute checking
Browse files Browse the repository at this point in the history
  • Loading branch information
willemliu committed May 27, 2019
1 parent 028135b commit 6e892be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fd-cypress-recorder/content.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fd-cypress-recorder/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Fd Cypress Recorder",
"version": "0.10",
"version": "0.11",
"description": "Fd Cypress Recorder captures user interactions and generates Cypress test code.",
"author": {
"name": "Willem Liu",
Expand Down
2 changes: 1 addition & 1 deletion fd-cypress-recorder/popup.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/utils/CypressDictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ export function getCode(event: AllFdEvents, options?: Options) {
case FdEventType.VIEWPORT_SIZE:
return `cy.viewport(${(event as FdViewportSizeEvent).width}, ${(event as FdViewportSizeEvent).height});`;
case FdEventType.ATTRIBUTE_VALUE_EQUALS:
return `cy.get('${(event as FdAttributeValueEvent).target}').should('have.attr', '${(event as FdAttributeValueEvent).name}', '${(event as FdAttributeValueEvent).value.replace(new RegExp("'", 'g'), "\\\'")}');`;
return `cy.get('${(event as FdAttributeValueEvent).target}').then((el) => expect(el.attr('${(event as FdAttributeValueEvent).name}')).to.eq('${(event as FdAttributeValueEvent).value.replace(new RegExp("'", 'g'), "\\\'")}'));`;
case FdEventType.ATTRIBUTE_VALUE_CONTAINS:
return `cy.get('${(event as FdAttributeValueEvent).target}').should('have.attr', '${(event as FdAttributeValueEvent).name}').then((attr) => expect(attr).to.contain('${(event as FdAttributeValueEvent).value.replace(new RegExp("'", 'g'), "\\\'")}'));`;
return `cy.get('${(event as FdAttributeValueEvent).target}').then((el) => expect(el.attr('${(event as FdAttributeValueEvent).name}')).to.contain('${(event as FdAttributeValueEvent).value.replace(new RegExp("'", 'g'), "\\\'")}'));`;
case FdEventType.ATTRIBUTE_VALUE_EXISTS:
return `cy.get('${(event as FdAttributeExistsEvent).target}').should('have.attr', '${(event as FdAttributeExistsEvent).name}');`;
default:
Expand Down

0 comments on commit 6e892be

Please sign in to comment.