Add data-testid to test relevant elements (fixes #244)
Change-Id: Id908e38f01e426543ed98975544204a9a632294d
diff --git a/t/page.t b/t/page.t
index 5fb2129..123a720 100644
--- a/t/page.t
+++ b/t/page.t
@@ -35,6 +35,8 @@
->header_is('X-Content-Type-Options', 'nosniff')
->header_is('Access-Control-Allow-Methods','GET, POST, OPTIONS')
->header_is('X-XSS-Protection', '1; mode=block')
+ ->element_exists('*[data-testid=home]')
+ ->element_exists('*[data-testid=tour-start]')
;
# Test additions
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index 1becd11..f1349a6 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -116,6 +116,10 @@
$t->get_ok('/')
->status_is(200)
->element_exists('form[action=/user/login] input[name=handle_or_email]')
+ ->element_exists('*[data-testid=handle-or-email]')
+ ->element_exists('*[data-testid=pwd]')
+ ->element_exists('*[data-testid=login-submit]')
+ ->element_exists_not('*[data-testid=logout]')
->element_exists('aside')
->element_exists('aside.invisible')
;
@@ -123,6 +127,7 @@
$t->get_ok('/settings/oauth')
->status_is(401)
->text_is('p.no-results', 'Not authenticated')
+ ->text_is('*[data-testid=error-message]','Not authenticated')
;
$t->get_ok('/settings/marketplace')
@@ -230,6 +235,8 @@
->element_exists_not('div.notify-error')
->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->element_exists('nav.dropdown')
+ ->element_exists_not('*[data-testid=handle-or-email]')
+ ->element_exists('*[data-testid=logout]')
->element_exists('a.dropdown-item.logout[title~="test"]')
;