Skip to content

Commit

Permalink
Use qa- prefix for test-only HTML classes
Browse files Browse the repository at this point in the history
In the HTML templates, mark classes added only for testing purposes
with qa- to make it clear they aren't controlling behavior.
  • Loading branch information
rra committed Sep 30, 2020
1 parent 9efc62a commit 092ffde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/gafaelfawr/templates/new_token.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ <h2>Download Token</h2>
<h3>Token Scopes</h3>

{% for scope in scopes %}
<div class="form-group row token-scope">
<div class="form-group row qa-token-scope">
<div class="col-md-4">
<div class="form-check">
{{ form[scope](class="form-check-input") }}
{{ form[scope].label(class="form-check-label") }}
</div>
</div>
<div class="col-md-8 text-dark scope-description">
<div class="col-md-8 text-dark qa-scope-description">
{{ form[scope].description }}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/gafaelfawr/templates/tokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ <h2>Personal access tokens</h2>
<div class="col-md-12">
<div class="list-group">
{% for token in tokens %} {% set form=forms[token.key] %}
<div class="list-group-item token-row">
<div class="list-group-item qa-token-row">
<form action="/auth/tokens/{{ token.key }}" method="POST"
novalidate>
<input type="hidden" name="_csrf" value="{{ csrf_token }}" />
{{ form.method_(value="DELETE") }}
<div class="float-right">
<button class="btn btn-sm btn-danger revoke-token"
<button class="btn btn-sm btn-danger qa-revoke-token"
aria-haspopup="dialog" type="submit">Revoke</button>
</div>
<span class="token-description">
Expand All @@ -51,7 +51,7 @@ <h2>Personal access tokens</h2>
<span>
<br/>
Scope: <em>
<span class="text-dark token-scope" aria-label="Token scope">
<span class="text-dark qa-token-scope" aria-label="Token scope">
{{ token.scope }}
</span>
</em>
Expand Down
9 changes: 5 additions & 4 deletions tests/pages/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def form(self) -> WebElement:
def scopes(self) -> List[ScopeRow]:
return [
ScopeRow(e)
for e in self.find_elements_by_class_name("token-scope")
for e in self.find_elements_by_class_name("qa-token-scope")
]

async def submit(self) -> None:
Expand All @@ -46,7 +46,8 @@ def new_token(self) -> Optional[str]:
@property
def tokens(self) -> List[TokenRow]:
return [
TokenRow(e) for e in self.find_elements_by_class_name("token-row")
TokenRow(e)
for e in self.find_elements_by_class_name("qa-token-row")
]

async def click_create_token(self) -> None:
Expand All @@ -61,7 +62,7 @@ def checkbox(self) -> WebElement:

@property
def description(self) -> str:
return self.find_element_by_class_name("scope-description").text
return self.find_element_by_class_name("qa-scope-description").text

@property
def label(self) -> str:
Expand All @@ -80,4 +81,4 @@ def link(self) -> str:

@property
def scope(self) -> str:
return self.find_element_by_class_name("token-scope").text
return self.find_element_by_class_name("qa-token-scope").text

0 comments on commit 092ffde

Please sign in to comment.