Open platform to collect and prioritize feedback
feature: add button to delete ideas (#318)
Guilherme Oenning015eb0969d60
diff --git a/app/actions/idea.go b/app/actions/idea.goindex 436ec81cd..fb1731aa8 100644--- a/app/actions/idea.go+++ b/app/actions/idea.go@@ -174,6 +174,46 @@ func (input *SetResponse) Validate(user *models.User, services *app.Services) *vreturn result}+// DeleteIdea represents the action of an administrator deleting an existing Idea+type DeleteIdea struct {+ Model *models.DeleteIdea+ Idea *models.Idea+}++// Initialize the model+func (input *DeleteIdea) Initialize() interface{} {+ input.Model = new(models.DeleteIdea)+ return input.Model+}++// IsAuthorized returns true if current user is authorized to perform this action+func (input *DeleteIdea) IsAuthorized(user *models.User, services *app.Services) bool {+ return user != nil && user.IsAdministrator()+}++// Validate if current model is valid+func (input *DeleteIdea) Validate(user *models.User, services *app.Services) *validate.Result {+ idea, err := services.Ideas.GetByNumber(input.Model.Number)+ if err != nil {+ return validate.Error(err)+ }++ isReferenced, err := services.Ideas.IsReferenced(input.Model.Number)+ if err != nil {+ return validate.Error(err)+ }++ if isReferenced {+ return validate.Failed([]string{+ "This idea cannot be deleted because it's being referenced by a duplicated idea.",+ })+ }++ input.Idea = idea++ return validate.Success()+}+// EditComment represents the action to update an existing commenttype EditComment struct {Model *models.EditCommentdiff --git a/app/actions/idea_test.go b/app/actions/idea_test.goindex adc9960f2..ffb2ea75c 100644--- a/app/actions/idea_test.go+++ b/app/actions/idea_test.go@@ -45,3 +45,32 @@ func TestCreateNewIdea_ValidIdeaTitles(t *testing.T) {ExpectSuccess(result)}}++func TestSetResponse_InvalidStatus(t *testing.T) {+ RegisterTestingT(t)++ action := &actions.SetResponse{Model: &models.SetResponse{+ Status: models.IdeaDeleted,+ Text: "Spam!",+ }}+ result := action.Validate(nil, services)+ ExpectFailed(result, "status")+}++func TestDeleteIdea_WhenIsBeingReferenced(t *testing.T) {+ RegisterTestingT(t)++ idea1, _ := services.Ideas.Add("Idea #1", "", 1)+ idea2, _ := services.Ideas.Add("Idea #2", "", 1)+ services.Ideas.MarkAsDuplicate(idea2.Number, idea1.Number, 1)++ model := &models.DeleteIdea{+ Number: idea2.Number,+ Text: "Spam!",+ }+ action := &actions.DeleteIdea{Model: model}+ ExpectSuccess(action.Validate(nil, services))++ model.Number = idea1.Number+ ExpectFailed(action.Validate(nil, services))+}diff --git a/app/handlers/idea.go b/app/handlers/idea.goindex a82101c2c..4e4226d32 100644--- a/app/handlers/idea.go+++ b/app/handlers/idea.go@@ -94,6 +94,23 @@ func UpdateIdea() web.HandlerFunc {}}+// DeleteIdea deletes an existing idea of current tenant+func DeleteIdea() web.HandlerFunc {+ return func(c web.Context) error {+ input := new(actions.DeleteIdea)+ if result := c.BindTo(input); !result.Ok {+ return c.HandleValidation(result)+ }++ err := c.Services().Ideas.SetResponse(input.Model.Number, input.Model.Text, c.User().ID, models.IdeaDeleted)+ if err != nil {+ return c.Failure(err)+ }++ return c.Ok(web.Map{})+ }+}+// IdeaDetails shows details of given Idea by idfunc IdeaDetails() web.HandlerFunc {return func(c web.Context) error {diff --git a/app/handlers/idea_test.go b/app/handlers/idea_test.goindex 56433c4d0..efc238934 100644--- a/app/handlers/idea_test.go+++ b/app/handlers/idea_test.go@@ -5,6 +5,7 @@ import ("net/http""testing"+ "github.com/getfider/fider/app""github.com/getfider/fider/app/models""github.com/getfider/fider/app/handlers"@@ -393,3 +394,23 @@ func TestUpdateCommentHandler_Unauthorized(t *testing.T) {comment, _ := services.Ideas.GetCommentByID(commentId)Expect(comment.Content).To(Equal("My first comment"))}++func TestDeleteIdeaHandler_Authorized(t *testing.T) {+ RegisterTestingT(t)++ server, services := mock.NewServer()+ services.SetCurrentTenant(mock.DemoTenant)+ services.SetCurrentUser(mock.JonSnow)+ idea, _ := services.Ideas.Add("The Idea #1", "The Description #1", mock.JonSnow.ID)++ code, _ := server.+ OnTenant(mock.DemoTenant).+ AsUser(mock.JonSnow).+ AddParam("number", idea.Number).+ ExecutePost(handlers.DeleteIdea(), `{ }`)++ Expect(code).To(Equal(http.StatusOK))+ idea, err := services.Ideas.GetByNumber(idea.Number)+ Expect(idea).To(BeNil())+ Expect(err).To(Equal(app.ErrNotFound))+}diff --git a/app/models/feedback.go b/app/models/feedback.goindex 466065ceb..49f793654 100644--- a/app/models/feedback.go+++ b/app/models/feedback.go@@ -40,6 +40,12 @@ type UpdateIdea struct {Description string `json:"description"`}+// DeleteIdea represents a request to delete an existing idea+type DeleteIdea struct {+ Number int `route:"number"`+ Text string `json:"text"`+}+// NewComment represents a new commenttype NewComment struct {Number int `route:"number"`@@ -128,23 +134,27 @@ var (IdeaPlanned = 4//IdeaDuplicate is used when the idea has already been posted beforeIdeaDuplicate = 5+ //IdeaDeleted is used when the idea is completely removed from the site and should never be shown again+ IdeaDeleted = 6)// GetIdeaStatusName returns the name of an idea statusfunc GetIdeaStatusName(status int) string {switch status {- case 0:+ case IdeaOpen:return "Open"- case 1:+ case IdeaStarted:return "Started"- case 2:+ case IdeaCompleted:return "Completed"- case 3:+ case IdeaDeclined:return "Declined"- case 4:+ case IdeaPlanned:return "Planned"- case 5:+ case IdeaDuplicate:return "Duplicate"+ case IdeaDeleted:+ return "Deleted"default:return "Unknown"}diff --git a/app/pkg/web/binder.go b/app/pkg/web/binder.goindex b4e711f64..edb40434b 100644--- a/app/pkg/web/binder.go+++ b/app/pkg/web/binder.go@@ -25,9 +25,14 @@ func NewDefaultBinder() *DefaultBinder {return &DefaultBinder{}}+func methodHasBody(method string) bool {+ return method == http.MethodPost ||+ method == http.MethodDelete+}+//Bind request data to object ifunc (b *DefaultBinder) Bind(target interface{}, c *Context) error {- if c.Request.Method == http.MethodPost && c.Request.ContentLength > 0 {+ if methodHasBody(c.Request.Method) && c.Request.ContentLength > 0 {contentType := strings.Split(c.Request.Header.Get("Content-Type"), ";")if len(contentType) == 0 || contentType[0] != JSONContentType {return ErrContentTypeNotAlloweddiff --git a/app/pkg/web/binder_test.go b/app/pkg/web/binder_test.goindex 9267d60ec..eed104342 100644--- a/app/pkg/web/binder_test.go+++ b/app/pkg/web/binder_test.go@@ -20,7 +20,7 @@ func TestDefaultBinder_FromParams(t *testing.T) {params := make(web.StringMap, 0)params["number"] = "2"params["slug"] = "jon-snow"- ctx := newPostContext(params, `{ "name": "Jon Snow" }`, "application/json")+ ctx := newBodyContext("POST", params, `{ "name": "Jon Snow" }`, "application/json")u := new(updateUser)err := binder.Bind(u, ctx)Expect(err).To(BeNil())@@ -41,7 +41,7 @@ func TestDefaultBinder_TrimSpaces(t *testing.T) {params := make(web.StringMap, 0)body := `{ "name": " Jon Snow ", "email": " [email protected] ", "color": "ff00ad" }`- ctx := newPostContext(params, body, "application/json")+ ctx := newBodyContext("POST", params, body, "application/json")u := new(user)err := binder.Bind(u, ctx)Expect(err).To(BeNil())@@ -51,6 +51,24 @@ func TestDefaultBinder_TrimSpaces(t *testing.T) {Expect(u.Other).To(Equal(""))}+func TestDefaultBinder_DELETE(t *testing.T) {+ RegisterTestingT(t)++ type user struct {+ Name string `json:"name"`+ Other string+ }++ params := make(web.StringMap, 0)+ body := `{ "name": " Jon Snow " }`+ ctx := newBodyContext("DELETE", params, body, "application/json")+ u := new(user)+ err := binder.Bind(u, ctx)+ Expect(err).To(BeNil())+ Expect(u.Name).To(Equal("Jon Snow"))+ Expect(u.Other).To(Equal(""))+}+func TestDefaultBinder_POST_WithoutBody(t *testing.T) {RegisterTestingT(t)@@ -62,7 +80,7 @@ func TestDefaultBinder_POST_WithoutBody(t *testing.T) {params := make(web.StringMap, 0)params["number"] = "2"params["slug"] = "jon-snow"- ctx := newPostContext(params, "", web.UTF8JSONContentType)+ ctx := newBodyContext("POST", params, "", web.UTF8JSONContentType)a := new(action)err := binder.Bind(a, ctx)Expect(err).To(BeNil())@@ -78,7 +96,7 @@ func TestDefaultBinder_POST_NonJSON(t *testing.T) {}params := make(web.StringMap, 0)- ctx := newPostContext(params, `name=JonSnow`, web.UTF8HTMLContentType)+ ctx := newBodyContext("POST", params, `name=JonSnow`, web.UTF8HTMLContentType)u := new(user)err := binder.Bind(u, ctx)diff --git a/app/pkg/web/context.go b/app/pkg/web/context.goindex dbe62d72b..2ed9d429d 100644--- a/app/pkg/web/context.go+++ b/app/pkg/web/context.go@@ -210,7 +210,7 @@ func (ctx *Context) HandleValidation(result *validate.Result) error {}return ctx.BadRequest(Map{- "message": result.Messages,+ "messages": result.Messages,"failures": result.Failures,})}diff --git a/app/pkg/web/context_test.go b/app/pkg/web/context_test.goindex aa562430d..8add371e9 100644--- a/app/pkg/web/context_test.go+++ b/app/pkg/web/context_test.go@@ -19,10 +19,10 @@ func newGetContext(params web.StringMap) *web.Context {return &ctx}-func newPostContext(params web.StringMap, body, contentType string) *web.Context {+func newBodyContext(method string, params web.StringMap, body, contentType string) *web.Context {e := web.New(nil)res := httptest.NewRecorder()- req := httptest.NewRequest("POST", "http://demo.test.fider.io:3000/some/resource", strings.NewReader(body))+ req := httptest.NewRequest(method, "http://demo.test.fider.io:3000/some/resource", strings.NewReader(body))req.Header.Set("Content-Type", contentType)ctx := e.NewContext(res, req, params)return &ctxdiff --git a/app/storage/inmemory/idea.go b/app/storage/inmemory/idea.goindex 4f47cb2df..b8f5ddeca 100644--- a/app/storage/inmemory/idea.go+++ b/app/storage/inmemory/idea.go@@ -200,13 +200,17 @@ func (s *IdeaStorage) RemoveSupporter(number, userID int) error {// SetResponse changes current idea responsefunc (s *IdeaStorage) SetResponse(number int, text string, userID, status int) error {- for _, idea := range s.ideas {+ for i, idea := range s.ideas {if idea.Number == number {- idea.Status = status- idea.Response = &models.IdeaResponse{- Text: text,- User: &models.User{ID: userID},- RespondedOn: time.Now(),+ if status == models.IdeaDeleted {+ s.ideas = append(s.ideas[:i], s.ideas[i+1:]...)+ } else {+ idea.Status = status+ idea.Response = &models.IdeaResponse{+ Text: text,+ User: &models.User{ID: userID},+ RespondedOn: time.Now(),+ }}}}@@ -239,6 +243,16 @@ func (s *IdeaStorage) MarkAsDuplicate(number, originalNumber, userID int) errorreturn nil}+// IsReferenced returns true if another idea is referencing given idea+func (s *IdeaStorage) IsReferenced(number int) (bool, error) {+ for _, i := range s.ideas {+ if i.Status == models.IdeaDuplicate && i.Response.Original.Number == number {+ return true, nil+ }+ }+ return false, nil+}+// SupportedBy returns a list of Idea ID supported by given userfunc (s *IdeaStorage) SupportedBy(userID int) ([]int, error) {return s.ideasSupportedBy[userID], nildiff --git a/app/storage/postgres/idea.go b/app/storage/postgres/idea.goindex 7779cba47..bb5e8693d 100644--- a/app/storage/postgres/idea.go+++ b/app/storage/postgres/idea.go@@ -3,6 +3,7 @@ package postgresimport ("errors""fmt"+ "strconv""time""database/sql"@@ -192,7 +193,7 @@ var (ON agg_c.idea_id = i.idLEFT JOIN agg_supporters agg_sON agg_s.idea_id = i.id- WHERE %s+ WHERE i.status != ` + strconv.Itoa(models.IdeaDeleted) + ` AND %sGROUP BY i.id, u.id, r.id, d.id, agg_c.all, agg_c.recent, agg_s.recent`)@@ -264,7 +265,7 @@ func (s *IdeaStorage) Search(query, filter string, tags []string) ([]*models.IdescoreField := "ts_rank(setweight(to_tsvector(title), 'A') || setweight(to_tsvector(description), 'B'), to_tsquery('english', $4)) + similarity(title, $5) + similarity(description, $5)"sql := fmt.Sprintf(`SELECT * FROM (%s) AS q- WHERE %s > 0.3+ WHERE %s > 0.1AND tags @> $3ORDER BY %s DESC`, innerQuery, scoreField, scoreField)@@ -650,6 +651,17 @@ func (s *IdeaStorage) MarkAsDuplicate(number, originalNumber, userID int) error`, idea.ID, s.tenant.ID, original.ID, respondedOn, userID, models.IdeaDuplicate)}+// IsReferenced returns true if another idea is referencing given idea+func (s *IdeaStorage) IsReferenced(number int) (bool, error) {+ return s.trx.Exists(`+ SELECT 1 FROM ideas i+ INNER JOIN ideas o+ ON o.tenant_id = i.tenant_id+ AND o.id = i.original_id+ WHERE i.tenant_id = $1+ AND o.number = $2`, s.tenant.ID, number)+}+// SupportedBy returns a list of Idea ID supported by given userfunc (s *IdeaStorage) SupportedBy(userID int) ([]int, error) {return s.trx.QueryIntArray("SELECT idea_id FROM idea_supporters WHERE user_id = $1 AND tenant_id = $2", userID, s.tenant.ID)diff --git a/app/storage/postgres/idea_test.go b/app/storage/postgres/idea_test.goindex 7d1802414..773434cb4 100644--- a/app/storage/postgres/idea_test.go+++ b/app/storage/postgres/idea_test.go@@ -351,6 +351,25 @@ func TestIdeaStorage_SetResponse_AsDuplicate(t *testing.T) {Expect(idea2.Response.Original.Status).To(Equal(idea1.Status))}+func TestIdeaStorage_SetResponse_AsDeleted(t *testing.T) {+ SetupDatabaseTest(t)+ defer TeardownDatabaseTest()++ ideas.SetCurrentTenant(demoTenant)+ idea, err := ideas.Add("My new idea", "with this description", jonSnow.ID)+ Expect(err).To(BeNil())++ ideas.SetResponse(idea.Number, "Spam!", jonSnow.ID, models.IdeaDeleted)++ idea1, err := ideas.GetByNumber(idea.Number)+ Expect(err).To(Equal(app.ErrNotFound))+ Expect(idea1).To(BeNil())++ idea2, err := ideas.GetByID(idea.ID)+ Expect(err).To(Equal(app.ErrNotFound))+ Expect(idea2).To(BeNil())+}+func TestIdeaStorage_AddSupporter_ClosedIdea(t *testing.T) {SetupDatabaseTest(t)defer TeardownDatabaseTest()@@ -418,3 +437,20 @@ func TestIdeaStorage_WithTags(t *testing.T) {Expect(idea.Tags[0]).To(Equal(bug.Slug))Expect(idea.Tags[1]).To(Equal(featureRequest.Slug))}++func TestIdeaStorage_IsReferenced(t *testing.T) {+ SetupDatabaseTest(t)+ defer TeardownDatabaseTest()++ ideas.SetCurrentTenant(demoTenant)+ idea1, _ := ideas.Add("My first idea", "with this description", jonSnow.ID)+ idea2, _ := ideas.Add("My second idea", "with this description", jonSnow.ID)+ idea3, _ := ideas.Add("My third idea", "with this description", jonSnow.ID)++ ideas.MarkAsDuplicate(idea2.Number, idea3.Number, jonSnow.ID)+ ideas.MarkAsDuplicate(idea3.Number, idea1.Number, jonSnow.ID)++ Expect(ideas.IsReferenced(idea1.Number)).To(BeTrue())+ Expect(ideas.IsReferenced(idea2.Number)).To(BeFalse())+ Expect(ideas.IsReferenced(idea3.Number)).To(BeTrue())+}diff --git a/app/storage/storage.go b/app/storage/storage.goindex d134a714d..d78e0fbda 100644--- a/app/storage/storage.go+++ b/app/storage/storage.go@@ -34,6 +34,7 @@ type Idea interface {GetActiveSubscribers(number int, channel models.NotificationChannel, event models.NotificationEvent) ([]*models.User, error)SetResponse(number int, text string, userID, status int) errorMarkAsDuplicate(number, originalNumber, userID int) error+ IsReferenced(number int) (bool, error)SupportedBy(userID int) ([]int, error)}diff --git a/public/pages/ShowIdea/ShowIdea.page.tsx b/public/pages/ShowIdea/ShowIdea.page.tsxindex 19c28727d..57e424b97 100644--- a/public/pages/ShowIdea/ShowIdea.page.tsx+++ b/public/pages/ShowIdea/ShowIdea.page.tsx@@ -5,7 +5,7 @@ import * as React from 'react';import { CurrentUser, Comment, Idea, Tag } from '@fider/models';import { page, actions, Failure } from '@fider/services';-import { TagsPanel, DiscussionPanel, ResponseForm, NotificationsPanel } from './';+import { TagsPanel, DiscussionPanel, ResponseForm, NotificationsPanel, ModerationPanel } from './';import { SupportCounter, ShowIdeaResponse, DisplayError, Button, Textarea, UserName, Gravatar, Moment, MultiLineText } from '@fider/components';interface ShowIdeaPageProps {@@ -132,6 +132,7 @@ export class ShowIdeaPage extends React.Component<ShowIdeaPageProps, ShowIdeaPag<TagsPanel user={this.props.user} idea={this.props.idea} tags={this.props.tags} /><NotificationsPanel user={this.props.user} idea={this.props.idea} subscribed={this.props.subscribed} />+ <ModerationPanel user={this.props.user} idea={this.props.idea} /></div><DiscussionPanel user={this.props.user} idea={this.props.idea} comments={this.props.comments} />diff --git a/public/pages/ShowIdea/components/ModerationPanel.tsx b/public/pages/ShowIdea/components/ModerationPanel.tsxnew file mode 100644index 000000000..b2122e9b7--- /dev/null+++ b/public/pages/ShowIdea/components/ModerationPanel.tsx@@ -0,0 +1,89 @@+import * as React from 'react';+import { IdeaStatus, CurrentUser, Idea } from '@fider/models';+import { page, actions, Failure } from '@fider/services';+import { Form, DisplayError, Textarea, Modal, Button } from '@fider/components';++interface ModerationPanelProps {+ user?: CurrentUser;+ idea: Idea;+}++interface ModerationPanelState {+ showConfirmation: boolean;+ text: string;+}++export class ModerationPanel extends React.Component<ModerationPanelProps, ModerationPanelState> {+ private form!: Form;++ constructor(props: ModerationPanelProps) {+ super(props);+ this.state = {+ text: '',+ showConfirmation: false,+ };+ }++ private async delete(): Promise<void> {+ const response = await actions.deleteIdea(this.props.idea.number, this.state.text);+ if (response.ok) {+ this.close();+ page.goHome();+ } else if (response.error) {+ this.form.setFailure(response.error);+ }+ }++ private async close(): Promise<void> {+ this.setState({ showConfirmation: false });+ }++ public render() {+ const status = IdeaStatus.Get(this.props.idea.status);+ if (!this.props.user || !this.props.user.isAdministrator || status.closed) {+ return null;+ }++ const modal = (+ <Modal.Window isOpen={this.state.showConfirmation} center={false} size="large">+ <Modal.Content>+ <Form ref={(f) => { this.form = f!; }}>+ <div className="field">+ <Textarea+ onChange={(e) => this.setState({ text: e.currentTarget.value })}+ defaultValue={this.state.text}+ placeholder="Why are you deleting this idea? (optional)"+ />+ </div>+ <span className="info">This operation <strong>cannot</strong> be undone.</span>+ </Form>+ </Modal.Content>++ <Modal.Footer>+ <Button color="red" onClick={async () => this.delete()}>+ Delete+ </Button>+ <Button onClick={async () => this.close()}>+ Cancel+ </Button>+ </Modal.Footer>+ </Modal.Window>+ );++ return (+ <div>+ {modal}+ <span className="subtitle">+ Moderation+ </span>+ <div className="ui list">+ <div className="item">+ <Button color="red" size="tiny" fluid={true} onClick={async () => this.setState({ showConfirmation: true })}>+ <i className="delete icon" /> Delete+ </Button>+ </div>+ </div>+ </div>+ );+ }+}diff --git a/public/pages/ShowIdea/index.ts b/public/pages/ShowIdea/index.tsindex 4ed3a20e8..9f4b729af 100644--- a/public/pages/ShowIdea/index.ts+++ b/public/pages/ShowIdea/index.ts@@ -4,5 +4,6 @@ export * from './components/ResponseForm';export * from './components/CommentList';export * from './components/IdeaSearch';export * from './components/TagsPanel';+export * from './components/ModerationPanel';export * from './components/NotificationsPanel';export * from './components/DiscussionPanel';diff --git a/public/services/actions/idea.ts b/public/services/actions/idea.tsindex bd0617bd9..812a4ae3c 100644--- a/public/services/actions/idea.ts+++ b/public/services/actions/idea.ts@@ -9,6 +9,12 @@ export const searchIdeas = async (query: string, filter: string, tags: string[])return await http.get<Idea[]>(`/api/ideas/search?q=${query}&f=${filter}&t=${tags.join(',')}`);};+export const deleteIdea = async (ideaNumber: number, text: string): Promise<Result> => {+ return http.delete(`/api/ideas/${ideaNumber}`, {+ text+ }).then(http.event('idea', 'delete'));+};+export const addSupport = async (ideaNumber: number): Promise<Result> => {return http.post(`/api/ideas/${ideaNumber}/support`).then(http.event('idea', 'support'));};diff --git a/public/services/page.ts b/public/services/page.tsindex d27cdf033..3ddd4d10c 100644--- a/public/services/page.ts+++ b/public/services/page.ts@@ -1,5 +1,9 @@import { AuthSettings} from '@fider/models';+export const goHome = (): void => {+ document.location.href = '/';+};+export const refresh = (): void => {document.location.reload();};diff --git a/routes.go b/routes.goindex 0d95e6c6f..044a862e6 100644--- a/routes.go+++ b/routes.go@@ -99,6 +99,7 @@ func GetMainEngine(settings *models.SystemSettings) *web.Engine {private.Use(middlewares.IsAuthorized(models.RoleAdministrator))+ private.Delete("/api/ideas/:number", handlers.DeleteIdea())private.Post("/api/admin/settings", handlers.UpdateSettings())private.Delete("/api/admin/tags/:slug", handlers.DeleteTag())private.Post("/api/admin/tags/:slug", handlers.CreateEditTag())diff --git a/tests/pages/GoogleSignInPage.ts b/tests/pages/GoogleSignInPage.tsindex bc5113794..53d9f2ab5 100644--- a/tests/pages/GoogleSignInPage.ts+++ b/tests/pages/GoogleSignInPage.ts@@ -7,8 +7,8 @@ export class GoogleSignInPage extends Page {super(browser);}- @findBy('base[href="https://accounts.google.com/"]')- private Head!: WebComponent;+ @findBy('#view_container')+ private Container!: WebComponent;@findBy('#identifierId')public Email!: TextInput;@@ -23,7 +23,7 @@ export class GoogleSignInPage extends Page {public ConfirmPassword!: Button;public loadCondition() {- return elementIsPresent(() => this.Head);+ return elementIsPresent(() => this.Container);}public async signInAsDarthVader() {@@ -36,6 +36,7 @@ export class GoogleSignInPage extends Page {const element = await this.browser.findElement(`p[data-email='${email}']`);await element.click();} catch (ex) {+ await this.browser.wait(elementIsVisible(() => this.Email));await this.Email.type(email);await this.ConfirmEmail.click();}