How we turned the task for hiring testers into interactive for the conference and readers of "Habr"

SQA Days. ( , ) . – , , «AliExpress » .





, .





. , – , , .





, - , – , . : , Post- .





, . «» Java + SpringBoot . 





@RestController
@SpringBootApplication
@Slf4j
public class IsNumberApplication {

    public static void main(String[] args) {
        SpringApplication.run(IsNumberApplication.class, args);
    }

    @PostMapping(path = "/isnumber", consumes = "application/json", produces = "application/json")
    public IsNumberResponse hello(@RequestBody IsNumberRequest request) {
        String requestValue = request.value;
        log.info("Request value is '{}'", requestValue);

        boolean isNumber;
        try {
            Float.parseFloat(requestValue);
            isNumber = true;
        } catch (NumberFormatException e) {
            isNumber = requestValue.equals(Boolean.toString(true));
        }

        return new IsNumberResponse(isNumber);
    }
}

      
      



– API.





Java + Junit5 + RestAssured:





 @Test
    void positiveNumber() {
        RestAssured.with().contentType(ContentType.JSON)
                .body(new IsNumberBody(5))
                .post("/isnumber")
                .then()
                .statusCode(OK)
                .body("isNumber", equalTo(true));
    } 	
      
      



«» . - , - . , . 





, -, - , . 





SQA Days, , , . . , , , AliExpress.





, , . , AliExpress, , . - (, !).





– :





const SqaDaysPage = () => {
  const [inputValue, setInputValue] = useState('');
  const [isShowAgain, setIsShowAgain] = useState(true);
  const [isFirstCall, setIsFirstCall] = useState(true);
  const {showModal, hideModal, activeModal} = useContext(ModalContext);

  const onSendAnswer = async () => {
    // Block request if it's the first call
    if (isFirstCall) {
      return setIsFirstCall(false);
    }
  
    setIsLoading(true);
  
    universalFetch('https://api.aliexpress.ru/***/***', {
      method: 'POST',
      headers: {},
      body: JSON.stringify({ value: inputValue }),
    }).then((response) => response.json())
      .then(({ error, isNumber }) => {
        setIsLoading(false);
  
        if (error)
          // some code...
  
        // Hardcode logic
        if (Number(requestData.value) === 0)
          isNumber = false;
  
        return toast.show({
          duration: 1500,
          type: isNumber ? 'default' : 'error',
          text: isNumber ? ` : ${inputValue}` : `  : ${inputValue}`,
        });
      })
      .catch(() => {
        // some code...
      });
  };

  const onCloseWelcomePopup = () => {
    hideModal();

    // If true, show welcome popup again after 40 sec.
    if (isShowAgain) {
      setTimeout(() => {
        showModal({ id: WELCOME_POPUP });
        setIsShowAgain(false);
      }, 40000);
    }
  };

  return (
     {/* some code... */}
     <Button size="l" onClick={onSendAnswer} isLoading={isLoading} fullWidth style={style.sendButton}>
       
     </Button>

	 {/* Display welcome popup */}
	 <ModalComponent visible={activeModal?.id === WELCOME_POPUP} key={WELCOME_POPUP} onHide={onCloseWelcomePopup}>
       <View style={{ paddingLeft: 20, paddingRight: 20, width: 750 }}>
         {/* Show broken image in a second times */}
         <Image style={{ width: 192, height: 122, marginBottom: 20 }} source={{ uri: isShowAgain ? 'https://img.alicdn.com/imgextra/i2/O1CN01KbA7Vc1Q0ek2o2K7t_!!6000000001914-2-tps-186-118.png' : '' }} />
         <Typography type="h3">   AliExpress</Typography>
         <Typography style={{ marginBottom: 30 }}>
                  .       ,        .
         </Typography>
         <Button size="l" onClick={onCloseWelcomePopup}></Button>
       </View>
     </ModalComponent>
     {/* some code... */}
  )
}

      
      



  AliExpress . 





QR code to start the task
QR-
This is how the AliExpress test bench looked like.
AliExpress

, . . :





  • ;





  • - - – .





, (, ) . .





AliExpress

. . «».





QR- AliExpress.  290 , , 100 , AliExpress.





: «»: , AliExpress.





***





, ! «AliExpress », . 








All Articles