Skip to content

Commit

Permalink
chore(ui-tests): use data-test-id attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
arein committed Dec 21, 2023
1 parent 08f3909 commit a6ed95c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/laboratory/tests/basic-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { testM, expect } from './shared/fixtures/w3m-fixture'

testM.describe('Modal only tests', () => {
testM('Should be able to open modal', async ({ modalPage }) => {
await modalPage.page.getByText('Connect Wallet').click()
await expect(modalPage.page.getByText('All Wallets')).toBeVisible()
await modalPage.page.getByTestId('connect-button').click()
await expect(modalPage.page.getByTestId('all-wallets')).toBeVisible()
})
})
4 changes: 2 additions & 2 deletions apps/laboratory/tests/shared/pages/ModalPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class ModalPage {
async copyConnectUriToClipboard() {
await this.page.goto(`${this.baseURL}library/${this.library}/`)
await this.connectButton.click()
await this.page.getByText('WalletConnect').click()
await this.page.getByTestId('wallet-selector-walletconnect').click()
await this.page.waitForTimeout(2000)
await this.page.getByText('Copy link').click()
await this.page.getByTestId('copy-wc2-uri').click()
}
}
1 change: 1 addition & 0 deletions packages/scaffold/src/modal/w3m-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class W3mButton extends LitElement {
size=${ifDefined(this.size)}
label=${ifDefined(this.label)}
loadingLabel=${ifDefined(this.loadingLabel)}
data-testid="connect-button"
></w3m-connect-button>
`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export class W3mConnectingWcQrcode extends W3mConnectingWidget {
private copyTemplate() {
const inactive = !this.uri || !this.ready

return html`<wui-link .disabled=${inactive} @click=${this.onCopyUri} color="fg-200">
return html`<wui-link
.disabled=${inactive}
@click=${this.onCopyUri}
color="fg-200"
data-testid="copy-wc2-uri"
>
<wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
Copy link
</wui-link>`
Expand Down
2 changes: 2 additions & 0 deletions packages/scaffold/src/views/w3m-connect-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class W3mConnectView extends LitElement {
@click=${() => this.onConnector(connector)}
tagLabel="qr code"
tagVariant="main"
data-testid="wallet-selector-walletconnect"
>
</wui-list-wallet>
`
Expand Down Expand Up @@ -214,6 +215,7 @@ export class W3mConnectView extends LitElement {
@click=${this.onAllWallets.bind(this)}
tagLabel=${tagLabel}
tagVariant="shade"
data-testid="all-wallets"
></wui-list-wallet>
`
}
Expand Down

0 comments on commit a6ed95c

Please sign in to comment.