This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LIVE-448 - Add playwright test suite for market page (#4736)
* Add playwright test suite for market page * update screenshots (linux) * update screenshots (windows) * update screenshots (windows) * update screenshots (linux) * update screenshots (windows) * Fix screenshots * Update market tests * update screenshots (linux) * update screenshots (windows) * update screenshots (windows) * Fix conflicts * Update LLC * update screenshots (linux) * update screenshots (linux) * update screenshots (linux) * ci run * Fix merge * update screenshots (windows) * market page tests * update screenshots (linux) * update screenshots (windows) * last ci run * Split sorting test step in two Co-authored-by: Team Live <[email protected]> Co-authored-by: Nabil Bourenane <[email protected]>
- Loading branch information
1 parent
daaaf09
commit 5ac4fc3
Showing
32 changed files
with
246 additions
and
14 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Page, Locator } from "@playwright/test"; | ||
|
||
export class MarketCoinPage { | ||
readonly page: Page; | ||
readonly buyButton: Locator; | ||
readonly swapButton: Locator; | ||
readonly counterValueSelect: Locator; | ||
readonly marketRangeSelect: Locator; | ||
readonly starFilterButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.buyButton = page.locator("data-test-id=market-coin-buy-button"); | ||
this.swapButton = page.locator("data-test-id=market-coin-swap-button"); | ||
this.counterValueSelect = page.locator("data-test-id=market-coin-counter-value-select"); | ||
this.marketRangeSelect = page.locator("data-test-id=market-coin-range-select"); | ||
this.starFilterButton = page.locator("data-test-id=market-coin-star-button"); | ||
} | ||
|
||
async openBuyPage() { | ||
await this.buyButton.click(); | ||
} | ||
|
||
async openSwapPage() { | ||
await this.swapButton.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Page, Locator } from "@playwright/test"; | ||
|
||
export class MarketPage { | ||
readonly page: Page; | ||
readonly searchInput: Locator; | ||
readonly counterValueSelect: Locator; | ||
readonly marketRangeSelect: Locator; | ||
readonly filterDrawerButton: Locator; | ||
readonly starFilterButton: Locator; | ||
readonly sortButton: Locator; | ||
readonly loadingPlaceholder: Locator; | ||
readonly coinRow: Function; | ||
readonly starButton: Function; | ||
readonly buyButton: Function; | ||
readonly swapButton: Function; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.searchInput = page.locator("data-test-id=market-search-input"); | ||
this.counterValueSelect = page.locator("data-test-id=market-countervalue-select"); | ||
this.marketRangeSelect = page.locator("data-test-id=market-range-select"); | ||
this.filterDrawerButton = page.locator("data-test-id=market-filter-drawer-button"); | ||
this.starFilterButton = page.locator("data-test-id=market-star-button"); | ||
this.sortButton = page.locator("data-test-id=market-sort-button"); | ||
this.loadingPlaceholder = page.locator("data-test-id=loading-placeholder"); | ||
this.coinRow = (ticker: string): Locator => page.locator(`data-test-id=market-${ticker}-row`); | ||
this.starButton = (ticker: string): Locator => | ||
page.locator(`data-test-id=market-${ticker}-star-button`); | ||
this.buyButton = (ticker: string): Locator => | ||
page.locator(`data-test-id=market-${ticker}-buy-button`); | ||
this.swapButton = (ticker: string): Locator => | ||
page.locator(`data-test-id=market-${ticker}-swap-button`); | ||
} | ||
|
||
async search(query: string) { | ||
await this.searchInput.fill(query); | ||
} | ||
|
||
async openFilterDrawer() { | ||
await this.filterDrawerButton.click(); | ||
} | ||
|
||
async toggleInvertSort() { | ||
await this.sortButton.click(); | ||
} | ||
|
||
async switchCountervalue(ticker: string) { | ||
await this.counterValueSelect.click(); | ||
// TODO: For some reason need to hack selects like that | ||
await this.page.click('#react-select-2-listbox div div:has-text("Thai Baht - THB")'); | ||
} | ||
|
||
async switchMarketRange(range: string) { | ||
await this.marketRangeSelect.click(); | ||
// TODO: For some reason need to hack selects like that | ||
await this.page.click(`text=${range}`); | ||
} | ||
|
||
async toggleStarFilter() { | ||
await this.starFilterButton.click(); | ||
} | ||
|
||
async openCoinPage(ticker: string) { | ||
await this.coinRow(ticker).click(); | ||
} | ||
|
||
async starCoin(ticker: string) { | ||
await this.starButton(ticker).click(); | ||
} | ||
|
||
async openBuyPage(ticker: string) { | ||
await this.buyButton(ticker).click(); | ||
} | ||
|
||
async openSwapPage(ticker: string) { | ||
await this.swapButton(ticker).click(); | ||
} | ||
|
||
async waitForLoading() { | ||
await this.loadingPlaceholder.first().waitFor({ state: "detached" }); | ||
await this.swapButton("btc").waitFor({ state: "attached" }); // swap buttons are displayed few seconds after | ||
} | ||
} |
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.