• 专项测试课程贴 at March 10, 2019

  • Docker 实战 at March 03, 2019


    老师 ,这个地址 http://172.17.0.4:5555 是谁的?

  • Docker 实战 at March 03, 2019

  • Docker 实战 at March 03, 2019


  • Docker 实战 at March 03, 2019

    练习二

    系统环境

    Win10环境:
    本地目录 D:\JavaWork\testhome\DockerDemo0303\Dockfile 下存在Dockerfile 、entrypoint.sh文件

    Dockerfile

    FROM  centos   
    ADD entrypoint.sh /root
    RUN yum install -y vim
    ENTRYPOINT ["/bin/bash","/root/entrypoint.sh"]

    entrypoint.sh

    ping www.baidu.com

    执行 docker build -t myimg .

    执行 docker run -it --name mycon myimg

  • GitHub 地址 https://github.com/AnnWu/SeleniumDemo

    所有社团列表页面

    public class ClubPage {
    WebDriver driver;

    @FindBy(css = "a[data-name='霍格沃兹测试学院']")
    WebElement teamName;

    public ClubPage(WebDriver driver) {
    this.driver=driver;
    }

    public TeamPage gotoTeamPage(By team){
    //teamName.click();
    driver.findElement(team).click();
    return new TeamPage(driver);
    }
    }

    某个社团页面

    public class TeamPage {
    WebDriver driver;
    @FindBy(css = ".topic .title")
    List<WebElement> teamTopics;

    public TeamPage(WebDriver driver){
    this.driver=driver;
    }

    public SignInPage gotoTopicPage(By teamTopic){
    driver.findElement(teamTopic).click();
    return new SignInPage(driver);
    }
    }

    登录页面

    public class SignInPage extends NavBarPage {
    //@FindBy(xpath = "//div[@class=alert-danger]")
    @FindBy(css = "#main div.alert")
    WebElement alert;

    public SignInPage(WebDriver driver){
    super(driver);
    }
    public String getAlertMsg(){
    Reporter.log(alert.getText());
    return alert.getText();
    }
    }

    测试类

    public class TeamTopic {
    private WebDriver driver=null;
    @BeforeMethod
    public void setUp(){
    ChromeOptions options=new ChromeOptions();
    driver=new ChromeDriver(options);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

    }
    @Test
    private void test() throws InterruptedException {
    String alerMsg="访问被拒绝,你可能没有权限或未登录。";

    driver.get("https://testerhome.com/");

    HomePage homePage = new HomePage(driver);
    ClubPage clubPage = homePage.gotoClubPage();//去到社团页面

    WebDriverWait wait=new WebDriverWait(driver,200);

    By teamPageBy=By.xpath("//div/div/a[@data-name='霍格沃兹测试学院']"); //By.cssSelector("a[data-name='霍格沃兹测试学院']");
    wait.until(ExpectedConditions.visibilityOfElementLocated(teamPageBy));

    TeamPage teamPage = clubPage.gotoTeamPage(teamPageBy);//进入某个社团页面

    By teamTopicBy = By.xpath("//div[1]/div[2]/div[1]/a/span[contains(text(),'霍格沃兹测试学院')]");
    wait.until(ExpectedConditions.elementToBeClickable(teamTopicBy));//不用也可以
    SignInPage signInPage = teamPage.gotoTopicPage(teamTopicBy);

    Assert.assertEquals(alerMsg,signInPage.getAlertMsg());

    }
    @AfterMethod
    private void tearDown(){
    driver.quit();
    }
    }