Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(extension): refactor Transaction Bundle class POM
- Loading branch information
1 parent
d7d5505
commit 4b9543b
Showing
8 changed files
with
35 additions
and
93 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
16 changes: 6 additions & 10 deletions
16
packages/e2e-tests/src/assert/transaction/transactionBundleAssert.ts
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
42 changes: 19 additions & 23 deletions
42
packages/e2e-tests/src/elements/newTransaction/transactionBundle.ts
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 |
---|---|---|
@@ -1,50 +1,46 @@ | ||
/* eslint-disable no-undef */ | ||
import { LocatorStrategy } from '../../actor/webTester'; | ||
import { WebElement, WebElementFactory as Factory } from '../webElement'; | ||
import { AddressInput } from '../AddressInput'; | ||
import { AssetInput } from './assetInput'; | ||
import { ChainablePromiseElement } from 'webdriverio'; | ||
|
||
export class TransactionBundle extends WebElement { | ||
export class TransactionBundle { | ||
protected CONTAINER = '//div[@data-testid="asset-bundle-container"]'; | ||
private BUNDLE_TITLE = '//h5[@data-testid="asset-bundle-title"]'; | ||
private BUNDLE_REMOVE_BUTTON = '//button[@data-testid="asset-bundle-remove-button"]'; | ||
private ADDRESS_INPUT_ERROR = '[data-testid="address-input-error"]'; | ||
readonly index: number = 1; | ||
|
||
constructor(index?: number) { | ||
super(); | ||
this.CONTAINER = typeof index === 'undefined' ? this.CONTAINER : `(${this.CONTAINER})[${index}]`; | ||
constructor(index = 1) { | ||
this.index = index; | ||
this.CONTAINER = `(${this.CONTAINER})[${index}]`; | ||
} | ||
|
||
container(): WebElement { | ||
return Factory.fromSelector(`${this.CONTAINER}`, 'xpath'); | ||
get container(): ChainablePromiseElement<WebdriverIO.Element> { | ||
return $(this.CONTAINER); | ||
} | ||
|
||
bundleTitle(): WebElement { | ||
return Factory.fromSelector(`${this.CONTAINER}${this.BUNDLE_TITLE}`, 'xpath'); | ||
get bundleTitle(): ChainablePromiseElement<WebdriverIO.Element> { | ||
return $(`${this.CONTAINER}${this.BUNDLE_TITLE}`); | ||
} | ||
|
||
bundleAddressInput(): AddressInput { | ||
return new AddressInput(); | ||
get bundleAddressInput(): AddressInput { | ||
return new AddressInput(this.index); | ||
} | ||
|
||
get bundleAddressInputError(): ChainablePromiseElement<WebdriverIO.Element> { | ||
return $(this.CONTAINER).$(this.ADDRESS_INPUT_ERROR); | ||
} | ||
|
||
bundleAssetInput(): AssetInput { | ||
return new AssetInput(); | ||
get bundleAssetInput(): AssetInput { | ||
return new AssetInput(this.index); | ||
} | ||
|
||
bundleRemoveButton(): WebElement { | ||
return Factory.fromSelector(`${this.CONTAINER}${this.BUNDLE_REMOVE_BUTTON}`, 'xpath'); | ||
get bundleRemoveButton(): ChainablePromiseElement<WebdriverIO.Element> { | ||
return $(`${this.CONTAINER}${this.BUNDLE_REMOVE_BUTTON}`); | ||
} | ||
|
||
toJSLocator(): string { | ||
return this.CONTAINER; | ||
} | ||
|
||
locatorStrategy(): LocatorStrategy { | ||
return 'xpath'; | ||
} | ||
clickRemoveBundleButton = async (): Promise<void> => { | ||
await this.bundleRemoveButton.waitForClickable(); | ||
await this.bundleRemoveButton.click(); | ||
}; | ||
} |
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
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