package org.musetest.seleniumide.tests;

import org.junit.jupiter.api.*;
import org.musetest.builtins.step.*;
import org.musetest.core.step.*;
import org.musetest.selenium.locators.*;
import org.musetest.selenium.steps.*;
import org.musetest.seleniumide.*;
import org.musetest.seleniumide.steps.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
class CommandConversionTests
    {
    @Test
    void storeVariable() throws UnsupportedError
        {
        StepConfiguration step = StepConverters.get().convertStep("", "store", "var1", "value2");
        Assertions.assertEquals(StoreVariable.TYPE_ID, step.getType(), "converted step does not have the correct type");
        Assertions.assertEquals("var1", step.getSource(StoreVariable.NAME_PARAM).getValue(), "the variable name is not set correctly");
        Assertions.assertEquals("value2", step.getSource(StoreVariable.VALUE_PARAM).getValue(), "the value is not set correctly");
        }

    @Test
    void selectByLabel() throws UnsupportedError
        {
        StepConfiguration step = StepConverters.get().convertStep("", "select", "id=InputMonth", "label=04");
        Assertions.assertEquals(SelectOptionByText.TYPE_ID, step.getType());
        Assertions.assertEquals("04", step.getSource(SelectOptionByText.TEXT_PARAM).getValue());
        Assertions.assertEquals(IdElementValueSource.TYPE_ID, step.getSource(SelectOptionByText.ELEMENT_PARAM).getType());
        Assertions.assertEquals("InputMonth", step.getSource(SelectOptionByText.ELEMENT_PARAM).getSource().getValue());
        }

    @Test
    void selectByIndex() throws UnsupportedError
        {
        StepConfiguration step = StepConverters.get().convertStep("", "select", "id=InputDay", "index=2");
        Assertions.assertEquals(SelectOptionByIndex.TYPE_ID, step.getType());
        Assertions.assertEquals("2", step.getSource(SelectOptionByIndex.INDEX_PARAM).getValue());
        Assertions.assertEquals(IdElementValueSource.TYPE_ID, step.getSource(SelectOptionByIndex.ELEMENT_PARAM).getType());
        Assertions.assertEquals("InputDay", step.getSource(SelectOptionByIndex.ELEMENT_PARAM).getSource().getValue());
        }
    }



@@ -402,24 +402,359 @@
 Tests%0A    %7B%0A
+    @Test%0A    void unsupportedCommand()%0A        %7B%0A        try%0A            %7B%0A            StepConverters.get().convertStep(%22%22, %22unsupported-command%22, %22param1%22, %22param2%22);%0A            Assertions.fail(%22exception should be thrown%22);%0A            %7D%0A        catch (UnsupportedError e)%0A            %7B%0A            // OK%0A            %7D%0A        %7D%0A%0A%0A
     @Test%0A  
@@ -1299,32 +1299,540 @@
 y%22);%0A        %7D%0A%0A
+    @Test%0A    void click() throws UnsupportedError%0A        %7B%0A        StepConfiguration step = StepConverters.get().convertStep(%22%22, %22click%22, %22id=it%22, %22%22);%0A        Assertions.assertEquals(ClickElement.TYPE_ID, step.getType(), %22converted step does not have the correct type%22);%0A        Assertions.assertEquals(IdElementValueSource.TYPE_ID, step.getSource(ClickElement.ELEMENT_PARAM).getType());%0A        Assertions.assertEquals(%22it%22, step.getSource(ClickElement.ELEMENT_PARAM).getSource().getValue());%0A        %7D%0A%0A
     @Test%0A    vo

add more unit tests