private void checkEntryFromTable(ArcliteDataTable element, InputVal wanted)
        {
            string text = wanted.getSelectedVal();

            IArcliteWebElement search = element._searchElement;

            search.accept(this, wanted);

            if (element._confirmDelete == null && element._cancelDelete == null)
            {
                IArcliteWebElement check = new ArcliteButton("", element._tableEntryFirst + text + element._tableEntrySecond);
                check.accept(this, new InputVal());
            }
            else if (element._expand == null)
            {
                IArcliteWebElement delete = new ArcliteButton("", element._tableEntryFirst + text + element._tableEntrySecond);
                delete.accept(this, new InputVal());
            }
            else if (element._expand != null)
            {
                IArcliteWebElement expand = new ArcliteButton("", element._tableEntryFirst + wanted.valTwo + element._tableEntrySecond + element._expand);
                expand.accept(this, new InputVal());
            }
            else
            {
                throw new ArgumentException("something is or is not null");
            }
        }
Exemplo n.º 2
0
    public int ReturnLaunchOrPauseOrNothingIsPressed()
    {
        for (int i = 0; i < 4; i++)
        {
            if (Input.GetKeyDown((KeyCode)(350 + 20 * i)))
            {
                return(1);
            }
            if (Input.GetKeyDown((KeyCode)(357 + 20 * i)))
            {
                return(2);
            }
        }
        InputVal launch = GetInputVal(saveInfo.GetBinding(InputMethod.KeyBinding.launch, 0, usingGamepad1));
        InputVal pause  = GetInputVal(saveInfo.GetBinding(InputMethod.KeyBinding.pause, 0, usingGamepad1));

        if (Input.GetMouseButtonDown(0) || launch.KeyDown())
        {
            return(1);
        }
        if (pause.KeyDown())
        {
            return(2);
        }
        return(0);
    }
        /*
         * Enter text in the textbox
         */

        void IActionsVisitor.visitTextBox(ArcliteTextBox element, InputVal wanted)
        {
            string      text = wanted.getSelectedVal();
            IWebElement input;
            long        number     = 0;
            bool        canConvert = long.TryParse(text, out number);

            if (element._secondXPath == null)
            {
                try
                {
                    input = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath)));
                    new ArcliteButton("", element.elementXPath).accept(this, new InputVal());
                }
                catch (WebDriverTimeoutException)
                {
                    input = driver.FindElement(By.XPath(element.elementXPath));
                }
            }
            else
            {
                input = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath + wanted.valTwo + element._secondXPath)));
                new ArcliteButton("", element.elementXPath + wanted.valTwo + element._secondXPath).accept(this, new InputVal());
            }
            if (canConvert)
            {
                input.Clear();
                input.SendKeys(text);
            }
            else
            {
                driver.ExecuteJavaScript("arguments[0].value = '" + text + "';", input);
            }
        }
Exemplo n.º 4
0
    public void ChangeKey(int y, int newVal, bool player1)
    {
        if (player1)
        {
            InputVal newInput           = new InputVal_Key((KeyCode)newVal);
            InputMethod.KeyBinding oldK = PD.controller.GetKeyInUse(newInput);
            if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3)
            {
                PD.controller.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal());
            }
            else
            {
                InputVal oldInput = PD.controller.GetInputVal(keyOrdering[y]);
                PD.controller.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(0, (int)keyOrdering[y], newInput.GetRawVal());

                PD.controller.ChangeKey(oldK, oldInput);
                PD.SetKeyBinding(0, (int)oldK, oldInput.GetRawVal());
                int idx = System.Array.IndexOf(keyOrdering, oldK);
                if (idx >= 0)
                {
                    UndoQuestion(idx, true);
                }
            }
        }
        else
        {
            InputVal newInput           = new InputVal_Key((KeyCode)newVal);
            InputMethod.KeyBinding oldK = fakePlayer2.GetKeyInUse(newInput);
            if (oldK == keyOrdering[y] || oldK == InputMethod.KeyBinding.hidden3)
            {
                fakePlayer2.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal());
            }
            else
            {
                InputVal oldInput = fakePlayer2.GetInputVal(keyOrdering[y]);
                fakePlayer2.ChangeKey(keyOrdering[y], newInput);
                PD.SetKeyBinding(1, (int)keyOrdering[y], newInput.GetRawVal());

                fakePlayer2.ChangeKey(oldK, oldInput);
                PD.SetKeyBinding(1, (int)oldK, oldInput.GetRawVal());
                int idx = System.Array.IndexOf(keyOrdering, oldK);
                if (idx >= 0)
                {
                    UndoQuestion(idx, false);
                }
            }
        }
        UndoQuestion(y, player1);
    }
        private void completeWorkStation()
        {
            _pageElements[pageInfo.ongoingWorkstationTable.Key].accept(visitor, inputs.getInput(pageInfo.ongoingWorkstationTable.Key));
            _pageElements[pageInfo.stepsTable.Key].accept(visitor, inputs.getInput(pageInfo.stepsTable.Key));
            this.runStep();
            InputVal newStep = inputs.getInput(pageInfo.stepsTable.Key).switchVal();

            _pageElements[pageInfo.stepsTable.Key].accept(visitor, newStep);
            this.runStep();
            _pageElements[pageInfo.back.Key].accept(visitor, new InputVal());
            _pageElements[pageInfo.completed.Key].accept(visitor, new InputVal());
            _pageElements[pageInfo.completedWorkstationTable.Key].accept(visitor, inputs.getInput(pageInfo.ongoingWorkstationTable.Key));
        }
Exemplo n.º 6
0
    public KeyBinding GetKeyInUse(InputVal v)
    {
        string vRaw = v.GetRawVal();

        foreach (KeyBinding k in keyBinds.bindings.Keys)
        {
            if (keyBinds.bindings[k].GetRawVal() == vRaw)
            {
                return(k);
            }
        }
        return(KeyBinding.hidden3);
    }
        /*
         * Delete a entry from a table if no action is specified
         */

        void IActionsVisitor.visitDataTable(ArcliteDataTable element, InputVal wanted, ArcliteTestAction action = ArcliteTestAction.delete)
        {
            switch (action)
            {
            case ArcliteTestAction.delete:
                deleteFromTable(element, wanted);
                break;

            case ArcliteTestAction.check:
                checkEntryFromTable(element, wanted);
                break;

            default:
                break;
            }
        }
        private void approveChecklists()
        {
            InputVal val = inputs.getInput(pageInfo.name.Key);

            val.valTwo = inputs.getInput(pageInfo.addCategoryName.Key).valOne;
            _pageElements[pageInfo.checklistDataTable.Key].accept(_visitor, val);
            Thread.Sleep(longSleepTime);
            _pageElements[pageInfo.approve.Key].accept(_visitor, new InputVal());

            _pageElements[pageInfo.approveDataTable.Key].accept(_visitor, inputs.getInput(pageInfo.name.Key));

            _pageElements[pageInfo.approvePassword.Key].accept(_visitor, inputs.getInput(pageInfo.approvePassword.Key));
            _pageElements[pageInfo.approveStatus.Key].accept(_visitor, inputs.getInput(pageInfo.approveStatus.Key));
            _pageElements[pageInfo.approveConfirm.Key].accept(_visitor, new InputVal());
            _visitor.switchToParentFrame();
        }
        /*
         * Enter text in a search box and clicks on search button if there is one
         */

        void IActionsVisitor.visitSearch(ArcliteSearch arcliteSearch, InputVal wanted)
        {
            if (arcliteSearch._searchButtonXpath == null)
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IWebElement webElement;
                webElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(search.elementXPath)));
                webElement.SendKeys(Keys.Enter);
            }
            else
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IArcliteWebElement confirm = new ArcliteButton("", arcliteSearch._searchButtonXpath);
                confirm.accept(this, new InputVal());
            }
        }
        /*
         * visit canvas in workflow builder and createds one step, and opens it
         */

        void IActionsVisitor.visitCanvas(ArcliteCanvas element, InputVal wanted)
        {
            int baseX = 170;
            int baseY = 130;

            int destX = int.Parse(wanted.valOne);
            int destY = int.Parse(wanted.valTwo);

            IWebElement canvas = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath)));
            Actions     click  = new Actions(driver);

            element.addStep.accept(this, new InputVal());

            click.MoveToElement(canvas, baseX, baseY).ClickAndHold().Build().Perform();

            click.MoveByOffset(destX, destY).Build().Perform();

            click.Release().Build().Perform();

            click.MoveToElement(canvas, destX + baseX, destY + baseY).DoubleClick().Build().Perform();
        }
        /*
         * selects from a dropdown with wanted option
         */

        void IActionsVisitor.visitSelect(ArcliteSelect element, InputVal wanted)
        {
            string             text     = wanted.getSelectedVal();
            IArcliteWebElement dropdown = new ArcliteButton(element.elementName, element._dropDownXpath);

            dropdown.accept(this, new InputVal());
            Thread.Sleep(shortSleepTime);
            SelectElement selectElement = new SelectElement(driver.FindElement(By.XPath(element._selectXPath)));

            if (element._optionFirst == null)
            {
                //get the options as a select element
                selectElement.SelectByText(text);
            }
            else
            {
                string             dataVal      = Util.getDataValue(text, selectElement);
                IArcliteWebElement selectOption = new ArcliteButton("", element._optionFirst + dataVal + element._optionSecond);
                selectOption.accept(this, new InputVal());
            }
        }
        /*
         * select the next month's first day for a calender
         */

        void IActionsVisitor.visitCalender(ArcliteCalender element, InputVal wanted)
        {
            IArcliteWebElement calender = new ArcliteButton(element.elementName, element.elementXPath);

            calender.accept(this, new InputVal());
            IArcliteWebElement nextMonth;

            try
            {
                nextMonth = new ArcliteButton(element.elementName, element._nextMonthXpath);
                nextMonth.accept(this, new InputVal());
            }
            catch (WebDriverTimeoutException)
            {
                ((IActionsVisitor)this).visitCalender(element, wanted);
                return;
            }

            IArcliteWebElement date = new ArcliteButton(element.elementName, element._firstDateXpath);

            date.accept(this, new InputVal());
        }
Exemplo n.º 13
0
    public InputMethod detectInput_P2()
    {
        if (usingGamepad2)
        {
            for (int i = 0; i < 4; i++)
            {
                if (Input.GetKeyDown((KeyCode)(350 + 20 * i)))
                {
                    UpdateGamepad(1, i);
                    break;
                }
            }
        }
        InputVal launch = GetInputVal(saveInfo.GetBinding(InputMethod.KeyBinding.launch, 1, usingGamepad2));
        InputVal pause  = GetInputVal(saveInfo.GetBinding(InputMethod.KeyBinding.pause, 1, usingGamepad2));

        if (launch.KeyDown() || pause.KeyDown())
        {
            return(new Input_Computer());
        }
        return(null);
    }
Exemplo n.º 14
0
 public void ChangeKey(KeyBinding k, InputVal v)
 {
     keyBinds.bindings[k] = v;
 }
        /*
         * selects a attatchement in the attachement box, need to have a exact file location
         */

        public void visitAttachment(ArcliteAttachment element, InputVal input)
        {
            IWebElement fileUp = driver.FindElement(By.XPath(element.elementXPath));

            fileUp.SendKeys(input.valOne);
        }
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitDataTable(this, input);
 }
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitAttachment(this, input);
 }
Exemplo n.º 18
0
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitCanvas(this, input);
 }
Exemplo n.º 19
0
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitButton(this);
 }
Exemplo n.º 20
0
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitSelect(this, input);
 }
Exemplo n.º 21
0
 new public void accept(IActionsVisitor visitor, InputVal input)
 {
     visitor.visitTextBox(this, input);
 }