Skip to content

correct server processing the form element with target=iframe#2290

Merged
miherlosev merged 3 commits intoDevExpress:masterfrom
AlexKamaev:frame-not-load
Apr 14, 2020
Merged

correct server processing the form element with target=iframe#2290
miherlosev merged 3 commits intoDevExpress:masterfrom
AlexKamaev:frame-not-load

Conversation

@AlexKamaev
Copy link
Copy Markdown
Contributor

@AlexKamaev AlexKamaev commented Apr 11, 2020

The situation:

  • we have form with target = 'framename'
  • we submit the form using form.submit
  • swithingToIframe
  • click/expect/any command in iframe leads to error

The cause that iframe window is reloaded after form submit, because of incomplete hh server processing.

I checked two original cases and they work as expected

@AlexKamaev AlexKamaev changed the title [WIP]correct processing the form element with target=iframe [WIP]correct server processing the form element with target=iframe Apr 11, 2020
@AlexKamaev
Copy link
Copy Markdown
Contributor Author

@testcafe-build-bot retest

@AlexKamaev AlexKamaev closed this Apr 13, 2020
@AlexKamaev AlexKamaev reopened this Apr 13, 2020
Copy link
Copy Markdown
Contributor

@LavrovArtem LavrovArtem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor code style issues

Comment thread src/processing/dom/base-dom-adapter.ts Outdated
abstract sameOriginCheck (destUrl: string, resourceUrl: string): boolean;
abstract getClassName (el: HTMLElement | ASTNode): string;
abstract isExistingTarget (target: string): boolean;
abstract isExistingTarget (target: string, el: ASTNode | void): boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- el: ASTNode | void
+ el?: ASTNode

while (el.parentNode)
el = el.parentNode;

return parse5Utils.findElement(el, e => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return parse5Utils.findElement(el, e => this.getAttr(e, 'name') === target);

Comment thread src/utils/parse5.ts Outdated
return elements;
}

export function findElement (el: ASTNode, predicate: Function) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function findElement (el: ASTNode, predicate: (el: ASTNode) => boolean) {

Comment thread src/utils/parse5.ts Outdated
if (!el.childNodes)
return null;

for (let i = 0; i < el.childNodes.length; i++) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (let child of el.childNodes)

@AlexKamaev AlexKamaev closed this Apr 13, 2020
@AlexKamaev AlexKamaev reopened this Apr 13, 2020
@AlexKamaev
Copy link
Copy Markdown
Contributor Author

FPR
Tests passed. For some reasons Job is displayed as pending, but tests finished

@AlexKamaev AlexKamaev changed the title [WIP]correct server processing the form element with target=iframe correct server processing the form element with target=iframe Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants