Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevented waiting element in the second time if an error was raised in the first #7111

Merged
merged 5 commits into from Jun 30, 2022

Conversation

Aleksey28
Copy link
Collaborator

[closes #6623]

Purpose

Prevent executing selector twice when it isn't available for the typeText command.

Approach

  1. Add test
  2. Skip typing text if the selector wasn't available during inspection.

References

#6623

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

@Aleksey28 Aleksey28 temporarily deployed to CI June 27, 2022 14:26 Inactive
@Aleksey28 Aleksey28 temporarily deployed to CI June 27, 2022 17:00 Inactive
@Aleksey28 Aleksey28 temporarily deployed to CI June 28, 2022 08:42 Inactive
@@ -2,6 +2,23 @@ import { AutomationErrorCtor } from '../types';
import { FnInfo, SelectorErrorCb } from '../../client/driver/command-executors/client-functions/types';
import * as Errors from './index';

export function createInvisibleErrorCtor (elementName?: string): AutomationErrorCtor | string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

export function getInvisibleErrorCtorData

};
}

export function createNotFoundErrorCtor (elementName?: string): AutomationErrorCtor | string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

export function getNotFoundErrorCtorData

@@ -69,8 +69,11 @@ function assertErrorMessage (fn, expectedErrMessage) {
expect(actualErr.message).eql(expectedErrMessage);
}

function makeSelector (str, skipVisibilityCheck) {
const builder = new SelectorBuilder(str, { visibilityCheck: !skipVisibilityCheck }, { instantiation: 'Selector' });
function makeSelector (str, skipVisibilityCheck, needError, separatedErrors) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add default values to boolean arguments.

@@ -43,4 +44,20 @@ describe('[API] t.typeText()', function () {
expect(errs[0]).to.contains('> 19 | await t.typeText(NaN, \'a\');');
});
});

if (!config.proxyless) {
it('Should not get selector the second time if the error was raised in the first.', function () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not execute selector twice for non-existing element due to "confidential" option (GH-6623)

only: 'chrome',
})
.catch(function (errs) {
expect(testReport.durationMs).lessThan(1100);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Increase the selectorTimeout value to make test more stable (this test sometimes failed on my machine).

@@ -156,6 +156,7 @@ export default class SelectorBuilder extends ClientFunctionBuilder {
apiFnChain: this.options.apiFnChain,
visibilityCheck: !!this.options.visibilityCheck,
timeout: this.options.timeout,
separatedErrors: this.options.separatedErrors,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I propose another name for this option - strictError.

@Aleksey28 Aleksey28 temporarily deployed to CI June 29, 2022 10:39 Inactive
@miherlosev miherlosev merged commit e06a501 into DevExpress:master Jun 30, 2022
@github-actions
Copy link

github-actions bot commented Jul 8, 2022

Release v1.20.0-rc.1 addresses this.

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.

Target element is waiting two time for the 'typeText' command
2 participants