Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fixed tests for UI changes

Matt Roberts170b61806b1e
diff --git a/app/pkg/web/react_test.go b/app/pkg/web/react_test.go
index b6921cba8..4d60c7204 100644
--- a/app/pkg/web/react_test.go
+++ b/app/pkg/web/react_test.go
@@ -52,7 +52,8 @@ func TestReactRenderer_RenderEmptyHomeHTML(t *testing.T) {
},
})
Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)
- Expect(html).ContainsSubstring(`<button type="submit" class="c-button c-button--default c-button--secondary c-input">Enter your suggestion here...</button>`)
+ Expect(html).ContainsSubstring(`<button class="p-home__add-idea-btn">`)
+ Expect(html).ContainsSubstring(`Enter your suggestion here...`)
Expect(html).ContainsSubstring(`What can we do better? This is the place for you to vote, discuss and share ideas.`)
Expect(html).ContainsSubstring(`No posts have been created yet.`)
Expect(html).ContainsSubstring(`Powered by Fider`)
@@ -81,7 +82,8 @@ func TestReactRenderer_RenderEmptyHomeHTML_Portuguese(t *testing.T) {
},
})
Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)
- Expect(html).ContainsSubstring(`<button type="submit" class="c-button c-button--default c-button--secondary c-input">Insira sua sugestão aqui...</button`)
+ Expect(html).ContainsSubstring(`<button class="p-home__add-idea-btn">`)
+ Expect(html).ContainsSubstring(`Insira sua sugestão aqui...`)
Expect(html).ContainsSubstring(`O que podemos fazer melhor? Este é o lugar para você votar, discutir e compartilhar ideias.`)
Expect(html).ContainsSubstring(`Nenhuma postagem foi criada ainda.`)
Expect(html).ContainsSubstring(`Powered by Fider`)
diff --git a/app/pkg/web/testdata/home_ssr.html b/app/pkg/web/testdata/home_ssr.html
index 32c2823bf..8398825ae 100755
--- a/app/pkg/web/testdata/home_ssr.html
+++ b/app/pkg/web/testdata/home_ssr.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"My Page Title · "}
+ {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","welcomeHeader":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"My Page Title · "}
</script>
diff --git a/app/pkg/web/testdata/tenant.html b/app/pkg/web/testdata/tenant.html
index 3792b4999..e62973501 100755
--- a/app/pkg/web/testdata/tenant.html
+++ b/app/pkg/web/testdata/tenant.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"Game of Thrones"}
+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","welcomeHeader":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"Game of Thrones"}
</script>
diff --git a/app/services/sqlstore/postgres/post_test.go b/app/services/sqlstore/postgres/post_test.go
index ba5d7db40..84febcb91 100644
--- a/app/services/sqlstore/postgres/post_test.go
+++ b/app/services/sqlstore/postgres/post_test.go
@@ -305,10 +305,10 @@ func TestPostStorage_AddAndReturnComments(t *testing.T) {
Expect(err).IsNil()
Expect(commentsByPost.Result).HasLen(2)
- Expect(commentsByPost.Result[0].Content).Equals("Comment #1")
- Expect(commentsByPost.Result[0].User.Name).Equals("Jon Snow")
- Expect(commentsByPost.Result[1].Content).Equals("Comment #2")
- Expect(commentsByPost.Result[1].User.Name).Equals("Arya Stark")
+ Expect(commentsByPost.Result[0].Content).Equals("Comment #2")
+ Expect(commentsByPost.Result[0].User.Name).Equals("Arya Stark")
+ Expect(commentsByPost.Result[1].Content).Equals("Comment #1")
+ Expect(commentsByPost.Result[1].User.Name).Equals("Jon Snow")
}
func TestPostStorage_AddGetUpdateComment(t *testing.T) {
diff --git a/e2e/step_definitions/home.steps.ts b/e2e/step_definitions/home.steps.ts
index ac5f6dead..099bef66b 100644
--- a/e2e/step_definitions/home.steps.ts
+++ b/e2e/step_definitions/home.steps.ts
@@ -32,7 +32,7 @@ Given("I type {string} as the description", async function (this: FiderWorld, de
})
Given("I click enter your suggestion", async function () {
- await this.page.click(".p-home__welcome-col .c-button--default")
+ await this.page.click(".p-home__add-idea-btn")
})
Given("I type my email address", async function (this: FiderWorld) {
diff --git a/e2e/step_definitions/show_post.steps.ts b/e2e/step_definitions/show_post.steps.ts
index 78d2b0937..e13c2bf8d 100644
--- a/e2e/step_definitions/show_post.steps.ts
+++ b/e2e/step_definitions/show_post.steps.ts
@@ -13,5 +13,7 @@ Then("I should see {string} as the post title", async function (this: FiderWorld
})
Then("I should see {int} vote\\(s)", async function (this: FiderWorld, voteCount: number) {
- await expect(this.page.getByText(`${voteCount}${voteCount === 1 ? "Vote" : "Votes"}`, { exact: true })).toBeVisible()
+ // The vote counter now shows just the number, look for it in the vote button
+ const voteButton = this.page.locator(".c-vote-counter__button .c-vote-counter__count")
+ await expect(voteButton).toHaveText(voteCount.toString())
})
diff --git a/e2e/step_definitions/user.steps.ts b/e2e/step_definitions/user.steps.ts
index 83469fce2..ec39ad935 100644
--- a/e2e/step_definitions/user.steps.ts
+++ b/e2e/step_definitions/user.steps.ts
@@ -13,7 +13,7 @@ Given("I sign in as {string}", async function (this: FiderWorld, userName: strin
}
const userEmail = `${userName}-${this.tenantName}@fider.io`
- await this.page.click(".c-menu .uppercase.text-sm")
+ await this.page.getByRole("button", { name: "Sign in" }).click()
await this.page.fill(".c-signin-control #input-email", userEmail)
await this.page.click(".c-signin-control .c-button--primary")