-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Search shadow roots. Add content editable to input search. Add tests for outlook and amazon * Change default to inputs only * remove commented
- Loading branch information
Showing
9 changed files
with
905 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { ELEMENT_FILTER } from '../../constants' | ||
import { isBlobIframe } from '../../elements' | ||
import { searchReplace } from '../../searchreplace' | ||
|
||
const SEARCHTERM = 'Chris' | ||
const REPLACETERM = 'Something else' | ||
const BASEURL = 'http://localhost:9000' | ||
describe('Search Replace WordPress', { baseUrl: BASEURL, responseTimeout: 120e3 }, () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:9000/tests/amazon_seller/test.html') | ||
}) | ||
|
||
it('counts the correct number of occurrences', () => { | ||
cy.window().then((window) => { | ||
console.log(window.location.host) | ||
const iframes = Array.from( | ||
<NodeListOf<HTMLIFrameElement>>window.document.querySelectorAll('iframe') | ||
).filter((iframe) => !isBlobIframe(iframe)) | ||
cy.wrap( | ||
searchReplace( | ||
'count', | ||
window, | ||
SEARCHTERM, | ||
REPLACETERM, | ||
false, | ||
false, | ||
true, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result) => { | ||
console.log(`result`, result) | ||
expect(result.searchReplaceResult.count.original).to.equal(1) | ||
}) | ||
).then(() => { | ||
console.log('done') | ||
}) | ||
}) | ||
}) | ||
it('replaces the search term and then replaces it again', () => { | ||
cy.window().then((window) => { | ||
console.log(window.location.host) | ||
const iframes = Array.from( | ||
<NodeListOf<HTMLIFrameElement>>window.document.querySelectorAll('iframe') | ||
).filter((iframe) => !isBlobIframe(iframe)) | ||
cy.wrap( | ||
searchReplace( | ||
'searchReplace', | ||
window, | ||
SEARCHTERM, | ||
REPLACETERM, | ||
false, | ||
false, | ||
true, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result1) => { | ||
expect(result1.searchReplaceResult.count.replaced).to.equal(1) | ||
searchReplace( | ||
'searchReplace', | ||
window, | ||
REPLACETERM, | ||
SEARCHTERM, | ||
false, | ||
false, | ||
true, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result2) => { | ||
expect(result2.searchReplaceResult.count.replaced).to.equal(1) | ||
}) | ||
}) | ||
).then(() => { | ||
console.log('done') | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { ELEMENT_FILTER } from '../../constants' | ||
import { isBlobIframe } from '../../elements' | ||
import { searchReplace } from '../../searchreplace' | ||
|
||
const SEARCHTERM = 'Something else' | ||
const REPLACETERM = 'The replacement' | ||
const BASEURL = 'http://localhost:9000' | ||
describe('Search Replace WordPress', { baseUrl: BASEURL, responseTimeout: 120e3 }, () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:9000/tests/outlook/test.html') | ||
}) | ||
|
||
it('counts the correct number of occurrences', () => { | ||
cy.window().then((window) => { | ||
console.log(window.location.host) | ||
const iframes = Array.from( | ||
<NodeListOf<HTMLIFrameElement>>window.document.querySelectorAll('iframe') | ||
).filter((iframe) => !isBlobIframe(iframe)) | ||
cy.wrap( | ||
searchReplace( | ||
'count', | ||
window, | ||
SEARCHTERM, | ||
REPLACETERM, | ||
true, | ||
false, | ||
false, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result) => { | ||
console.log(`result`, result) | ||
expect(result.searchReplaceResult.count.original).to.equal(1) | ||
}) | ||
).then(() => { | ||
console.log('done') | ||
}) | ||
}) | ||
}) | ||
it('replaces the search term and then replaces it again', () => { | ||
cy.window().then((window) => { | ||
console.log(window.location.host) | ||
const iframes = Array.from( | ||
<NodeListOf<HTMLIFrameElement>>window.document.querySelectorAll('iframe') | ||
).filter((iframe) => !isBlobIframe(iframe)) | ||
cy.wrap( | ||
searchReplace( | ||
'searchReplace', | ||
window, | ||
SEARCHTERM, | ||
REPLACETERM, | ||
true, | ||
false, | ||
false, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result1) => { | ||
expect(result1.searchReplaceResult.count.replaced).to.equal(1) | ||
searchReplace( | ||
'searchReplace', | ||
window, | ||
REPLACETERM, | ||
SEARCHTERM, | ||
true, | ||
false, | ||
false, | ||
false, | ||
false, | ||
false, | ||
true, | ||
false, | ||
iframes, | ||
ELEMENT_FILTER | ||
).then((result2) => { | ||
expect(result2.searchReplaceResult.count.replaced).to.equal(1) | ||
}) | ||
}) | ||
).then(() => { | ||
console.log('done') | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.