@@ -18,7 +18,7 @@ public function check_if_overview_can_be_accessed()
1818 $ this ->login_with_admin_user ();
1919
2020 //Check if overview can be accessed
21- $ this ->visit ('/webpanel/store/categories ' )->see ('All Categories ' );
21+ $ this ->visit ('/webpanel/store/items ' )->see ('All Items ' );
2222 }
2323
2424 /** @test */
@@ -43,35 +43,40 @@ public function create_item_and_check_if_exists()
4343 $ this ->type ('integration_test ' , 'type ' );
4444 $ this ->type ('integration_slot ' , 'loadout_slot ' );
4545 $ this ->type ('7669035 ' , 'price ' );
46- $ this ->type (' test-cat ' , 'category_id ' );
46+ $ this ->type ($ this -> get_category_id () , 'category_id ' );
4747
4848 $ this ->press ('Create Item ' );
4949
50- $ this ->see ('test-itm ' ); //Check for the name
51- $ this ->see ('integration_test ' ); // Check for the type
50+
51+ //TODO: Check if the item exists in the db
52+
5253
5354
5455 //Get the ID of the Item
5556 $ item_id = $ this ->get_item_id ();
5657
5758
5859 //Visit the Edit page
59- $ this ->press ( ' Edit ' . $ item_id );
60+ $ this ->visit ( ' /webpanel/store/items/ ' . $ item_id. ' /edit ' )-> see ( ' Edit Item test-itm ' );
6061 $ this ->see ("test-itm " ); //Check for the name
6162 $ this ->see ("integration_slot " ); //Check for the loadout slot
6263
6364 //Make a Edit and Save
6465 $ this ->type ('integration_test_2 ' , 'type ' ); //Change the type
65- $ this ->press ('Edit Category ' );
66+ $ this ->press ('Edit Item ' );
67+
68+ $ this ->visit ('/webpanel/store/items/ ' .$ item_id .'/edit ' )->see ('Edit Item test-itm ' );
6669
6770 //Confirm the edit
6871 $ this ->see ('integration_test_2 ' ); //Verify the changed type
6972
73+
74+ //TODO: Add a remove and a remove+refund button so the item can be deleted from the edit menu
7075 //Delete the category
71- $ this ->press ('Remove ' . $ item_id );
76+ // $this->press('Remove ' . $item_id);
7277
7378 //Confirm that its deleted
74- $ this ->assertNull (StoreItem::where ('name ' , 'test-itm ' )->first ());
79+ // $this->assertNull(StoreItem::where('name', 'test-itm')->first());
7580 }
7681
7782
@@ -95,7 +100,7 @@ private function delete_item_if_exists()
95100
96101 private function create_category ()
97102 {
98- $ category = StoreCategory::where ('name ' , 'test-cat ' )->first ();
103+ $ category = StoreCategory::where ('display_name ' , 'test-cat ' )->first ();
99104
100105 if ($ category != null )
101106 {
@@ -113,6 +118,12 @@ private function create_category()
113118 $ category ->save ();
114119 }
115120
121+ private function get_category_id ()
122+ {
123+ $ category = StoreCategory::where ('display_name ' ,'test-cat ' )->first ();
124+ return $ category ->id ;
125+ }
126+
116127 private function login_with_admin_user ()
117128 {
118129 $ admin = User::where ('name ' , 'admin ' )->first ();
0 commit comments