11import { Given , Then } from "@cucumber/cucumber"
22import { FiderWorld } from "../world"
33import expect from "expect"
4+ import { getLatestLinkSentTo } from "./fns"
45
56Given ( "I go to the home page" , async function ( this : FiderWorld ) {
67 await this . page . goto ( `https://${ this . tenantName } .dev.fider.io:3000/` )
@@ -27,6 +28,53 @@ Given("I type {string} as the description", async function (this: FiderWorld, de
2728 await this . page . type ( "#input-description" , description )
2829} )
2930
30- Given ( "I click submit new post" , async function ( ) {
31- await this . page . click ( ".p-home__welcome-col .c-button--primary" )
31+ Given ( "I click enter your suggestion" , async function ( ) {
32+ await this . page . click ( ".p-home__welcome-col .c-button--default" )
33+ } )
34+
35+ Given ( "I type my email address" , async function ( this : FiderWorld ) {
36+ const userEmail = `$user-${ this . tenantName } @fider.io`
37+ await this . page . type ( "#input-email" , userEmail )
38+ } )
39+
40+ Given ( "I click continue with email" , async function ( ) {
41+ await this . page . click ( ".c-signin-control button[type='submit']" )
42+ } )
43+
44+ Given ( "I click submit your feedback" , async function ( ) {
45+ await this . page . click ( ".c-share-feedback__content .c-button--primary" )
46+ } )
47+
48+ Given ( "I click on the confirmation link" , async function ( this : FiderWorld ) {
49+ const userEmail = `$user-${ this . tenantName } @fider.io`
50+ const activationLink = await getLatestLinkSentTo ( userEmail )
51+ await this . page . goto ( activationLink )
52+ } )
53+
54+ Then ( "I should be on the complete profile page" , async function ( this : FiderWorld ) {
55+ const container = await this . page . $$ ( "#p-complete-profile" )
56+ expect ( container ) . toBeDefined ( )
57+ } )
58+
59+ Then ( "I should see the new post modal" , async function ( this : FiderWorld ) {
60+ const container = await this . page . $$ ( ".c-share-feedback" )
61+ expect ( container ) . toBeDefined ( )
62+ } )
63+
64+ Given ( "I enter my name as {string}" , async function ( this : FiderWorld , name : string ) {
65+ await this . page . type ( "#input-name" , name )
66+ } )
67+
68+ Given ( "I click submit" , async function ( ) {
69+ await this . page . click ( "button[type='submit']" )
70+ } )
71+
72+ Then ( "I should be on the confirmation link page" , async function ( this : FiderWorld ) {
73+ const userEmail = `$user-${ this . tenantName } @fider.io`
74+ await expect ( this . page . getByText ( `We have just sent a confirmation link to ${ userEmail } ` ) ) . toBeVisible ( )
75+ } )
76+
77+ Then ( "I should see {string} as the draft post title" , async function ( this : FiderWorld , title : string ) {
78+ const postTitle = await this . page . locator ( "#input-title" ) . inputValue ( )
79+ expect ( postTitle ) . toBe ( title )
3280} )
0 commit comments