From aa8874d941ae4c804ca61673b9d79ca68b94f07d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 29 May 2020 13:49:54 +0200 Subject: [PATCH] chore(loadtests): don't manually add submittors --- load/Load.hs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/load/Load.hs b/load/Load.hs index 147e5a2a6..95ae192fe 100644 --- a/load/Load.hs +++ b/load/Load.hs @@ -263,20 +263,21 @@ runSimulation' LoadSheetSubmission = do where formURI' = nullURI { uriPath = unpack . Text.intercalate "/" $ "." : formPath } (formPath, _) = renderRoute $ CSheetR loadTerm loadSchool loadCourse loadSheet SubmissionNewR resp <- liftIO . Session.get session $ uriToString id formURI mempty - Just formData <- return . getFormData FIDsubmission $ resp ^. responseBody - Just addButtonData <- return . flip (runFormScraper FIDsubmission) (resp ^. responseBody) $ do - let btnSel = "button" Scalpel.@: [Scalpel.hasClass "btn-mass-input-add"] + -- Just formData <- return . getFormData FIDsubmission $ resp ^. responseBody + -- Just addButtonData <- return . flip (runFormScraper FIDsubmission) (resp ^. responseBody) $ do + -- let btnSel = "button" Scalpel.@: [Scalpel.hasClass "btn-mass-input-add"] - name <- Scalpel.attr "name" btnSel - value <- Scalpel.attr "value" btnSel - guard $ value == "add__0__0" - return $ toStrict name := value - let miData = addButtonData : map addEmail formData - where addEmail dat@(name := _) - | "__add__0__fields__emails" `isSuffixOf` name = name := ("loadtest@example.invalid" :: Text) - | otherwise = dat - resp2 <- liftIO $ Session.post session (uriToString id formURI mempty) miData - Just formData2 <- return . getFormData FIDsubmission $ resp2 ^. responseBody + -- name <- Scalpel.attr "name" btnSel + -- value <- Scalpel.attr "value" btnSel + -- guard $ value == "add__0__0" + -- return $ toStrict name := value + -- let miData = addButtonData : map addEmail formData + -- where addEmail dat@(name := _) + -- | "__add__0__fields__emails" `isSuffixOf` name = name := ("loadtest@example.invalid" :: Text) + -- | otherwise = dat + -- resp2 <- liftIO $ Session.post session (uriToString id formURI mempty) miData + -- Just formData2 <- return . getFormData FIDsubmission $ resp2 ^. responseBody + Just formData2 <- return . getFormData FIDsubmission $ resp ^. responseBody uploadSeed <- liftIO seedNew chunkCount <- sampleIntegral loadUploadChunks chunks <- replicateM (fromIntegral chunkCount) $ sampleIntegral loadUploadChunkSize