@o3r/testing 13.0.0-next.6 → 13.0.0-prerelease.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/core/angular/angular-materials/autocomplete-material.js +9 -20
  2. package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
  3. package/core/angular/angular-materials/index.js +1 -1
  4. package/core/angular/angular-materials/select-material.js +42 -91
  5. package/core/angular/angular-materials/select-material.js.map +1 -1
  6. package/core/angular/angular-materials/slider-material.js +8 -11
  7. package/core/angular/angular-materials/slider-material.js.map +1 -1
  8. package/core/angular/component-fixture.js +68 -148
  9. package/core/angular/component-fixture.js.map +1 -1
  10. package/core/angular/element.js +44 -50
  11. package/core/angular/element.js.map +1 -1
  12. package/core/angular/elements/checkbox-element.js +12 -16
  13. package/core/angular/elements/checkbox-element.js.map +1 -1
  14. package/core/angular/elements/index.js +1 -1
  15. package/core/angular/elements/radio-element.js +12 -16
  16. package/core/angular/elements/radio-element.js.map +1 -1
  17. package/core/angular/elements/select-element.js +28 -49
  18. package/core/angular/elements/select-element.js.map +1 -1
  19. package/core/angular/elements/slider-element.js +38 -42
  20. package/core/angular/elements/slider-element.js.map +1 -1
  21. package/core/angular/group.js +9 -14
  22. package/core/angular/group.js.map +1 -1
  23. package/core/angular/groups/index.js +1 -1
  24. package/core/angular/groups/radio-group.js +25 -62
  25. package/core/angular/groups/radio-group.js.map +1 -1
  26. package/core/angular/index.js +1 -1
  27. package/core/angular/page-fixture.js +8 -11
  28. package/core/angular/page-fixture.js.map +1 -1
  29. package/core/angular-materials/autocomplete-material.js +8 -11
  30. package/core/angular-materials/autocomplete-material.js.map +1 -1
  31. package/core/angular-materials/index.js +1 -1
  32. package/core/angular-materials/select-material.js +12 -15
  33. package/core/angular-materials/select-material.js.map +1 -1
  34. package/core/angular-materials/slider-material.js +5 -8
  35. package/core/angular-materials/slider-material.js.map +1 -1
  36. package/core/component-fixture.js +28 -33
  37. package/core/component-fixture.js.map +1 -1
  38. package/core/element.js +24 -26
  39. package/core/element.js.map +1 -1
  40. package/core/elements/checkbox-element.js +12 -16
  41. package/core/elements/checkbox-element.js.map +1 -1
  42. package/core/elements/index.js +1 -1
  43. package/core/elements/radio-element.js +12 -16
  44. package/core/elements/radio-element.js.map +1 -1
  45. package/core/elements/select-element.js +10 -13
  46. package/core/elements/select-element.js.map +1 -1
  47. package/core/elements/slider-element.js +5 -8
  48. package/core/elements/slider-element.js.map +1 -1
  49. package/core/group.js +9 -15
  50. package/core/group.js.map +1 -1
  51. package/core/groups/index.js +1 -1
  52. package/core/groups/radio-group.js +8 -11
  53. package/core/groups/radio-group.js.map +1 -1
  54. package/core/helpers.js +11 -16
  55. package/core/helpers.js.map +1 -1
  56. package/core/index.js +1 -1
  57. package/core/page-fixture.js +8 -11
  58. package/core/page-fixture.js.map +1 -1
  59. package/core/playwright/angular-materials/autocomplete-material.js +26 -56
  60. package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
  61. package/core/playwright/angular-materials/index.js +1 -1
  62. package/core/playwright/angular-materials/select-material.js +48 -110
  63. package/core/playwright/angular-materials/select-material.js.map +1 -1
  64. package/core/playwright/angular-materials/slider-material.js +7 -10
  65. package/core/playwright/angular-materials/slider-material.js.map +1 -1
  66. package/core/playwright/component-fixture.js +88 -173
  67. package/core/playwright/component-fixture.js.map +1 -1
  68. package/core/playwright/element.js +38 -90
  69. package/core/playwright/element.js.map +1 -1
  70. package/core/playwright/elements/checkbox-element.js +49 -94
  71. package/core/playwright/elements/checkbox-element.js.map +1 -1
  72. package/core/playwright/elements/index.js +1 -1
  73. package/core/playwright/elements/radio-element.js +18 -34
  74. package/core/playwright/elements/radio-element.js.map +1 -1
  75. package/core/playwright/elements/select-element.js +14 -21
  76. package/core/playwright/elements/select-element.js.map +1 -1
  77. package/core/playwright/elements/slider-element.js +78 -157
  78. package/core/playwright/elements/slider-element.js.map +1 -1
  79. package/core/playwright/group.js +9 -14
  80. package/core/playwright/group.js.map +1 -1
  81. package/core/playwright/groups/index.js +1 -1
  82. package/core/playwright/groups/radio-group.js +27 -64
  83. package/core/playwright/groups/radio-group.js.map +1 -1
  84. package/core/playwright/index.js +1 -1
  85. package/core/playwright/page-fixture.js +8 -18
  86. package/core/playwright/page-fixture.js.map +1 -1
  87. package/errors/fixture-usage-error.js +5 -10
  88. package/errors/fixture-usage-error.js.map +1 -1
  89. package/errors/index.js +1 -1
  90. package/errors/transpilation-purpose-only.js +5 -10
  91. package/errors/transpilation-purpose-only.js.map +1 -1
  92. package/kassette/index.js +1 -1
  93. package/kassette/update-dates-in-mocks.js +66 -85
  94. package/kassette/update-dates-in-mocks.js.map +1 -1
  95. package/localization/index.js +1 -1
  96. package/localization/localization-mock.js +38 -60
  97. package/localization/localization-mock.js.map +1 -1
  98. package/mocks/index.js +1 -1
  99. package/mocks/mock-component-generator.js +54 -53
  100. package/mocks/mock-component-generator.js.map +1 -1
  101. package/package.json +60 -59
  102. package/public_api.js +1 -1
  103. package/schematics/add-functions-to-fixture/models.d.ts.map +1 -1
  104. package/schematics/add-functions-to-fixture/models.js.map +1 -1
  105. package/schematics/ng-add/index.d.ts.map +1 -1
  106. package/schematics/ng-add/index.js +4 -6
  107. package/schematics/ng-add/index.js.map +1 -1
  108. package/schematics/ng-add/playwright/index.d.ts.map +1 -1
  109. package/schematics/ng-add/playwright/index.js +3 -4
  110. package/schematics/ng-add/playwright/index.js.map +1 -1
  111. package/schematics/ng-add/schema.json +2 -1
  112. package/schematics/playwright/sanity/schema.json +2 -1
  113. package/schematics/playwright/scenario/schema.json +2 -1
  114. package/store/index.js +1 -1
  115. package/store/testable-select.js +13 -13
  116. package/store/testable-select.js.map +1 -1
  117. package/tools/index.js +1 -1
  118. package/tools/path-replacement/index.js +1 -1
  119. package/tools/path-replacement/path-replacement.js +24 -20
  120. package/tools/path-replacement/path-replacement.js.map +1 -1
  121. package/visual-test/index.js +1 -1
  122. package/visual-test/utils.js +18 -7
  123. package/visual-test/utils.js.map +1 -1
  124. package/visual-test/visual-test.d.ts.map +1 -1
  125. package/visual-test/visual-test.js +30 -35
  126. package/visual-test/visual-test.js.map +1 -1
  127. package/visual-testing-reporter/index.d.ts.map +1 -1
  128. package/visual-testing-reporter/index.js +37 -40
  129. package/visual-testing-reporter/index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4CAE4B;AAI5B,sCAEoB;AACpB,qCAImB;AAQnB;;GAEG;AACH;IAME;;;;OAIG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,qBAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,SAAA,EAAE,CAAC,EAAA;;wBAAnF,SAAmF,CAAC;wBACpF,sBAAO,OAAO,EAAC;;;;KAChB;IAED;;;;;OAKG;IACO,8CAAgB,GAA1B,UAAiD,OAAmB,EAAE,OAAgB;QAAtF,iBAQC;QAPC,OAAO,IAAA,qBAAW,EAChB,CAAC;;;;4BACY,qBAAM,OAAO,EAAA;;wBAAlB,EAAE,GAAG,SAAa;wBACxB,qBAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAA;;wBAArE,SAAqE,CAAC;wBACtE,sBAAO,EAAE,EAAC;;;aACX,CAAC,EAAE,EACJ,OAAO,CAAC,CAAC;IAC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,IAAI,yBAAiB,CAAC,wBAAwB,CAAC,CAAC;wBACxD,CAAC;wBACD,sBAAO,KAAK,EAAC;4BAGf,sBAAO,QAAQ,EAAC;;;wBAEhB,mEAAmE;wBACnE,OAAO,CAAC,IAAI,CAAC,8BAAuB,QAAQ,CAAE,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;;;;;KAE9B;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,6CAAe,GAAtB,UAAuB,QAAgB;QACrC,IAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACH,0BAAC;AAAD,CAAC,AA9MD,IA8MC;AA9MY,kDAAmB","sourcesContent":["import {\n FixtureUsageError,\n} from '../../errors/index';\nimport type {\n ComponentFixtureProfile,\n} from '../component-fixture';\nimport {\n withTimeout,\n} from '../helpers';\nimport {\n O3rElement,\n O3rElementConstructor,\n PlaywrightSourceElement,\n} from './element';\nimport {\n O3rGroup,\n O3rGroupConstructor,\n} from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n await element.sourceElement.element.first().waitFor({ state: 'attached', timeout });\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(element: Promise<T>, timeout?: number): Promise<T> {\n return withTimeout(\n (async () => {\n const el = await element;\n await el.sourceElement.element.first().waitFor({ state: 'attached' });\n return el;\n })(),\n timeout);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement> {\n const element: O3rElement = await (options.index === undefined ? this.query(selector, elementConstructor as any) : this.queryNth(selector, options.index, elementConstructor as any));\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement = { element: element, page: this.rootElement.sourceElement.page } as const satisfies PlaywrightSourceElement;\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement = { element: element, page: this.rootElement.sourceElement.page } as const satisfies PlaywrightSourceElement;\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({ state: 'attached', timeout });\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = { element: pElements.nth(i), page: this.rootElement.sourceElement.page };\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }> {\n return Promise.resolve({ block: [this] });\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
1
+ {"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;AAAA,8CAE4B;AAI5B,wCAEoB;AACpB,uCAImB;AAQnB;;GAEG;AACH,MAAa,mBAAmB;IAM9B;;;;OAIG;IACH,YAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,uBAAuB,CAAuB,OAAW,EAAE,OAAgB;QACzF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACpF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACO,gBAAgB,CAAuB,OAAmB,EAAE,OAAgB;QACpF,OAAO,IAAA,qBAAW,EAChB,CAAC,KAAK,IAAI,EAAE;YACV,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC;YACzB,MAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;YACtE,OAAO,EAAE,CAAC;QACZ,CAAC,CA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AAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,kBAAkB;IACX,UAAU;QACf,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,gBAAgB;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,eAAe,CAAC,QAAgB;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;CACF;AA9MD,kDA8MC","sourcesContent":["import {\n FixtureUsageError,\n} from '../../errors/index';\nimport type {\n ComponentFixtureProfile,\n} from '../component-fixture';\nimport {\n withTimeout,\n} from '../helpers';\nimport {\n O3rElement,\n O3rElementConstructor,\n PlaywrightSourceElement,\n} from './element';\nimport {\n O3rGroup,\n O3rGroupConstructor,\n} from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n await element.sourceElement.element.first().waitFor({ state: 'attached', timeout });\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(element: Promise<T>, timeout?: number): Promise<T> {\n return withTimeout(\n (async () => {\n const el = await element;\n await el.sourceElement.element.first().waitFor({ state: 'attached' });\n return el;\n })(),\n timeout);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement> {\n const element: O3rElement = await (options.index === undefined ? this.query(selector, elementConstructor as any) : this.queryNth(selector, options.index, elementConstructor as any));\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement = { element: element, page: this.rootElement.sourceElement.page } as const satisfies PlaywrightSourceElement;\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement = { element: element, page: this.rootElement.sourceElement.page } as const satisfies PlaywrightSourceElement;\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({ state: 'attached', timeout });\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = { element: pElements.nth(i), page: this.rootElement.sourceElement.page };\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }> {\n return Promise.resolve({ block: [this] });\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rElement = void 0;
4
4
  exports.getPlainText = getPlainText;
5
- var tslib_1 = require("tslib");
6
5
  /**
7
6
  * Remove text formatting (endline etc.) and return the content.
8
7
  * @param innerText
@@ -13,113 +12,62 @@ function getPlainText(innerText) {
13
12
  /**
14
13
  * Implementation dedicated to Playwright.
15
14
  */
16
- var O3rElement = /** @class */ (function () {
17
- function O3rElement(sourceElement) {
15
+ class O3rElement {
16
+ constructor(sourceElement) {
18
17
  this.sourceElement = sourceElement instanceof O3rElement
19
18
  ? { element: sourceElement.sourceElement.element, page: sourceElement.sourceElement.page }
20
19
  : sourceElement;
21
20
  }
22
21
  /** @inheritdoc */
23
- O3rElement.prototype.getText = function () {
22
+ getText() {
24
23
  return this.sourceElement.element.innerText();
25
- };
24
+ }
26
25
  /** @inheritdoc */
27
- O3rElement.prototype.getPlainText = function () {
28
- return tslib_1.__awaiter(this, void 0, void 0, function () {
29
- var _a;
30
- return tslib_1.__generator(this, function (_b) {
31
- switch (_b.label) {
32
- case 0:
33
- _a = getPlainText;
34
- return [4 /*yield*/, this.getText()];
35
- case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
36
- }
37
- });
38
- });
39
- };
26
+ async getPlainText() {
27
+ return getPlainText(await this.getText());
28
+ }
40
29
  /** @inheritdoc */
41
- O3rElement.prototype.getInnerHTML = function () {
30
+ getInnerHTML() {
42
31
  return this.sourceElement.element.innerHTML();
43
- };
32
+ }
44
33
  /** @inheritdoc */
45
- O3rElement.prototype.mouseOver = function () {
34
+ mouseOver() {
46
35
  return this.sourceElement.element.hover();
47
- };
36
+ }
48
37
  /** @inheritdoc */
49
- O3rElement.prototype.getValue = function () {
50
- return tslib_1.__awaiter(this, void 0, void 0, function () {
51
- var _a, valueByAttribute;
52
- return tslib_1.__generator(this, function (_b) {
53
- switch (_b.label) {
54
- case 0:
55
- _b.trys.push([0, 2, , 4]);
56
- return [4 /*yield*/, this.sourceElement.element.inputValue()];
57
- case 1: return [2 /*return*/, _b.sent()];
58
- case 2:
59
- _a = _b.sent();
60
- // eslint-disable-next-line no-console -- no other logger available
61
- console.warn('Failed to retrieve input value');
62
- return [4 /*yield*/, this.sourceElement.element.getAttribute('value')];
63
- case 3:
64
- valueByAttribute = _b.sent();
65
- return [2 /*return*/, valueByAttribute === null ? undefined : valueByAttribute];
66
- case 4: return [2 /*return*/];
67
- }
68
- });
69
- });
70
- };
38
+ async getValue() {
39
+ try {
40
+ return await this.sourceElement.element.inputValue();
41
+ }
42
+ catch {
43
+ // eslint-disable-next-line no-console -- no other logger available
44
+ console.warn('Failed to retrieve input value');
45
+ const valueByAttribute = await this.sourceElement.element.getAttribute('value');
46
+ return valueByAttribute === null ? undefined : valueByAttribute;
47
+ }
48
+ }
71
49
  /** @inheritdoc */
72
- O3rElement.prototype.setValue = function (input) {
73
- return tslib_1.__awaiter(this, void 0, void 0, function () {
74
- return tslib_1.__generator(this, function (_a) {
75
- switch (_a.label) {
76
- case 0: return [4 /*yield*/, this.sourceElement.element.fill(input)];
77
- case 1:
78
- _a.sent();
79
- return [4 /*yield*/, this.sourceElement.element.press('Tab')];
80
- case 2:
81
- _a.sent();
82
- return [2 /*return*/];
83
- }
84
- });
85
- });
86
- };
50
+ async setValue(input) {
51
+ await this.sourceElement.element.fill(input);
52
+ await this.sourceElement.element.press('Tab');
53
+ }
87
54
  /** @inheritdoc */
88
- O3rElement.prototype.clearValue = function () {
89
- return tslib_1.__awaiter(this, void 0, void 0, function () {
90
- return tslib_1.__generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0: return [4 /*yield*/, this.sourceElement.element.fill('')];
93
- case 1:
94
- _a.sent();
95
- return [2 /*return*/];
96
- }
97
- });
98
- });
99
- };
55
+ async clearValue() {
56
+ await this.sourceElement.element.fill('');
57
+ }
100
58
  /** @inheritdoc */
101
- O3rElement.prototype.click = function () {
59
+ click() {
102
60
  return this.sourceElement.element.click();
103
- };
61
+ }
104
62
  /** @inheritdoc */
105
- O3rElement.prototype.isVisible = function () {
63
+ isVisible() {
106
64
  return this.sourceElement.element.isVisible();
107
- };
65
+ }
108
66
  /** @inheritdoc */
109
- O3rElement.prototype.getAttribute = function (attributeName) {
110
- return tslib_1.__awaiter(this, void 0, void 0, function () {
111
- var attribute;
112
- return tslib_1.__generator(this, function (_a) {
113
- switch (_a.label) {
114
- case 0: return [4 /*yield*/, this.sourceElement.element.getAttribute(attributeName)];
115
- case 1:
116
- attribute = _a.sent();
117
- return [2 /*return*/, attribute === null ? undefined : attribute];
118
- }
119
- });
120
- });
121
- };
122
- return O3rElement;
123
- }());
67
+ async getAttribute(attributeName) {
68
+ const attribute = await this.sourceElement.element.getAttribute(attributeName);
69
+ return attribute === null ? undefined : attribute;
70
+ }
71
+ }
124
72
  exports.O3rElement = O3rElement;
125
73
  //# sourceMappingURL=element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":";;;AAyBA,oCAEC;;AAND;;;GAGG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrG,CAAC;AAED;;GAEG;AACH;IAIE,oBAAY,aAAmD;QAC7D,IAAI,CAAC,aAAa,GAAG,aAAa,YAAY,UAAU;YACtD,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE;YAC1F,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;IAED,kBAAkB;IACX,4BAAO,GAAd;QACE,OAAO,IAAI,CAAC,aAAa,CAAC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wBAAzC,SAAyC,CAAC;;;;;KAC3C;IAED,kBAAkB;IACX,0BAAK,GAAZ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,8BAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB,UAA0B,aAAqB;;;;;4BAC3B,qBAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,EAAA;;wBAAxE,SAAS,GAAG,SAA4D;wBAC9E,sBAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAC;;;;KACnD;IACH,iBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,gCAAU","sourcesContent":["import type {\n Locator,\n Page,\n} from '@playwright/test';\nimport {\n ElementProfile,\n} from '../element';\n\nexport { ElementProfile } from '../element';\n\n/**\n * Playwright type for source element\n * @param element is the DOM element\n * @param page is the tab in the browser where the test is run\n */\n\nexport type PlaywrightSourceElement = {\n element: Locator;\n page: Page;\n};\n\n/**\n * Remove text formatting (endline etc.) and return the content.\n * @param innerText\n */\nexport function getPlainText(innerText: string) {\n return innerText ? innerText.replace(/\\r\\n|\\r|\\n/g, ' ').replace(/\\s\\s+/g, ' ').trim() : undefined;\n}\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rElement implements ElementProfile {\n /** Playwright sourceElement */\n public sourceElement: PlaywrightSourceElement;\n\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n this.sourceElement = sourceElement instanceof O3rElement\n ? { element: sourceElement.sourceElement.element, page: sourceElement.sourceElement.page }\n : sourceElement;\n }\n\n /** @inheritdoc */\n public getText() {\n return this.sourceElement.element.innerText();\n }\n\n /** @inheritdoc */\n public async getPlainText() {\n return getPlainText(await this.getText());\n }\n\n /** @inheritdoc */\n public getInnerHTML(): Promise<string | undefined> {\n return this.sourceElement.element.innerHTML();\n }\n\n /** @inheritdoc */\n public mouseOver() {\n return this.sourceElement.element.hover();\n }\n\n /** @inheritdoc */\n public async getValue() {\n try {\n return await this.sourceElement.element.inputValue();\n } catch {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve input value');\n const valueByAttribute = await this.sourceElement.element.getAttribute('value');\n return valueByAttribute === null ? undefined : valueByAttribute;\n }\n }\n\n /** @inheritdoc */\n public async setValue(input: string) {\n await this.sourceElement.element.fill(input);\n\n await this.sourceElement.element.press('Tab');\n }\n\n /** @inheritdoc */\n public async clearValue() {\n await this.sourceElement.element.fill('');\n }\n\n /** @inheritdoc */\n public click() {\n return this.sourceElement.element.click();\n }\n\n /** @inheritdoc */\n public isVisible() {\n return this.sourceElement.element.isVisible();\n }\n\n /** @inheritdoc */\n public async getAttribute(attributeName: string) {\n const attribute = await this.sourceElement.element.getAttribute(attributeName);\n return attribute === null ? undefined : attribute;\n }\n}\n\n/**\n * Constructor of a O3rElement\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: PlaywrightSourceElement | O3rElement) => T;\n"]}
1
+ {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":";;;AAyBA,oCAEC;AAND;;;GAGG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrG,CAAC;AAED;;GAEG;AACH,MAAa,UAAU;IAIrB,YAAY,aAAmD;QAC7D,IAAI,CAAC,aAAa,GAAG,aAAa,YAAY,UAAU;YACtD,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,OAA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,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,KAAK;QACV,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,YAAY,CAAC,aAAqB;QAC7C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QAC/E,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;CACF;AArED,gCAqEC","sourcesContent":["import type {\n Locator,\n Page,\n} from '@playwright/test';\nimport {\n ElementProfile,\n} from '../element';\n\nexport { ElementProfile } from '../element';\n\n/**\n * Playwright type for source element\n * @param element is the DOM element\n * @param page is the tab in the browser where the test is run\n */\n\nexport type PlaywrightSourceElement = {\n element: Locator;\n page: Page;\n};\n\n/**\n * Remove text formatting (endline etc.) and return the content.\n * @param innerText\n */\nexport function getPlainText(innerText: string) {\n return innerText ? innerText.replace(/\\r\\n|\\r|\\n/g, ' ').replace(/\\s\\s+/g, ' ').trim() : undefined;\n}\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rElement implements ElementProfile {\n /** Playwright sourceElement */\n public sourceElement: PlaywrightSourceElement;\n\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n this.sourceElement = sourceElement instanceof O3rElement\n ? { element: sourceElement.sourceElement.element, page: sourceElement.sourceElement.page }\n : sourceElement;\n }\n\n /** @inheritdoc */\n public getText() {\n return this.sourceElement.element.innerText();\n }\n\n /** @inheritdoc */\n public async getPlainText() {\n return getPlainText(await this.getText());\n }\n\n /** @inheritdoc */\n public getInnerHTML(): Promise<string | undefined> {\n return this.sourceElement.element.innerHTML();\n }\n\n /** @inheritdoc */\n public mouseOver() {\n return this.sourceElement.element.hover();\n }\n\n /** @inheritdoc */\n public async getValue() {\n try {\n return await this.sourceElement.element.inputValue();\n } catch {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve input value');\n const valueByAttribute = await this.sourceElement.element.getAttribute('value');\n return valueByAttribute === null ? undefined : valueByAttribute;\n }\n }\n\n /** @inheritdoc */\n public async setValue(input: string) {\n await this.sourceElement.element.fill(input);\n\n await this.sourceElement.element.press('Tab');\n }\n\n /** @inheritdoc */\n public async clearValue() {\n await this.sourceElement.element.fill('');\n }\n\n /** @inheritdoc */\n public click() {\n return this.sourceElement.element.click();\n }\n\n /** @inheritdoc */\n public isVisible() {\n return this.sourceElement.element.isVisible();\n }\n\n /** @inheritdoc */\n public async getAttribute(attributeName: string) {\n const attribute = await this.sourceElement.element.getAttribute(attributeName);\n return attribute === null ? undefined : attribute;\n }\n}\n\n/**\n * Constructor of a O3rElement\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: PlaywrightSourceElement | O3rElement) => T;\n"]}
@@ -1,111 +1,66 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rCheckboxElement = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
4
+ const element_1 = require("../element");
6
5
  /**
7
6
  * Implementation dedicated to Playwright.
8
7
  */
9
- var O3rCheckboxElement = /** @class */ (function (_super) {
10
- tslib_1.__extends(O3rCheckboxElement, _super);
11
- function O3rCheckboxElement(sourceElement) {
12
- return _super.call(this, sourceElement) || this;
8
+ class O3rCheckboxElement extends element_1.O3rElement {
9
+ constructor(sourceElement) {
10
+ super(sourceElement);
11
+ }
12
+ async getInputElement() {
13
+ try {
14
+ const subInputElement = this.sourceElement.element.locator('input[type="checkbox"]');
15
+ if (await subInputElement.count()) {
16
+ return subInputElement;
17
+ }
18
+ return this.sourceElement.element;
19
+ }
20
+ catch {
21
+ return this.sourceElement.element;
22
+ }
23
+ }
24
+ async getLabelElement() {
25
+ try {
26
+ const element = this.sourceElement.element.locator('label');
27
+ if (await element.count()) {
28
+ return element;
29
+ }
30
+ }
31
+ catch (err) {
32
+ // eslint-disable-next-line no-console -- no other logger available
33
+ console.warn('Failed to retrieve label of O3rCheckboxElement', err);
34
+ return;
35
+ }
13
36
  }
14
- O3rCheckboxElement.prototype.getInputElement = function () {
15
- return tslib_1.__awaiter(this, void 0, void 0, function () {
16
- var subInputElement, _a;
17
- return tslib_1.__generator(this, function (_b) {
18
- switch (_b.label) {
19
- case 0:
20
- _b.trys.push([0, 2, , 3]);
21
- subInputElement = this.sourceElement.element.locator('input[type="checkbox"]');
22
- return [4 /*yield*/, subInputElement.count()];
23
- case 1:
24
- if (_b.sent()) {
25
- return [2 /*return*/, subInputElement];
26
- }
27
- return [2 /*return*/, this.sourceElement.element];
28
- case 2:
29
- _a = _b.sent();
30
- return [2 /*return*/, this.sourceElement.element];
31
- case 3: return [2 /*return*/];
32
- }
33
- });
34
- });
35
- };
36
- O3rCheckboxElement.prototype.getLabelElement = function () {
37
- return tslib_1.__awaiter(this, void 0, void 0, function () {
38
- var element, err_1;
39
- return tslib_1.__generator(this, function (_a) {
40
- switch (_a.label) {
41
- case 0:
42
- _a.trys.push([0, 2, , 3]);
43
- element = this.sourceElement.element.locator('label');
44
- return [4 /*yield*/, element.count()];
45
- case 1:
46
- if (_a.sent()) {
47
- return [2 /*return*/, element];
48
- }
49
- return [3 /*break*/, 3];
50
- case 2:
51
- err_1 = _a.sent();
52
- // eslint-disable-next-line no-console -- no other logger available
53
- console.warn('Failed to retrieve label of O3rCheckboxElement', err_1);
54
- return [2 /*return*/];
55
- case 3: return [2 /*return*/];
56
- }
57
- });
58
- });
59
- };
60
37
  /**
61
38
  * Check the checkbox element
62
39
  * @param value If specified, determine the value of the checkbox button
63
40
  * If the element contains a label, the label will be used to (un)check the checkbox.
64
41
  */
65
- O3rCheckboxElement.prototype.check = function () {
66
- return tslib_1.__awaiter(this, arguments, void 0, function (value) {
67
- var labelElement, currentValue;
68
- if (value === void 0) { value = true; }
69
- return tslib_1.__generator(this, function (_a) {
70
- switch (_a.label) {
71
- case 0: return [4 /*yield*/, this.getLabelElement()];
72
- case 1:
73
- labelElement = _a.sent();
74
- if (!labelElement) return [3 /*break*/, 3];
75
- return [4 /*yield*/, this.isChecked()];
76
- case 2:
77
- currentValue = _a.sent();
78
- if (currentValue === value) {
79
- // eslint-disable-next-line no-console -- no other logger available
80
- console.warn("Checkbox is already ".concat(currentValue ? 'checked' : 'unchecked'));
81
- return [2 /*return*/, Promise.resolve()];
82
- }
83
- return [2 /*return*/, labelElement.click()];
84
- case 3: return [4 /*yield*/, this.getInputElement()];
85
- case 4: return [2 /*return*/, (_a.sent()).setChecked(value)];
86
- }
87
- });
88
- });
89
- };
42
+ async check(value = true) {
43
+ const labelElement = await this.getLabelElement();
44
+ if (labelElement) {
45
+ const currentValue = await this.isChecked();
46
+ if (currentValue === value) {
47
+ // eslint-disable-next-line no-console -- no other logger available
48
+ console.warn(`Checkbox is already ${currentValue ? 'checked' : 'unchecked'}`);
49
+ return Promise.resolve();
50
+ }
51
+ return labelElement.click();
52
+ }
53
+ return (await this.getInputElement()).setChecked(value);
54
+ }
90
55
  /** @inheritDoc */
91
- O3rCheckboxElement.prototype.uncheck = function () {
56
+ uncheck() {
92
57
  return this.check(false);
93
- };
58
+ }
94
59
  /** @inheritDoc */
95
- O3rCheckboxElement.prototype.isChecked = function () {
96
- return tslib_1.__awaiter(this, void 0, void 0, function () {
97
- var inputElement;
98
- return tslib_1.__generator(this, function (_a) {
99
- switch (_a.label) {
100
- case 0: return [4 /*yield*/, this.getInputElement()];
101
- case 1:
102
- inputElement = _a.sent();
103
- return [2 /*return*/, inputElement.isChecked()];
104
- }
105
- });
106
- });
107
- };
108
- return O3rCheckboxElement;
109
- }(element_1.O3rElement));
60
+ async isChecked() {
61
+ const inputElement = await this.getInputElement();
62
+ return inputElement.isChecked();
63
+ }
64
+ }
110
65
  exports.O3rCheckboxElement = O3rCheckboxElement;
111
66
  //# sourceMappingURL=checkbox-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AAGA,sCAGoB;AAEpB;;GAEG;AACH;IAAwC,8CAAU;IAChD,4BAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAEa,4CAAe,GAA7B;;;;;;;wBAEU,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;wBACjF,qBAAM,eAAe,CAAC,KAAK,EAAE,EAAA;;wBAAjC,IAAI,SAA6B,EAAE,CAAC;4BAClC,sBAAO,eAAe,EAAC;wBACzB,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;wBAElC,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;;;KAErC;IAEa,4CAAe,GAA7B;;;;;;;wBAEU,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;wBACxD,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;wBAAzB,IAAI,SAAqB,EAAE,CAAC;4BAC1B,sBAAO,OAAO,EAAC;wBACjB,CAAC;;;;wBAED,mEAAmE;wBACnE,OAAO,CAAC,IAAI,CAAC,gDAAgD,EAAE,KAAG,CAAC,CAAC;wBACpE,sBAAO;;;;;KAEV;IAED;;;;OAIG;IACU,kCAAK,GAAlB;oEAAmB,KAAY;;YAAZ,sBAAA,EAAA,YAAY;;;4BACR,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;6BAC7C,YAAY,EAAZ,wBAAY;wBACO,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAArC,YAAY,GAAG,SAAsB;wBAC3C,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;4BAC3B,mEAAmE;4BACnE,OAAO,CAAC,IAAI,CAAC,8BAAuB,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC3B,CAAC;wBACD,sBAAO,YAAY,CAAC,KAAK,EAAE,EAAC;4BAEtB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;4BAApC,sBAAO,CAAC,SAA4B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACzD;IAED,kBAAkB;IACX,oCAAO,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACL,sCAAS,GAAtB;;;;;4BACuB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;wBACjD,sBAAO,YAAY,CAAC,SAAS,EAAE,EAAC;;;;KACjC;IACH,yBAAC;AAAD,CAAC,AA3DD,CAAwC,oBAAU,GA2DjD;AA3DY,gDAAkB","sourcesContent":["import {\n CheckboxElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n private async getInputElement() {\n try {\n const subInputElement = this.sourceElement.element.locator('input[type=\"checkbox\"]');\n if (await subInputElement.count()) {\n return subInputElement;\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getLabelElement() {\n try {\n const element = this.sourceElement.element.locator('label');\n if (await element.count()) {\n return element;\n }\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve label of O3rCheckboxElement', err);\n return;\n }\n }\n\n /**\n * Check the checkbox element\n * @param value If specified, determine the value of the checkbox button\n * If the element contains a label, the label will be used to (un)check the checkbox.\n */\n public async check(value = true) {\n const labelElement = await this.getLabelElement();\n if (labelElement) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Checkbox is already ${currentValue ? 'checked' : 'unchecked'}`);\n return Promise.resolve();\n }\n return labelElement.click();\n }\n return (await this.getInputElement()).setChecked(value);\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const inputElement = await this.getInputElement();\n return inputElement.isChecked();\n }\n}\n"]}
1
+ {"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":";;;AAGA,wCAGoB;AAEpB;;GAEG;AACH,MAAa,kBAAmB,SAAQ,oBAAU;IAChD,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;YACrF,IAAI,MAAM,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC;gBAClC,OAAO,eAAe,CAAC;YACzB,CAAC;YACD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QACpC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5D,IAAI,MAAM,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;gBAC1B,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mEAAmE;YACnE,OAAO,CAAC,IAAI,CAAC,gDAAgD,EAAE,GAAG,CAAC,CAAC;YACpE,OAAO;QACT,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QAC7B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAClD,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5C,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;gBAC3B,mEAAmE;gBACnE,OAAO,CAAC,IAAI,CAAC,uBAAuB,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC9E,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;YACD,OAAO,YAAY,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;QACD,OAAO,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,kBAAkB;IACX,OAAO;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,SAAS;QACpB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAClD,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;CACF;AA3DD,gDA2DC","sourcesContent":["import {\n CheckboxElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n private async getInputElement() {\n try {\n const subInputElement = this.sourceElement.element.locator('input[type=\"checkbox\"]');\n if (await subInputElement.count()) {\n return subInputElement;\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getLabelElement() {\n try {\n const element = this.sourceElement.element.locator('label');\n if (await element.count()) {\n return element;\n }\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve label of O3rCheckboxElement', err);\n return;\n }\n }\n\n /**\n * Check the checkbox element\n * @param value If specified, determine the value of the checkbox button\n * If the element contains a label, the label will be used to (un)check the checkbox.\n */\n public async check(value = true) {\n const labelElement = await this.getLabelElement();\n if (labelElement) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Checkbox is already ${currentValue ? 'checked' : 'unchecked'}`);\n return Promise.resolve();\n }\n return labelElement.click();\n }\n return (await this.getInputElement()).setChecked(value);\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const inputElement = await this.getInputElement();\n return inputElement.isChecked();\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./checkbox-element"), exports);
5
5
  tslib_1.__exportStar(require("./radio-element"), exports);
6
6
  tslib_1.__exportStar(require("./select-element"), exports);
@@ -1,47 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rRadioElement = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
4
+ const element_1 = require("../element");
6
5
  /**
7
6
  * Implementation dedicated to Playwright.
8
7
  */
9
- var O3rRadioElement = /** @class */ (function (_super) {
10
- tslib_1.__extends(O3rRadioElement, _super);
11
- function O3rRadioElement(sourceElement) {
12
- return _super.call(this, sourceElement) || this;
8
+ class O3rRadioElement extends element_1.O3rElement {
9
+ constructor(sourceElement) {
10
+ super(sourceElement);
13
11
  }
14
12
  /** @inheritDoc */
15
- O3rRadioElement.prototype.check = function () {
16
- return tslib_1.__awaiter(this, arguments, void 0, function (value) {
17
- if (value === void 0) { value = true; }
18
- return tslib_1.__generator(this, function (_a) {
19
- switch (_a.label) {
20
- case 0: return [4 /*yield*/, this.isChecked()];
21
- case 1:
22
- if ((_a.sent()) === value) {
23
- // eslint-disable-next-line no-console -- no other logger available
24
- console.warn("O3rRadioELement is already ".concat(value ? 'checked' : 'unchecked'));
25
- return [2 /*return*/];
26
- }
27
- return [2 /*return*/, this.sourceElement.element.setChecked(value)];
28
- }
29
- });
30
- });
31
- };
13
+ async check(value = true) {
14
+ if ((await this.isChecked()) === value) {
15
+ // eslint-disable-next-line no-console -- no other logger available
16
+ console.warn(`O3rRadioELement is already ${value ? 'checked' : 'unchecked'}`);
17
+ return;
18
+ }
19
+ return this.sourceElement.element.setChecked(value);
20
+ }
32
21
  /** @inheritDoc */
33
- O3rRadioElement.prototype.uncheck = function () {
34
- return tslib_1.__awaiter(this, void 0, void 0, function () {
35
- return tslib_1.__generator(this, function (_a) {
36
- return [2 /*return*/, this.check(false)];
37
- });
38
- });
39
- };
22
+ async uncheck() {
23
+ return this.check(false);
24
+ }
40
25
  /** @inheritDoc */
41
- O3rRadioElement.prototype.isChecked = function () {
26
+ isChecked() {
42
27
  return this.sourceElement.element.isChecked();
43
- };
44
- return O3rRadioElement;
45
- }(element_1.O3rElement));
28
+ }
29
+ }
46
30
  exports.O3rRadioElement = O3rRadioElement;
47
31
  //# sourceMappingURL=radio-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;;AAGA,sCAGoB;AAEpB;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,+BAAK,GAAlB;oEAAmB,KAAY;YAAZ,sBAAA,EAAA,YAAY;;;4BACxB,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAA3B,IAAI,CAAC,SAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;4BACvC,mEAAmE;4BACnE,OAAO,CAAC,IAAI,CAAC,qCAA8B,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO;wBACT,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACrD;IAED,kBAAkB;IACL,iCAAO,GAApB;;;gBACE,sBAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC;;;KAC1B;IAED,kBAAkB;IACX,mCAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IACH,sBAAC;AAAD,CAAC,AAxBD,CAAqC,oBAAU,GAwB9C;AAxBY,0CAAe","sourcesContent":["import {\n RadioElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true) {\n if ((await this.isChecked()) === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`O3rRadioELement is already ${value ? 'checked' : 'unchecked'}`);\n return;\n }\n return this.sourceElement.element.setChecked(value);\n }\n\n /** @inheritDoc */\n public async uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n return this.sourceElement.element.isChecked();\n }\n}\n"]}
1
+ {"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;AAGA,wCAGoB;AAEpB;;GAEG;AACH,MAAa,eAAgB,SAAQ,oBAAU;IAC7C,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QAC7B,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;YACvC,mEAAmE;YACnE,OAAO,CAAC,IAAI,CAAC,8BAA8B,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAC9E,OAAO;QACT,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;CACF;AAxBD,0CAwBC","sourcesContent":["import {\n RadioElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true) {\n if ((await this.isChecked()) === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`O3rRadioELement is already ${value ? 'checked' : 'unchecked'}`);\n return;\n }\n return this.sourceElement.element.setChecked(value);\n }\n\n /** @inheritDoc */\n public async uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n return this.sourceElement.element.isChecked();\n }\n}\n"]}
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rSelectElement = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
4
+ const element_1 = require("../element");
6
5
  /**
7
6
  * Implementation dedicated to Playwright.
8
7
  */
9
- var O3rSelectElement = /** @class */ (function (_super) {
10
- tslib_1.__extends(O3rSelectElement, _super);
11
- function O3rSelectElement(sourceElement) {
12
- return _super.call(this, sourceElement) || this;
8
+ class O3rSelectElement extends element_1.O3rElement {
9
+ constructor(sourceElement) {
10
+ super(sourceElement);
13
11
  }
14
12
  /** @inheritdoc */
15
- O3rSelectElement.prototype.selectByIndex = function (index, _timeout) {
16
- return this.sourceElement.element.selectOption({ index: index });
17
- };
13
+ selectByIndex(index, _timeout) {
14
+ return this.sourceElement.element.selectOption({ index });
15
+ }
18
16
  /** @inheritdoc */
19
- O3rSelectElement.prototype.selectByValue = function (value, _timeout) {
20
- return this.sourceElement.element.selectOption({ value: value });
21
- };
17
+ selectByValue(value, _timeout) {
18
+ return this.sourceElement.element.selectOption({ value });
19
+ }
22
20
  /** @inheritDoc */
23
- O3rSelectElement.prototype.getValue = function () {
24
- return tslib_1.__awaiter(this, void 0, void 0, function () {
25
- return tslib_1.__generator(this, function (_a) {
26
- return [2 /*return*/, this.sourceElement.element.locator('option:checked').inputValue()];
27
- });
28
- });
29
- };
30
- return O3rSelectElement;
31
- }(element_1.O3rElement));
21
+ async getValue() {
22
+ return this.sourceElement.element.locator('option:checked').inputValue();
23
+ }
24
+ }
32
25
  exports.O3rSelectElement = O3rSelectElement;
33
26
  //# sourceMappingURL=select-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,sCAGoB;AAEpB;;GAEG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACL,mCAAQ,GAArB;;;gBACE,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,EAAC;;;KAC1E;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAsC,oBAAU,GAmB/C;AAnBY,4CAAgB","sourcesContent":["import {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rSelectElement extends O3rElement {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public selectByIndex(index: number, _timeout?: number) {\n return this.sourceElement.element.selectOption({ index });\n }\n\n /** @inheritdoc */\n public selectByValue(value: string, _timeout?: number) {\n return this.sourceElement.element.selectOption({ value });\n }\n\n /** @inheritDoc */\n public async getValue() {\n return this.sourceElement.element.locator('option:checked').inputValue();\n }\n}\n"]}
1
+ {"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;AAAA,wCAGoB;AAEpB;;GAEG;AACH,MAAa,gBAAiB,SAAQ,oBAAU;IAC9C,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,aAAa,CAAC,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACX,aAAa,CAAC,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,QAAQ;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3E,CAAC;CACF;AAnBD,4CAmBC","sourcesContent":["import {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rSelectElement extends O3rElement {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public selectByIndex(index: number, _timeout?: number) {\n return this.sourceElement.element.selectOption({ index });\n }\n\n /** @inheritdoc */\n public selectByValue(value: string, _timeout?: number) {\n return this.sourceElement.element.selectOption({ value });\n }\n\n /** @inheritDoc */\n public async getValue() {\n return this.sourceElement.element.locator('option:checked').inputValue();\n }\n}\n"]}